mlr3tuning (version 0.1.0)

AutoTuner: AutoTuner

Description

The AutoTuner is a mlr3::Learner which auto-tunes by first tuning the hyperparameters of its encapsulated learner on the training data, then setting the optimal configuration in the learner, then finally fitting the model on the complete training data. Note that this class allows to perform nested resampling by passing an AutoTuner object to mlr3::resample() or mlr3::benchmark().

Arguments

Format

R6::R6Class object inheriting from mlr3::Learner.

Construction

at = AutoTuner$new(learner, resampling, measures, tune_ps, terminator, tuner, bm_args = list())

Fields

All fields from Learner, and additionally:

  • instance_args :: list All arguments from construction to create the TuningInstance.

  • tuner :: Tuner; from construction.

  • store_tuning_instance :: logical(1) If TRUE, stores the internally created TuningInstance with all intermediate results in slot $tuning_instance. By default, this is TRUE.

  • learner :: mlr3::Learner Trained learner

  • tuning_instance :: TuningInstance Internally created tuning instance with all intermediate results.

  • tuning_result :: named list Short-cut to result from TuningInstance.

Methods

All methods from Learner, and additionally:

Examples

Run this code
# NOT RUN {
library(mlr3)
library(paradox)
task = tsk("iris")
learner = lrn("classif.rpart")
resampling = rsmp("holdout")
measures = msr("classif.ce")
param_set = ParamSet$new(
  params = list(ParamDbl$new("cp", lower = 0.001, upper = 0.1)))

terminator = term("evals", n_evals = 5)
tuner = tnr("grid_search")
at = AutoTuner$new(learner, resampling, measures, param_set, terminator, tuner)
at$store_tuning_instance = TRUE

at$train(task)
at$model
at$learner
# }

Run the code above in your browser using DataLab