Keras is an open-source neural network library written in Python. There are many classes in Keras. Keras supports the early stopping of training via a callback called EarlyStopping. You can use
callbacks = [ EarlyStoppingByLossVal(monitor='val_loss', value=0.00001, verbose=1)
ModelCheckpoint(kfold_weights_path, monitor='val_loss', save_best_only=True, verbose=0), ] model.fit(X_train.astype('float32'),
Y_train, batch_size=batch_size, nb_epoch=nb_epoch, shuffle=True, verbose=1, validation_data=(X_valid, Y_valid), callbacks=callbacks)
It stops training when a monitored quantity(threshold value) has stopped improving. This callback allows you to specify the performance measure to monitor the trigger, and once triggered, it will stop the training process. The EarlyStopping callback is configured when instantiated via arguments. You can find more here.