Early stopping your model
The early stopping callback is useful since it allows for you to stop the model training if it no longer improves after a given number of epochs. To make use of this functionality you need to pass the callback inside a list to the model's callback parameter in the .fit() method.
The model you built to detect fake dollar bills is loaded for you to train, this time with early stopping. X_train, y_train, X_test and y_test are also available for your use.
Diese Übung ist Teil des Kurses
Introduction to Deep Learning with Keras
Anleitung zur Übung
- Import the 
EarlyStoppingcallback fromtensorflow.keras.callbacks. - Define a callback, monitor 
'val_accuracy'with apatienceof 5 epochs. - Train your model using the early stopping callback.
 
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Import the early stopping callback
from tensorflow.____.____ import ____
# Define a callback to monitor val_accuracy
monitor_val_acc = ____(monitor=____, 
                       patience=____)
# Train your model using the early stopping callback
model.____(____, ____, 
           epochs=1000, validation_data=____,
           callbacks= ____)