optuna.integration.KerasPruningCallback
- class optuna.integration.KerasPruningCallback(trial, monitor, interval=1)[源代码]
Keras callback to prune unpromising trials.
See the example if you want to add a pruning callback which observes validation accuracy.
- 参数
trial (optuna.trial._trial.Trial) – A
Trial
corresponding to the current evaluation of the objective function.monitor (str) – An evaluation metric for pruning, e.g.,
val_loss
andval_accuracy
. Please refer to keras.Callback reference for further details.interval (int) – 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.
- 返回类型
None
警告
Deprecated in v2.1.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.1.0.
Recent Keras release (2.4.0) simply redirects all APIs in the standalone keras package to point to tf.keras. There is now only one Keras: tf.keras. There may be some breaking changes for some workflows by upgrading to keras 2.4.0. Test before upgrading. REF:https://github.com/keras-team/keras/releases/tag/2.4.0
Methods
on_epoch_end
(epoch[, logs])