deephyper.stopper.integration.tf_keras2.TFKerasStopperCallback#
- class deephyper.stopper.integration.tf_keras2.TFKerasStopperCallback(*args: Any, **kwargs: Any)[source]#
Bases:
Callback
Tensorflow/Keras callback to be used with a DeepHyper
RunningJob
.This stops the training when the
Stopper
is triggered.def run(job): callback = TFKerasStopperCallback(job, ...) ... model.fit(..., callbacks=[callback]) ...
- Parameters:
job (RunningJob) – The running job created by DeepHyper.
monitor (str, optional) – The metric to monitor. It can be any metric collected in the
History
. Defaults to"val_loss"
.mode (str, optional) – If the metric is maximized or minimized. Value in `` [“max”, “min”]``. Defaults to
"max"
.
Methods
Called at the end of an epoch during training.
- on_epoch_end(epoch, logs=None)[source]#
Called at the end of an epoch during training.
- Parameters:
epoch – Integer, index of epoch.
logs – Dict, metric results for this training epoch, and for the validation epoch if validation is performed. Validation result keys are prefixed with val_. For training epoch, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.