Skip to contents

Subclass that implements CMA-ES calling adagio::pureCMAES() from package adagio.

Source

Hansen N (2016). “The CMA Evolution Strategy: A Tutorial.” 1604.00772.

Dictionary

This Tuner can be instantiated via the dictionary mlr_tuners or with the associated sugar function tnr():

TunerCmaes$new()
mlr_tuners$get("cmaes")
tnr("cmaes")

Parameters

sigma

numeric(1)

start_values

character(1)
Create random start values or based on center of search space? In the latter case, it is the center of the parameters before a trafo is applied.

For the meaning of the control parameters, see adagio::pureCMAES(). Note that we have removed all control parameters which refer to the termination of the algorithm and where our terminators allow to obtain the same behavior.

Progress Bars

$optimize() supports progress bars via the package progressr combined with a Terminator. Simply wrap the function in progressr::with_progress() to enable them. We recommend to use package progress as backend; enable with progressr::handlers("progress").

Logging

All Tuners use a logger (as implemented in lgr) from package bbotk. Use lgr::get_logger("bbotk") to access and control the logger.

Optimizer

This Tuner is based on bbotk::OptimizerCmaes which can be applied on any black box optimization problem. See also the documentation of bbotk.

Super classes

mlr3tuning::Tuner -> mlr3tuning::TunerFromOptimizer -> TunerCmaes

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

TunerCmaes$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(data.table)

# retrieve task
task = tsk("pima")

# load learner and set search space
learner = lrn("classif.rpart",
  cp = to_tune(1e-04, 1e-1, logscale = TRUE),
  minsplit = to_tune(p_dbl(2, 128, trafo = as.integer)),
  minbucket = to_tune(p_dbl(1, 64, trafo = as.integer))
)

# hyperparameter tuning on the pima indians diabetes data set
instance = tune(
  method = "cmaes",
  task = task,
  learner = learner,
  resampling = rsmp("holdout"),
  measure = msr("classif.ce"),
  term_evals = 10)

# best performing hyperparameter configuration
instance$result
#>           cp minsplit minbucket learner_param_vals  x_domain classif.ce
#> 1: -4.395109        2         1          <list[4]> <list[3]>   0.203125

# all evaluated hyperparameter configuration
as.data.table(instance$archive)
#>            cp minsplit minbucket classif.ce  x_domain_cp x_domain_minsplit
#>  1: -6.120993 46.51192  31.06398  0.2187500 0.0021962735                46
#>  2: -9.210340  2.00000  64.00000  0.2187500 0.0001000000                 2
#>  3: -7.360729 51.16997  57.37536  0.2187500 0.0006357349                51
#>  4: -8.784397  2.00000  64.00000  0.2187500 0.0001531035                 2
#>  5: -2.302585  2.00000   1.00000  0.2343750 0.1000000000                 2
#>  6: -5.940967  2.00000  35.72344  0.2187500 0.0026294862                 2
#>  7: -4.395109  2.00000   1.00000  0.2031250 0.0123375383                 2
#>  8: -8.242574 58.10235  41.19296  0.2226562 0.0002632058                58
#>  9: -4.606802 15.53207   1.00000  0.2226562 0.0099836936                15
#> 10: -9.210340 66.19490  45.64718  0.2187500 0.0001000000                66
#>     x_domain_minbucket runtime_learners           timestamp batch_nr warnings
#>  1:                 31            0.021 2022-08-13 04:25:11        1        0
#>  2:                 64            0.016 2022-08-13 04:25:11        2        0
#>  3:                 57            0.015 2022-08-13 04:25:12        3        0
#>  4:                 64            0.015 2022-08-13 04:25:12        4        0
#>  5:                  1            0.015 2022-08-13 04:25:12        5        0
#>  6:                 35            0.015 2022-08-13 04:25:12        6        0
#>  7:                  1            0.017 2022-08-13 04:25:12        7        0
#>  8:                 41            0.015 2022-08-13 04:25:12        8        0
#>  9:                  1            0.034 2022-08-13 04:25:12        9        0
#> 10:                 45            0.016 2022-08-13 04:25:12       10        0
#>     errors      resample_result
#>  1:      0 <ResampleResult[21]>
#>  2:      0 <ResampleResult[21]>
#>  3:      0 <ResampleResult[21]>
#>  4:      0 <ResampleResult[21]>
#>  5:      0 <ResampleResult[21]>
#>  6:      0 <ResampleResult[21]>
#>  7:      0 <ResampleResult[21]>
#>  8:      0 <ResampleResult[21]>
#>  9:      0 <ResampleResult[21]>
#> 10:      0 <ResampleResult[21]>

# fit final model on complete data set
learner$param_set$values = instance$result_learner_param_vals
learner$train(task)