Skip to contents

Extract inner feature selection results of nested resampling. Implemented for mlr3::ResampleResult and mlr3::BenchmarkResult.

Usage

extract_inner_fselect_results(x, fselect_instance, ...)

Arguments

x

(mlr3::ResampleResult | mlr3::BenchmarkResult).

fselect_instance

(logical(1))
If TRUE, instances are added to the table.

...

(any)
Additional arguments.

Details

The function iterates over the AutoFSelector objects and binds the feature selection results to a data.table::data.table(). AutoFSelector must be initialized with store_fselect_instance = TRUE and resample() or benchmark() must be called with store_models = TRUE. Optionally, the instance can be added for each iteration.

Data structure

The returned data table has the following columns:

  • experiment (integer(1))
    Index, giving the according row number in the original benchmark grid.

  • iteration (integer(1))
    Iteration of the outer resampling.

  • One column for each feature of the task.

  • One column for each performance measure.

  • features (character())
    Vector of selected feature set.

  • task_id (character(1)).

  • learner_id (character(1)).

  • resampling_id (character(1)).

Examples

# Nested Resampling on Palmer Penguins Data Set

# create auto fselector
at = auto_fselector(
  fselector = fs("random_search"),
  learner = lrn("classif.rpart"),
  resampling = rsmp ("holdout"),
  measure = msr("classif.ce"),
  term_evals = 4)

resampling_outer = rsmp("cv", folds = 2)
rr = resample(tsk("iris"), at, resampling_outer, store_models = TRUE)

# extract inner results
extract_inner_fselect_results(rr)
#>    iteration Petal.Length Petal.Width Sepal.Length Sepal.Width classif.ce
#>        <int>       <lgcl>      <lgcl>       <lgcl>      <lgcl>      <num>
#> 1:         1         TRUE        TRUE        FALSE       FALSE       0.04
#> 2:         2         TRUE       FALSE        FALSE        TRUE       0.04
#>                    features n_features task_id              learner_id
#>                      <list>      <int>  <char>                  <char>
#> 1: Petal.Length,Petal.Width          2    iris classif.rpart.fselector
#> 2: Petal.Length,Sepal.Width          2    iris classif.rpart.fselector
#>    resampling_id
#>           <char>
#> 1:            cv
#> 2:            cv