-
Notifications
You must be signed in to change notification settings - Fork 410
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
Optimization over mixed spaces in optimize_acqf_homotopy
#2639
Optimization over mixed spaces in optimize_acqf_homotopy
#2639
Conversation
I think that makes sense. Starting with only supporting the |
botorch/optim/optimize_homotopy.py
Outdated
if fixed_features and fixed_features_list: | ||
raise ValueError( | ||
"Èither `fixed_feature` or `fixed_features_list` can be provided, not both." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed_features
as an arg seems redundant if we have fixed_features_list
. We should probably deprecate the fixed_features
arg and raise a warning when passed. And if fixed_features_list
contains only one element we can just use that with optimize_acqf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise a warning but still give the user the possibility to pass it for now? Should the same then also be done for optimize_acqf_list
? There the same setup is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemeted it now for optimize_acqf_homotopy
, if it is fine for you how it looks there, I will port it to optimize_acqf_list
.
Co-authored-by: Max Balandat <[email protected]>
I added the possibility
What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gen_candidates: would it make sense for you to add this option to optimize_acqf_mixed?
Yeah I think that would make sense. Inside of optimize_acqf_mixed
we'd just pass this to optimize_acqf
.
sequential: this keyword make for me no sense in the kontext of optimize_homotopy, as we are always using q=1 for the calls to optimize_acqf
True - I think we can remove this from optimize_acqf_homotopy
.
return_full_tree: I am not sure about this as I do not exactly know what it does. Does it make sense in kontext of optimize_homotopy?
This is used by lookahead acquisition functions. I don't think we need to support this for optimize_acqf_homotopy
.
botorch/optim/optimize_homotopy.py
Outdated
if fixed_features and fixed_features_list: | ||
raise ValueError( | ||
"Èither `fixed_feature` or `fixed_features_list` can be provided, not both." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that would be great
Co-authored-by: Max Balandat <[email protected]>
Co-authored-by: Max Balandat <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - largely nits except for the conditional when "Optimize one more time with the final options".
Also looks like you have a KeyError
test failure as well as line length lint issue
Hi @Balandat, thanks for your review(s). I think, I have now implemented all the suggestions. Could you have a look on the issue that I always have to wait for approval before the pipelines start? In the past, they were starting always automatically which helped me to faster finish the PRs ;) And maybe it is also less annoying for you ... Best, Johannes |
Yeah I pinged some folks to understand if we can avoid this, let's see what they say. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2639 +/- ##
=======================================
Coverage 99.98% 99.98%
=======================================
Files 196 196
Lines 17410 17431 +21
=======================================
+ Hits 17408 17429 +21
Misses 2 2 ☔ View full report in Codecov by Sentry. |
Looks like you're missing a unit test for more than 1 elements in the |
Ah, this is now a consequence of the new structure where we call |
Now, the test is there ;), But there is still something wrong. Need to fix it ;) |
Not it is actually correct, I was overlooking something. Too late for coding ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tutorial failure is unrelated (and will be fixed in #2641). Thanks!
@Balandat has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
botorch/optim/optimize.py
Outdated
@@ -956,15 +979,18 @@ def optimize_acqf_mixed( | |||
post_processing_func=post_processing_func, | |||
batch_initial_conditions=batch_initial_conditions, | |||
ic_generator=ic_generator, | |||
return_best_only=True, | |||
return_best_only=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not return_best_only=return_best_only
? (A comment would be helpful here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get here all candidates and then filter later based on the return_best_only
argument. I will add a comment.
ic_generator=ic_generator, | ||
ic_gen_kwargs=ic_gen_kwargs, | ||
timeout_sec=timeout_sec, | ||
retry_on_optimization_warning=retry_on_optimization_warning, | ||
return_best_only=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why True here and False earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because, currently return_best_only
is only implemented for q=1
and here we are in the loop for q>1
.
Thanks for the review @esantorella. I adressed your comments and resolved the merge conflicts with main. Best, Johannes |
@Balandat has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Motivation
So far,
optimize_acqf_homotopy
can only handlefixed_features
but notfixed_features_list
which is useful for optimization over mixed spaces. In the spirit ofoptimize_acqf_list
, this PR adds the option forfixed_features_list
by usingoptimize_acqf_mixed
instead ofoptimize_acqf
inoptimize_acqf_homotopy
, whenfixed_features_list
is provided.Currently, it is not working as
optimize_acqf_mixed
has no optionreturn_best_only=False
likeoptimize_acqf
. The easiest way to solve it (maybe not the best), would be to provide an option to return the candidates from all restarts for the finally picked fixed features combination inoptimize_acqf_mixed
. For the start, it would be sufficient to only implement it forq=1
, and error out for the case ofq>1
.What do you think?
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Unit tests.