-
Notifications
You must be signed in to change notification settings - Fork 312
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
[Question] Is there a way to set a random state for reproducibility? #95
Comments
@Irynei - what level are you looking for reproducibility at? The whole optimization loop or a specific generator? You can set the seed for (quasi)-random generators, such as the Sobol generator (see https://ax.dev/api/models.html#ax.models.random.sobol.SobolGenerator.seed). |
I was looking for the whole optimization loop, in the As far as I understand a (quasi)-random generator is chosen somehow under the hood? |
In that example (https://ax.dev/tutorials/gpei_hartmann_developer.html) there are two main sources of randomness: The scrambling in the Sobol generator used for the initialization, and the randomness in the (quasi) Monte Carlo approximation used in the acquisition function. Like @kkashin says, the first can easily be handled by making the change to
And yes, this will require using the more explicit API rather than Most of the randomness will come from that (the initialization). The actually Bayesian optimization phase will still have some randomness in that the acquisition function is evaluated with a Monte Carlo approximation. The seed for that is set here: Ax/ax/models/torch/botorch_defaults.py Line 162 in eebb8c7
So, you can just run
before every call to As a side note, for the purposes of benchmarking / performance evaluation I'd recommend setting the number of reps high enough that the seed doesn't matter. But of course there are other settings where reproducibility of a single run would be useful, and this should give that. |
@bletham, thank you for a great explanation! It's clear to me now. |
I'm going to close out this issue for now, given that you're unblocked. We will look into making it possible to pass a seed directly to the |
Hi!
I didn't find a possibility to set random seed in the docs, maybe I missed something.
Can you please tell if there is a way how to make results reproducible? Thanks.
The text was updated successfully, but these errors were encountered: