-
Notifications
You must be signed in to change notification settings - Fork 418
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
[Bug]: initialize_q_batch does not always include the maximum value when called in batch mode #2772
Closed
1 task done
Labels
bug
Something isn't working
Comments
Potential fix at #2773 |
Thanks, this is nice find of a not-so-nice issue. |
facebook-github-bot
pushed a commit
that referenced
this issue
Mar 17, 2025
…led in batch mode (#2773) Summary: <!-- Thank you for sending the PR! We appreciate you spending the time to make BoTorch better. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to BoTorch here: https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md --> ## Motivation Fix for #2772 ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? Yes Pull Request resolved: #2773 Test Plan: - Added assert to existing to ensure max value is included for every element of the batch. - Added a test case with large batch size - Verified test failed before making the change, and that it passes after ## Related PRs No related PRs; no changes to docs required. Reviewed By: Balandat Differential Revision: D71320417 Pulled By: saitcakmak fbshipit-source-id: d72a50cb5a6c9c3ecb672b9d78ca2e373fd87e04
@JackBuck can we consider this issue resolved? |
Hi @Balandat, sorry, yes - and thanks for the swift merging of the PR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
When calling
initialize_q_batch()
with a non-trivial batch_shape, the maximum of the inputacq_values
for each batch is not guaranteed to be included in the selected result. In fact, as thebatch_shape
is given more and more elements, the probability of including it shrinks to zero.The code which is supposed to include the maximum is here:
botorch/botorch/optim/initializers.py
Lines 989 to 991 in 01aa45e
The variable
max_idx
has shapebatch_shape
andidcs
has shapen x batch_shape
. The checkmax_idx not in idcs
only checks that the maximum is inidcs
for at least one batch. I would expectinitialize_q_batch()
to ensure the maximum of the inputacq_values
is included in every batch.Please provide a minimal, reproducible example of the unexpected behavior.
Please paste any relevant traceback/logs produced by the example provided.
BoTorch Version
0.13.0
Python Version
3.13.2
Operating System
Ubuntu 20.04.6 LTS (Focal Fossa)
Code of Conduct
The text was updated successfully, but these errors were encountered: