Open larskotthoff opened 6 months ago
@be-marc this looks like a more general issue with callbacks within an optim instance and evaluating points outside of optimize (probably the context just does not exist at this point and is NULL).
Do you have any ideas how to tackle this?
The context is only available when optimizer$optimize(instance)
is called because the context contains the optimizer and the instance. I already had the same problem and solved it with a callback :D
callback_tuning("mlr3tuning.initial_design",
label = "Initial Design Callback",
on_optimization_begin = function(callback, context) {
assert_data_table(callback$state$design)
context$instance$eval_batch(callback$state$design)
}
)
Sounds like this could be documented better and the error message improved :)
gives me
Note that the callback specified is
on_optimizer_after_eval
and the error comes fromon_optimizer_before_eval
(the same error would probably come from the specified callback as well though).