| predict.gafs | R Documentation |
Predict new samples using safs() and gafs() objects.
## S3 method for class 'gafs'
predict(object, newdata, ...)
object |
an object of class |
newdata |
a data frame or matrix of predictors. |
... |
not currently used |
Only the predictors listed in object$optVariables are required.
The type of result depends on what was specified in
object$control$functions$predict.
Max Kuhn
safs(), gafs()
Other feature-selection:
gafsControl(),
rfe(),
sbf()
## Not run:
if (caret:::has_packages("randomForest")) {
set.seed(1)
train_data <- twoClassSim(100, noiseVars = 10)
test_data <- twoClassSim(10, noiseVars = 10)
## A short example
ctrl <- safsControl(functions = rfSA, method = "cv", number = 3)
rf_search <- safs(
x = train_data[, -ncol(train_data)],
y = train_data$Class,
iters = 3,
safsControl = ctrl
)
rf_search
predict(rf_search, train_data)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.