tune_nested: Function for Nested Resampling

Description Usage Arguments Value Examples

View source: R/tune_nested.R

Description

Function to conduct nested resampling.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
tune_nested(
  method,
  task,
  learner,
  inner_resampling,
  outer_resampling,
  measure,
  term_evals = NULL,
  term_time = NULL,
  search_space = NULL,
  ...
)

Arguments

method

(character(1))
Key to retrieve tuner from mlr_tuners dictionary.

task

(mlr3::Task)
Task to operate on.

learner

(mlr3::Learner).

inner_resampling

(mlr3::Resampling)
Resampling used for the inner loop.

outer_resampling

mlr3::Resampling)
Resampling used for the outer loop.

measure

(mlr3::Measure)
Measure to optimize.

term_evals

(integer(1))
Number of allowed evaluations.

term_time

(integer(1))
Maximum allowed time in seconds.

search_space

(paradox::ParamSet)
Hyperparameter search space. If NULL, the search space is constructed from the TuneToken in the ParamSet of the learner.

...

(named list())
Named arguments to be set as parameters of the tuner.

Value

mlr3::ResampleResult

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
rr = tune_nested(
  method = "random_search",
  task = tsk("pima"),
  learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE)), 
  inner_resampling = rsmp ("holdout"),
  outer_resampling = rsmp("cv", folds = 2), 
  measure = msr("classif.ce"),
  term_evals = 2,
  batch_size = 2)

# retrieve inner tuning results.
extract_inner_tuning_results(rr)

# performance scores estimated on the outer resampling
rr$score()

# unbiased performance of the final model trained on the full data set
rr$aggregate()

mlr3tuning documentation built on Sept. 14, 2021, 9:08 a.m.