Skip to main content

resolve_optuna_suggest

Recursively resolve optuna suggest calls in a nested dict/list structure. Parameters: Returns:

resolve_optuna_metric_output

Resolves the output metric from a portfolio pipeline into a float or tuple of floats. This function checks for NaN values in the metric and ensures the output is in a format suitable for Optuna optimization. It supports metrics that are floats, lists, pandas DataFrames, or pandas Series. Parameters: Returns: Raises: Examples:

BaseTracker

Abstract base class for trackers. Method generated by attrs for class BaseTracker.

Ancestors

  • abc.ABC

Descendants

  • systematica.tuners.neptune_ai.tracker.NeptuneOptunaTracker
  • systematica.tuners.sqlite.tracker.SQLiteOptunaTracker

Instance variables

  • tags: Set: Metadata tags.
  • add_configs: Dict[str, Any]: Additional config logs to store.
  • init_kwargs: Dict[str, Any]: Additional arguments.
  • log_kwargs: Dict[str, Any]: Additional logging arguments.

Methods

run_context

Context manager to initialize run. Parameters: Yields:

run_study

Run study. Parameters: Returns:

BaseCustomNeptuneCallback

Abstract base class for custom Neptune.ai tracker callback. This class extends Neptune’s callback functionality to track Optuna trials and log them to Neptune.ai. Initialize the Neptune custom callback. Parameters:

Ancestors

  • abc.ABC
  • systematica.utils.neptune_ai.NeptuneCallback

Descendants

  • systematica.tuners.neptune_ai.callbacks.CustomCallback

BaseTrialSelector

Abstract class for hyperparameter selection. This is the base class that defines the interface for all parameter selectors. Child classes must implement the run method. Method generated by attrs for class BaseTrialSelector.

Ancestors

  • abc.ABC

Descendants

  • systematica.tuners.trial_selectors.AUCMaximization
  • systematica.tuners.trial_selectors.BestMetricPoint
  • systematica.tuners.trial_selectors.ClosestIdealPoint
  • systematica.tuners.trial_selectors.DiversitySampling
  • systematica.tuners.trial_selectors.EfficientFrontierProjection
  • systematica.tuners.trial_selectors.ElbowPoint
  • systematica.tuners.trial_selectors.EpsilonConstraint
  • systematica.tuners.trial_selectors.HullExtremePoint
  • systematica.tuners.trial_selectors.HullMidPoint
  • systematica.tuners.trial_selectors.HullPoint
  • systematica.tuners.trial_selectors.HypervolumeContribution
  • systematica.tuners.trial_selectors.MaxMetricPoint
  • systematica.tuners.trial_selectors.MinMetricPoint
  • systematica.tuners.trial_selectors.Preference
  • systematica.tuners.trial_selectors.Random
  • systematica.tuners.trial_selectors.RegretMinimization
  • systematica.tuners.trial_selectors.RiskAwareUtility

Instance variables

  • name: Name of the selector, used for identification.

Methods

run

Execute the selection algorithm. Parameters: Returns:

BaseAnalyzer

A class for analyzing experiment. Abstract methods from BaseAnalyzer:
  • run_context
  • fetch_trials
  • fetch_feature_config
Method generated by attrs for class BaseAnalyzer.

Ancestors

  • abc.ABC

Descendants

  • systematica.tuners.base.BaseOptunaAnalyzer
  • systematica.tuners.base.BaseOptunaAnalyzer

Static methods

combine_trials

Combine trials into a pd.DataFrame object. Parameters: Returns:

Instance variables

  • api_token: str: API token if needed, e.g. “your_api_token”.
  • project: str: Project name.

Methods

run_context

Context manager to initialize run. Parameters: Yields:

fetch_trials

Fetch metadata and return as a DataFrame. Parameters: Returns:

fetch_feature_config

Fetch feature config from Neptune. Parameters: Raises: Returns:

get_trial_params

Get trial parameters. Parameters: Returns:

clear_cache

Clear cache. Returns:

get_best_metrics

Get best metrics. Uses fetch_trials. Parameters: Returns:

get_best_params

Get best parameters. Uses fetch_trials. Parameters: Returns:

get_best_trials

Get the best trials. Uses fetch_trials. Parameters: Returns:

get_all_trials

Get all trials. Uses fetch_trials. Parameters: Returns:

get_metrics

List metric names. Parameters: Returns:

get_params

List parameter names. Parameters: Returns:

get_all_params

List parameter names. Parameters: Returns:

get_all_combination

Generate combinations of metric and parameter names. Parameters: Returns:

get_param_combination

Generate permutations of parameter names. Parameters: Returns:

BaseOptunaObjective

Base class for Optuna objectives. Method generated by attrs for class BaseOptunaObjective.

Ancestors

  • abc.ABC

Descendants

  • systematica.tuners.optuna_.objectives.ObjectiveFullHistory
  • systematica.tuners.optuna_.objectives.ObjectiveRollingWalkForward

Static methods

optuna_optimize_kwargs

Configure optimization parameters.

Instance variables

  • debug: bool: Flag to enable debug mode for detailed error messages.
  • validate_model: bool: Flag to validate model signals before running the backtest.

Methods

compute

Compute the objective value. Parameters: Returns:

