Extract inner tuning archives of nested resampling. Implemented for mlr3::ResampleResult and mlr3::BenchmarkResult. The function iterates over the AutoTuner objects and binds the tuning archives to a data.table::data.table(). AutoTuner must be initialized with store_tuning_instance = TRUE and resample() or benchmark() must be called with store_models = TRUE.

extract_inner_tuning_archives(
  x,
  unnest = "x_domain",
  exclude_columns = "uhash"
)

Arguments

x

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

unnest

(character())
Transforms list columns to separate columns. By default, x_domain is unnested. Set to NULL if no column should be unnested.

exclude_columns

(character())
Exclude columns from result table. Set to NULL if no column should be excluded.

Value

data.table::data.table().

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 hyperparameter of the search spaces.

  • One column for each performance measure.

  • runtime_learners (numeric(1))
    Sum of training and predict times logged in learners per mlr3::ResampleResult / evaluation. This does not include potential overhead time.

  • timestamp (POSIXct)
    Time stamp when the evaluation was logged into the archive.

  • batch_nr (integer(1))
    Hyperparameters are evaluated in batches. Each batch has a unique batch number.

  • x_domain (list())
    List of transformed hyperparameter values. By default this column is unnested.

  • x_domain_* (any)
    Separate column for each transformed hyperparameter.

  • resample_result (mlr3::ResampleResult)
    Resample result of the inner resampling.

  • task_id (character(1)).

  • learner_id (character(1)).

  • resampling_id (character(1)).

Examples

learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE)) at = auto_tuner( method = "grid_search", learner = learner, 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_tuning_archives(rr)
#> iteration cp classif.ce x_domain_cp runtime_learners #> 1: 1 -6.140227 0.04 0.0021544347 0.010 #> 2: 1 -4.605170 0.04 0.0100000000 0.009 #> 3: 1 -7.675284 0.04 0.0004641589 0.010 #> 4: 1 -8.442812 0.04 0.0002154435 0.010 #> 5: 2 -6.140227 0.04 0.0021544347 0.009 #> 6: 2 -3.070113 0.04 0.0464158883 0.008 #> 7: 2 -2.302585 0.04 0.1000000000 0.009 #> 8: 2 -4.605170 0.04 0.0100000000 0.010 #> timestamp batch_nr resample_result task_id #> 1: 2021-09-16 04:23:10 1 <ResampleResult[20]> iris #> 2: 2021-09-16 04:23:10 2 <ResampleResult[20]> iris #> 3: 2021-09-16 04:23:11 3 <ResampleResult[20]> iris #> 4: 2021-09-16 04:23:11 4 <ResampleResult[20]> iris #> 5: 2021-09-16 04:23:11 1 <ResampleResult[20]> iris #> 6: 2021-09-16 04:23:11 2 <ResampleResult[20]> iris #> 7: 2021-09-16 04:23:11 3 <ResampleResult[20]> iris #> 8: 2021-09-16 04:23:11 4 <ResampleResult[20]> iris #> learner_id resampling_id #> 1: classif.rpart.tuned cv #> 2: classif.rpart.tuned cv #> 3: classif.rpart.tuned cv #> 4: classif.rpart.tuned cv #> 5: classif.rpart.tuned cv #> 6: classif.rpart.tuned cv #> 7: classif.rpart.tuned cv #> 8: classif.rpart.tuned cv