Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Prediction of future values using narnet
Replies: 1   Last Post: Apr 9, 2014 4:31 AM

 Messages: [ Previous | Next ]
 Elma Redzic Posts: 1 Registered: 1/24/14
Prediction of future values using narnet
Posted: Jan 24, 2014 4:22 AM

I have time series of hourly data during the period from 1980 to 2005 (219000 timesteps), and I need to predict those values for the period 2006-2012 (52560 timesteps). I have generated the code using NN Toolbox, but I need to make clear next issues: How can I get predicted values based on the created network for next 6 years? I know that closed loop is used for multi-step prediction, but the elements of resulting array yc have constant values. Is that value prediction for timestep y(t+1)? How can I get predictions for additional 52559 timesteps?

I created the code by nn toolbox, and I used divideblock division since the time serie is considered.

The code:

if true
% WSin - feedback time series.
targetSeries = WSin;
feedbackDelays = 1:4;
hiddenLayerSize = 10;
net = narnet(feedbackDelays,hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
[inputs,inputStates,layerStates,targets] = preparets(net,{},{},targetSeries);
% Setup Division of Data for Training, Validation, Testing
net.divideFcn = 'divideblock'; % Divide data in blocks net.divideMode = 'time'; % Divide up every value
net.trainFcn = 'trainrp';
net.performFcn = 'mse'; % Mean squared error net.trainParam.epochs=2000;
% Train the Network
[net,tr] = train(net,inputs,targets,inputStates,layerStates);
% Test the Network
outputs = net(inputs,inputStates,layerStates); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs)
% Recalculate Training, Validation and Test Performance
trainTargets = gmultiply(targets,tr.trainMask); valTargets = gmultiply(targets,tr.valMask); testTargets = gmultiply(targets,tr.testMask); trainPerformance = perform(net,trainTargets,outputs) valPerformance = perform(net,valTargets,outputs) testPerformance = perform(net,testTargets,outputs)
% View the Network
view(net)
% Closed Loop Network
netc = closeloop(net); [xc,xic,aic,tc] = preparets(netc,{},{},targetSeries); yc = netc(xc,xic,aic); perfc = perform(net,tc,yc)
end

Thank you very much in advance for helping me with this, I have tried to find an answer in earlier topics, but since I tried everything I read, I needed to ask you.

With kind regards

Date Subject Author
1/24/14 Elma Redzic
4/9/14 Greg Heath