Skip to contents

TunerMbo class that implements Model Based Optimization (MBO). This is a minimal interface internally passing on to OptimizerMbo. For additional information and documentation see OptimizerMbo.

Active bindings

loop_function

(loop_function | NULL)
Loop function determining the MBO flavor.

surrogate

(Surrogate | NULL)
The surrogate.

acq_function

(AcqFunction | NULL)
The acquisition function.

acq_optimizer

(AcqOptimizer | NULL)
The acquisition function optimizer.

args

(named list())
Further arguments passed to the loop_function. For example, random_interleave_iter.

result_assigner

(ResultAssigner | NULL)
The result assigner.

param_classes

(character())
Supported parameter classes that the optimizer can optimize. Determined based on the surrogate and the acq_optimizer. This corresponds to the values given by a paradox::ParamSet's $class field.

properties

(character())
Set of properties of the optimizer. Must be a subset of bbotk_reflections$optimizer_properties. MBO in principle is very flexible and by default we assume that the optimizer has all properties. When fully initialized, properties are determined based on the loop, e.g., the loop_function, and surrogate.

packages

(character())
Set of required packages. A warning is signaled prior to optimization if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace(). Required packages are determined based on the acq_function, surrogate and the acq_optimizer.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class. For more information on default values for loop_function, surrogate, acq_function, acq_optimizer, and result_assigner, see ?mbo_defaults.

Note that all the parameters below are simply passed to the OptimizerMbo and the respective fields are simply (settable) active bindings to the fields of the OptimizerMbo.

Usage

TunerMbo$new(
  loop_function = NULL,
  surrogate = NULL,
  acq_function = NULL,
  acq_optimizer = NULL,
  args = NULL,
  result_assigner = NULL
)

Arguments

loop_function

(loop_function | NULL)
Loop function determining the MBO flavor.

surrogate

(Surrogate | NULL)
The surrogate.

acq_function

(AcqFunction | NULL)
The acquisition function.

acq_optimizer

(AcqOptimizer | NULL)
The acquisition function optimizer.

args

(named list())
Further arguments passed to the loop_function. For example, random_interleave_iter.

result_assigner

(ResultAssigner | NULL)
The result assigner.


Method print()

Print method.

Usage

TunerMbo$print()

Returns

(character()).


Method reset()

Reset the tuner. Sets the following fields to NULL: loop_function, surrogate, acq_function, acq_optimizer, args, result_assigner

Usage

TunerMbo$reset()


Method clone()

The objects of this class are cloneable with this method.

Usage

TunerMbo$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# \donttest{
if (requireNamespace("mlr3learners") &
    requireNamespace("DiceKriging") &
    requireNamespace("rgenoud")) {

  library(mlr3)
  library(mlr3tuning)

  # single-objective
  task = tsk("wine")
  learner = lrn("classif.rpart", cp = to_tune(lower = 1e-4, upper = 1, logscale = TRUE))
  resampling = rsmp("cv", folds = 3)
  measure = msr("classif.acc")

  instance = TuningInstanceBatchSingleCrit$new(
    task = task,
    learner = learner,
    resampling = resampling,
    measure = measure,
    terminator = trm("evals", n_evals = 5))

  tnr("mbo")$optimize(instance)

  # multi-objective
  task = tsk("wine")
  learner = lrn("classif.rpart", cp = to_tune(lower = 1e-4, upper = 1, logscale = TRUE))
  resampling = rsmp("cv", folds = 3)
  measures = msrs(c("classif.acc", "selected_features"))

  instance = TuningInstanceBatchMultiCrit$new(
    task = task,
    learner = learner,
    resampling = resampling,
    measures = measures,
    terminator = trm("evals", n_evals = 5),
    store_models = TRUE) # required due to selected features

  tnr("mbo")$optimize(instance)
}
#>              cp learner_param_vals  x_domain classif.acc selected_features
#>           <num>             <list>    <list>       <num>             <num>
#> 1: -0.326016159          <list[2]> <list[1]>   0.3986817          0.000000
#> 2: -4.931186071          <list[2]> <list[1]>   0.8707156          3.333333
#> 3: -7.233771301          <list[2]> <list[1]>   0.8707156          3.333333
#> 4: -2.628601252          <list[2]> <list[1]>   0.8370056          2.333333
#> 5: -0.000381697          <list[2]> <list[1]>   0.3986817          0.000000
# }