automl / SMAC3

SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization
https://automl.github.io/SMAC3/v2.2.0/
Other
1.09k stars 227 forks source link

[Feature] Remove `target_function` as required when using `ask` and `tell` interface #946

Open eddiebergman opened 1 year ago

eddiebergman commented 1 year ago

In the case where someone is using the ask and tell only, there's no reason for SMAC to know about the target_function at hand, however it's required by the abstract facade.

I can get around this pretty easily as I'm familiar enough with SMAC but it would nice not to have to do these hacky work-arounds.

optimizer = HyperparameterOptimizationFacade(
    scenario=Scenario(...),
    target_function="dummy"  # Smac things this is a program it should run
)

The reason for this is we are building light wrappers around some optimizers that support ask and tell and not relying on SMAC to actually evaluate the target_function itself.

eddiebergman commented 1 year ago

One possible way to do this is have a "lazy" instantiated runner via a @property such that the runner is only defined once required, at which point it will be detected that there is no target_function and a suitable error can be raised.

Another possibility is to have None be allowed as a possible value to target_function which can be detected at the point of optimize, raising a suitable error if None is provided, otherwise instantiating a runner at the optimize call.

Some combination of these solutions would probably be required as the SMBO object is created in the __init__, passing the desired Runner to the SMBO object.

renesass commented 1 year ago

The None option sounds decent. Haven't thought about that - thanks for pointing out :)

eddiebergman commented 1 year ago

@benjamc bump. Turns out it's from quite a few months ago...