strategies.strategy_from_dict
strategies.strategy_from_dict(data)Create a strategy from a dict (YAML deserialization).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | dict[str, Any] | Dict with “type” key and strategy-specific fields. | required |
Returns
| Name | Type | Description |
|---|---|---|
| SweepStrategy | Instantiated strategy. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If type is unknown. |
Examples
>>> strategy_from_dict({"type": "cartesian"})
CartesianStrategy()
>>> strategy_from_dict({"type": "optuna", "n_trials": 50})
OptunaStrategy(n_trials=50, ...)