0

I am trying to use Keras EarlyStopping however whenever I try to use restore_best_weights it comes up with an error:

_init_() got an unexpected keyword argument 'restore_best_weights'

I am using the most up to date Keras so I'm really unsure why this is happening.

gosuto
  • 5,422
  • 6
  • 36
  • 57

1 Answers1

0

What version of Keras are you using?

If you still do use Keras 2.3.1, please do ensure that your are not mixing keras and tensorflow versions.

More precisely, avoid using imports like from keras.layers import Conv2D and from tensorflow.keras.layers import MaxPool2D.

If the problem still persists after this issue, please use all the imports from tensorflow, i.e. from tensorflow.keras import .....

Avoid using the plain Keras package, as it will become obsolete in the foreseeable future; the additional problem is that is nowhere near as well maintained as keras inside tensorflow.

You can uninstall it altogether from your environment.

Timbus Calin
  • 13,809
  • 5
  • 41
  • 59
  • Hi, thank you so much for taking the time to reply! Currently I import like: from keras.layers import Dense are you suggesting I now use from tensorflow.keras.layers import Dense? And would that be for all of my Keras imports? Thanks again, I'm new to Keras :) – Catherine M Abraham Apr 13 '20 at 09:48
  • Yes Catherine, all the imports, exactly, doesn't matter if it is Dense or Conv2D :D. You are welcome. – Timbus Calin Apr 13 '20 at 10:15