optuna.multi_objective.trial.MultiObjectiveTrial

class optuna.multi_objective.trial.MultiObjectiveTrial(trial)[source]

A trial is a process of evaluating an objective function.

This object is passed to an objective function and provides interfaces to get parameter suggestion, manage the trial’s state, and set/get user-defined attributes of the trial.

Note that the direct use of this constructor is not recommended. This object is seamlessly instantiated and passed to the objective function behind the optuna.multi_objective.study.MultiObjectiveStudy.optimize() method; hence library users do not care about instantiation of this object.

Parameters

trial – A Trial object.

Warning

Deprecated in v2.4.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v4.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v2.4.0.

Methods

report(values, step)

Report intermediate objective function values for a given step.

set_system_attr(key, value)

Set system attributes to the trial.

set_user_attr(key, value)

Set user attributes to the trial.

suggest_categorical(name, choices)

Suggest a value for the categorical parameter.

suggest_discrete_uniform(name, low, high, q)

Suggest a value for the discrete parameter.

suggest_float(name, low, high, *[, step, log])

Suggest a value for the floating point parameter.

suggest_int(name, low, high[, step, log])

Suggest a value for the integer parameter.

suggest_loguniform(name, low, high)

Suggest a value for the continuous parameter.

suggest_uniform(name, low, high)

Suggest a value for the continuous parameter.

Attributes

datetime_start

Return start datetime.

distributions

Return distributions of parameters to be optimized.

number

Return trial’s number which is consecutive and unique in a study.

params

Return parameters to be optimized.

system_attrs

Return system attributes.

user_attrs

Return user attributes.

property datetime_start

Return start datetime.

Returns

Datetime where the Trial started.

property distributions

Return distributions of parameters to be optimized.

Returns

A dictionary containing all distributions.

property number

Return trial’s number which is consecutive and unique in a study.

Returns

A trial number.

property params

Return parameters to be optimized.

Returns

A dictionary containing all parameters.

report(values, step)[source]

Report intermediate objective function values for a given step.

The reported values are used by the pruners to determine whether this trial should be pruned.

See also

Please refer to BasePruner.

Note

The reported values are converted to float type by applying float() function internally. Thus, it accepts all float-like types (e.g., numpy.float32). If the conversion fails, a TypeError is raised.

Parameters
  • values (Sequence[float]) – Intermediate objective function values for a given step.

  • step (int) – Step of the trial (e.g., Epoch of neural network training).

Return type

None

set_system_attr(key, value)[source]

Set system attributes to the trial.

Please refer to the documentation of optuna.trial.Trial.set_system_attr() for further details.

Parameters
  • key (str) –

  • value (Any) –

Return type

None

set_user_attr(key, value)[source]

Set user attributes to the trial.

Please refer to the documentation of optuna.trial.Trial.set_user_attr() for further details.

Parameters
  • key (str) –

  • value (Any) –

Return type

None

suggest_categorical(name, choices)[source]

Suggest a value for the categorical parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_categorical() for further details.

Parameters
Return type

Union[None, bool, int, float, str]

suggest_discrete_uniform(name, low, high, q)[source]

Suggest a value for the discrete parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_discrete_uniform() for further details.

Parameters
Return type

float

suggest_float(name, low, high, *, step=None, log=False)[source]

Suggest a value for the floating point parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_float() for further details.

Parameters
Return type

float

suggest_int(name, low, high, step=1, log=False)[source]

Suggest a value for the integer parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_int() for further details.

Parameters
Return type

int

suggest_loguniform(name, low, high)[source]

Suggest a value for the continuous parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_loguniform() for further details.

Parameters
Return type

float

suggest_uniform(name, low, high)[source]

Suggest a value for the continuous parameter.

Please refer to the documentation of optuna.trial.Trial.suggest_uniform() for further details.

Parameters
Return type

float

property system_attrs

Return system attributes.

Returns

A dictionary containing all system attributes.

property user_attrs

Return user attributes.

Returns

A dictionary containing all user attributes.