TunerIrace class that implements iterated racing. Calls irace::irace() from package irace.

Source

Lopez-Ibanez M, Dubois-Lacoste J, Caceres LP, Birattari M, Stuetzle T (2016). “The irace package: Iterated racing for automatic algorithm configuration.” Operations Research Perspectives, 3, 43--58. doi: 10.1016/j.orp.2016.09.002 .

Dictionary

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

TunerIrace$new()
mlr_tuners$get("irace")
tnr("irace")

Parameters

n_instances

integer(1)
Number of resampling instances.

For the meaning of all other parameters, see irace::defaultScenario(). Note that we have removed all control parameters which refer to the termination of the algorithm. Use TerminatorEvals instead. Other terminators do not work with TunerIrace.

Archive

The ArchiveTuning holds the following additional columns:

  • "race" (integer(1))
    Race iteration.

  • "step" (integer(1))
    Step number of race.

  • "instance" (integer(1))
    Identifies resampling instances across races and steps.

  • "configuration" (integer(1))
    Identifies configurations across races and steps.

Result

The tuning result (instance$result) is the best performing elite of the final race. The reported performance is the average performance estimated on all used instances.

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.

See also

Super classes

mlr3tuning::Tuner -> mlr3tuning::TunerFromOptimizer -> TunerIrace

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

TunerIrace$new()


Method optimize()

Performs the tuning on a TuningInstanceSingleCrit until termination. The single evaluations and the final results will be written into the ArchiveTuning that resides in the TuningInstanceSingleCrit. The final result is returned.

Usage

TunerIrace$optimize(inst)

Arguments

Returns

data.table::data.table.


Method clone()

The objects of this class are cloneable with this method.

Usage

TunerIrace$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# retrieve task task = tsk("pima") # load learner and set search space learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE)) # hyperparameter tuning on the pima indians diabetes data set instance = tune( method = "irace", task = task, learner = learner, resampling = rsmp("holdout"), measure = msr("classif.ce"), term_evals = 42 )
#> # 2021-09-16 04:23:21 UTC: Initialization #> # Elitist race #> # Elitist new instances: 1 #> # Elitist limit: 2 #> # nbIterations: 2 #> # minNbSurvival: 2 #> # nbParameters: 1 #> # seed: 983633176 #> # confidence level: 0.95 #> # budget: 42 #> # mu: 5 #> # deterministic: FALSE #> #> # 2021-09-16 04:23:21 UTC: Iteration 1 of 2 #> # experimentsUsedSoFar: 0 #> # remainingBudget: 42 #> # currentBudget: 21 #> # nbConfigurations: 3 #> # Markers: #> x No test is performed. #> c Configurations are discarded only due to capping. #> - The test is performed and some configurations are discarded. #> = The test is performed but no configuration is discarded. #> ! The test is performed and configurations could be discarded but elite configurations are preserved. #> . All alive configurations are elite and nothing is discarded #> #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> | | Instance| Alive| Best| Mean best| Exp so far| W time| rho|KenW| Qvar| #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> |x| 1| 3| 3| 0.2578125000| 3|00:00:00| NA| NA| NA| #> |x| 2| 3| 3| 0.2656250000| 6|00:00:00|+0.86|0.93|0.1627| #> |x| 3| 3| 3| 0.2513020833| 9|00:00:00|+0.90|0.93|0.1085| #> |x| 4| 3| 3| 0.2529296875| 12|00:00:00|+0.90|0.93|0.1165| #> |-| 5| 1| 3| 0.2437500000| 15|00:00:00| NA| NA| NA| #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> Best-so-far configuration: 3 mean value: 0.2437500000 #> Description of the best-so-far configuration: #> .ID. cp .PARENT. #> 3 3 -3.696 NA #> #> # 2021-09-16 04:23:23 UTC: Elite configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks): #> cp #> 3 -3.696 #> # 2021-09-16 04:23:23 UTC: Iteration 2 of 2 #> # experimentsUsedSoFar: 15 #> # remainingBudget: 27 #> # currentBudget: 27 #> # nbConfigurations: 4 #> # Markers: #> x No test is performed. #> c Configurations are discarded only due to capping. #> - The test is performed and some configurations are discarded. #> = The test is performed but no configuration is discarded. #> ! The test is performed and configurations could be discarded but elite configurations are preserved. #> . All alive configurations are elite and nothing is discarded #> #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> | | Instance| Alive| Best| Mean best| Exp so far| W time| rho|KenW| Qvar| #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> |x| 6| 4| 3| 0.2812500000| 4|00:00:00| NA| NA| NA| #> |x| 1| 4| 3| 0.2695312500| 7|00:00:00|+0.00|0.50|0.3750| #> |x| 5| 4| 3| 0.2486979167| 10|00:00:00|+0.50|0.67|0.2500| #> |x| 4| 4| 3| 0.2509765625| 13|00:00:00|+0.33|0.50|0.2500| #> |=| 2| 4| 4| 0.2507812500| 16|00:00:00|+0.06|0.24|0.4250| #> |=| 3| 4| 4| 0.2460937500| 19|00:00:00|+0.04|0.20|0.3583| #> |=| 7| 4| 3| 0.2522321429| 23|00:00:00|+0.00|0.14|0.4286| #> +-+-----------+-----------+-----------+---------------+-----------+--------+-----+----+------+ #> Best-so-far configuration: 3 mean value: 0.2522321429 #> Description of the best-so-far configuration: #> .ID. cp .PARENT. #> 3 3 -3.696 NA #> #> # 2021-09-16 04:23:25 UTC: Elite configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks): #> cp #> 3 -3.6960 #> 4 -3.2257 #> # 2021-09-16 04:23:25 UTC: Stopped because there is not enough budget left to race more than the minimum (2) #> # You may either increase the budget or set 'minNbSurvival' to a lower value #> # Iteration: 3 #> # nbIterations: 3 #> # experimentsUsedSoFar: 38 #> # timeUsed: 0 #> # remainingBudget: 4 #> # currentBudget: 4 #> # number of elites: 2 #> # nbConfigurations: 2
# best performing hyperparameter configuration instance$result
#> cp configuration learner_param_vals x_domain classif.ce #> 1: -3.696 3 <list[2]> <list[1]> 0.2522321
# all evaluated hyperparameter configuration as.data.table(instance$archive)
#> cp classif.ce x_domain_cp runtime_learners timestamp #> 1: -7.2126 0.2617188 0.0007372378 0.009 2021-09-16 04:23:22 #> 2: -5.1415 0.2617188 0.0058489098 0.009 2021-09-16 04:23:22 #> 3: -3.6960 0.2578125 0.0248226186 0.011 2021-09-16 04:23:22 #> 4: -7.2126 0.2851562 0.0007372378 0.010 2021-09-16 04:23:22 #> 5: -5.1415 0.2773438 0.0058489098 0.011 2021-09-16 04:23:22 #> 6: -3.6960 0.2734375 0.0248226186 0.012 2021-09-16 04:23:22 #> 7: -7.2126 0.2695312 0.0007372378 0.011 2021-09-16 04:23:22 #> 8: -5.1415 0.2695312 0.0058489098 0.011 2021-09-16 04:23:22 #> 9: -3.6960 0.2226562 0.0248226186 0.011 2021-09-16 04:23:22 #> 10: -7.2126 0.2851562 0.0007372378 0.011 2021-09-16 04:23:23 #> 11: -5.1415 0.2656250 0.0058489098 0.012 2021-09-16 04:23:23 #> 12: -3.6960 0.2578125 0.0248226186 0.013 2021-09-16 04:23:23 #> 13: -7.2126 0.2539062 0.0007372378 0.012 2021-09-16 04:23:23 #> 14: -5.1415 0.2343750 0.0058489098 0.010 2021-09-16 04:23:23 #> 15: -3.6960 0.2070312 0.0248226186 0.009 2021-09-16 04:23:23 #> 16: -3.6960 0.2812500 0.0248226186 0.011 2021-09-16 04:23:23 #> 17: -3.2257 0.2812500 0.0397279623 0.010 2021-09-16 04:23:23 #> 18: -2.5684 0.2812500 0.0766581003 0.012 2021-09-16 04:23:23 #> 19: -3.3355 0.2812500 0.0355967834 0.011 2021-09-16 04:23:23 #> 20: -3.2257 0.2578125 0.0397279623 0.012 2021-09-16 04:23:24 #> 21: -2.5684 0.3085938 0.0766581003 0.011 2021-09-16 04:23:24 #> 22: -3.3355 0.2578125 0.0355967834 0.011 2021-09-16 04:23:24 #> 23: -3.2257 0.2070312 0.0397279623 0.011 2021-09-16 04:23:24 #> 24: -2.5684 0.2656250 0.0766581003 0.010 2021-09-16 04:23:24 #> 25: -3.3355 0.2070312 0.0355967834 0.010 2021-09-16 04:23:24 #> 26: -3.2257 0.2578125 0.0397279623 0.011 2021-09-16 04:23:24 #> 27: -2.5684 0.2578125 0.0766581003 0.012 2021-09-16 04:23:24 #> 28: -3.3355 0.2578125 0.0355967834 0.012 2021-09-16 04:23:24 #> 29: -3.2257 0.2500000 0.0397279623 0.010 2021-09-16 04:23:24 #> 30: -2.5684 0.2500000 0.0766581003 0.010 2021-09-16 04:23:24 #> 31: -3.3355 0.2500000 0.0355967834 0.019 2021-09-16 04:23:24 #> 32: -3.2257 0.2226562 0.0397279623 0.011 2021-09-16 04:23:25 #> 33: -2.5684 0.2226562 0.0766581003 0.010 2021-09-16 04:23:25 #> 34: -3.3355 0.2226562 0.0355967834 0.011 2021-09-16 04:23:25 #> 35: -3.6960 0.2656250 0.0248226186 0.011 2021-09-16 04:23:25 #> 36: -3.2257 0.2890625 0.0397279623 0.011 2021-09-16 04:23:25 #> 37: -2.5684 0.2890625 0.0766581003 0.011 2021-09-16 04:23:25 #> 38: -3.3355 0.2890625 0.0355967834 0.011 2021-09-16 04:23:25 #> cp classif.ce x_domain_cp runtime_learners timestamp #> batch_nr race step instance configuration resample_result #> 1: 1 1 1 8 1 <ResampleResult[20]> #> 2: 1 1 1 8 2 <ResampleResult[20]> #> 3: 1 1 1 8 3 <ResampleResult[20]> #> 4: 2 1 1 2 1 <ResampleResult[20]> #> 5: 2 1 1 2 2 <ResampleResult[20]> #> 6: 2 1 1 2 3 <ResampleResult[20]> #> 7: 3 1 1 3 1 <ResampleResult[20]> #> 8: 3 1 1 3 2 <ResampleResult[20]> #> 9: 3 1 1 3 3 <ResampleResult[20]> #> 10: 4 1 1 5 1 <ResampleResult[20]> #> 11: 4 1 1 5 2 <ResampleResult[20]> #> 12: 4 1 1 5 3 <ResampleResult[20]> #> 13: 5 1 1 6 1 <ResampleResult[20]> #> 14: 5 1 1 6 2 <ResampleResult[20]> #> 15: 5 1 1 6 3 <ResampleResult[20]> #> 16: 6 2 1 1 3 <ResampleResult[20]> #> 17: 6 2 1 1 4 <ResampleResult[20]> #> 18: 6 2 1 1 5 <ResampleResult[20]> #> 19: 6 2 1 1 6 <ResampleResult[20]> #> 20: 7 2 1 8 4 <ResampleResult[20]> #> 21: 7 2 1 8 5 <ResampleResult[20]> #> 22: 7 2 1 8 6 <ResampleResult[20]> #> 23: 8 2 1 6 4 <ResampleResult[20]> #> 24: 8 2 1 6 5 <ResampleResult[20]> #> 25: 8 2 1 6 6 <ResampleResult[20]> #> 26: 9 2 1 5 4 <ResampleResult[20]> #> 27: 9 2 1 5 5 <ResampleResult[20]> #> 28: 9 2 1 5 6 <ResampleResult[20]> #> 29: 10 2 1 2 4 <ResampleResult[20]> #> 30: 10 2 1 2 5 <ResampleResult[20]> #> 31: 10 2 1 2 6 <ResampleResult[20]> #> 32: 11 2 1 3 4 <ResampleResult[20]> #> 33: 11 2 1 3 5 <ResampleResult[20]> #> 34: 11 2 1 3 6 <ResampleResult[20]> #> 35: 12 2 1 7 3 <ResampleResult[20]> #> 36: 12 2 1 7 4 <ResampleResult[20]> #> 37: 12 2 1 7 5 <ResampleResult[20]> #> 38: 12 2 1 7 6 <ResampleResult[20]> #> batch_nr race step instance configuration resample_result
# fit final model on complete data set learner$param_set$values = instance$result_learner_param_vals learner$train(task)