-
Notifications
You must be signed in to change notification settings - Fork 383
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
[Feature Request] Fantasize SingleTaskVariationalGP and/or HeteroskedasticSingleTaskGP #1459
Comments
Hi @JordanJar8. I am not really familiar with the details, but there's some support in GPyTorch for fantasizing variational GPs. This was implemented in cornellius-gp/gpytorch#1874 and a tutorial is found in https://docs.gpytorch.ai/en/stable/examples/08_Advanced_Usage/SVGP_Model_Updating.html#SVGP-Model-Updating If you need 20k samples, it is unlikely that I also want to point out is that |
Hi @saitcakmak. Thanks for your response. Yes I did look at GPyTorch variational GPs and fantasizing and make it works, but what I'm trying to do is to wrap it in BoTorch to make it works with all the framework, at least with the I have looked at how the |
Hi @JordanJar8 , thanks for reaching out!
I am not a modeling expert, but I can comment on the structure of the code. BoTorch often uses subclassing to share functionality rather than to define a consistent interface. In other words, if X subclasses Y, that doesn't guarantee that you can use an X wherever you can use a Y; it may just be that When you're trying to figure out how to use a model or acquisition function, I'd recommend looking at usage examples in the tutorials rather than studying the inheritance structure. You've identified at least one "documentation bug" here -- the docstrings for |
…discussion! (pytorch#1462) 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 The `Model` base class has a `fantasize` method, but it isn't actually possible to `fantasize` from all models. For some models, `fantasize` fails with a `NotImplementedError` even though the docstring implies it should work. This is confusing (e.g. pytorch#1459 ). Another disadvantage is that codecov doesn't require tests for all of the many `fantasize` methods that exist, only for the base one -- which can't be called, since it is abstract. This PR removes the "fantasize" method from the `Model` base class. Instead, there is a `fantasize` function that is called by the few classes that do actually use and/or test `fantasize`. Pros: - decreases the "surface area" of BoTorch and prevents misuse of methods that we didn't really intend to exist - Allows codecov to surface where we aren't actually testing methods (I expect it to fail) Cons: - `fantasize` still exists but doesn't work in `HeteroskedasticSingleTaskGP` because it inherits from `SingleTaskGP` (a further refactor can fix that) - Could remove `fantasize` from classes where it _should_ exist (despite not being used or tested within BoTorch) - Somewhat more verbose ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? Yes Pull Request resolved: pytorch#1462 Test Plan: [x] Codecov [x] Unit tests should pass [x] No new Pyre errors introduced Differential Revision: D40783106 Pulled By: esantorella fbshipit-source-id: ecdae44b95b11248170fec7b7a9c9c4f2095c9f8
…discussion! (#1462) 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 The `Model` base class has a `fantasize` method, but it isn't actually possible to `fantasize` from all models. For some models, `fantasize` fails with a `NotImplementedError` even though the docstring implies it should work. This is confusing (e.g. #1459 ). Another disadvantage is that codecov doesn't require tests for all of the many `fantasize` methods that exist, only for the base one -- which can't be called, since it is abstract. This PR removes the "fantasize" method from the `Model` base class. Instead, there is a `fantasize` function that is called by the few classes that do actually use and/or test `fantasize`. Pros: - decreases the "surface area" of BoTorch and prevents misuse of methods that we didn't really intend to exist - Allows codecov to surface where we aren't actually testing methods (I expect it to fail) Cons: - `fantasize` still exists but doesn't work in `HeteroskedasticSingleTaskGP` because it inherits from `SingleTaskGP` (a further refactor can fix that) - Could remove `fantasize` from classes where it _should_ exist (despite not being used or tested within BoTorch) - Somewhat more verbose ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? Yes Pull Request resolved: #1462 Test Plan: [x] Codecov [x] Unit tests should pass [x] No new Pyre errors introduced Reviewed By: saitcakmak Differential Revision: D40783106 Pulled By: esantorella fbshipit-source-id: 91cd7ee47efee1d89ae7f65af1ed94a4d88bdbe6
🚀 Feature Request
An implementation of fantasize method for
SingleTaskVariationalGP
and/orHeteroskedasticSingleTaskGP
Motivation
Is your feature request related to a problem? Please describe.
I'm trying to do some active learning with a
SingleTaskVariationalGP
andHeteroskedasticSingleTaskGP
on a heteroskedastic regression task (~20 000 samples expected at the end) usingqNegIntegratedPosteriorVariance
as acquisition function. It requires to fantasize the surrogate model to compute fast posterior covariances but this method isn't implemented yet.Pitch
Describe the solution you'd like
An implementation of fantasize method that return fantasy model for
SingleTaskVariationalGP
andHeteroskedasticSingleTaskGP
Describe alternatives you've considered
I've tried to implement myself fantasize method for both models but didn't achieve yet. A little help in how BoTorch fantasize works would be very much appreciated :)
Are you willing to open a pull request? (See CONTRIBUTING)
Yes, why not. I've already tried to modify botorch lib on my PC.
Additional context
None
The text was updated successfully, but these errors were encountered: