View source: R/predict.VSURF.R
predict.VSURF | R Documentation |
This function predicts new data with random forests, using variables selected by VSURF only.
## S3 method for class 'VSURF'
predict(object, newdata, step = c("interp", "pred"), ...)
object |
An object of class |
newdata |
A data frame or matrix containing new data. (Note: If not given, the out-of-bag predictions of the randomForest object is returned.) |
step |
A character string indicating which variable set must be used to train
the |
... |
further parameters passed to |
This method applies for a VSURF object. VSURF selects two sets of variables during its two
last steps. For each set of variables, a random forest object is created, by running
randomForest
on training data using this set of variables only. Then the
predict.randomForest
function is used to predict new data.
If only one step is indicated in step
, a vector of predicted values.
If two or more steps are indicated in step
, a data frame of predicted values
(each column corresponding to a variable set).
Robin Genuer, Jean-Michel Poggi and Christine Tuleau-Malot
Genuer, R. and Poggi, J.M. and Tuleau-Malot, C. (2010), Variable selection using random forests, Pattern Recognition Letters 31(14), 2225-2236
Genuer, R. and Poggi, J.M. and Tuleau-Malot, C. (2015), VSURF: An R Package for Variable Selection Using Random Forests, The R Journal 7(2):19-33
VSURF
## Not run:
data(iris)
iris.learn <- sample(1:nrow(iris), nrow(iris)/2)
iris.vsurf <- VSURF(iris[iris.learn, 1:4], iris[iris.learn, 5], ntree = 100, nfor.thres = 20,
nfor.interp = 10, nfor.pred = 10)
iris.predictions <- predict(iris.vsurf, newdata = iris[-iris.learn, 1:4])
# A more interesting example with toys data (see \code{\link{toys}})
# (a few minutes to execute)
data(toys)
toys.learn <- 1:(nrow(toys$x) / 2)
toys.vsurf <- VSURF(toys$x[toys.learn, ], toys$y[toys.learn])
toys.predictions <- predict(toys.vsurf, newdata = toys$x[-toys.learn, ])
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.