FSelectorRFE class that implements Recursive Feature Elimination (RFE). The
recursive algorithm (
recursive = TRUE) recomputes the feature importance
on the reduced feature set in every iteration. The non-recursive algorithm
recursive = FALSE) only uses the feature importance of the model fitted
with all features to eliminate the next most unimportant features in every
This FSelector can be instantiated via the dictionary
mlr_fselectors or with the associated sugar function
The minimum number of features to select, default is
Fraction of features to retain in each iteration, default is
Number of features to remove in each iteration.
Vector of number of features to retain in each iteration. Must be sorted in decreasing order.
Use the recursive version? Default is
Stores the feature importance of the model with all variables if
recrusive is set to
Creates a new instance of this R6 class.
The objects of this class are cloneable with this method.
FSelectorRFE$clone(deep = FALSE)
Whether to make a deep clone.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
library(mlr3) terminator = trm("evals", n_evals = 10) instance = FSelectInstanceSingleCrit$new( task = tsk("iris"), learner = lrn("classif.rpart"), resampling = rsmp("holdout"), measure = msr("classif.ce"), terminator = terminator, store_models = TRUE ) fselector = fs("rfe") # Modifies the instance by reference fselector$optimize(instance) # Returns best scoring evaluation instance$result # Allows access of data.table of full path of all evaluations as.data.table(instance$archive)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.