Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras: Exception: Received unknown keyword arguments: {'epochs': 100}

Tags:

python

keras

I am trying to replicate the code on http://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/ (first example). The code can be found in the part "LSTM Networks for Regression". However, my question mainly refers to the following line:

model.fit(trainX, trainY, epochs=100, batch_size=1, verbose=2)

When I execute this line, I get the following Exception:

model.fit(trainX, trainY, batch_size=1, verbose=2, epochs = 100) File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 612, in fit str(kwargs)) Exception: Received unknown keyword arguments: {'epochs': 100}

If I leave the keyword 'epochs' away, everything works fine. But of course, this is highly unsatisfactory since I want to increase the number of epochs. Can anyone help?

like image 967
Peter Series Avatar asked Apr 20 '17 03:04

Peter Series


1 Answers

The epoch flags were CHANGED in version 2+, for version 1+ use nb_epoch instead.

model.fit(trainX, trainY, nb_epoch=100, batch_size=1, verbose=2)

To check your Keras version ..

import keras
print(keras.__version__)
like image 134
Butsuri Avatar answered Nov 01 '22 17:11

Butsuri