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

add mixed optimization for list optimization #1342

Closed
wants to merge 5 commits into from

Conversation

jduerholt
Copy link
Contributor

Motivation

As outlined in issue #1272, optimize_acqf_list cannot be used to optimize over mixed domains. For this reason, this PR introduces the argument fixed_features_list for òptimize_acqf_list. Calling optimize_acqf_list with a list of fixed features invokes optimize_acqf_mixed instead of optimize_acqf under the hood.

Have you read the Contributing Guidelines on pull requests?

Yes.

Test Plan

In principle unit tests, but I had problems to understand how the tests of the different optimisation functions work, perhaps @Balandat or @saitcakmak can help me here ;)

Related PRs

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Aug 5, 2022
@codecov
Copy link

codecov bot commented Aug 5, 2022

Codecov Report

Merging #1342 (b5c1620) into main (8ecc903) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1342   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          149       149           
  Lines        12962     12966    +4     
=========================================
+ Hits         12962     12966    +4     
Impacted Files Coverage Δ
botorch/optim/optimize.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@saitcakmak saitcakmak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together and sorry for the late review!

Re testing: You can mock out optimize_acqf and optimize_acqf_mixed, and check that the correct one was called with the correct arguments. Here's an example from tests that mock gen_candidates_scipy and gen_batch_initial_conditions. You can then check call_args / call_args_list of the mock object to assert that it got called with the correct arguments. Lmk if you need more specific examples.

Comment on lines 411 to 416
fixed_features: A map `{feature_index: value}` for features that
should be fixed to a particular value during generation.
fixed_features_list: A list of maps `{feature_index: value}`. The i-th
item represents the fixed_feature for the i-th optimization. If
`fixed_features_list` is provided, `optimize_acqf_mixed` is invoked
and the `fixed_features` argument is ignored.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both are provided, let's throw an informative error rather than silently ignoring one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the behavior according to your suggestion.

@jduerholt
Copy link
Contributor Author

@saitcakmak: I implemented the test according to how I understood your suggestion. Can you have a look?

Copy link
Contributor

@saitcakmak saitcakmak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm!

@facebook-github-bot
Copy link
Contributor

@saitcakmak has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants