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

Dictionary

This FSelector can be instantiated via the dictionary mlr_fselectors or with the associated sugar function fs():

mlr_fselectors$get("rfe")
fs("rfe")

Parameters

min_features

integer(1)
The minimum number of features to select, default is 1L.

feature_fraction

double(1)
Fraction of features to retain in each iteration, default is 0.5.

feature_number

integer(1)
Number of features to remove in each iteration.

subset_sizes

integer()
Vector of number of features to retain in each iteration. Must be sorted in decreasing order.

recursive

logical(1)
Use the recursive version? Default is FALSE.

The parameter feature_fraction, feature_number and subset_sizes are mutually exclusive.

Super class

mlr3fselect::FSelector -> FSelectorRFE

Public fields

importance

numeric()
Stores the feature importance of the model with all variables if recrusive is set to FALSE

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

FSelectorRFE$new()


Method clone()

The objects of this class are cloneable with this method.

Usage

FSelectorRFE$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

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") # \donttest{ # Modifies the instance by reference fselector$optimize(instance)
#> Petal.Length Petal.Width Sepal.Length Sepal.Width #> 1: TRUE TRUE TRUE TRUE #> features x_domain classif.ce #> 1: Petal.Length,Petal.Width,Sepal.Length,Sepal.Width <list[4]> 0.06
# Returns best scoring evaluation instance$result
#> Petal.Length Petal.Width Sepal.Length Sepal.Width #> 1: TRUE TRUE TRUE TRUE #> features x_domain classif.ce #> 1: Petal.Length,Petal.Width,Sepal.Length,Sepal.Width <list[4]> 0.06
# Allows access of data.table of full path of all evaluations instance$archive$data()# }
#> Petal.Length Petal.Width Sepal.Length Sepal.Width classif.ce #> 1: TRUE TRUE TRUE TRUE 0.06 #> 2: TRUE TRUE FALSE FALSE 0.06 #> 3: FALSE TRUE FALSE FALSE 0.06 #> uhash x_domain timestamp batch_nr #> 1: c0dba853-6818-4f56-a498-73b5003ded45 <list[4]> 2020-10-31 04:26:22 1 #> 2: 12bbc354-66da-4248-8c42-37efc1fbbee0 <list[4]> 2020-10-31 04:26:22 2 #> 3: 02f8a141-7bf3-4707-8bc1-b1e377c1ff6f <list[4]> 2020-10-31 04:26:22 3