Prediction using Neural Network with multiple external input variables
Show older comments
Hi I am trying to forecast rainfall using five external variables. I search the net for help and found this post (<http://www.mathworks.com/matlabcentral/answers/14970-neural-network-multi-step-ahead-prediction)helpful>, specially the answer given by Mark Hudson Beale. I have rainfall data from 1900 - 2014 and I want to predict rainfall for the next ten years (2015 - 2025). I have working codes up to test the network (given below). After that I need to predict rainfall for next ten years. I tried to get help from the codes given by Mark Hudson Beale, but I have error in the line Ai2 = mat2cell([zeros(10,2); Ai2],[10 1],ones(1,2));. I would greatly appreciate any help to solve this issue
load Rain;
X = [TMax,TMin,Evap,VP,Rad];
X = tonndata(X,false,false);
T = tonndata(Rain,false,false);
trainFcn = 'trainlm';
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
[x,xi,ai,t] = preparets(net,X,{},T);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t,xi,ai);
% Test the Network
y = net(x,xi,ai);
e = gsubtract(t,y);
performance = perform(net,t,y)
%Performance (last 120 predictions)
pred_test = (y(1391:end));
actual_test = (t(1391:end));
performance_test = perform(net,pred_test, actual_test)
RMSE = sqrt(performance_test)
Accepted Answer
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!