-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from deephyper.search.hps import CBO | ||
|
||
|
||
class ExperimentalDesignSearch(CBO): | ||
"""Centralized Experimental Design Search. It follows a manager-workers architecture where the manager runs the sampling process and workers execute parallel evaluations of the black-box function. | ||
Example Usage: | ||
>>> max_evals = 100 | ||
>>> search = ExperimentalDesignSearch(problem, evaluator, n_points=max_evals, design="grid") | ||
>>> results = search.search(max_evals=100) | ||
Args: | ||
problem (HpProblem): Hyperparameter problem describing the search space to explore. | ||
evaluator (Evaluator): An ``Evaluator`` instance responsible of distributing the tasks. | ||
random_state (int, optional): Random seed. Defaults to ``None``. | ||
log_dir (str, optional): Log directory where search's results are saved. Defaults to ``"."``. | ||
verbose (int, optional): Indicate the verbosity level of the search. Defaults to ``0``. | ||
n_points (int, optional): Number of points to sample. Defaults to ``None``. | ||
design (str, optional): Experimental design to use. Defaults to ``"random"``. | ||
- ``"random"`` for uniform random numbers. | ||
- ``"sobol"`` for a Sobol' sequence. | ||
- ``"halton"`` for a Halton sequence. | ||
- ``"hammersly"`` for a Hammersly sequence. | ||
- ``"lhs"`` for a latin hypercube sequence. | ||
- ``"grid"`` for a uniform grid sequence. | ||
initial_points (list, optional): List of initial points to evaluate. Defaults to ``None``. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
problem, | ||
evaluator, | ||
random_state: int = None, | ||
log_dir: str = ".", | ||
verbose: int = 0, | ||
n_points: int = None, | ||
design: str = "random", | ||
initial_points=None, | ||
): | ||
if n_points is None: | ||
raise ValueError( | ||
"n_points must be specified for the ExperimentalDesignSearch." | ||
) | ||
super().__init__( | ||
problem, | ||
evaluator, | ||
random_state, | ||
log_dir, | ||
verbose, | ||
n_initial_points=n_points, | ||
initial_points=initial_points, | ||
initial_point_generator=design, | ||
surrogate_model="DUMMY", | ||
) |