Skip to contents

The TuningInstanceBatchMultiCrit specifies a tuning problem for a Tuner. The function ti() creates a TuningInstanceBatchMultiCrit and the function tune() creates an instance internally.


The instance contains an ObjectiveTuningBatch object that encodes the black box objective function a Tuner has to optimize. The instance allows the basic operations of querying the objective at design points ($eval_batch()). This operation is usually done by the Tuner. Evaluations of hyperparameter configurations are performed in batches by calling mlr3::benchmark() internally. The evaluated hyperparameter configurations are stored in the ArchiveBatchTuning ($archive). 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 tuner is also supposed to store its final result, consisting of a selected hyperparameter configuration and associated estimated performance values, by calling the method instance$assign_result.


There are several sections about hyperparameter optimization in the mlr3book.

The gallery features a collection of case studies and demos about optimization.


For analyzing the tuning results, it is recommended to pass the ArchiveBatchTuning to The returned data table is joined with the benchmark result which adds the mlr3::ResampleResult for each hyperparameter evaluation.

The archive provides various getters (e.g. $learners()) to ease the access. All getters extract by position (i) or unique hash (uhash). For a complete list of all getters see the methods section.

The benchmark result ($benchmark_result) allows to score the hyperparameter configurations again on a different measure. Alternatively, measures can be supplied to

The mlr3viz package provides visualizations for tuning results.

Super classes

bbotk::OptimInstance -> bbotk::OptimInstanceBatch -> bbotk::OptimInstanceBatchMultiCrit -> TuningInstanceBatchMultiCrit

Active bindings


List of param values for the optimal learner call.


The search space containing those parameters that are internally optimized by the mlr3::Learner.


Inherited methods

Method new()

Creates a new instance of this R6 class.


  search_space = NULL,
  store_benchmark_result = TRUE,
  store_models = FALSE,
  check_values = FALSE,
  callbacks = NULL



Task to operate on.


Learner to tune.


Resampling that is used to evaluate the performance of the hyperparameter configurations. Uninstantiated resamplings are instantiated during construction so that all configurations are evaluated on the same data splits. Already instantiated resamplings are kept unchanged. Specialized Tuner change the resampling e.g. to evaluate a hyperparameter configuration on different data splits. This field, however, always returns the resampling passed in construction.


(list of mlr3::Measure)
Measures to optimize.


Stop criterion of the tuning process.


Hyperparameter search space. If NULL (default), the search space is constructed from the paradox::TuneToken of the learner's parameter set (learner$param_set).


If TRUE (default), store resample result of evaluated hyperparameter configurations in archive as mlr3::BenchmarkResult.


If TRUE, fitted models are stored in the benchmark result (archive$benchmark_result). If store_benchmark_result = FALSE, models are only stored temporarily and not accessible after the tuning. This combination is needed for measures that require a model.


If TRUE, hyperparameter values are checked before evaluation and performance scores after. If FALSE (default), values are unchecked but computational overhead is reduced.


(list of mlr3misc::Callback)
List of callbacks.

Method assign_result()

The Tuner object writes the best found points and estimated performance values here. For internal use.


TuningInstanceBatchMultiCrit$assign_result(xdt, ydt, learner_param_vals = NULL)



Hyperparameter values as data.table::data.table(). Each row is one configuration. Contains values in the search space. Can contain additional columns for extra information.


Optimal outcomes, e.g. the Pareto front.


(List of named list()s)
Fixed parameter values of the learner that are neither part of the

Method clone()

The objects of this class are cloneable with this method.


TuningInstanceBatchMultiCrit$clone(deep = FALSE)



Whether to make a deep clone.


# Hyperparameter optimization on the Palmer Penguins data set
task = tsk("penguins")

# Load learner and set search space
learner = lrn("classif.rpart",
  cp = to_tune(1e-04, 1e-1, logscale = TRUE)

# Construct tuning instance
instance = ti(
  task = task,
  learner = learner,
  resampling = rsmp("cv", folds = 3),
  measures = msrs(c("classif.ce", "time_train")),
  terminator = trm("evals", n_evals = 4)

# Choose optimization algorithm
tuner = tnr("random_search", batch_size = 2)

# Run tuning
#>           cp learner_param_vals  x_domain classif.ce  time_train
#>        <num>             <list>    <list>      <num>       <num>
#> 1: -7.349764          <list[2]> <list[1]> 0.06402237 0.004666667

# Optimal hyperparameter configurations
#>           cp learner_param_vals  x_domain classif.ce  time_train
#>        <num>             <list>    <list>      <num>       <num>
#> 1: -7.349764          <list[2]> <list[1]> 0.06402237 0.004666667

# Inspect all evaluated configurations$archive)
#>           cp classif.ce  time_train  x_domain_cp runtime_learners
#>        <num>      <num>       <num>        <num>            <num>
#> 1: -7.095299 0.06402237 0.005000000 0.0008289927            0.045
#> 2: -7.349764 0.06402237 0.004666667 0.0006427440            0.026
#> 3: -2.357433 0.06692093 0.005333333 0.0946629107            0.029
#> 4: -8.488297 0.06402237 0.015666667 0.0002058636            0.061
#>              timestamp batch_nr warnings errors  resample_result
#>                 <POSc>    <int>    <int>  <int>           <list>
#> 1: 2024-06-30 09:41:11        1        0      0 <ResampleResult>
#> 2: 2024-06-30 09:41:11        1        0      0 <ResampleResult>
#> 3: 2024-06-30 09:41:11        2        0      0 <ResampleResult>
#> 4: 2024-06-30 09:41:11        2        0      0 <ResampleResult>