optuna.integration.KerasPruningCallback¶
- class optuna.integration.KerasPruningCallback(trial: optuna.trial._trial.Trial, monitor: str, interval: int = 1)[source]¶
Keras callback to prune unpromising trials.
See the example if you want to add a pruning callback which observes validation accuracy.
- Parameters
trial – A
Trial
corresponding to the current evaluation of the objective function.monitor – An evaluation metric for pruning, e.g.,
val_loss
andval_accuracy
. Please refer to keras.Callback reference for further details.interval – Check if trial should be pruned every n-th epoch. By default
interval=1
and pruning is performed after every epoch. Increaseinterval
to run several epochs faster before applying pruning.
Methods
__init__
(trial, monitor[, interval])on_epoch_end
(epoch[, logs])