class optuna.terminator.BestValueStagnationEvaluator(max_stagnation_trials=30)[source]

Evaluates the stagnation period of the best value in an optimization process.

This class is initialized with a maximum stagnation period (max_stagnation_trials) and is designed to evaluate the remaining trials before reaching this maximum period of allowed stagnation. If this remaining trials reach zero, the trial terminates. Therefore, the default error evaluator is instantiated by StaticErrorEvaluator(const=0).


max_stagnation_trials (int) – The maximum number of trials allowed for stagnation.


Added in v3.4.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v3.4.0.


evaluate(trials, study_direction)