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. In fact, the first few values are different, and all the others are constant. Is the last or the first value of array yc 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.
load('WSin.mat')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
On this picture is the output of the open loop network, and it is ok.
On this picture is shown the output of the closed-loop network, with same input data, so I'am not sure if the next predicted value of the network is first or last, and is this should be like this?
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
Best Answer