Callbacks allow to customize the behavior of processes in mlr3 packages. The following packages implement callbacks:
CallbackOptimization
in bbotk.CallbackTuning
in mlr3tuning.CallbackTorch
inmlr3torch
Details
Callback is an abstract base class.
A subclass inherits from Callback and adds stages as public members.
Names of stages should start with "on_"
.
For each subclass a function should be implemented to create the callback.
For an example on how to implement such a function see callback_optimization()
in bbotk.
Callbacks are executed at stages using the function call_back()
.
A Context defines which information can be accessed from the callback.
Public fields
id
(
character(1)
)
Identifier of the callback.label
(
character(1)
)
Label for this object. Can be used in tables, plot and text output instead of the ID.man
(
character(1)
)
String in the format[pkg]::[topic]
pointing to a manual page for this object. Defaults toNA
, but can be set by child classes.state
(named
list()
)
A callback can write data into the state.