As a neural network accumulates more parameters, it is more exposed to overfitting. Too many epochs can lead to overfitting of the training dataset, whereas too few may result in an underfit model.
A viable solution is to train on the training dataset, but stop training when performance on the validation dataset begins to deteriorate. Early stopping is one such technique that helps in less wastage of training resources. The Keras module contains a built-in callback designed for this purpose called the Early Stopping Callback.
Using tf.keras.callbacks.EarlyStopping, you can implement the Keras API, the high-level API of TensorFlow.
Keras Callback APIs help in monitoring and tracking when the model is getting trained and can be attached fit, evaluate, predict of the Keras model.
Min delta is an important parameter of the Early Stopping Callback.
If Min delta is set as X, that means the validation accuracy has to improve by at least X for it to count as an improvement.
Adding the min delta argument to the code implementation in Patience,
it creates an argument of the early stopping callback which has been
set as 0.01 in this code example. This means that the validation
accuracy has to improve by at least 0.01 for it to count as an
By default, min_delta is zero, which means that any improvement in the performance is enough to reset the patience.