1 Optimizable

utils.Optimizable()

Declarative description of an optimisable parameter.

The class intentionally avoids importing Optuna at runtime so the rest of the package can be used without the optional dependency. The trial argument is treated duck-typed (expects suggest_float/int/categorical methods).

1.1 Attributes

Name Description
target Type of the parameter (int, float, bool, str, Enum).
low Lower bound for numeric spaces.
high Upper bound for numeric spaces.
step Step used for discrete integer suggestions.
categories Explicit set of categorical choices (or Enum members).
log Use logarithmic sampling for numeric spaces.
name Optional override for the Optuna parameter name.
default Default value used outside Optuna trials.
description Human readable description of the parameter.
relies_on Optional dependency map: {param_path: (accepted_values,…)}.

1.2 Methods

Name Description
suggest Sample a value from Optuna.
serialize Convert a suggested value to a JSON/W&B friendly representation.

1.2.1 suggest

utils.Optimizable.suggest(trial, path, *, current_value=None, value_lookup=None)

Sample a value from Optuna.

1.2.1.1 Parameters

Name Type Description Default
trial 'optuna.Trial' Optuna trial (duck-typed; must implement suggest_* APIs). required
path str Default parameter name derived from the config path. required

1.2.1.2 Returns

Name Type Description
T Suggested value coerced into the requested target type.

1.2.2 serialize

utils.Optimizable.serialize(value)

Convert a suggested value to a JSON/W&B friendly representation.