Specifies a general feature selection scenario, including objective function
and archive for feature selection algorithms to act upon. This class stores
an ObjectiveFSelect object that encodes the black box objective function
which an FSelector has to optimize. It allows the basic operations of
querying the objective at feature subsets (
$eval_batch()), storing the
evaluations in the internal bbotk::Archive and accessing the final result
Evaluations of feature subsets are performed in batches by calling
mlr3::benchmark() internally. Before a batch is evaluated, the
bbotk::Terminator is queried for the remaining budget. If the available
budget is exhausted, an exception is raised, and no further evaluations can
be performed from this point on.
The FSelector is also supposed to store its final result, consisting
of the selected feature subsets and associated estimated performance values, by
calling the method
Creates a new instance of this R6 class.
FSelectInstanceMultiCrit$new( task, learner, resampling, measures, terminator, store_models = FALSE, check_values = TRUE, store_benchmark_result = TRUE )
Task to operate on.
Uninstantiated resamplings are instantiated during construction so that all configurations are evaluated on the same data splits.
Store models in benchmark result?
Check the parameters before the evaluation and the results for validity?
Store benchmark result in archive?
The FSelector object writes the best found feature subsets and estimated performance values here. For internal use.
The objects of this class are cloneable with this method.
FSelectInstanceMultiCrit$clone(deep = FALSE)
Whether to make a deep clone.
library(mlr3) library(data.table) # Objects required to define the performance evaluator task = tsk("iris") measures = msrs(c("classif.ce", "classif.acc")) learner = lrn("classif.rpart") resampling = rsmp("cv") terminator = trm("evals", n_evals = 8) inst = FSelectInstanceMultiCrit$new( task = task, learner = learner, resampling = resampling, measures = measures, terminator = terminator ) # Try some feature subsets xdt = data.table( Petal.Length = c(TRUE, FALSE), Petal.Width = c(FALSE, TRUE), Sepal.Length = c(TRUE, FALSE), Sepal.Width = c(FALSE, TRUE) ) inst$eval_batch(xdt) # Get archive data inst$archive$data()#> Petal.Length Petal.Width Sepal.Length Sepal.Width classif.ce classif.acc #> 1: TRUE FALSE TRUE FALSE 0.06000000 0.9400000 #> 2: FALSE TRUE FALSE TRUE 0.04666667 0.9533333 #> uhash x_domain timestamp batch_nr #> 1: bf5347f1-a256-4a9e-b2a2-ba653972a211 <list> 2020-10-31 04:26:11 1 #> 2: 07e78f07-82e2-4f3c-9578-503868bdb1df <list> 2020-10-31 04:26:11 1