Ax

AxOptimizer hyperparameter

class orion.algo.axoptimizer.AxOptimizer(space: Space, seed: Optional[int] = None, n_initial_trials: Optional[int] = 20, extra_objectives: Optional[List[str]] = None, constraints: Optional[List[str]] = None)[source]

Wrapper around the Ax platform for multi-objectives optimization and constraints.

Parameters
space: `orion.algo.space.Space`

Optimisation space with priors for each dimension.

seed: None, int or sequence of int, optional

random seed for reproducibility. Works only for Sobol quasi-random generator and for BoTorch-powered models. For the latter models, the trials generated from the same optimization setup with the same seed, will be mostly similar, but the exact parameter values may still vary and trials latter in the optimizations will diverge more and more. This is because a degree of randomness is essential for high performance of the Bayesian optimization models and is not controlled by the seed.

Note

In multi-threaded environments, the random seed is thread-safe, but does not actually guarantee reproducibility. Whether the outcomes will be exactly the same for two same operations that use the random seed, depends on whether the threads modify the random state in the same order across the two operations. Default: None

n_initial_trials: int, optional

Specific number of initialization trials. Initialization trials are generated quasi-randomly using Sobol.

extra_objectives: sequence of str, optional

List of metrics’ name which are also objectives to minimize. threshold: The bound in the objective’s threshold constraint.

Note

Orion expects the extra_objectives results to be stored in orion.core.worker.Trial.statistics

constraints: sequence of str, optional

Dict of list of string representation of metrics constraints of form [“metric_name >= bound”], like [“m1 <= 3”]

Note

Orion expects the constraints results to be stored in orion.core.worker.Trial.constraints

Note

See https://ax.dev/docs/core.html#optimization-config for more details about how Ax expects its outcome constraints

Attributes
requires_dist
state_dict

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

Methods

get_client()

Instantiate a new AxClient from previous snapshot

observe(trials)

Observe the trials new state of result.

reverse_params(ax_params, space)

Reverse converted choices dimensions values to their original types

seed_rng(seed)

Seed the state of the random number generator.

set_state(state_dict)

Reset the state of the algorithm based on the given state_dict

suggest(num)

Suggest a number of new sets of parameters.

transform_params(orion_params, space)

Convert orion parameter values

get_client()[source]

Instantiate a new AxClient from previous snapshot

observe(trials)[source]

Observe the trials new state of result.

Parameters
trials: list of ``orion.core.worker.trial.Trial``

Trials from a orion.algo.space.Space.

classmethod reverse_params(ax_params, space)[source]

Reverse converted choices dimensions values to their original types

seed_rng(seed)[source]

Seed the state of the random number generator.

Parameters
seed: int

Integer seed for the random number generator.

.. note:: Ax does not promise deterministic trials generation and only

similar trials generation.

set_state(state_dict)[source]

Reset the state of the algorithm based on the given state_dict

Parameters
state_dict: dict

Dictionary representing state of an algorithm

property state_dict

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

suggest(num)[source]

Suggest a number of new sets of parameters.

Parameters
num: int

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

Returns
list of trials

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.

classmethod transform_params(orion_params, space)[source]

Convert orion parameter values