OptunaTuner
Static methods
get_all_metrics
| Name | Type | Default | Description |
|---|---|---|---|
use_rolling | bool | False | Flag to use rolling method via BaseRollingReport. Note that both rolling and cv models can be passed. Defaults to False. |
| Type | Description |
|---|---|
List[str] | List of metric keys with valid (non-NaN) rolling_func values. |
Instance variables
-
target_names: List[str]: Normalize metric names. -
create_study_kwargs: Dict[str, Any]: Additional optuna study parameters. -
cross_validate: bool: Whether to use cross-validation analytics throughrun_report, wrappingBaseReportCVorBaseRollingReportinstead of usingrun_pipelinealone. If True, optimize using cross validation. Otherwise, uses data history as a whole. Defaults to False. -
direction: str | List[str]: Optimization direction for Optuna (default: ‘maximize’). If list, direction is modified to “directions” internally. -
gc_after_trial: bool: Flag to determine whether to automatically run garbage collection after each trial. Set toTrueto run the garbage collection,Falseotherwise. It runs a full collection by internally callinggc.collect. If you see an increase in memory consumption over several trials, try setting this flag toTrue. -
metric_registry_kwargs: Dict[str, Any]: Additional arguments for metric registry. Parameters such aswindowofminpfor rolling metrics should be specified at this level. -
metrics: str | List[str]: Performance metrics to compute (default: ‘sharpe_ratio’). -
n_completed_trials: int: Number of trials to complete before stopping (default: None). -
n_jobs: int: Parallel jobs for Optuna (default: -1). -
n_trials: int: Number of optimization trials for Optuna (default: 100). -
optimize_kwargs: Dict[str, Any]: Additional arguments for Optuna optimization. -
pruner: optuna.pruners._base.BasePruner: Pruner. Defaults to Asynchronous Successive Halving Algorithm. -
reduce_func: Callable: Reduce function when using cross_validate. If None, defaults tovbt.nb.nanmedian_nb. Defaults to None. -
sampler: optuna.samplers._base.BaseSampler: Sampler. Defaults to TPE (Tree-structured Parzen Estimator) algorithm. -
tracker: systematica.portfolio.trackers.base.BaseTracker: Log and monitor the Optuna hyperparameter using tracker integration. -
use_rolling: bool: Flag to use rolling method viaBaseRollingReport. Note that both rolling and cv models can be passed. Defaults to False. -
verbose: bool: Enable verbose output (default: True).
Methods
check_direction
| Name | Type | Default | Description |
|---|---|---|---|
attribute | attrs.Attribute | -- | The attribute being validated. |
value | BaseStatArb | -- | The model instance. |
| Type | Description |
|---|---|
ValueError | If direction is not “maximize” or “minimize”. |
TypeError | If direction is not a string or a list |
check_metrics
| Name | Type | Default | Description |
|---|---|---|---|
attribute | attrs.Attribute | -- | The attribute being validated. |
value | BaseStatArb | -- | The model instance. |
| Type | Description |
|---|---|
TypeError | If metrics is not a string or list. |
ValueError | If metric has not been registred and is not tunable. |
create_objective
| Name | Type | Default | Description |
|---|---|---|---|
feature_config | FeatureConfig | -- | Feature configurations. |
| Type | Description |
|---|---|
tp.Callable | A callable objective function for Optuna optimization. |
run_feature
| Name | Type | Default | Description |
|---|---|---|---|
feature_config | FeatureConfig | -- | feature configuration. |
| Type | Description |
|---|---|
optuna.Study | Optuna study. |
run
| Name | Type | Default | Description |
|---|---|---|---|
objective | tp.Callable | -- | Objective function. |
| Type | Description |
|---|---|
study : optuna.Study | Optuna Study. |
run_tracker
| Name | Type | Default | Description |
|---|---|---|---|
objective | tp.Callable | -- | Objective function. |
| Type | Description |
|---|---|
study : optuna.Study | Optuna Study. |
run_optuna
| Name | Type | Default | Description |
|---|---|---|---|
objective | tp.Callable | -- | Objective function. |
| Type | Description |
|---|---|
study : optuna.Study | Optuna Study. |

