Skip to contents

Subclass for Covariance Matrix Adaptation Evolution Strategy (CMA-ES). Calls adagio::pureCMAES() from package adagio.

Source

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

Dictionary

This Tuner can be instantiated with the associated sugar function tnr():

tnr("cmaes")

Control Parameters

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.

Resources

There are several sections about hyperparameter optimization in the mlr3book.

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

  • Use the Hyperband optimizer with different budget parameters.

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

# Hyperparameter Optimization

# 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))
)

# run hyperparameter tuning on the Palmer Penguins data set
instance = tune(
  tuner = tnr("cmaes"),
  task = tsk("penguins"),
  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
#>        <num>    <num>     <num>             <list>    <list>      <num>
#> 1: -4.685173  115.224  42.21322          <list[4]> <list[3]> 0.06086957

# all evaluated hyperparameter configuration
as.data.table(instance$archive)
#>            cp  minsplit minbucket classif.ce  x_domain_cp x_domain_minsplit
#>         <num>     <num>     <num>      <num>        <num>             <int>
#>  1: -2.302585  38.11712  49.56317 0.06956522 0.1000000000                38
#>  2: -2.302585 128.00000  51.58809 0.07826087 0.1000000000               128
#>  3: -4.685173 115.22404  42.21322 0.06086957 0.0092311372               115
#>  4: -4.740603 128.00000  64.00000 0.13043478 0.0087333759               128
#>  5: -6.474745 127.08243  64.00000 0.13043478 0.0015418919               127
#>  6: -2.302585 128.00000  64.00000 0.13043478 0.1000000000               128
#>  7: -2.302585 128.00000  64.00000 0.13043478 0.1000000000               128
#>  8: -2.794201  15.15813  36.35288 0.06086957 0.0611637160                15
#>  9: -7.774599  24.96408  35.60676 0.06086957 0.0004202761                24
#> 10: -5.422237 128.00000  35.72433 0.06086957 0.0044172540               128
#>     x_domain_minbucket runtime_learners           timestamp batch_nr warnings
#>                  <int>            <num>              <POSc>    <int>    <int>
#>  1:                 49            0.006 2024-03-06 08:51:23        1        0
#>  2:                 51            0.005 2024-03-06 08:51:23        2        0
#>  3:                 42            0.005 2024-03-06 08:51:23        3        0
#>  4:                 64            0.005 2024-03-06 08:51:23        4        0
#>  5:                 64            0.006 2024-03-06 08:51:23        5        0
#>  6:                 64            0.006 2024-03-06 08:51:23        6        0
#>  7:                 64            0.004 2024-03-06 08:51:23        7        0
#>  8:                 36            0.005 2024-03-06 08:51:23        8        0
#>  9:                 35            0.006 2024-03-06 08:51:24        9        0
#> 10:                 35            0.005 2024-03-06 08:51:24       10        0
#>     errors  resample_result
#>      <int>           <list>
#>  1:      0 <ResampleResult>
#>  2:      0 <ResampleResult>
#>  3:      0 <ResampleResult>
#>  4:      0 <ResampleResult>
#>  5:      0 <ResampleResult>
#>  6:      0 <ResampleResult>
#>  7:      0 <ResampleResult>
#>  8:      0 <ResampleResult>
#>  9:      0 <ResampleResult>
#> 10:      0 <ResampleResult>

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