繁体   English   中英

在Keras中使用LSTM自动编码器进行多个时间序列预测

[英]Multiple time series prediction with LSTM Autoencoder in Keras

我试图建立一个自动编码LSTM如图所示这里
我的代码:

from keras.layers import Input, LSTM, RepeatVector
from keras.models import Model

inputs = Input(shape=(window_length, input_dim))
encoded = LSTM(latent_dim)(inputs)

decoded = RepeatVector(window_length)(encoded)
decoded = LSTM(input_dim, return_sequences=True)(decoded)

model = Model(inputs, decoded)
model.fit(batch_size=512)

数据集的形状为:(行,window_length,input_dim)。
当我尝试调用fit()时,出现此错误:

ValueError: Cannot feed value of shape (512, 221) for Tensor u'lstm_2_target:0', which has shape '(?, ?, ?)'

这个模型真的很简单,我不明白是什么问题。

编辑
型号摘要:

Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, 10, 221)           0         
_________________________________________________________________
lstm_1 (LSTM)                (None, 128)               179200    
_________________________________________________________________
repeat_vector_1 (RepeatVecto (None, 10, 128)           0         
_________________________________________________________________
lstm_2 (LSTM)                (None, 10, 221)           309400    
=================================================================
Total params: 488,600
Trainable params: 488,600
Non-trainable params: 0

如果代码完全按照上述方式运行,则可能需要对其进行编译:

model.compile(optimizer='rmsprop', loss='mse', metrics=['acc', 'cosine_proximity'])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM