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

Inducing Point Allocators for Sparse GPs #1652

Closed
wants to merge 22 commits into from

Conversation

henrymoss
Copy link
Contributor

Motivation

As requested by @eytan, I have had a go at implementing BO-specific inducing point allocation (IPA) strategies from my new paper (https://arxiv.org/abs/2301.10123). These allow you to build sparse Gaussian processes that are somewhat customized to the particular task at hand, be it BO, active learning e.t.c.

  1. I have rewritten part of your approximate GP code to allow the specification of custom IPA strategies.
  2. BoTorch's existing behaviour (using the greedy variance reduction of Burt et al (2020)) is a special case of the new functionality and remains the default.
  3. I have included one of the new IPAs from my paper to help demonstrate how custom IPAs can be defined. The one I chose is quite complicated (requiring access to model from the previous BO step) and so being able to implement it was a good test case to check that this code for custom IPA initialisation isnt stupid.
  4. There ended up being a lot of IPA related code, so I moved it all into a utility file, with its own testing file.

Test Plan

I have added loads of tests in test_inducing_point_allocators.py. I also added some extra tests higher up in the code in test_approximate_gp.py. There is perhaps a little bit of redundancy between the two sets of tests, but they are testing different interfaces.

Related PRs

I will write a follow-up PR with a notebook demonstrating this new inducing point allocation functionality and showing how a user can define their own IPA.

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

codecov bot commented Feb 3, 2023

Codecov Report

Merging #1652 (66854e7) into main (5df2fab) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 66854e7 differs from pull request most recent head ca52f7d. Consider uploading reports for the commit ca52f7d to get more accurate results

@@            Coverage Diff            @@
##              main     #1652   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          169       170    +1     
  Lines        14555     14615   +60     
=========================================
+ Hits         14555     14615   +60     
Impacted Files Coverage Δ
botorch/acquisition/max_value_entropy_search.py 100.00% <ø> (ø)
botorch/models/approximate_gp.py 100.00% <100.00%> (ø)
botorch/models/utils/inducing_point_allocators.py 100.00% <100.00%> (ø)

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

@facebook-github-bot
Copy link
Contributor

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

@esantorella
Copy link
Member

Thanks so much for the PR! I've imported it to Meta-internal and someone should be reviewing it soon.

To fix the Sphinx documentation error, could you list the new module here?

Copy link
Contributor

@Balandat Balandat 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 the contribution @henrymoss, this is excellent.

At a high level this all looks good to me, I have two main points, one is about the design of the instanstiation of the quality function for _allocate_inducing_points handled, the other one about avoiding code duplication in _pivoted_cholesky_init. The rest are mostly nits.

@@ -417,131 +448,3 @@ def init_inducing_points(
var_strat.variational_params_initialized.fill_(0)

return inducing_points


def _select_inducing_points(
Copy link
Member

Choose a reason for hiding this comment

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

Deleting _select_inducing_points is creating an import error for a downstream library (aepsych). Can _select_inducing_points either call one of the new functions or raise a deprecation warning?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we probably don't have to get too crazy in terms of deprecations here since this is a "private" method - @crasanders could we just update aepsych to use the new and shiny initialization strategies here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What did you two decide?

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll fix the aepsych issue ourselves and then will merge those changes together. @esantorella could you take care of this, please?

Copy link
Member

Choose a reason for hiding this comment

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

Yup I'll put in a PR to aepsych

@henrymoss
Copy link
Contributor Author

Thanks so much for the PR! I've imported it to Meta-internal and someone should be reviewing it soon.

To fix the Sphinx documentation error, could you list the new module here?

Hi @esantorella, I tried to do this but made things worse

@esantorella
Copy link
Member

Thanks so much for the PR! I've imported it to Meta-internal and someone should be reviewing it soon.
To fix the Sphinx documentation error, could you list the new module here?

Hi @esantorella, I tried to do this but made things worse

Thanks! Looks like there are additionally some citation-related issues. I'll clean those up and make a PR into this branch.

@facebook-github-bot
Copy link
Contributor

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

@henrymoss
Copy link
Contributor Author

I think we are ready @Balandat !

@Balandat
Copy link
Contributor

Most excellent, thanks for all the cleaning up. We'll just fix the aepsych failure on our end and then we can merge this in!

@facebook-github-bot
Copy link
Contributor

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

esantorella added a commit to esantorella/aepsych that referenced this pull request Feb 20, 2023
…Torch function to replacement with equivalent behavior

Summary: BoTorch `_select_inducing_points` is being deprecated in pytorch/botorch#1652 / D43001106. It is being replaced by more general inducing point allocator functionality; the legacy behavior remains a special case.

Differential Revision: D43438578

fbshipit-source-id: d781b8af2adab4e585c091e1b049c2c5271f832a
@esantorella esantorella self-assigned this Feb 21, 2023
esantorella added a commit to esantorella/aepsych that referenced this pull request Feb 23, 2023
…Torch function to replacement with equivalent behavior (facebookresearch#235)

Summary:
Pull Request resolved: facebookresearch#235

BoTorch `_select_inducing_points` is being deprecated in pytorch/botorch#1652 / D43001106. It is being replaced by more general inducing point allocator functionality; the legacy behavior remains a special case.

Reviewed By: Balandat

Differential Revision: D43438578

fbshipit-source-id: 0e9945490b3f228b0c2eca584e77bb5f58769023
esantorella added a commit to esantorella/botorch that referenced this pull request Feb 23, 2023
…Torch function to replacement with equivalent behavior (pytorch#235)

Summary:
X-link: facebookresearch/aepsych#235

BoTorch `_select_inducing_points` is being deprecated in pytorch#1652 / D43001106. It is being replaced by more general inducing point allocator functionality; the legacy behavior remains a special case.

Reviewed By: Balandat

Differential Revision: D43438578

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

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

esantorella pushed a commit to esantorella/aepsych that referenced this pull request Feb 24, 2023
Summary:
## Motivation

As requested by eytan, I have had a go at implementing BO-specific inducing point allocation (IPA) strategies from my new paper (https://arxiv.org/abs/2301.10123). These allow you to build sparse Gaussian processes that are somewhat customized to the particular task at hand, be it BO, active learning e.t.c.

1. I have rewritten part of your approximate GP code to allow the specification of custom IPA strategies.
2.  BoTorch's existing behaviour (using the greedy variance reduction of Burt et al (2020)) is a special case of the new functionality and remains the default.
3. I have included one of the new IPAs from my paper to help demonstrate how custom IPAs can be defined. The one I chose is quite complicated (requiring access to model from the previous BO step) and so being able to implement it was a good test case to check that this code for custom IPA initialisation isnt stupid.
4. There ended up being a lot of IPA related code, so I moved it all into a utility file, with its own testing file.

X-link: pytorch/botorch#1652

Differential Revision: D43556981

Pulled By: esantorella

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

@esantorella merged this pull request in d935d10.

facebook-github-bot pushed a commit to facebookresearch/aepsych that referenced this pull request Feb 24, 2023
Summary:
Pull Request resolved: #240

## Motivation

As requested by eytan, I have had a go at implementing BO-specific inducing point allocation (IPA) strategies from my new paper (https://arxiv.org/abs/2301.10123). These allow you to build sparse Gaussian processes that are somewhat customized to the particular task at hand, be it BO, active learning e.t.c.

1. I have rewritten part of your approximate GP code to allow the specification of custom IPA strategies.
2.  BoTorch's existing behaviour (using the greedy variance reduction of Burt et al (2020)) is a special case of the new functionality and remains the default.
3. I have included one of the new IPAs from my paper to help demonstrate how custom IPAs can be defined. The one I chose is quite complicated (requiring access to model from the previous BO step) and so being able to implement it was a good test case to check that this code for custom IPA initialisation isnt stupid.
4. There ended up being a lot of IPA related code, so I moved it all into a utility file, with its own testing file.

X-link: pytorch/botorch#1652

Test Plan:
I have added loads of tests in test_inducing_point_allocators.py. I also added some extra tests higher up in the code in test_approximate_gp.py. There is perhaps a little bit of redundancy between the two sets of tests, but they are testing different interfaces.

## Related PRs

I will write a follow-up PR with a notebook demonstrating this new inducing point allocation functionality and showing how a user can define their own IPA.

Reviewed By: saitcakmak

Differential Revision: D43556981

Pulled By: esantorella

fbshipit-source-id: 1fd989c00e6dabf302beec5f4bde0279ccaf158b
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. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants