deephyper.evaluator#
Evaluator subpackage.
This package a common interface to execute asynchronous parallel tasks with different backends and system properties.
This interface is used by search algorithm to perform black-box optimization
(the black-box being represented by the run-function). An Evaluator,
when instanciated, is bound to a run-function which takes as first
argument a job and optionally has other keyword-arguments.
In it’s most basic form the return value is a float. The standard way of
creating an Evaluator is to use deephyper.evaluator.Evaluator.create().
An example run-function is:
def run(job: RunningJob) -> float | str | dict:
config = job.parameters
y = config["x"]**2
return y
The return value of the run-function respect the following standards
(but the feature is not necessarily supported by all search algorithms, such
as multi-objective optimization):
# float for single objective optimization
return 42.0
# str with "F" prefix for failed evaluation
return "F_out_of_memory"
# dict
return {"objective": 42.0}
# dict with additional information
return {"objective": 42.0, "metadata": {"num_epochs_trained": 25, "num_parameters": 420000}}
# dict with reserved keywords (when @profile decorator is used)
return {"objective": 42.0, "metadata": {"timestamp_start": ..., "timestamp_end": ...}"
# tuple of float for multi-objective optimization, appears as "objective_0" and "objective_1"
return 42.0, 0.42
Functions
Utility to parse a result from a subprocess of the format "DH-OUTPUT:...". |
|
Decorator to use on a |
|
Decorator transforming an Evaluator into a |
|
Classes
This class manages the execution of asynchronous parallel calls of a Python function. |
|
Represents the execution of a |
|
Represents the execution of a generic |
|
Represents the execution status of a job. |
|
This evaluator uses the |
|
This evaluator uses the |
|
This evaluator uses the |
|
This evaluator uses the |
|
A RunningJob is an adapted Job object that is passed to the run-function as input. |
|
This evaluator uses Python AsyncIO as backend. |
|
This evaluator uses the |
Exceptions
Raised when the maximum number of jobs spawned by the evaluator is reached. |