get_objective

Create a callable for the Optuna trial. Parameters: Returns:

run_study

Run optuna study or tracker. Parameters: Returns:

BaseOptunaAnalyzer

A class for analyzing optuna experiment. Abstract methods from BaseAnalyzer:
  • run_context
  • fetch_trials
  • fetch_feature_config
Abstract methods from BaseOptunaAnalyzer:
  • fetch_optuna_study
Method generated by attrs for class BaseOptunaAnalyzer.

Ancestors

  • systematica.tuners.base.BaseAnalyzer
  • abc.ABC

Descendants

  • systematica.tuners.neptune_ai.analyzer.NeptuneOptunaAnalyzer
  • systematica.tuners.neptune_ai.analyzer.NeptuneOptunaAnalyzer
  • systematica.tuners.sqlite.analyzer.SQLiteOptunaAnalyzer
  • systematica.tuners.sqlite.analyzer.SQLiteOptunaAnalyzer

Methods

fetch_optuna_study

Loads Optuna study. Loading mechanics depend on the study storage type used during the run. Parameters: Returns:

get_optuna_trials

Export optuna trials as a pandas DataFrame. The DataFrame provides various features to analyze studies. It is also useful to draw a histogram of objective values and to export trials as a CSV file. If there are no trials, an empty pd.DataFrame is returned. Parameters: Returns:

get_optuna_best_trials

Export optuna best trials as a pandas DataFrame. Parameters: Returns:

stats

Compute statistics from a Neptune run. Parameters: Returns:

run_composer

Run portfolio analytics from run_id. New generation logging is supported. Parameters: Returns:

plot_pareto_front

Plot pareto front. Parameters: Returns:

plot_contour

Plot the parameter relationship as contour plot in a study. Parameters: Returns:

plot_param_importances

Plot parameter importance.
An importance evaluator object that specifies which algorithm to base the importance assessment on, defaults to FanovaImportanceEvaluator.
Parameters: Returns:

plot_edf

Plot the objective value EDF (empirical distribution function) of a study. Parameters: Returns:

plot_optimization_history

Plot optimization history of all trials in a study. Parameters: Returns:

plot_parallel_coordinate

Plot the high-dimensional parameter relationships in a study. Parameters: Returns:

plot_rank

Plot parameter relations as scatter plots with colors indicating ranks of target value.
Trials missing the specified parameters will not be plotted.
Parameters: Returns:

plot_slice

Plot the parameter relationship as a slice plot in a study. Trials missing the specified parameters will not be plotted.
The slice plot is useful for visualizing the relationship between hyperparameters and the objective function values.It can help you:
  • Identify Parameter Sensitivity: Shows which hyperparameters have a strong influence on performance.
  • Detect Bad Regions: Highlights ranges where performance is consistently poor.
  • Spot Non-linear Patterns: You might notice trends.
  • Debug Optimization: If you see no pattern or strange clumping, it might indicate:
    • A bad search space.
    • Problems with the objective function.
  • Guide Future Searches: Helps you refine the search space for better performance in future runs.
Parameters: Returns:

plot_hypervolume_history

Plot hypervolume history of all trials in a study. This function is only applicable for multi-objective optimization studies. It computes the hypervolume of the Pareto front at each trial and plots the hypervolume history. The hypervolume is a measure of the volume of the dominated region in the objective space, defined by the reference point. The higher the hypervolume, the better the Pareto front.
Study must be multi-objective. For single-objective optimization, please use plot_optimization_history instead.
Parameters: Returns:

plot_timeline

Plot the timeline of a study. Parameters: Returns:

plot_intermediate_values

Plot intermediate values of all trials in a study. Parameters: Returns:

plot_terminator_improvement

Plot the potentials for future objective improvement. This function does not support multi-objective optimization study.
This function visualizes the objective improvement potentials, evaluated with improvement_evaluator. It helps to determine whether we should continue the optimization or not. You can also plot the error evaluated with error_evaluator if the plot_error argument is set to True. Note that this function may take some time to compute the improvement potentials. The improvement_evaluator defaults to RegretBoundEvaluator and the error_evaluator to CrossValidationErrorEvaluator.
Parameters: Returns:

plot_params_correlation

Plot parameters correlation matrix. Parameters: Returns:

plot_metrics_correlation

Plot metrics correlation matrix. Parameters: Returns:

plot_metrics

Plot a histogram matrix of metrics for a Neptune run. Parameters: Returns:

plot_params

Plot a scatter matrix of parameters for a Neptune run. Parameters: Returns:

plot_density_heatmap

Plot a density heatmap for a metric and parameter. Parameters: Returns:

plot_density_contour

Plot a density contour for a metric and parameter. Parameters: Returns:

plot_frontier

Plot an efficient frontier.
This function plots the efficient frontier of a study, which is a graphical representation of the trade-off between risk and return. The efficient frontier is a curve that shows the optimal risk-return combinations for a given set of trials. The points on the curve represent the best possible trade-offs between risk and return, while points below the curve are suboptimal:
  • x is generally a risk metric (e.g., volatility), while y is a performance measure (e.g., returns).
  • The risk-adjusted optimized point is calculated as: risk_adj = (returns - risk_free_rate) / risks
Parameters: Returns: