12

I am using EarlyStopping from Keras for my deep learning project. The documentations here mentions a very useful idea of restoring best weights. But somehow I am not able to use it yet. I am using Keras 2.2.2/TF 1.10, installed using Anaconda. Call is simple as follows. is there any issue?

es = EarlyStopping(monitor='val_acc', min_delta=1e-4, patience=patience_,verbose=1,restore_best_weights=True)

__init__() got an unexpected keyword argument 'restore_best_weights'

Akram Berkawy
  • 4,920
  • 2
  • 19
  • 27
Arka Mallick
  • 1,206
  • 3
  • 15
  • 28

1 Answers1

20

Ah, a very common problem. The keras documentation online is produced from the master branch in github, so features that have been introduced only recently are present there, but not yet in any Keras release.

So the restore_best_weights option of the EarlyStopping callback was added on August 18, 2018, while currently the latest Keras release (2.2.2) was made on July 28, 2018. So you will have to use Keras master, wait for a Keras release, or just not use the option.

Update: It is now included in Keras 2.2.3 release.

today
  • 32,602
  • 8
  • 95
  • 115
Dr. Snoopy
  • 55,122
  • 7
  • 121
  • 140
  • 1
    Good to know this new addition! I have been using `ModelCheckpoint` callback and load the best weight after training. This can be a workaround with version 2.2.2. – Kota Mori Sep 23 '18 at 16:33