rfe | R Documentation |
A wrapper method of backward feature selection in which a given model is fit to nested subsets of most important predictor variables in order to select the subset whose resampled predictive performance is optimal.
rfe(...)
## S3 method for class 'formula'
rfe(formula, data, model, ...)
## S3 method for class 'matrix'
rfe(x, y, model, ...)
## S3 method for class 'ModelFrame'
rfe(input, model, ...)
## S3 method for class 'recipe'
rfe(input, model, ...)
## S3 method for class 'ModelSpecification'
rfe(
object,
select = NULL,
control = MachineShop::settings("control"),
props = 4,
sizes = integer(),
random = FALSE,
recompute = TRUE,
optimize = c("global", "local"),
samples = c(rfe = 1, varimp = 1),
metrics = NULL,
stat = c(resample = MachineShop::settings("stat.Resample"), permute =
MachineShop::settings("stat.TrainingParams")),
progress = FALSE,
...
)
## S3 method for class 'MLModel'
rfe(model, ...)
## S3 method for class 'MLModelFunction'
rfe(model, ...)
... |
arguments passed from the generic function to its methods, from
the |
formula , data |
formula defining the model predictor and response variables and a data frame containing them. |
model |
model function, function name, or object; or another object that can be coerced to a model. A model can be given first followed by any of the variable specifications. |
x , y |
matrix and object containing predictor and response variables. |
input |
input object defining and containing the model predictor and response variables. |
object |
model input or specification. |
select |
expression indicating predictor variables that can be
eliminated (see |
control |
control function, function name, or object defining the resampling method to be employed. |
props |
numeric vector of the proportions of most important predictor
variables to retain in fitted models or an integer number of equal spaced
proportions to generate automatically; ignored if |
sizes |
integer vector of the set sizes of most important predictor variables to retain. |
random |
logical indicating whether to eliminate variables at random with probabilities proportional to their importance. |
recompute |
logical indicating whether to recompute variable importance after eliminating each set of variables. |
optimize |
character string specifying a search through all |
samples |
numeric vector or list giving the number of permutation
samples for each of the |
metrics |
metric function, function name, or vector of these with which to calculate performance. If not specified, default metrics defined in the performance functions are used. |
stat |
functions or character strings naming functions to compute summary statistics on resampled metric values and permuted samples. One or both of the values may be specified as named arguments or in the order in which their defaults appear. |
progress |
logical indicating whether to display iterative progress during elimination. |
TrainingStep
class object containing a summary of the numbers
of predictor variables retained (size), their names (terms), logical
indicators for the optimal model selected (selected), and associated
performance metrics (metrics).
performance
, plot
,
summary
, varimp
## Requires prior installation of suggested package gbm to run
(res <- rfe(sale_amount ~ ., data = ICHomes, model = GBMModel))
summary(res)
summary(performance(res))
plot(res, type = "line")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.