Reputation: 31738
Given a set of past values of a variable, how can future ones be predicted with MATLAB's narnet
?
An example given my MATLAB's Neural Net Time Series App is as follows:
T = oil_dataset;
net = narnet(1:2,10);
[Xs,Xi,Ai,Ts] = preparets(net,{},{},T);
net = train(net,X,T,Xi,Ai);
view(net) Y = net(Xs,Xi,Ai)
plotresponse(T,Y)
How could say the next 10 values be predicted of the oil_dataset
?
Upvotes: 0
Views: 1403
Reputation: 3635
If you use the Matlab NSTTool, at the very last step, you can automatically generate a script with examples (click on "Advanced script" box). In this code, there is an example of how to predict multiple values. The function used is cnet.
This is the part of the code I generated for my own net:
[x1,xio,aio,t] = preparets(net,{},{},T);
[y1,xfo,afo] = net(x1,xio,aio);
[netc,xic,aic] = closeloop(net,xfo,afo);
[y2,xfc,afc] = netc(cell(0,20),xic,aic); % Predict next 20 values
Upvotes: 1