deephyper.hpo.RandomSearch#

class deephyper.hpo.RandomSearch(problem, evaluator, random_state=None, log_dir='.', verbose=0, stopper=None)[source]#

Bases: Search

Random search algorithm used as an example for the API to implement new search algorithms.

Single-Objective

Multi-Objectives

Failures

Parameters:
  • problem – object describing the search/optimization problem.

  • evaluator – object describing the evaluation process.

  • random_state (np.random.RandomState, optional) – Initial random state of the search. Defaults to None.

  • log_dir (str, optional) – Path to the directoy where results of the search are stored. Defaults to ".".

  • verbose (int, optional) – Use verbose mode. Defaults to 0.

  • stopper (Stopper, optional) – a stopper to leverage multi-fidelity when evaluating the function. Defaults to None which does not use any stopper.

Methods

ask

Ask the search for new configurations to evaluate.

check_evaluator

dump_context

Dumps the context in the log folder.

extend_results_with_pareto_efficient

Extend the results DataFrame with a column pareto_efficient which is True if the point is Pareto efficient.

search

Execute the search algorithm.

tell

Tell the search the results of the evaluations.

to_json

Returns a json version of the search object.

Attributes

search_id

The identifier of the search used by the evaluator.

ask(n: int = 1) List[Dict]#

Ask the search for new configurations to evaluate.

Parameters:

n (int, optional) – The number of configurations to ask. Defaults to 1.

Returns:

a list of hyperparameter configurations to evaluate.

Return type:

List[Dict]

dump_context()#

Dumps the context in the log folder.

extend_results_with_pareto_efficient(df_path: str)#

Extend the results DataFrame with a column pareto_efficient which is True if the point is Pareto efficient.

Parameters:

df (pd.DataFrame) – the input results DataFrame.

search(max_evals: int = -1, timeout: int = None, max_evals_strict: bool = False)#

Execute the search algorithm.

Parameters:
  • max_evals (int, optional) – The maximum number of evaluations of the run function to perform before stopping the search. Defaults to -1, will run indefinitely.

  • timeout (int, optional) – The time budget (in seconds) of the search before stopping. Defaults to None, will not impose a time budget.

  • max_evals_strict (bool, optional) – If True the search will not spawn more than max_evals jobs. Defaults to False.

Returns:

a pandas DataFrame containing the evaluations performed or None if the search could not evaluate any configuration.

Return type:

DataFrame

property search_id#

The identifier of the search used by the evaluator.

tell(results: List[HPOJob])#

Tell the search the results of the evaluations.

Parameters:

results (List[HPOJob]) – a list of HPOJobs from which hyperparameters and objectives can be retrieved.

to_json()#

Returns a json version of the search object.