Skip to main content

check_direction

check_direction(
    value: str | list[str],
)
Validate optimization directions. Parameters:
NameTypeDefaultDescription
valuestr--| list[str] Direction.
Raises:
TypeDescription
ValueErrorIf direction is not “maximize” or “minimize”.
TypeErrorIf direction is not a string or a list

BaseOptunaTrial

BaseOptunaTrial()
Base Optuna trial class used to suggest value.

Ancestors

  • abc.ABC

Descendants

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

Methods

suggest

suggest(
    self,
    trial: optuna.trial._trial.Trial,
) ‑> Any
Suggest a value for the parameter. Parameters:
NameTypeDefaultDescription
trialoptuna.Trial--The Optuna trial object.
Returns:
TypeDescription
tp.AnyA suggested value for the parameter.

Float

Float(
    name: str,
    low: float,
    high: float,
    step: float | None = None,
    log: bool = False,
)
Class that represents a float Optuna suggestion. Method generated by attrs for class Float.

Ancestors

  • systematica.tuners.optuna_.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(
    self,
    trial: optuna.trial._trial.Trial,
) ‑> float
Suggest a value for the floating point parameter. Parameters:
NameTypeDefaultDescription
trialoptuna.Trial--The Optuna trial object.
Returns:
TypeDescription
floatA suggested float value.

Int

Int(
    name: str,
    low: int,
    high: int,
    step: int = 1,
    log: bool = False,
)
Class that represents an integer Optuna suggestion. Method generated by attrs for class Int.

Ancestors

  • systematica.tuners.optuna_.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(
    self,
    trial: optuna.trial._trial.Trial,
) ‑> int
Suggest a value for the integer parameter. The value is sampled from the integers in :math:[\mathsf{low}, \mathsf{high}]. Parameters:
NameTypeDefaultDescription
trialoptuna.Trial--The Optuna trial object.
Returns:
TypeDescription
intA suggested int value.

Categorical

Categorical(
    name: str,
    choices: Sequence[bool | int | float | str | None],
)
Class that represents a categorical Optuna suggestion. Method generated by attrs for class Categorical.

Ancestors

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

Instance variables

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

Methods

suggest

suggest(
    self,
    trial: optuna.trial._trial.Trial,
) ‑> bool | int | float | str | None
Suggest a value for the categorical parameter. The value is sampled from choices. Parameters:
NameTypeDefaultDescription
trialoptuna.Trial--The Optuna trial object.
Returns:
TypeDescription
optuna.distributions.CategoricalChoiceTypeA suggested categorical value.

Param

Param(
    name: str,
    choices: Sequence[bool | int | float | str | None= None,
    low: int = None,
    high: int = None,
    step: int = 1,
    log: bool = False,
)
Class that represents a any Optuna suggestion. Method generated by attrs for class Param.

Ancestors

  • systematica.tuners.optuna_.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(
    self,
    trial: optuna.trial._trial.Trial,
) ‑> bool | int | float | str | None
Suggest a value for any parameter. Parameters:
NameTypeDefaultDescription
trialoptuna.Trial--The Optuna trial object.
Returns:
TypeDescription
int | float | optuna.distributions.CategoricalChoiceTypeA suggested value.