【发布时间】:2019-03-28 06:17:32
【问题描述】:
我正在使用 keras 库在 LSTM 上训练我的模型。
虽然我已经导入了Dropout 层,但它仍然给我以下错误:
文件“C:\Users\Faiq Ahmad\Anaconda3\lib\site-packages\keras\engine\base_layer.py", 行 128,在 初始化 raise TypeError('关键字参数不理解:', kwarg)
TypeError: ('Keyword argument not understand:', 'Dropout')
有人建议升级 keras,但没有成功。
代码如下:
keras.models
import Sequential from sklearn.preprocessing
import MinMaxScaler from keras.layers
import Dense, Dropout, Activation, Flatten, LSTM ,
model = Sequential()
model.add(LSTM(128, return_sequences=True, input_dim=3, input_shape =(50,), activation= 'relu'))
model.add(LSTM(32, Dropout=0.2))
model.add(Dense(2, activation='softmax'))
model.compile(Adam(lr=0.0001), loss='mean_absolute_error', metrics=['accuracy'])
model.fit(x_train, y_train, validation_split=(x_test,y_test), epochs=30 )
【问题讨论】:
-
错误是你调用方法的方式,除了错误信息,请发布你的代码。
-
您使用的是哪个版本的 keras?也请按照@BurhanKhalid 所说的那样发布代码
-
显示代码。没有代码我们帮不了你
-
可能是大小写错误——
dropout应该小写? -
我建议您提出一个新问题。