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
- 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
- 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
- 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.
- 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
- 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.
- 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
- lie(trial: Trial) Trial.Result | None [source]¶
See ParallelStrategy.lie