Neural Network - Multi Step Ahead Prediction
Show older comments
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
Greg Heath
on 31 Jan 2018
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
Emerson Abraham
on 2 Feb 2018
Edited: Emerson Abraham
on 2 Feb 2018
Greg Heath
on 3 Feb 2018
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
Emerson Abraham
on 6 Feb 2018
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?
Greg Heath
on 13 Feb 2018
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.
Emerson Abraham
on 16 Feb 2018
Answers (0)
Categories
Find more on Signal Modeling 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!