-
Notifications
You must be signed in to change notification settings - Fork 311
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
Get rid of benchmark problem class constructors #2605
Conversation
This pull request was exported from Phabricator. Differential Revision: D60284484 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2605 +/- ##
=======================================
Coverage 95.20% 95.20%
=======================================
Files 495 495
Lines 47745 47724 -21
=======================================
- Hits 45456 45438 -18
+ Misses 2289 2286 -3 ☔ View full report in Codecov by Sentry. |
This pull request was exported from Phabricator. Differential Revision: D60284484 |
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Differential Revision: D60284484
79e18fa
to
99637b1
Compare
This pull request was exported from Phabricator. Differential Revision: D60284484 |
99637b1
to
7b28dde
Compare
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Reviewed By: saitcakmak Differential Revision: D60284484
…k#2603) Summary: Pull Request resolved: facebook#2603 Context: Surrogate benchmark problems allow for downloading datasets and constructing a surrogate lazily. Since the surrogates and datasets are only needed for the `Runner`, it makes sense to confine this logic to `SurrogateRunner`. This gives surrogate benchmark problems an interface that is much clsoer to that of non-surrogate benchmark problems. In the future, we should be able to get down to just one `BenchmarkProblem` class. This PR: * Moves lazy construction of surrogates from the `Problem` to the `Runner`. * Moves corresponding unit tests from the problem's file to the runner's. * Removes the attribute `noise_stds` from the problem, since it duplicates the same attribute on the runner and doesn't conform to the interface of other benchmark problems. * Requires `is_noiseless` to be provided at problem initialization, to make surrogate problems have the same interface as other problems, and adds an attribute `SurrogateRunner.is_noiseless` so that this is not difficult to provide. Differential Revision: D60266288 Reviewed By: saitcakmak
…eritance (facebook#2601) Summary: Pull Request resolved: facebook#2601 Context: * Problems that lack an `optimal_value` get a NaN score and cannot really be used for benchmarking except when aggregated. This is a nasty "gotcha." We don't always know the optimum, but IMO it is better to guess. * The inheritance structure of benchmark problems is too complex and will make subsequent refactors harder. This PR: * Adds an `optimal_value` requirement to `BenchmarkProblem` and makes `BenchmarkProblem` the base class to `SurrogateBenchmarkProblem`, enabling `BenchmarkProblem` to be the only type annotation needed. Therefore, the type annotation `BenchmarkProblemProtocol` is no longer necessary. It will be removed in the next PR. * No longer allows for giving an NaN score to benchmarks where the problem lacks an optimal value, because this won't happen. * Updates a lot of annotations. * Raises an exception for constrained multi-objective problems. * Use dataclasses to cut down on code. Differential Revision: D60145193 Reviewed By: saitcakmak
…e annotations (facebook#2602) Summary: Pull Request resolved: facebook#2602 These are no longer necessary. See previous PR for context. This change reaps them and updates type annotations. Differential Revision: D60146081 Reviewed By: saitcakmak
This pull request was exported from Phabricator. Differential Revision: D60284484 |
7b28dde
to
6579dcd
Compare
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Reviewed By: saitcakmak Differential Revision: D60284484
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Differential Revision: D60284484 Reviewed By: saitcakmak
This pull request was exported from Phabricator. Differential Revision: D60284484 |
6579dcd
to
6627d0e
Compare
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Reviewed By: saitcakmak Differential Revision: D60284484
Summary: Pull Request resolved: facebook#2605 Context: Benchmark problems are sometimes created with class methods `SingleObjectiveBenchmarkProblem.from_botorch`, `SingleObjectiveBenchmarkProblem.from_botorch_synthetic`, and `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective`, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future. This PR: * Replaces `SingleObjectiveBenchmarkProblem.from_botorch` and `SingleObjectiveBenchmarkProblem.from_botorch_synthetic` with `create_single_objective_problem_from_botorch` * Replaces `MultiObjectiveBenchmarkProblem.from_botorch_multi_objective` with `create_multi_objective_problem_from_botorch` Reviewed By: saitcakmak Differential Revision: D60284484
This pull request was exported from Phabricator. Differential Revision: D60284484 |
6627d0e
to
9aa4176
Compare
This pull request has been merged in 8d38512. |
Summary:
Context: Benchmark problems are sometimes created with class methods
SingleObjectiveBenchmarkProblem.from_botorch
,SingleObjectiveBenchmarkProblem.from_botorch_synthetic
, andMultiObjectiveBenchmarkProblem.from_botorch_multi_objective
, the former two now being identical. This creates the need for some tricky type annotations; to me, replacing these with functions is obviously cleaner. This will make it easier to consolidate classes in the future.This PR:
SingleObjectiveBenchmarkProblem.from_botorch
andSingleObjectiveBenchmarkProblem.from_botorch_synthetic
withcreate_single_objective_problem_from_botorch
MultiObjectiveBenchmarkProblem.from_botorch_multi_objective
withcreate_multi_objective_problem_from_botorch
Differential Revision: D60284484