Exceptions

class optuna.exceptions.OptunaError[source]

Base class for Optuna specific errors.

class optuna.exceptions.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():
>>>             raise TrailPruned()
class optuna.exceptions.CLIUsageError[source]

Exception for CLI.

CLI raises this exception when it receives invalid configuration.

class optuna.exceptions.StorageInternalError[source]

Exception for storage operation.

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

class optuna.exceptions.DuplicatedStudyError[source]

Exception for a duplicated study name.

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