神经网络中的时间序列提前预测(N Point Ahead Prediction)大规模迭代训练 [英] Time Series Ahead Prediction in Neural Network (N Point Ahead Prediction) Large Scale Iterative Training

查看:34
本文介绍了神经网络中的时间序列提前预测(N Point Ahead Prediction)大规模迭代训练的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(N=90) 使用神经网络的前点预测:

我试图预测提前 3 分钟,即提前 180 分.因为我将时间序列数据压缩为每 2 个点的平均值为 1,所以我必须预测 (N=90) 超前预测.

我的时间序列数据以秒为单位.数值在 30-90 之间.它们通常从 30 移动到 90 和 90 到 30,如下例所示.

我的数据可能来自: (ESN) 或其他形式的 Reservoir Computing.它们非常适合时间序列预测,非常易于使用且收敛速度快.您根本不需要担心网络的结构(中间层中的每个神经元都有不会改变的随机权重).您只学习输出权重.

如果我正确理解了问题,使用 Echo State Networks,我只需训练网络预测下一个点和 90 个点.这可以通过简单地强制输出神经元中的期望输出然后执行岭回归来学习输出权重来完成.

在训练完成后运行网络时,在每一步n,它都会输出下一个点(n+1),你会反馈给网络作为输入(继续迭代),并提前 90 个点 (n+90),你可以用它做任何你想做的事情 - 即:你也可以将它反馈给网络,以便它影响下一个输出.

对不起,如果答案不是很清楚.很难用简短的回答来解释水库计算的工作原理,但是如果您只是阅读链接中的文章,您会发现很容易理解其中的原理.

如果您决定使用 ESN,还请阅读 这篇 论文了解 ESN 最重要的属性并真正了解您在做什么.

根据您的系统的可预测性"程度,预测 90 分可能仍然非常困难.例如,如果您尝试预测一个混沌系统,如果您预测的距离很远,噪声会引入非常大的错误.

(N=90) Point ahead Prediction using Neural Network:

I am trying to predict 3 minutes ahead i.e. 180 points ahead. Because I compressed my time series data as taking the mean of every 2 points as one, I have to predict (N=90) step-ahead prediction.

My time series data is given in seconds. The values are in between 30-90. They usually move from 30 to 90 and 90 to 30, as seen in the example below.

My data could be reach from: https://www.dropbox.com/s/uq4uix8067ti4i3/17HourTrace.mat

I am having trouble in implementing neural network to predict N points ahead. My only feature is previous time. I used elman recurrent neural network and also newff.

In my scenario I need to predict 90 points ahead. First how I separated my input and target data manually: For Example:

data_in = [1,2,3,4,5,6,7,8,9,10]; //imagine 1:10 only defines the array index values.
N = 90; %predicted second ahead.
P(:, :)         T(:)     it could also be(2 theta time)  P(:, :)         T(:) 
[1,2,3,4,5]    [5+N]              |                     [1,3,5,7,9]     [9+N]
[2,3,4,5,6]    [6+N]              |                     [2,4,6,8,10]    [10+N]
...

until it reaches to end of the data

I have 100 input points and 90 output points in Elman recurrent neural networks. What could be the most efficient hidden node size?

input_layer_size = 90;  
NodeNum1 =90;

 net = newelm(threshold,[NodeNum1 ,prediction_ahead],{'tansig', 'purelin'});
net.trainParam.lr       = 0.1; 
net.trainParam.goal     = 1e-3; 

//At the beginning of my training I filter it with kalman, normalization into range of [0,1] and after that I shuffled the data. 1) I won't able to train my complete data. First I tried to train complete M data which is around 900,000, which didn't gave me a solution.

2) Secondly I tried iteratively training. But in each iteration the new added data is merged with already trained data. After 20,000 trained data the accuracy start to decreases. First trained 1000 data perfectly fits in training. But after when I start iterativelt merge the new data and continue to training, the training accuracy drops very rapidly 90 to 20. For example.

