-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename and reorganize classes (#2977)
Summary: Pull Request resolved: #2977 ** Context** The current structure of the code is such: * Each `BenchmarkProblem` has a `BenchmarkRunner` * ` BenchmarkRunner` is the only runner * A` BenchmarkRunner` has a `ParamBasedTestProblem`, which is either a `BoTorchTestProblem`, `SurrogateTestFunction`, or a special subclass such as `Jenatton`. The directory structure and names have gotten quite out of touch with the code. **New class names** * `ParamBasedTestProblem` -> `TestFunction` (maybe we should call this `BenchmarkTestFunction`?) * `BoTorchTestProblem` -> `BoTorchTestFunction` **New directory structure** | benchmark_problem.py | problems/ | | synthetic/hss/jenatton.py | | ... | benchmark_runner.py | test_function.py | test_function.py | test_functions/ | | botorch_test.py | | surrogate.py Future diffs: * rename `BenchmarkRunner.test_problem` to `BenchmarkRunner.test_function` (D65088791) Differential Revision: D64969707 Reviewed By: saitcakmak, Balandat
- Loading branch information
1 parent
852629a
commit 69e877f
Showing
15 changed files
with
112 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# pyre-strict | ||
|
||
from abc import ABC, abstractmethod | ||
from collections.abc import Mapping | ||
from dataclasses import dataclass | ||
|
||
from ax.core.types import TParamValue | ||
from torch import Tensor | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class BenchmarkTestFunction(ABC): | ||
""" | ||
The basic Ax class for generating deterministic data to benchmark against. | ||
(Noise - if desired - is added by the runner.) | ||
""" | ||
|
||
@abstractmethod | ||
def evaluate_true(self, params: Mapping[str, TParamValue]) -> Tensor: | ||
""" | ||
Evaluate noiselessly. | ||
Returns: | ||
1d tensor of shape (num_outcomes,). | ||
""" | ||
... |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.