雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

Exception: Received unknown keyword arguments: {'nb_epochs': 1}

問題

kerasで以下のコマンドで実行しようとした時に

model.fit(X_train, Y_train, nb_epochs=1, batch_size=1)

以下のようなエラーコードを出力した

Using Theano backend.
corpus length: 600893
total chars: 57
nb sequences: 200285
Vectorization...
Build model...

--------------------------------------------------
Iteration 1
Traceback (most recent call last):
  File "textKeras.py", line 78, in <module>
    nb_epochs=1)
  File "/Users/test/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/keras/models.py", line 642, in fit
    str(kwargs))
Exception: Received unknown keyword arguments: {'nb_epochs': 1}

解決法

nb_epochs から nb_epochにする。

model.fit(X_train, Y_train, nb_epoch=1, batch_size=1)

kerasのバージョンによって変数名が異なるらしい

参考

stackoverflow.com