P = P_test(1:1000) T = T_test(1:1000) counter = 1;
     while(1)
      net = train(net,P,T, [], [] );%until it reaches to minimum error I train it.
      [normTrainOutput]    = sim(net,P,         [], [] );

      P = [ P P(counter*1000:counter*2000)]%iteratively new training portion of the data added. 
    counter = counter + 1; end

This approach is very slow and after a point it won't give any good resuts.

My third approach was iteratively training; It was similar to previous training but in each iteration, I do only train the 1000 portion of the data, without do any merging with previous trained data.For example when I train first 1000 data until it gets to minimum error which has >95% accuracy. After it has been trained, when I have done the same for the second 1000 portion of the data;it overwrites the weight and the predictor mainly behave as the latest train portion of the data.

> P = P_test(1:1000) T = T_test(1:1000) counter = 1; 
      while(1)
>       net            = train(net,P,T, [], [] ); % I did also use adapt()
>       [normTrainOutput]    = sim(net,P,         [], [] );
>    
>       P = [ P(counter*1000:counter*2000)]%iteratively only 1000 portion of the data is added.
>     counter = counter + 1; 
end

Trained DATA: This figure is snapshot from my trained training set, blue line is the original time series and red line is the predicted values with trained neural network. The MSE is around 50.

Tested DATA: On the below picture, you can see my prediction for my testing data with the neural network, which is trained with 20,000 input points while keeping MSE error <50 for the training data set. It is able to catch few patterns but mostly I doesn't give the real good accuracy.

I wasn't able to successes any of this approaches. In each iteration I also observe that slight change on the alpha completely overwrites to already trained data and more focus onto the currently trained data portion. I won't able to come up with a solution to this problem. In iterative training should I keep the learning rate small and number of epochs as small.

And I couldn't find an efficient way to predict 90 points ahead in time series. Any suggestions that what should I do to do in order to predict N points ahead, any tutorial or link for information.

What is the best way for iterative training? On my second approach when I reach 15 000 of trained data, training size starts suddenly to drop. Iteratively should I change the alpha on run time?

==========

Any suggestion or the things I am doing wrong would be very appreciated.

I also implemented recurrent neural network. But on training for large data I have faced with the same problems.Is it possible to do adaptive learning(online learning) in Recurrent Neural Networks for(newelm)? The weight won't update itself and I didn't see any improvement.

If yes, how it is possible, which functions should I use?

net = newelm(threshold,[6, 8, 90],{'tansig','tansig', 'purelin'});
net.trainFcn               = 'trains';
batch_size                 = 10;
while(1)
       net = train(net,Pt(:, k:k+batch_size ) , Tt(:, k:k+batch_size)   );
end

解决方案

Have a look at Echo State Networks (ESNs) or other forms of Reservoir Computing. They are perfect for time series prediction, very easy to use and converge fast. You don't need to worry about the structure of the network at all (every neuron in the mid-layer has random weights which do not change). You only learn the output weights.

If I understood the problem correctly, with Echo State Networks, I would just train the network to predict the next point AND 90 points ahead. This can be done by simply forcing the desired output in the output neurons and then performing ridge regression to learn the output weights.

When running the network after having trained it, at every step n, it would output the next point (n+1), which you would feed back to the network as input (to continue the iteration), and 90 points ahead (n+90), which you can do whatever you want with - i.e: you could also feed it back to the network so that it affects the next outputs.

Sorry if the answer is not very clear. It's hard to explain how reservoir computing works in a short answer, but if you just read the article in the link, you will find it very easy to understand the principles.

If you do decide to use ESNs, also read this paper to understand the most important property of ESNs and really know what you're doing.

EDIT: Depending on how "predictable" your system is, predicting 90 points ahead may still be very difficult. For example if you're trying to predict a chaotic system, noise would introduce very large errors if you're predicting far ahead.

这篇关于神经网络中的时间序列提前预测(N Point Ahead Prediction)大规模迭代训练的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