Learn R Programming

mlr3fselect (version 0.2.1)

FSelectorRFE: Feature Selection via Recursive Feature Elimination

Description

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 feature in every iteration.

Arguments

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) Minimum number of features. By default, 1.

recursive

logical(1)

Super class

mlr3fselect::FSelector -> FSelectorRFE

Public fields

importance

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

Methods

Public 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

Run this code
# NOT RUN {
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")
fselector$optimize(instance)
instance$result
instance$archive$data
# }

Run the code above in your browser using DataLab