Parallel Strategy

Parallel Strategies

Register objectives for incomplete trials.

Parallel strategy objects can be created using strategy_factory.create(‘strategy_name’).

class orion.algo.parallel_strategy.MaxParallelStrategy(default_result=inf)[source]

Parallel strategy that uses the max of completed objectives

Attributes
configuration

Provide the configuration of the strategy as a dictionary.

max_result

Methods

lie(trial)

See ParallelStrategy.lie

property configuration: dict

Provide the configuration of the strategy as a dictionary.

lie(trial: Trial) Trial.Result | None[source]

See ParallelStrategy.lie

class orion.algo.parallel_strategy.MeanParallelStrategy(default_result: float = inf)[source]

Parallel strategy that uses the mean of completed objectives

Attributes
configuration

Provide the configuration of the strategy as a dictionary.

mean_result

Methods

lie(trial)

See ParallelStrategy.lie

property configuration: dict

Provide the configuration of the strategy as a dictionary.

lie(trial: Trial) Trial.Result | None[source]

See ParallelStrategy.lie

class orion.algo.parallel_strategy.NoParallelStrategy[source]

No parallel strategy

Methods

lie(trial)

See ParallelStrategy.lie

lie(trial: Trial) Trial.Result | None[source]

See ParallelStrategy.lie

class orion.algo.parallel_strategy.ParallelStrategy[source]

Strategy to give intermediate results for incomplete trials

Attributes
configuration

Provide the configuration of the strategy as a dictionary.

state_dict

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

Methods

lie(trial)

Construct a fake result for an incomplete trial

observe(trials)

Observe completed trials

infer

set_state

property configuration: dict

Provide the configuration of the strategy as a dictionary.

lie(trial: Trial) Trial.Result | None[source]

Construct a fake result for an incomplete trial

Parameters
trial: `orion.core.worker.trial.Trial`

A trial object which is not supposed to be completed.

Returns
orion.core.worker.trial.Trial.Result

The fake objective result corresponding to the trial given.

Notes

If the trial has an objective even if not completed, a warning is printed to user with a pointer to documentation to resolve the database corruption. The result returned is the corresponding objective instead of the lie.

observe(trials: list[Trial]) None[source]

Observe completed trials

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

Trials from a orion.algo.space.Space.

property state_dict: dict

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

class orion.algo.parallel_strategy.StatusBasedParallelStrategy(strategy_configs: dict | None = None, default_strategy: dict | None = None)[source]

Different parallel strategies for different trial status

Parameters
strategy_configs: dict

Dictionary of strategy configurations. Each key should be a valid trial status.

default_strategy: dict or None, optional

Default strategy for trial status that are not defined by strategy_configs. Default is NoParallelStrategy(), which always returns None.

Attributes
configuration

Provide the configuration of the strategy as a dictionary.

state_dict

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

Methods

lie(trial)

Construct a fake result for an incomplete trial

observe(trials)

Observe completed trials

get_strategy

set_state

property configuration: dict

Provide the configuration of the strategy as a dictionary.

lie(trial: Trial) Trial.Result | None[source]

Construct a fake result for an incomplete trial

Parameters
trial: `orion.core.worker.trial.Trial`

A trial object which is not supposed to be completed.

Returns
orion.core.worker.trial.Trial.Result

The fake objective result corresponding to the trial given.

Notes

If the trial has an objective even if not completed, a warning is printed to user with a pointer to documentation to resolve the database corruption. The result returned is the corresponding objective instead of the lie.

observe(trials: list[Trial]) None[source]

Observe completed trials

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

Trials from a orion.algo.space.Space.

property state_dict: dict

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

class orion.algo.parallel_strategy.StubParallelStrategy(stub_value: float | None = None)[source]

Parallel strategy that returns static objective value for incompleted trials.

Attributes
configuration

Provide the configuration of the strategy as a dictionary.

Methods

lie(trial)

See ParallelStrategy.lie

property configuration: dict

Provide the configuration of the strategy as a dictionary.

lie(trial: Trial) Trial.Result | None[source]

See ParallelStrategy.lie

orion.algo.parallel_strategy.get_objective(trial: Trial) float | None[source]

Get the value for the objective, if it exists, for this trial

Returns

Float or None The value of the objective, or None if it doesn’t exist