Skip to main content

resolve_optuna

Resolve an Optuna trial by suggesting parameters if applicable. Parameters: Returns:

resolve_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:

BaseOptunaTrial

Base Optuna trial class used to suggest value.

Ancestors

  • abc.ABC

Descendants

  • systematica.portfolio.tuners.utils.Categorical
  • systematica.portfolio.tuners.utils.Float
  • systematica.portfolio.tuners.utils.Int
  • systematica.portfolio.tuners.utils.Param

Methods

suggest

Suggest a value for the parameter. Parameters: Returns:

Float

Class that represents a float Optuna suggestion. Method generated by attrs for class Float.

Ancestors

  • systematica.portfolio.tuners.utils.BaseOptunaTrial
  • abc.ABC

Instance variables

  • high: float: Upper endpoint of the range of suggested values. high is included in the range. high must be greater than or equal to low.
  • log: bool: A flag to sample the value from the log domain or not. If log is True, the value is sampled from the range in the log domain. Otherwise, the value is sampled from the range in the linear domain.
  • low: float: Lower endpoint of the range of suggested values. low is included in the range. low must be less than or equal to high. If log is True, low must be larger than 0.
  • name: str: A parameter name.
  • step: float | None: A step of discretization.

Methods

suggest

Suggest a value for the floating point parameter. Parameters: Returns:

Int

Class that represents an integer Optuna suggestion. Method generated by attrs for class Int.

Ancestors

  • systematica.portfolio.tuners.utils.BaseOptunaTrial
  • abc.ABC

Instance variables

  • high: int: Upper endpoint of the range of suggested values. high is included in the range. high must be greater than or equal to low.
  • log: bool: A flag to sample the value from the log domain or not. If log is true, the value is sampled from the range in the log domain. Otherwise, the value is sampled from the range in the linear domain.
  • low: int: Lower endpoint of the range of suggested values. low is included in the range. low must be less than or equal to high. If log is True, low must be larger than 0.
  • name: str: A parameter name.
  • step: int: A step of discretization.

Methods

suggest

Suggest a value for the integer parameter. The value is sampled from the integers in :math:[\mathsf{low}, \mathsf{high}]. Parameters: Returns:

Categorical

Class that represents a categorical Optuna suggestion. Method generated by attrs for class Categorical.

Ancestors

  • systematica.portfolio.tuners.utils.BaseOptunaTrial
  • abc.ABC

Instance variables

  • choices: Sequence[bool | int | float | str | None]: Parameter value candidates.
  • name: str: A parameter name.

Methods

suggest

Suggest a value for the categorical parameter. The value is sampled from choices. Parameters: Returns:

Param

Class that represents a any Optuna suggestion. Method generated by attrs for class Param.

Ancestors

  • systematica.portfolio.tuners.utils.BaseOptunaTrial
  • abc.ABC

Instance variables

  • choices: Sequence[bool | int | float | str | None]: Parameter value candidates.
  • high: int: Upper endpoint of the range of suggested values. high is included in the range. high must be greater than or equal to low.
  • log: bool: A flag to sample the value from the log domain or not. If log is true, the value is sampled from the range in the log domain. Otherwise, the value is sampled from the range in the linear domain.
  • low: int: Lower endpoint of the range of suggested values. low is included in the range. low must be less than or equal to high. If log is True, low must be larger than 0.
  • name: str: A parameter name.
  • step: int: A step of discretization.

Methods

suggest

Suggest a value for any parameter. Parameters: Returns: