我试图通过LSTM序列预测时间序列数据来排序'模型。 我用过keras。 我应该在模型中更改哪些内容以提高准确性?
数据维度:
train_x (1308, 4, 5)
train_y (1308, 2, 5)
test_x (118, 4, 5)
test_y (118, 2, 5)
结果:[mse : 0.021793483835408241, accuracy : 0.54661016696590492]
模型定义:
def fit_model(n_cells):
model=Sequential()
model.add(LSTM(n_cells, input_shape=(4,5)))
model.add(Dense(n_cells))
model.add(RepeatVector(2))
model.add(LSTM(n_cells, input_shape=(10,5), return_sequences=True))
model.add(TimeDistributed(Dense(5, activation='linear')))
model.compile(loss='mse', optimizer='adam', metrics=['accuracy'])
print(model.summary())
hist=History()
for i in range(100):
hist=model.fit(train_x, train_y, batch_size=32, epochs=1, validation_split=0.33, shuffle=False)
model.reset_states()
loss=model.evaluate(test_x, test_y, verbose=0)
print(loss)
cells = [150]
for value in cells:
fit_model(value)