NARX closed loop prediction: starting value problem

12 views (last 30 days)
Hello everyone,
I am using NARX to do a multistep prediction on several time series. After training it in open loop, the net is converted to closed loop for prediction (default workflow).
Many times, the error of the first predicted values is big (see picture below). This get better by strongly increasing number of prediction steps. For me this indicates a reasonable generalisation ability after the training procedure, and this is why I am focusing on this "starting value" aspect, instead of further improvement of delays, size of hidden layer etc...
Is there any possibility to "define" a starting value for the closed loop Narx? I wonder if it is possible to use an overlap of openloop and closed loop data to let the narxnet "recognize" last open loop timesteps. I read a lot about data division in this context. Usually I use 'divideblock' to define training, validation and testing subsets. Last subset is the test subset, which is - of course - not used for calibration. In this case overlapping of openloop and closedloop data with just a few timesteps does not make sense because the net simply can't recognize values of the testing-subset. I tested the possibiliy of overlapping the data set, using 'dividerand', which indeed did improve errors for first prediction values. But I would prefer not to use 'dividerand'. I also tried to use 'divideind' and simply change the order of training, and testing set indices like this:
%documentation example
%[trainInd,valInd,testInd] = divideind(3000,1:2000,2001:2500,2501:3000);
[trainInd,valInd,testInd] = divideind(3000,1001:3000,1:500,501:1000,);
Is this a bad idea? I had some troubles to write the code to simply test this idea. This is why I am asking.
Thanks for shearing your thoughts and ideas with me
Andrew

Accepted Answer

Thomas Schattschneider
Thomas Schattschneider on 21 Mar 2017
Hello Andreas,
I am working on a similar problem right now and might have something to help you.
Look at the section "Multistep Closed-Loop Prediction Following Known Sequence" of Multistep Neural Network Prediction. It describes how to get the correct initial input and layer states for your network in order to get the correct following predictions. This could be what you asked for (defining starting values). At least for me, this solved the same problem I had with my NARX time series prediction.
  3 Comments
Andreas Wunsch
Andreas Wunsch on 21 Mar 2017
Hello Thomas,
I have read this site a hundred times before, but now I found something I have missed somehow.
% Test the Network
y = net(x,xi,ai) %this is wrong or at least insufficient
[y,xf,af] = net(x,xi,ai); %this is what you need
I simply did forget to create xf and af. This is what follows:
[netc,xic,aic] = closeloop(net,xf,af); %close the loop
Now it works perfectly.Thank you!
Thomas Schattschneider
Thomas Schattschneider on 22 Mar 2017
Happy to hear that it works!
I was a little bit confused too, since a different method of prediction is shown in Design Time Series NARX Feedback Neural Networks for multistep prediction. Both methods work for me, but the prediction method with following the known sequence gives way better results.

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 15 Mar 2017
1. There is an erroneous shift between the blue and green curves because the delay is not properly accounted for.
2. Low error rates on openloop training/validation/testing does not automatically carry over when the loop is closed. In particular, I have illustrated examples where closing the loop can yield low training/validation subset errors but fails tragically on the test subset.
3. I have not been able to deal with this directly except to try many designs differing via initial weights. However, even this is not guaranteed to work.
4. None of these cases have received a response from MATLAB.
5. See my tutorials in the NEWSGROUP.
Hope this helps.
Thank you for formally accepting my answer
Greg
  5 Comments
Andreas Wunsch
Andreas Wunsch on 21 Mar 2017
Edited: Andreas Wunsch on 21 Mar 2017
Hi Greg,
just one more question. It doesn't make sense to use delays that which have a value bigger than the length of the forecasting period, right?
For example:
ID = 0:15
FD = 1:23
to predict 5 timesteps. In this case I can't even fill up my tapped delay line...
Thanks again!
Andrew
Greg Heath
Greg Heath on 25 Jul 2017
Use the smallest delay lengths that give you the answer you want (or will accept).
In addition to trying to minimize the number of hidden nodes, you can try to minimize the number of delays.
Since neither is a continuous variable, intelligent trial and error is the only approach that I would use.

Sign in to comment.

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!