Predict futures values in ntstool (NAR)
Show older comments
I have used ntstool to create a neural network say net . I am using NAR. I have a vector v of size 271 x 1 having data of an element at 271 timesteps. I am assuming d to be 5 , i.e, value at each step is dependent of 5 previous steps. Now I need the value of my element at 272th step. What is the syntax to do do?
A peculiar observation is the command sim(net,t); or net(t); where t is any row vector returns me same value independent on the choice of vector t.
Here is my training function:
function results = time_series(input,hiddenLayerSize,train_function, validation_no,test_no,time_step,iterations)
targetSeries = tonndata(input,false,false);
feedbackDelays = 1:time_step;
net = narnet(feedbackDelays,hiddenLayerSize);
% Choose Feedback Pre/Post-Processing Functions
% Settings for feedback input are automatically applied to feedback output
% For a list of all processing functions type: help nnprocess
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
[inputs,inputStates,layerStates,targets] = preparets(net,{},{},targetSeries);
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'time'; % Divide up every value
net.divideParam.trainRatio = (100-validation_no-test_no)/100;
net.divideParam.valRatio = validation_no/100;
net.divideParam.testRatio = test_no/100;
net.trainFcn = train_function; % Levenberg-Marquardt
for i= 1:iterations
[net,tr] = train(net,inputs,targets,inputStates,layerStates);
end;
% View the Network
%view(net);
if(closed_loop)
netc = closeloop(net);
[xc,xic,aic,tc] = preparets(netc,{},{},targetSeries);
yc = netc(xc,xic,aic);
perfc = perform(net,tc,yc);
nets = removedelay(net);
[xs,xis,ais,ts] = preparets(nets,{},{},targetSeries);
ys = nets(xs,xis,ais);
closedLoopPerformance = perform(net,tc,yc);
end
results.net = net;
results.inputs = inputs;
end
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!