Learn R Programming

mlr3fselect (version 0.2.1)

FSelectorSequential: Feature Selection via Sequential Selection

Description

FSelectorSequential class that implements sequential feature selection. The sequential forward selection (strategy = fsf) extends the feature set in each step with the feature that increases the models performance the most. The sequential backward selection (strategy = fsb) starts with the complete future set and removes in each step the feature that decreases the models performance the least.

Arguments

Dictionary

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

mlr_fselectors$get("sequential")
fs("sequential")

Parameters

max_features

integer(1) Maximum number of features. By default, number of features in mlr3::Task.

strategy

character(1) Search method sfs (forward search) or sbs (backward search).

Super class

mlr3fselect::FSelector -> FSelectorSequential

Methods

Public methods

Method new()

Creates a new instance of this R6 class.`

Usage

FSelectorSequential$new()

Method optimization_path()

Returns the optimization path.

Usage

FSelectorSequential$optimization_path(inst)

Arguments

inst

(FSelectInstanceSingleCrit) Instance optimized with FSelectorSequential.

Returns

data.table::data.table

Method clone()

The objects of this class are cloneable with this method.

Usage

FSelectorSequential$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
)

fselector = fs("sequential")

# 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
instance$archive$data
# }

Run the code above in your browser using DataLab