1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with Keras

Connected

Exercise

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.

Instructions

100 XP
  • Import the EarlyStoppingcallback from tensorflow.keras.callbacks.
  • Define a callback, monitor 'val_accuracy' with a patience of 5 epochs.
  • Train your model using the early stopping callback.