相关疑难解决方法(0)

具有LSTM单元的Keras RNN用于基于多个输入时间序列预测多个输出时间序列

我想用LSTM单元模拟RNN,以便根据多个输入时间序列预测多个输出时间序列.具体而言,我有4个输出时间序列,y1 [t],y2 [t],y3 [t],y4 [t],每个具有3,000的长度(t = 0,...,2999).我还有3个输入时间序列,x1 [t],x2 [t],x3 [t],每个都有3000秒的长度(t = 0,...,2999).目标是使用直到当前时间点的所有输入时间序列来预测y1 [t],... y4 [t],即:

  y1[t] = f1(x1[k],x2[k],x3[k], k = 0,...,t)
  y2[t] = f2(x1[k],x2[k],x3[k], k = 0,...,t)
  y3[t] = f3(x1[k],x2[k],x3[k], k = 0,...,t)
  y4[t] = f3(x1[k],x2[k],x3[k], k = 0,...,t)
Run Code Online (Sandbox Code Playgroud)

对于具有长期记忆的模型,我通过以下方式创建了有状态的RNN模型.keras-stateful-lstme.我的案例和keras-stateful-lstme之间的主要区别在于我:

  • 超过1个输出时间序列
  • 超过1个输入时间序列
  • 目标是连续时间序列的预测

我的代码正在运行.然而,即使使用简单的数据,模型的预测结果也很糟糕.所以我想问你我是否有任何错误.

这是我的代码与玩具示例.

在玩具示例中,我们的输入时间序列是简单的cosign和sign wave:

import numpy as np
def random_sample(len_timeseries=3000):
    Nchoice = 600
    x1 = np.cos(np.arange(0,len_timeseries)/float(1.0 + np.random.choice(Nchoice)))
    x2 = np.cos(np.arange(0,len_timeseries)/float(1.0 + np.random.choice(Nchoice)))
    x3 = np.sin(np.arange(0,len_timeseries)/float(1.0 + np.random.choice(Nchoice)))
    x4 = np.sin(np.arange(0,len_timeseries)/float(1.0 + np.random.choice(Nchoice))) …
Run Code Online (Sandbox Code Playgroud)

python neural-network keras recurrent-neural-network

14
推荐指数
1
解决办法
7247
查看次数