-
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
Fix custom bounds handling in test problems #1760
Conversation
This pull request was exported from Phabricator. Differential Revision: D44326798 |
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.
Some tests are still failing, o/w this generally lgtm, thanks.
botorch/test_functions/base.py
Outdated
if len(self._bounds) != self.dim: | ||
raise InputDataError( | ||
"Expected the bounds to match the dimensionality of the domain. " | ||
f"Got {self.dim=} and {self._bounds=}." |
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.
should we print the dimension of the bounds rather than the bounds themselves here? If this is a high-dim problem that would likely be a lot easier to comprehend.
@@ -45,8 +47,34 @@ class DummySyntheticTestFunctionWithOptimizers(DummySyntheticTestFunction): | |||
|
|||
|
|||
class TestSyntheticTestFunction(BotorchTestCase): | |||
functions_with_custom_bounds = [ |
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.
maybe add a comment what the int value here is
for func_class, dim in self.functions_with_custom_bounds: | ||
bounds = [(-1e5, 1e5) for _ in range(dim)] | ||
bounds_tensor = torch.tensor(bounds).T | ||
func = func_class(bounds=bounds) | ||
self.assertEqual(func._bounds, bounds) | ||
self.assertTrue(torch.allclose(func.bounds, bounds_tensor)) |
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 this!
Do these problems need to have a |
Do they need to? Probably not. They've had it for a long time, so it makes sense to keep it around. I generally wouldn't rely on code search to find usage of test problems since they'll mostly be used for benchmarking by us or external users. I guess this makes it a bit harder to catch non-breaking bugs with them as well. |
Summary: Pull Request resolved: pytorch#1760 Fixes pytorch#1759 Reviewed By: Balandat Differential Revision: D44326798 fbshipit-source-id: 5ce9481fc2376b66d62be1edd08fdb7f81c9a858
This pull request was exported from Phabricator. Differential Revision: D44326798 |
8561b99
to
480ef5f
Compare
Codecov Report
@@ Coverage Diff @@
## main #1760 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 170 170
Lines 14717 14729 +12
=========================================
+ Hits 14717 14729 +12
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This pull request has been merged in 005fd56. |
Summary: Fixes #1759
Differential Revision: D44326798