Skip to content

Commit

Permalink
adding experimental design search
Browse files Browse the repository at this point in the history
  • Loading branch information
Deathn0t committed Mar 26, 2024
1 parent 8b3ecbc commit 4359852
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deephyper/search/hps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
.. warning:: All search algorithms are MAXIMIZING the objective function. If you want to MINIMIZE the objective function, you have to return the negative of you objective.
"""

from deephyper.search.hps._cbo import CBO, AMBS
from deephyper.search.hps._eds import ExperimentalDesignSearch

__all__ = ["CBO", "AMBS"]
__all__ = ["CBO", "AMBS", "ExperimentalDesignSearch"]

try:
from deephyper.search.hps._mpi_dbo import MPIDistributedBO # noqa: F401
Expand Down
55 changes: 55 additions & 0 deletions deephyper/search/hps/_eds.py
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",
)

0 comments on commit 4359852

Please sign in to comment.