Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

restore_best_weights issue keras early stopping

Tags:

keras

keras-2

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'

like image 408
Haramoz Avatar asked Sep 23 '18 14:09

Haramoz


1 Answers

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.

like image 81
Dr. Snoopy Avatar answered Sep 24 '22 16:09

Dr. Snoopy