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.

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: -2.304763 43.04148  33.70751          <list[4]> <list[3]>  0.2578125

# all evaluated hyperparameter configuration
as.data.table(instance$archive)
#>            cp minsplit minbucket classif.ce  x_domain_cp x_domain_minsplit
#>  1: -2.304763 43.04148 33.707512  0.2578125 0.0997824876                43
#>  2: -2.302585  2.00000 39.301901  0.2578125 0.1000000000                 2
#>  3: -7.268017  2.00000  1.000000  0.2773438 0.0006974937                 2
#>  4: -2.302585 43.75238 17.641897  0.2578125 0.1000000000                43
#>  5: -2.302585 24.14398 29.188294  0.2578125 0.1000000000                24
#>  6: -3.042874 25.07460  8.532294  0.2578125 0.0476976193                25
#>  7: -2.302585 33.25467 53.045169  0.2578125 0.1000000000                33
#>  8: -3.287071  2.00000  1.000000  0.2578125 0.0373631277                 2
#>  9: -3.340450  2.00000  1.000000  0.2578125 0.0354210249                 2
#> 10: -2.302585  2.00000  1.000000  0.2578125 0.1000000000                 2
#>     x_domain_minbucket runtime_learners           timestamp batch_nr
#>  1:                 33            0.013 2022-01-23 04:26:35        1
#>  2:                 39            0.038 2022-01-23 04:26:36        2
#>  3:                  1            0.017 2022-01-23 04:26:36        3
#>  4:                 17            0.013 2022-01-23 04:26:36        4
#>  5:                 29            0.013 2022-01-23 04:26:36        5
#>  6:                  8            0.034 2022-01-23 04:26:36        6
#>  7:                 53            0.013 2022-01-23 04:26:36        7
#>  8:                  1            0.013 2022-01-23 04:26:36        8
#>  9:                  1            0.014 2022-01-23 04:26:36        9
#> 10:                  1            0.034 2022-01-23 04:26:36       10
#>          resample_result
#>  1: <ResampleResult[22]>
#>  2: <ResampleResult[22]>
#>  3: <ResampleResult[22]>
#>  4: <ResampleResult[22]>
#>  5: <ResampleResult[22]>
#>  6: <ResampleResult[22]>
#>  7: <ResampleResult[22]>
#>  8: <ResampleResult[22]>
#>  9: <ResampleResult[22]>
#> 10: <ResampleResult[22]>

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