Primary algorithm

TODO

Sanitizing wrapper of main algorithm

Performs checks and organizes required transformations of points.

class orion.core.worker.primary_algo.SpaceTransformAlgoWrapper(algo_constructor, space, **algorithm_config)[source]

Perform checks on points and transformations. Wrap the primary algorithm.

1. Checks requirements on the parameter space from algorithms and create the appropriate transformations. Apply transformations before and after methods of the primary algorithm. 2. Checks whether incoming and outcoming points are compliant with a space.

Parameters
algo_constructor: Child class of `BaseAlgorithm`

Class constructor to build the algorithm object.

spaceorion.algo.space.Space

The original definition of a problem’s parameters space.

algorithm_configdict

Configuration for the algorithm.

Attributes
configuration

Return tunable elements of this algorithm in a dictionary form appropriate for saving.

fidelity_index

Compute the index of the point where fidelity is.

is_done

Return True, if an algorithm holds that there can be no further improvement.

n_observed

Number of completed trials observed by the algorithm

n_suggested

Number of trials suggested by the algorithm

space

Domain of problem associated with this algorithm’s instance.

state_dict

Return a state dict that can be used to reset the state of the algorithm.

Methods

get_id(point[, ignore_fidelity])

Compute a unique hash for a point based on params

has_observed(trial)

Whether the algorithm has observed a given trial.

has_suggested(trial)

Whether the algorithm has suggested a given trial.

judge(trial, measurements)

Inform an algorithm about online measurements of a running trial.

observe(trials)

Observe evaluated trials.

score(trial)

Allow algorithm to evaluate point based on a prediction about this parameter set's performance.

seed_rng(seed)

Seed the state of the algorithm's random number generator.

set_state(state_dict)

Reset the state of the algorithm based on the given state_dict

should_suspend(trial)

Allow algorithm to decide whether a particular running trial is still worth to complete its evaluation, based on information provided by the judge method.

suggest(num)

Suggest a num of new sets of parameters.

property configuration

Return tunable elements of this algorithm in a dictionary form appropriate for saving.

property fidelity_index

Compute the index of the point where fidelity is.

Returns None if there is no fidelity dimension.

get_id(point, ignore_fidelity=False)[source]

Compute a unique hash for a point based on params

has_observed(trial)[source]

Whether the algorithm has observed a given trial.

has_suggested(trial)[source]

Whether the algorithm has suggested a given trial.

property is_done

Return True, if an algorithm holds that there can be no further improvement.

judge(trial, measurements)[source]

Inform an algorithm about online measurements of a running trial.

The algorithm can return a dictionary of data which will be provided as a response to the running environment. Default is None response.

property n_observed

Number of completed trials observed by the algorithm

property n_suggested

Number of trials suggested by the algorithm

observe(trials)[source]

Observe evaluated trials.

score(trial)[source]

Allow algorithm to evaluate point based on a prediction about this parameter set’s performance. Return a subjective measure of expected performance.

By default, return the same score any parameter (no preference).

seed_rng(seed)[source]

Seed the state of the algorithm’s random number generator.

set_state(state_dict)[source]

Reset the state of the algorithm based on the given state_dict

Parameters

state_dict – Dictionary representing state of an algorithm

should_suspend(trial)[source]

Allow algorithm to decide whether a particular running trial is still worth to complete its evaluation, based on information provided by the judge method.

property space

Domain of problem associated with this algorithm’s instance.

Note

Redefining property here without setter, denies base class’ setter.

property state_dict

Return a state dict that can be used to reset the state of the algorithm.

suggest(num)[source]

Suggest a num of new sets of parameters.

Parameters
num: int

Number of points to suggest. The algorithm may return less than the number of points requested.

Returns
list of trials or None

A list of trials representing values suggested by the algorithm. The algorithm may opt out if it cannot make a good suggestion at the moment (it may be waiting for other trials to complete), in which case it will return None.

Notes

New parameters must be compliant with the problem’s domain orion.algo.space.Space.