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

Continuing cleanup of optimize_acqf #1676

Closed
wants to merge 1 commit into from

Conversation

esantorella
Copy link
Member

Summary:
The usage of kwargs in optimize_acqf and related functions has a few downsides:

  • It's not transparent to the user what options are supported
  • When kwargs get mutated by .pop(), this can cause subtle errors
  • If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in kwargs to named arguments. I did not entirely remove kwargs, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

  • Some kwargs, now marked as ic_gen_kwargs, get passed from optimize_acqf to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the kwargs arguement in optimize_acqf is removed.
  • Users may pass incorrect keyword arguments for no good reason. This fails silently.
  • Ax botorch_modular passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: D43200823

@facebook-github-bot facebook-github-bot added CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported labels Feb 14, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43200823

esantorella added a commit to esantorella/botorch that referenced this pull request Feb 14, 2023
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: D43200823

fbshipit-source-id: 45a0b7e08cfef6e1eb572871549f1eb7fdcc8b24
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43200823

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #1676 (3ae9425) into main (3e18d2a) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 3ae9425 differs from pull request most recent head 6902041. Consider uploading reports for the commit 6902041 to get more accurate results

@@            Coverage Diff            @@
##              main     #1676   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          169       169           
  Lines        14523     14522    -1     
=========================================
- Hits         14523     14522    -1     
Impacted Files Coverage Δ
botorch/optim/initializers.py 100.00% <100.00%> (ø)
botorch/optim/optimize.py 100.00% <100.00%> (ø)

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

esantorella added a commit to esantorella/botorch that referenced this pull request Feb 14, 2023
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: D43200823

fbshipit-source-id: c7679451da10b5934bf3c55e4909d418cfa72a70
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43200823

esantorella added a commit to esantorella/botorch that referenced this pull request Feb 14, 2023
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: https://internalfb.com/D43200823

fbshipit-source-id: 88cccb5a7093d707bee36a712ebb915588c1ff29
esantorella added a commit to esantorella/botorch that referenced this pull request Feb 14, 2023
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: https://internalfb.com/D43200823

fbshipit-source-id: b66ac13dba40ccd9e0b2c4e3ef10475d9b3a8167
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: D43200823

fbshipit-source-id: 287b998aaf46d5709723e97b3b7fc6b3eea96e5b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43200823

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 718be0c.

CompRhys added a commit to Radical-AI/botorch that referenced this pull request Oct 21, 2024
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. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants