MATLAB: NARX closed loop prediction: starting value problem

data divisionDeep Learning Toolboxnarxneural networkprediction

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

Best Answer

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.