-
Notifications
You must be signed in to change notification settings - Fork 314
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
Remove dispatching functionality from optimizer_argparse
#2998
Conversation
This pull request was exported from Phabricator. Differential Revision: D65231763 |
…2998) Summary: Context: This dispatcher's only usage is to raise an exception with qKG. There is no need for it to be a dispatcher. This diff: * makes `optimizer_argparse` no longer a dispatcher * Moves the error for qKG into the body of the now-only `optimizer_argparse` function * Removes special function for qKG * Changes type annotations so that the first argument is always an `AcquisitionFunction`; it was always used that way, with different types used only in tests. Reviewed By: saitcakmak, Balandat Differential Revision: D65231763
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2998 +/- ##
==========================================
- Coverage 95.60% 95.60% -0.01%
==========================================
Files 483 483
Lines 49007 48976 -31
==========================================
- Hits 46855 46825 -30
+ Misses 2152 2151 -1 ☔ View full report in Codecov by Sentry. |
…2998) Summary: Context: This dispatcher's only usage is to raise an exception with qKG. There is no need for it to be a dispatcher. This diff: * makes `optimizer_argparse` no longer a dispatcher * Moves the error for qKG into the body of the now-only `optimizer_argparse` function * Removes special function for qKG * Changes type annotations so that the first argument is always an `AcquisitionFunction`; it was always used that way, with different types used only in tests. Reviewed By: saitcakmak, Balandat Differential Revision: D65231763
Summary: Context: It appears that using `qKnowledgeGradient` with MBM doesn't work, since [this line](https://github.com/facebook/Ax/blob/535af4edff70cbf20a49c676377f5c8945560d03/ax/models/torch/botorch_modular/acquisition.py#L339) passes the argument `optimizer` to `_argparse_kg`, which errors [here](https://github.com/facebook/Ax/blob/535af4edff70cbf20a49c676377f5c8945560d03/ax/models/torch/botorch_modular/optimizer_argparse.py#L169) because it has now received the argument "optimizer" twice. We don't really need the `optimizer_argparse` special case for qKG anymore. This existed for two reasons: - in order to construct initial conditions, which can be handled by `optimize_acqf`, and - to ensure that the optimizer is `optimize_acqf`, because others are not supported This diff: * Modifies the `optimize_argparse` case for qKG to do nothing except update the optimizer to `optimize_acqf` and then call the base case Implementation notes: * Isn't it nonintuitive to set the optimizer then override it? Yes, a little, but the user can't choose the optimizer, so we're not overriding a user-specified choice. Also, lots of arguments to the `optimizer_argparse` functions get ignored. The "right" thing might be to put the choice of optimizer inside a dispatcher so that it can depend on the acquisition class, but that would be a bigger change. * Do we really need this dispatcher anymore, if it is doing so little? Maybe. Third parties may wish to use it to accommodate acquisition functions that are not in Ax. On the other hand, this dispatcher is currently not doing much of anything. * Do the `optimize_argparse` functions still need to support so many arguments, given that some of them seemed to just be there for constructing initial conditions? Probably not; I mean to look into that in a follow-up. Reviewed By: saitcakmak Differential Revision: D65227420
…2998) Summary: Context: This dispatcher's only usage is to raise an exception with qKG. There is no need for it to be a dispatcher. This diff: * makes `optimizer_argparse` no longer a dispatcher * Moves the error for qKG into the body of the now-only `optimizer_argparse` function * Removes special function for qKG * Changes type annotations so that the first argument is always an `AcquisitionFunction`; it was always used that way, with different types used only in tests. Reviewed By: saitcakmak, Balandat Differential Revision: D65231763
6a59c39
to
e749edb
Compare
This pull request was exported from Phabricator. Differential Revision: D65231763 |
This pull request has been merged in 2b14d3f. |
Summary:
Context: This dispatcher's only usage is to raise an exception with qKG. There is no need for it to be a dispatcher.
This diff:
optimizer_argparse
no longer a dispatcheroptimizer_argparse
functionAcquisitionFunction
; it was always used that way, with different types used only in tests.Reviewed By: saitcakmak, Balandat
Differential Revision: D65231763