Callbacks

class pyhopper.callbacks.Callback[source]
on_evaluate_cancelled(candidate, info)[source]

Called if candidate was cancelled (by an pyhopper.cancelers.EarlyCanceller())

Parameters
on_evaluate_end(candidate, f, info)[source]

Called after candidate was successfully evaluated

Parameters
  • candidate (dict) – Parameter value of the evaluated candidate

  • f (float) – Value of the objective function corresponding to the candidate

  • info (pyhopper.utils.ParamInfo) –

on_evaluate_start(candidate, info)[source]

Called after candidate was sampled and scheduled for evaluation

Parameters
on_new_best(new_best, f, info)[source]

Called when a new best parameter is found

Parameters
  • new_best (dict) – Value of the new best parameter

  • f (float) – Value of the objective function corresponding to the new best parameter

  • info (pyhopper.utils.ParamInfo) –

on_search_end()[source]

Called at the end of the search process

on_search_start(search)[source]

Called at the beginning of the search

Parameters

search (pyhopper.search.Search) – pyhopper.Search object handling the search

class pyhopper.ParamInfo(candidate_type, sampled_at)[source]

Holds auxiliary information about a parameter candidate

Attributes:

type Enum specifying how the parameter was sampled (valid values are pyhopper.CandidateType.INIT, pyhopper.CandidateType.MANUALLY_ADDED, pyhopper.CandidateType.RANDOM_SEEDING, pyhopper.CandidateType.LOCAL_SAMPLING).

sampled_at UNIX epoch timestamp when the parameter candidate was sampled.

finished_at UNIX epoch timestamp when the evaluation of the candidate was finished.

is_canceled Bool indicating if the candidate was cancelled.

class pyhopper.callbacks.History[source]

Public API for the history of the search. Can be used by the user for plotting and analyzing the search space. Persistent over several consecutive calls of `run`

on_evaluate_cancelled(candidate, info)[source]

Called if candidate was cancelled (by an pyhopper.cancelers.EarlyCanceller())

Parameters
on_evaluate_end(candidate, f, info)[source]

Called after candidate was successfully evaluated

Parameters
  • candidate (dict) – Parameter value of the evaluated candidate

  • f (float) – Value of the objective function corresponding to the candidate

  • info (pyhopper.utils.ParamInfo) –

on_new_best(new_best, f, info)[source]

Called when a new best parameter is found

Parameters
  • new_best (dict) – Value of the new best parameter

  • f (float) – Value of the objective function corresponding to the new best parameter

  • info (pyhopper.utils.ParamInfo) –

on_search_start(search)[source]

Called at the beginning of the search

Parameters

search (pyhopper.search.Search) – pyhopper.Search object handling the search