FSelector: FSelector

Description Private Methods Technical Details and Subclasses Public fields Methods Examples

Description

Abstract FSelector class that implements the base functionality each fselector must provide. A FSelector object describes the feature selection strategy, i.e. how to optimize the black-box function and its feasible set defined by the FSelectInstanceSingleCrit / FSelectInstanceMultiCrit object.

A fselector must write its result into the FSelectInstanceSingleCrit / FSelectInstanceMultiCrit using the assign_result method of the bbotk::OptimInstance at the end of its selection in order to store the best selected feature subset and its estimated performance vector.

Private Methods

Technical Details and Subclasses

A subclass is implemented in the following way:

Public fields

param_set

(paradox::ParamSet).

param_classes

(character()).

properties

(character()).

packages

(character()).

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage
FSelector$new(param_set, properties, packages = character(0))
Arguments
param_set

paradox::ParamSet
Set of control parameters for fselector.

properties

(character())
Set of properties of the fselector. Must be a subset of mlr_reflections$fselect_properties.

packages

(character())
Set of required packages. Note that these packages will be loaded via requireNamespace(), and are not attached.


Method format()

Helper for print outputs.

Usage
FSelector$format()
Returns

(character()).


Method print()

Print method.

Usage
FSelector$print()
Returns

(character()).


Method optimize()

Performs the feature selection on a FSelectInstanceSingleCrit or FSelectInstanceMultiCrit until termination. The single evaluations will be written into the ArchiveFSelect that resides in the FSelectInstanceSingleCrit / FSelectInstanceMultiCrit. The result will be written into the instance object.

Usage
FSelector$optimize(inst)
Arguments
inst

(FSelectInstanceSingleCrit|FSelectInstanceMultiCrit).

Returns

data.table::data.table.


Method clone()

The objects of this class are cloneable with this method.

Usage
FSelector$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(mlr3)

terminator = trm("evals", n_evals = 3)

instance = FSelectInstanceSingleCrit$new(
  task = tsk("iris"),
  learner = lrn("classif.rpart"),
  resampling = rsmp("holdout"),
  measure = msr("classif.ce"),
  terminator = terminator
)

# swap this line to use a different FSelector
fselector = fs("random_search")

# modifies the instance by reference
fselector$optimize(instance)

# returns best feature subset and best performance
instance$result

# allows access of data.table / benchmark result of full path of all evaluations
instance$archive

mlr3fselect documentation built on March 9, 2021, 5:06 p.m.