predict.VSURF: Predict method for VSURF object

View source: R/predict.VSURF.R

predict.VSURFR Documentation

Predict method for VSURF object

Description

This function predicts new data with random forests, using variables selected by VSURF only.

Usage

## S3 method for class 'VSURF'
predict(object, newdata, step = c("interp", "pred"), ...)

Arguments

object

An object of class VSURF, which is the result of the VSURF function.

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 randomForest object (default is c("interp", "pred")). Available choices are "thres", "interp", "pred".

...

further parameters passed to randomForest or predict.randomForest functions (depending on their names).

Details

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.

Value

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).

Author(s)

Robin Genuer, Jean-Michel Poggi and Christine Tuleau-Malot

References

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

See Also

VSURF

Examples


## 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)


VSURF documentation built on Dec. 28, 2022, 2:32 a.m.

Related to predict.VSURF in VSURF...