Skip to content
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

Recommendation History, Deterministic? #473

Closed
brandon-holt opened this issue Jan 31, 2025 · 4 comments
Closed

Recommendation History, Deterministic? #473

brandon-holt opened this issue Jan 31, 2025 · 4 comments
Labels
question Further information is requested

Comments

@brandon-holt
Copy link
Contributor

Hi, is recommendation for botorchrecommender supposed to be deterministic?

I find that if I save a campaign before every making recommendations, and request 1, 2, 3, etc. recommendations, the recs are preserved. For example, the first in the list of 2 and 3 is the same as in the list of 1. And the second in the list of 3 is the same as the second in the list of 2.

But when I save the campaign after having made any recommendations, the next batch does not preserve any of the historical recommendations and makes entirely new ones, overwriting the history. Why does it work this way? This seems pointless.

@Scienfitz
Copy link
Collaborator

Hi,
there are many aspects that could influence this, you need to provide more information.

Sequential Greedy Batch Recommendation
As example for the latter point: In discrete and hybrid spaces the botorch recommender always operates greedily. This means, when recommending a batch of N points, it first selects the best point, then conditions the acqf on that point, then selects the second point and so on. This naturally leads to the effect you describe in the second paragraph. In continuous spaces, the flag can change the outcome.

Cached Recommendations
Perhaps there's no immediate connection, but you should know that recommendations are cached when you work with Campaigns. So if you perform the exact same recommendation call twice, it should proved the exact same recommendation. It only recomputes in case you use a different batch size or new data were added etc.

To understand the potential connections to campaign saving that you describe, it would be good to have a minimal reproducing example.

@AdrianSosic
Copy link
Collaborator

AdrianSosic commented Jan 31, 2025

Hi @brandon-holt 👋🏼 Generally speaking, unless you fix the random seed (e.g., via our set_random_seed/temporary_seed helpers), the output of recommenders is non-deterministic. Depending on the recommender setting and context, there can generally be several sources of randomness involved that would result in non-reproducible outcomes, such as the initial conditions for the optimization of the hyperparameters, or of the acquisition function.

HOWEVER: in most practical situations, where you condition the model on some data, this randomness should not matter too much since you'll likely end up in the same (local) optimum. That's why I think what you describe here could have a different cause. Unfortunately, I cannot completely follow what exact steps you've conducted. Would you be so kind to set up a minimal example demonstrating the behavior?

@AdrianSosic
Copy link
Collaborator

Oh, I see that @Scienfitz texted at the same time :D

@brandon-holt
Copy link
Contributor Author

Thanks, this is helpful!

@AdrianSosic AdrianSosic added the question Further information is requested label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants