Multi-Criteria Tuning with Rush
Source:R/TuningInstanceAsyncMulticrit.R
TuningInstanceAsyncMultiCrit.Rd
The TuningInstanceAsyncMultiCrit specifies a tuning problem for a Tuner.
The function ti_async()
creates a TuningInstanceAsyncMultiCrit and the function tune()
creates an instance internally.
Details
The instance contains an ObjectiveTuningAsync object that encodes the black box objective function a Tuner has to optimize.
The instance allows the basic operations of querying the objective at design points ($eval_async()
).
This operation is usually done by the Tuner.
Hyperparameter configurations are asynchronously sent to workers and evaluated by calling mlr3::resample()
.
The evaluated hyperparameter configurations are stored in the ArchiveAsyncTuning ($archive
).
Before a batch is evaluated, the bbotk::Terminator is queried for the remaining budget.
If the available budget is exhausted, an exception is raised, and no further evaluations can be performed from this point on.
The tuner is also supposed to store its final result, consisting of a selected hyperparameter configuration and associated estimated performance values, by calling the method instance$.assign_result
.
Resources
There are several sections about hyperparameter optimization in the mlr3book.
Getting started with hyperparameter optimization.
An overview of all tuners can be found on our website.
Tune a support vector machine on the Sonar data set.
Learn about tuning spaces.
Estimate the model performance with nested resampling.
Learn about multi-objective optimization.
Simultaneously optimize hyperparameters and use early stopping with XGBoost.
Automate the tuning.
The gallery features a collection of case studies and demos about optimization.
Learn more advanced methods with the Practical Tuning Series.
Learn about hotstarting models.
Run the default hyperparameter configuration of learners as a baseline.
Use the Hyperband optimizer with different budget parameters.
The cheatsheet summarizes the most important functions of mlr3tuning.
Analysis
For analyzing the tuning results, it is recommended to pass the ArchiveAsyncTuning to as.data.table()
.
The returned data table contains the mlr3::ResampleResult for each hyperparameter evaluation.
Super classes
bbotk::OptimInstance
-> bbotk::OptimInstanceAsync
-> bbotk::OptimInstanceAsyncMultiCrit
-> TuningInstanceAsyncMultiCrit
Public fields
internal_search_space
(paradox::ParamSet)
The search space containing those parameters that are internally optimized by the mlr3::Learner.
Active bindings
result_learner_param_vals
(
list()
)
List of param values for the optimal learner call.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
TuningInstanceAsyncMultiCrit$new(
task,
learner,
resampling,
measures,
terminator,
search_space = NULL,
internal_search_space = NULL,
store_benchmark_result = TRUE,
store_models = FALSE,
check_values = FALSE,
callbacks = NULL,
rush = NULL
)
Arguments
task
(mlr3::Task)
Task to operate on.learner
(mlr3::Learner)
Learner to tune.resampling
(mlr3::Resampling)
Resampling that is used to evaluate the performance of the hyperparameter configurations. Uninstantiated resamplings are instantiated during construction so that all configurations are evaluated on the same data splits. Already instantiated resamplings are kept unchanged. Specialized Tuner change the resampling e.g. to evaluate a hyperparameter configuration on different data splits. This field, however, always returns the resampling passed in construction.measures
(list of mlr3::Measure)
Measures to optimize.terminator
(bbotk::Terminator)
Stop criterion of the tuning process.search_space
(paradox::ParamSet)
Hyperparameter search space. IfNULL
(default), the search space is constructed from the paradox::TuneToken of the learner's parameter set (learner$param_set).internal_search_space
(paradox::ParamSet or
NULL
)
The internal search space.store_benchmark_result
(
logical(1)
)
IfTRUE
(default), store resample result of evaluated hyperparameter configurations in archive as mlr3::BenchmarkResult.store_models
(
logical(1)
)
IfTRUE
, fitted models are stored in the benchmark result (archive$benchmark_result
). Ifstore_benchmark_result = FALSE
, models are only stored temporarily and not accessible after the tuning. This combination is needed for measures that require a model.check_values
(
logical(1)
)
IfTRUE
, hyperparameter values are checked before evaluation and performance scores after. IfFALSE
(default), values are unchecked but computational overhead is reduced.callbacks
(list of mlr3misc::Callback)
List of callbacks.rush
(
Rush
)
If a rush instance is supplied, the tuning runs without batches.
Method assign_result()
The TunerAsync writes the best found points and estimated performance values here (probably the Pareto set / front). For internal use.
Usage
TuningInstanceAsyncMultiCrit$assign_result(
xdt,
ydt,
learner_param_vals = NULL,
extra = NULL,
...
)
Arguments
xdt
(
data.table::data.table()
)
Hyperparameter values asdata.table::data.table()
. Each row is one configuration. Contains values in the search space. Can contain additional columns for extra information.ydt
(
numeric(1)
)
Optimal outcomes, e.g. the Pareto front.learner_param_vals
(List of named
list()s
)
Fixed parameter values of the learner that are neither part of theextra
(
data.table::data.table()
)
Additional information....
(
any
)
ignored.