-
Notifications
You must be signed in to change notification settings - Fork 415
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
BAxUS tutorial #1559
BAxUS tutorial #1559
Conversation
Hi Leonard, thank you for the PR! I'll review this in the next few days. |
Codecov Report
@@ Coverage Diff @@
## main #1559 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 170 170
Lines 14610 14610
=========================================
Hits 14610 14610 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing this tutorial and sorry for the delayed review! This looks great to me overall.
On a high level there is plenty of overlap between this tutorial and the TuRBO and SCBO tutorials. This is outside the scope of this diff, but we should probably get some of the core trust region functionality checked into BoTorch so we can cut some of the code in these tutorials. cc @Balandat .
- Can you run isort and flake8 on the notebook? Some of the lines are quite long which makes the code hard to read.
- Why are you using a domain of [-5, 15]^500? This is a bit non-standard for Branin which is usually optimized over [-5, 10] x [0, 15]. You can do something similar to https://github.com/pytorch/botorch/blob/main/tutorials/saasbo.ipynb in which case you can avoid having to define DummyBranin.
- Why are you learning the GP hyperparameters using Adam instead of calling fit_gpytorch_mll which will use L-BFGS-B? We generally find that fit_gpytorch_mll works better and you can see how this is done in https://botorch.org/tutorials/turbo_1.
- Can you rename X_turbo, Y_turbo, etc. to X_baxus, Y_baxus, … ?
- Dummy Branin -> Embedded Branin
Thank you for the review! I agree that there's a lot of overlap, but I think it's better to use similar code than to implement it differently if we cannot share code between the tutorials.
Please let me know if I need to make additional changes! |
@dme65 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, there are a few places in which things can be cleaned up but overall this lgtm.
@dme65 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Looks like the model fitting occasionally fails in the smoke test mode. Would you mind setting the seed so that this doesn't lead to CI failures? If you have other ideas for having it deterministically succeed, that'd also be great. |
Thanks, I fixed the seed. When the embedding is increased, the previous observations lie in a lower-dimensional subspace of that higher-dimensional embedding. This seems to cause problems with LBFGS in some cases. What I do in my work is to catch the |
I think that could be helpful for someone else that's using this tutorial to optimize their problem and runs into a similar issue. Let's add it with a simple comment explaining why this is needed. |
…nings: We scale the input data but to a different domain due to the BAxUS embedding
I added the fallback optimization and a comment about that. Also, I added a context manager to suppress the input data validation. The data is normalized but to [-1, 1] instead of [0, 1] due to the choice of the embedding. |
@dme65 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…lt BoTorch kernel for BAxUS. (#2165) Summary: This commit does two things: First, it fixes a bug that occurs when trying to split a bin with a single element. Also, we now use the default BoTorch Matern kernel instead of using MLE and lengthscale constraints. <!-- 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 I received a bug report via email for a slightly different benchmark setup that affects the code in the BAxUS tutorial. The bug occurs in cases when, after splitting, a bin contains only a single element, but other bins contain more than one element. In that case, the previous code attempted to split that bin which later caused an error. This commit fixes this bug and, at the same time, removes the custom Matern kernel we used in the previous version. The kernel does not improve performance but adds overhead to the tutorial. ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? Yes Pull Request resolved: #2165 Test Plan: I tested this version on multiple benchmark setups to ensure this bug is fixed. ## Related PRs Initial PR for BAxUS tutorial: #1559 Reviewed By: SebastianAment Differential Revision: D52718499 Pulled By: saitcakmak fbshipit-source-id: 7b2af5ec988406b3e482baa3ddf9f0becc17e45c
…lt BoTorch kernel for BAxUS. (pytorch#2165) Summary: This commit does two things: First, it fixes a bug that occurs when trying to split a bin with a single element. Also, we now use the default BoTorch Matern kernel instead of using MLE and lengthscale constraints. <!-- 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 I received a bug report via email for a slightly different benchmark setup that affects the code in the BAxUS tutorial. The bug occurs in cases when, after splitting, a bin contains only a single element, but other bins contain more than one element. In that case, the previous code attempted to split that bin which later caused an error. This commit fixes this bug and, at the same time, removes the custom Matern kernel we used in the previous version. The kernel does not improve performance but adds overhead to the tutorial. ### 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#2165 Test Plan: I tested this version on multiple benchmark setups to ensure this bug is fixed. ## Related PRs Initial PR for BAxUS tutorial: pytorch#1559 Reviewed By: SebastianAment Differential Revision: D52718499 Pulled By: saitcakmak fbshipit-source-id: 7b2af5ec988406b3e482baa3ddf9f0becc17e45c
Motivation
This pull request adds a tutorial for BAxUS (published at NeurIPS 2022), a novel BO method for high-dimensional problems. BAxUS allows for sample-efficient BO by using nested random embeddings that preserve observations.
Including BAxUS as a tutorial in Botorch helps other researchers to build on our work and makes it accessible for practitioners.
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
This PR does not add any core functionality, therefore no tests were added.
Related PRs
No new functionality.