According to the Keras docs, fit takes a validation_freq param:
validation_freq: Only relevant if validation data is provided. Integer or list/tuple/set. If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. validation_freq=2 runs validation every 2 epochs. If a list, tuple, or set, specifies the epochs on which to run validation, e.g. validation_freq=[1, 2, 10] runs validation at the end of the 1st, 2nd, and 10th epochs.
result = model.fit( X_train, Y_train, epochs=2000, verbose=1, validation_data=(X_test,Y_test), validation_freq=10) # , validation_split=0.2
This raises:
File "/Users/george/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 942, in fit
raise TypeError('Unrecognized keyword arguments: ' + str(kwargs))
TypeError: Unrecognized keyword arguments: {'validation_freq': 10}
Using Keras2.1.6-tf. Has this param been added since?
If so, how to update Keras for Anaconda? I tried:
> conda update keras
Collecting package metadata: done
Solving environment: done
# All requested packages already installed.
The commit that added validation_freq was added after the latest release 2.2.4. See https://github.com/keras-team/keras/commit/a6c8042121371b5873773ca767f28cdf5689d5e4, which was committed 28 days ago, after the latest release which was released last October.
I fixed this by installing from keras' git repo:
pip uninstall keras
pip install git+git://github.com/keras-team/keras.git
Although you're using conda, pip should still work to install packages. You may have to fiddle around with pip installing to the right python, i.e. pip3 install or on windows python -m pip install. Worst comes to worst use conda to install from the source on github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With