automl / SMAC3

SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization
https://automl.github.io/SMAC3/v2.1.0/
Other
1.07k stars 220 forks source link

How to add trials/walltime after a optimize call ends #1103

Closed oddg closed 5 months ago

oddg commented 5 months ago

Description

I ran myfacade.optimize and it completed successfully. Now I want to re-optimize but with a larger budget on n_trials and walltime_limit while reusing the data collected on the first scenario. How can I do that?

What I tried.

The documentation explains how to use prior over the optimum but it is not clear how to find that prior from the previous successful optimization.

I tried to reuse the intensifier of the first facade without success.

dengdifan commented 5 months ago

Hi,

you could create a new facade with the enlarged n_trials and walltime_limit, then use the tell function to tell the optimizer the TrialValue and TrialInfo from your previous runs (which can be read from the runhistory generated by your first SMAC run). Please let me know if that helps

oddg commented 5 months ago

Thanks @dengdifan for the reply!

This is what I was looking for. I ended doing something like below

for (trial_key, trial_value) in complete_facade.runhistory.items():
    trial_info = TrialInfo(
        config=complete_facade.runhistory.get_config(trial_key.config_id),
        instance=trial_key.instance,
        seed=trial_key.seed,
        budget=trial_key.budget
    )
    new_facade.tell(trial_info, trial_value)