用于序列数据的 LSTM 自动编码器

LSTM Autoencoder for sequence data

我对 LSTM 领域完全陌生。是否有任何提示可以优化我的自动编码器以重建 len = 300

序列的任务

瓶颈层应该有 10-15 个神经元

model = Sequential()
model.add(LSTM(128, activation='relu', input_shape=(timesteps,1), return_sequences=True))
model.add(LSTM(64, activation='relu', return_sequences=False))
model.add(RepeatVector(timesteps))
model.add(LSTM(64, activation='relu', return_sequences=True))
model.add(LSTM(128, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(1)))
model.compile(optimizer='adam', loss='mae')

代码复制自:https://towardsdatascience.com/step-by-step-understanding-lstm-autoencoder-layers-ffab055b6352

目前结果只有一个 nan 序列:[nan, nan, nan ... nan, nan]

序列看起来类似于下图:

我相信您在这里使用的激活函数,即 'relu' 可能会破坏梯度。尝试使用其他适合您数据的激活函数,例如 'tanh'。