Need help NARX Neural Network forecasting methodology. 1,6,12 hours / step ahead ???
1 view (last 30 days)
Show older comments
Noor Mohd Safar
on 15 Jan 2016
Commented: Saeed Bello
on 30 Mar 2021
I read a lots of post in NARX topics/solutions, I'm very novice in this NN architecture/algorithm. I'm not sure what am I doing now is correct or not
This is what I'm going to do I want to use ANN with Back Propagation Multilayer perceptron model to predict rainfall rate. First I need to predict whether it is raining or not raining, then followed by the 1,6,12 hour look ahead prediction.
-Input data would be humidity, wind speed, pressure, temperature , dew point
-target is the rainfall rate
I have a data that in one hour interval for each input variable.
My questions are: 1- What is the input delay and feedback delay ( is it , if I want to forecast the next 6 hours , should I just set the input delay 1:6 ??? and 1:12 for the next 12 hours? 2- OR should I just create each dataset for each forecast time (t+n) ???
Here is my code
Input_Parameter = tonndata(ANN_num_TEST(:,[1:5]),false,false);
Target_Parameter = tonndata(ANN_num_TEST(:,6),false,false);
trainFcn = 'trainbr'; % Bayesian Regularization
% trainFcn = 'trainlm';
% trainFcn = 'trainrp';
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 1:1;
feedbackDelays = 1:1;
hiddenLayerSize = 10;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
% Prepare the Data for Training and Simulation
[Input_Net,Input_Net_initial,Layer_Delay_initial,Target_Net] = preparets(net,Input_Parameter,{},Target_Parameter);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 80/100;
net.divideParam.valRatio = 10/100;
net.divideParam.testRatio = 10/100;
% net.trainParam.max_fail = 50;
net.trainParam.min_grad=1e-10;
net.trainParam.show=10;
net.trainParam.lr=0.01;
net.trainParam.epochs=1000;
net.trainParam.goal=0.01;
% Train the Network
[net,tr] = train(net,Input_Net,Target_Net,Input_Net_initial,Layer_Delay_initial);
% Test the Network
% y = net(x,xi,ai);
Prediction_Result = net(Input_Net,Input_Net_initial,Layer_Delay_initial);
e = gsubtract(Target_Net,Prediction_Result);
performance = perform(net,Target_Net,Prediction_Result);
% View the Network
% view(net)
% variable for plot actual vs prediction
Prediction = (cell2mat(Prediction_Result))';
Cluster = (cell2mat(Target_Net))';
3- Is the forecast for t+1 ? Should I use multistep ahead NARX ???
Thank you
This is the result for 1 step ahead , why it is shifting?
1 Comment
Saeed Bello
on 30 Mar 2021
I have similar question asked above.
Does anyone have answer to this question?
Thank you in advance.
Accepted Answer
Greg Heath
on 24 Jan 2016
Edited: Greg Heath
on 24 Jan 2016
Choose the number of lags from the number of significant lags in the input/target crosscorrelation function and the target autocorrelation function.
I have zillions of examples in both the NEWSGROUP and ANSWERS just search on
greg nncorr
Hope this helps.
Thank you for formally accepting my answer
Greg
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows 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!