-
-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting information about each trial as soon as it completes? #302
Comments
Sounds cool. We Optuna dev team will discuss possible designs and implementations for the proposed feature. |
Great. Thanks. Two possible API designs that I can think of are:
for trial in study.optimize(objective, n_trials=10, iter=True):
# trial.params contains the set of parameters that were last tested
# trial.value contains the corresponding objective value
# trial.trial_id contains the trial ID
pass
def callback(trial):
# trial.params contains the set of parameters that were last tested
# trial.value contains the corresponding objective value
# trial.trial_id contains the trial ID
pass
study.optimize(objective, n_trials=10, callback=callback) I believe the former is more powerful and flexible than the latter. |
Thanks for your suggestion. I think option 2 is preferable from the perspective of implementation cost and compatibility with current Optuna API. Out of curiosity, in your use case, what are you trying to do in the callback function? |
Here are a few things the callback function might do:
The last point might be tricky to do with option 2 (callback) but very easy with option 1 (iterator). |
I close this issue because this feature was implemented in #480. |
It would be nice to have a programmatic way to get information about each trial as soon as it completes (at least in the sequential optimization case...).
Something like:
My main use case for this is to be able to run some kind of "callback function" every time a new best set of hyper-parameters is found.
As far as I understand, there is no easy way to do this -- except maybe by doing this directly in the objective function but this is not very convenient.
Does that make sense?
The text was updated successfully, but these errors were encountered: