deephyper.evaluator.callback

deephyper.evaluator.callback

The callback module contains sub-classes of the Callback class used to trigger custom actions on the start and completion of jobs by the Evaluator. Callbacks can be used with any Evaluator implementation.

class deephyper.evaluator.callback.Callback[source]

Bases: object

on_done(job)[source]

Called each time a Job is completed by the Evaluator.

Parameters

job (Job) – The completed job.

on_launch(job)[source]

Called each time a Job is created by the Evaluator.

Parameters

job (Job) – The created job.

class deephyper.evaluator.callback.LoggerCallback[source]

Bases: deephyper.evaluator.callback.Callback

Print information when jobs are completed by the Evaluator.

An example usage can be:

>>> evaluator.create(method="ray", method_kwargs={..., "callbacks": [LoggerCallback()]})
on_done(job)[source]

Called each time a Job is completed by the Evaluator.

Parameters

job (Job) – The completed job.

on_launch(job)

Called each time a Job is created by the Evaluator.

Parameters

job (Job) – The created job.

class deephyper.evaluator.callback.ProfilingCallback[source]

Bases: deephyper.evaluator.callback.Callback

Collect profiling data. Each time a Job is completed by the Evaluator a timestamp and current number of running jobs is collected.

An example usage can be:

>>> profiler = ProfilingCallback()
>>> evaluator.create(method="ray", method_kwargs={..., "callbacks": [profiler]})
...
>>> profiler.profile
on_done(job)[source]

Called each time a Job is completed by the Evaluator.

Parameters

job (Job) – The completed job.

on_launch(job)[source]

Called each time a Job is created by the Evaluator.

Parameters

job (Job) – The created job.

property profile
class deephyper.evaluator.callback.SearchEarlyStopping(patience: int = 10, objective_func=<function SearchEarlyStopping.<lambda>>)[source]

Bases: deephyper.evaluator.callback.Callback

Stop the search gracefully when it does not improve for a given number of evaluations.

Parameters
  • patience (int, optional) – The number of not improving evaluations to wait for before stopping the search. Defaults to 10.

  • objective_func (callable, optional) – A function that takes a Job has input and returns the maximized scalar value monitored by this callback. Defaults to lambda j: j.result.

on_done(job)[source]

Called each time a Job is completed by the Evaluator.

Parameters

job (Job) – The completed job.

on_launch(job)

Called each time a Job is created by the Evaluator.

Parameters

job (Job) – The created job.