Early stopping based on average val_loss of last ten epoches and with some n partiences

I am training a DNN with CNN in Keras. Though, I can write an EarlyStopping criteria based on val_loss but due to minor oscillations in the val_loss, I want to monitor the average validation loss over last n epoches and with n patience.

How can I do this in Keras?

Topic early-stopping multi-output keras tensorflow loss-function

Category Data Science


You can always write a custom callback inheriting the tf.keras.callbacks.Callback() class. You would need to override the on_epoch_end() method with your custom logic.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.