我有以下LSTM网络设置:
.list-group {
display: none;
width: 350px;
height: 100%;
position: fixed;
top: 0;
right: 0;
background: #303030;
opacity: 0.95;
border-color: transparent;
border: none;
}
返回:
“ KerasClassifier”对象没有属性“ reset_states”
问题1:Keras 2.2.0是否不再支持.reset_states()?我在文档中找不到线索。
相反,我也可以这样做:
...
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.utils import np_utils
...
dim = 10
time = 20
batch_size = 20
def baseline_model():
model = Sequential()
model.add(LSTM(12, stateful=True, batch_input_shape=(batch_size, time, dim)))
model.add(Dense(3, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
model = KerasClassifier(build_fn=baseline_model, batch_size=batch_size, shuffle=False)
for i in range(100):
model.fit(X_train, y_train, epochs=1)
model.reset_states()
?