如何正确配置编码器解码器LSTM具有一个携带多个功能的时间步输出

发布于 2025-01-27 21:53:01 字数 523 浏览 4 评论 0原文

在每个观察结果中,我都有6个时间段,每个时间段具有2个功能,并且我正在尝试预测具有2个平行功能的1个时间表。更具体地说,

我的输入数据的形状是:(81、6、2) 我的输出数据的形状是:(81,1,2)

我编写了以下代码来构建Encoder-Decoder LSTM:

model.add(LSTM(200, activation='relu', input_shape=(n_input, 2)))
model.add(RepeatVector(1))
model.add(LSTM(200, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(100, activation='relu')))
model.add(TimeDistributed(Dense(2)))

当我执行单个预测时,网络使我恢复了形状(1,1,2)。

我想仔细检查这是否正确,并且我不会缺少任何东西,因为预测的值很糟糕(有些是负面的,而另一些则很高)。

In each observation, I have 6 timesteps each with 2 features, and I am trying to predict 1 timetsep that has 2 parallel features. More specifically,

The shape of my input data is: (81, 6, 2)
The shape of my output data is: (81, 1, 2)

I wrote the following code to build Encoder-Decoder LSTM:

model.add(LSTM(200, activation='relu', input_shape=(n_input, 2)))
model.add(RepeatVector(1))
model.add(LSTM(200, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(100, activation='relu')))
model.add(TimeDistributed(Dense(2)))

The network gives me back the shape (1, 1, 2) when I perform a single prediction.

I want to double check if this is correct, and I am not missing anything, because the predicted values are very bad (some are negative and others are very high).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放飞的风筝 2025-02-03 21:53:01

有一个不良的预测是一个不同的问题。您获得的形状应与(样本,时间段,功能)=> (1,1,2)在密集(2)层中指定。

Having a bad prediction is a different issue. The shape you're getting back should correspond to (samples, timesteps, features) => (1, 1, 2) as specified in the Dense(2) layer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文