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

should_suspend

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

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(point)

Whether the algorithm has observed a given point.

has_suggested(point)

Whether the algorithm has suggested a given point.

judge(point, measurements)

Inform an algorithm about online measurements of a running trial.

observe(points, results)

Observe evaluation results corresponding to list of points in space.

score(point)

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

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(point)[source]

Whether the algorithm has observed a given point.

has_suggested(point)[source]

Whether the algorithm has suggested a given point.

property is_done

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

judge(point, 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(points, results)[source]

Observe evaluation results corresponding to list of points in space.

score(point)[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

property should_suspend

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 – how many sets to be suggested.

Note

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