# Structs¶

class optuna.structs.TrialState[source]

State of a Trial.

RUNNING

The Trial is running.

COMPLETE

The Trial has been finished without any error.

PRUNED

The Trial has been pruned with TrialPruned.

FAIL

The Trial has failed due to an uncaught error.

class optuna.structs.StudyDirection[source]

Direction of a Study.

NOT_SET

Direction has not been set.

MNIMIZE

Study minimizes the objective function.

MAXIMIZE

Study maximizes the objective function.

class optuna.structs.FrozenTrial[source]

Status and results of a Trial.

trial_id

Identifier of the Trial.

state
value

Objective value of the Trial.

datetime_start

Datetime where the Trial started.

datetime_complete

Datetime where the Trial finished.

params

Dictionary that contains suggested parameters.

user_attrs

Dictionary that contains the attributes of the Trial set with optuna.trial.Trial.set_user_attr().

system_attrs

Dictionary that contains the attributes of the Trial internally set by Optuna.

intermediate_values

Intermediate objective values set with optuna.trial.Trial.report().

params_in_internal_repr

Optuna’s internal representation of params.

class optuna.structs.StudySummary[source]

Basic attributes and aggregated results of a Study.

study_id

Identifier of the Study.

study_name

Name of the Study.

direction
best_trial

FrozenTrial with best objective value in the Study.

user_attrs

Dictionary that contains the attributes of the Study set with optuna.study.Study.set_user_attr().

system_attrs

Dictionary that contains the attributes of the Study internally set by Optuna.

n_trials

The number of trials ran in the Study.

datetime_start

Datetime where the Study started.

class optuna.structs.OptunaError[source]

Base class for Optuna specific errors.

class optuna.structs.TrialPruned[source]

Exception for pruned trials.

This error tells a trainer that the current Trial was pruned. It is supposed to be raised after optuna.trial.Trial.should_prune() as shown in the following example.

Example

>>> def objective(trial):
>>>     ...
>>>     for step in range(n_train_iter):
>>>         ...
>>>         if trial.should_prune(step):
>>>             raise TrailPruned()

class optuna.structs.CLIUsageError[source]

Exception for CLI.

CLI raises this exception when it receives invalid configuration.

class optuna.structs.StorageInternalError[source]

Exception for storage operation.

This error is raised when an operation failed in backend DB of storage.

class optuna.structs.DuplicatedStudyError[source]

Exception for a duplicated study name.

This error is raised when a specified study name already exists in the storage.