title: How to get the best model when using EarlyStopping callback in Keras?
body: <p>I am training a neural network with Keras using <code>EarlyStopping</code> based on <code>val_acc</code> and <code>patience=0</code>. <code>EarlyStopping</code> stops the training as soon as <code>val_acc</code> decreases.</p>
  
  <p>However the final model that I obtain is not the best model, namely the one with the highest <code>val_acc</code>. But I rather have the model corresponding to the epoch after, namely the one corresponding to a <code>val_acc</code> just a bit lower than the best one and that caused the early stopping!</p>
  
  <p>How do I get the best one? </p>
  
  <p>I tried to use the save the best model using the call back: </p>
  
  <pre><code>ModelCheckpoint(filepath='best_model.h5', monitor='val_loss', save_best_only=True)]
  </code></pre>
  
  <p>But I get the same results.</p>