Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras EarlyStopping patience parameter

I'm trying to do some binary classification and I use Keras's EarlyStopping callback. However, I have a question regarding patience parameter.

In the documentation it is stated

patience: number of epochs with no improvement after which training will be stopped.

but I find that it behaves in a different way. For example, I have set

EarlyStopping(monitor='val_loss', min_delta=0.0001, patience=2, verbose=0, mode='auto')

and here are the results:

val_loss: 0.6811
val_loss: 0.6941 
val_loss: 0.6532
val_loss: 0.6546
val_loss: 0.6534
val_loss: 0.6489
val_loss: 0.6240
val_loss: 0.6285
val_loss: 0.6144
val_loss: 0.5921
val_loss: 0.5731
val_loss: 0.5956
val_loss: 0.5753
val_loss: 0.5977

enter image description here

After this training has stopped. As far as I see there are no 2 consecutively increasing loss values at the end. Could someone give an explanation to this parameter-phenomena?

like image 602
nabroyan Avatar asked Jul 11 '17 07:07

nabroyan


Video Answer


1 Answers

There are three consecutively worse runs by loss, let's look at the numbers:

val_loss: 0.5921 < current best
val_loss: 0.5731 < current best
val_loss: 0.5956 < patience 1
val_loss: 0.5753 < patience 2
val_loss: 0.5977 < patience >2, stopping the training

You already discovered the min delta parameter, but I think it is too small to trigger here (you're off by 10x).

like image 55
Thomas Jungblut Avatar answered Sep 23 '22 16:09

Thomas Jungblut