Neural Network - Multi Step Ahead Prediction

I built a NAR Neural Network using Neural Network Toolbox and after training it was provided an algorithm to do simulations, such as: Multi-Step prediction and Step-Ahead prediction. However, I would like to do Multi-Step Ahead Predictions (five steps) and it was not provided by the assistent. Could anybody help me ?
Below you can see part of the code provided by Matlab
T = tonndata(input,true,false);
[x,xi,ai,t] = preparets(net,{},{},T);
% Closed Loop Network
netc = closeloop(net);
netc.name = [net.name ' - Closed Loop'];
view(netc)
[xc,xic,aic,tc] = preparets(netc,{},{},T);
yc = netc(xc,xic,aic);
closedLoopPerformance = perform(net,tc,yc)
% Step-Ahead Prediction Network
nets = removedelay(net);
nets.name = [net.name ' - Predict One Step Ahead'];
view(nets)
[xs,xis,ais,ts] = preparets(nets,{},{},T);
ys = nets(xs,xis,ais);
stepAheadPerformance = perform(nets,ts,ys)
Thank you very much

7 Comments

You cannot train a net, then be given an arbitrary set of data and expect anything useful to result.
Or am I missing something?
Greg
Hi Greg,
My main aim is to use a Neural Network to make predictions on time series. I used the time series app provided by the Neural Network Toolbox to make predictions, considering 40 timesteps (forty years). The algorithms provided by the matlab were used to forecast each year of the serie (aiming to evaluate the error between the original data and the predicted data) and to simulate a step ahead (prediction for next year). This is ok, but I intend to do a multi-step prediction (next five years ahead) considering this network. Is it possible ? Is there any algorithm to do this ?
Thank you. Best regards
If you design a net to predict 1 step a head, you have to call it 5 times to predict 5 points a head.
Alternatively, you can design it to predict 5 steps ahead.
Just use the given algorithm.
Greg
Then, should I try a loop using "for" command ?
Thank you
Greg Heath
Greg Heath on 13 Feb 2018
Edited: Greg Heath on 13 Feb 2018
You can, but why not just train it for 5 timesteps instead of the default?
Or, why not educate yourself and do both?
It is VERY DIFFICULT to be sure that comments and answers are accurate when you only post sections of code.
In addition, if you want to compare numbers, you have to include the initial state of the random number generator. I typically use
rng(0) or rng('default')
before training the first of multiple designs.
Ok, I'll do it. Thank you.

Sign in to comment.

Answers (0)

Asked:

on 31 Jan 2018

Commented:

on 16 Feb 2018

Community Treasure Hunt

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

Start Hunting!