Specialized mlr3misc::Callback for optimization.
Callbacks allow to customize the behavior of processes in bbotk.
The callback_optimization()
function creates a CallbackOptimization.
Predefined callbacks are stored in the dictionary mlr_callbacks and can be retrieved with clbk()
.
For more information on optimization callbacks see callback_optimization()
.
Super class
mlr3misc::Callback
-> CallbackOptimization
Public fields
on_optimization_begin
(
function()
)
Stage called at the beginning of the optimization. Called inOptimizer$optimize()
.on_optimizer_before_eval
(
function()
)
Stage called after the optimizer proposes points. Called inOptimInstance$eval_batch()
.on_optimizer_after_eval
(
function()
)
Stage called after points are evaluated. Called inOptimInstance$eval_batch()
.on_result
(
function()
)
Stage called after result are written. Called inOptimInstance$assign_result()
.on_optimization_end
(
function()
)
Stage called at the end of the optimization. Called inOptimizer$optimize()
.
Examples
# write archive to disk
callback_optimization("bbotk.backup",
on_optimization_end = function(callback, context) {
saveRDS(context$instance$archive, "archive.rds")
}
)
#> <CallbackOptimization:bbotk.backup>
#> * Active Stages: on_optimization_end