load forecasting using NARNET

3 views (last 30 days)
Ehsan
Ehsan on 1 Jan 2015
Answered: Greg Heath on 6 Jan 2015
Hi folks,
I am using narnet to forecast one step ahead of power system load. I am using NARNET wizard. First of all, let's give it an array of ten elements and predict 11th element.
if true
targetSeries = tonndata(yyt,true,false);
%yyt is an array of ten elemnts:
[749.8398 739.8419 719.8462 709.8483 689.8526 709.8483 739.8419 759.8376 709.8483 739.8419]
feedbackDelays = 1:9;
% I am confused here, what the f**k is going on with this delay thing? if I give it 9, it forecasts the 10th point which I already have it. So I thought I would need to remove one delay to get one more forecast. Am I right?
hiddenLayerSize = 10; %whatever
net = narnet(feedbackDelays,hiddenLayerSize); %whatever
[inputs,inputStates,layerStates,targets] = preparets(net,{},{},targetSeries); %same sh*t
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,inputs,targets,inputStates,layerStates);% Apparently training
outputs = net(inputs,inputStates,layerStates);
%This should give me next value of my series, the dumb net just gives me the 10th point I already entered
%How about this?
net = removedelay(net,1);
%Now if I train net and get the output, it gives me a 1*2 cell. Clearly, I will go with the second point as my forecast, right?
end
Alright, now let's look at what I got out of the script:
Actual 749.8397827 739.841938 719.846189 709.8483443 689.8525953 709.8483443 739.841938
One step ahead Forecast 750.0746601 749.8397827 740.2006302 719.8708696 708.7710368 689.8413695 717.4414728
Look at the bold numbers. Do you see the shifting pattern? it seems that my two step ahead forecast and actual value are almost equal. However, I do not have two step ahead forecast(e.g forecast(t=2)) unless I have the actual load of one step prior (actual(t=1)). What is going on here?

Accepted Answer

Greg Heath
Greg Heath on 6 Jan 2015
You do not have enough data (N=11) to do anything useful. Use one or more of the MATLAB example data sets
help nndatasets
doc nndatasets
[ O N ] = size(target)
NFD = No. of feedback delays
H = No. of hidden nodes
Ntrn = N-2*round(0.15*N) Default No. of training examples
Ntrneq = Ntrn*O % No. of training equations
Nw = (NFD*O+1)*H+(H+1)*O % No. of unknown weights
Want Ntrneq >= Nw. Prefer Ntrneq >> Nw
With your numbers
O = 1, N=11, NFD = 9, H = 10, Ntrn = 8,Ntrneq = 8, Nw = 10*10++11 = 111
If you use all 11 for training, no hidden layer (Just a linear 1-D feedback model) and NFD = 1
O = 1, N = Ntrn = 11, NFD = 1, H = [], Ntrneq = 11, Nw = (1+1)*1 +1 = 3 (1 feedback and 2 biases)
net = narnet(1,[]);
I suggest you get more data (e.g., a MATLAB Example dataset.
Hope tis helps.
Greg

More Answers (0)

Categories

Find more on Deep Learning Toolbox 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!