HI, please help me to forecast feature groundwater level using feed forward neural network with LM algorithm, i developed the feed forward neural network with LM algorithm with ANN architecture 3-5-1, my model is as follows, but i want to use this model for forecasting at least 3 to 6 point ahead, can any one please help me,
clear all;
clc;
load dannlm.txt;
t=dannlm(:,1);
rain=dannlm(:,2);
et=dannlm(:,3);
gwl=dannlm(:,4);
%[ACF, Lags, Bounds] = autocorr(gwl, [], 2);
%[PACF, Lags, Bounds] = parcorr(gwl, [], 2);
%[CCF, Lags, Bounds] = crosscorr(gwl,rain);
gwlmin=min(gwl);
gwlmax=max(gwl);
rain=(rain-min(rain))/(max(rain)-min(rain));
et=(et-min(et))/(max(et)-min(et));
gwl=(gwl-min(gwl))/(max(gwl)-min(gwl));
%*****Data Preparation****
for t=5:195
Data(t-4,:)=[rain(t-4) et(t-1) gwl(t-1) gwl(t)];
end
%Define Input patter for Training and Validation
INPTR=Data(1:150, 1:3);
TARTR=Data(1:150,4);
net=newff([0 1; 0 1; 0 1], [5 1], {'logsig', 'purelin'}, 'trainlm');
net.trainParam.epochs=500;
net.trainParam.goal=0.0001;
net.performFcn='mse';
net=init(net);
net=train(net, INPTR', TARTR');
a=sim(net, INPTR');
z=[a' TARTR];
INPVAL=Data(151:191, 1:3);
TARVAL=Data(151:191,4);
y=sim(net, INPVAL');
zv=[y' TARVAL];
%Converting back to Original Flow of gwl Validation
zv=zv*(gwlmax-gwlmin)+gwlmin;
save val1.txt zv -ascii;
z=z*(gwlmax-gwlmin)+gwlmin;
save cal1.txt z -ascii;
CORR_CAL=corrcoef(z)
CORR_VAL=corrcoef(zv)
COM_CAL=z(:,1);
OBS_CAL=z(:,2);
COM_VAL=zv(:,1);
OBS_VAL=zv(:,2);
Eff_ANN_CAL=1-(sumsqr(OBS_CAL-COM_CAL)/sumsqr(OBS_CAL-mean(OBS_CAL)))
Eff_ANN_VAL=1-(sumsqr(OBS_VAL-COM_VAL)/sumsqr(OBS_VAL-mean(OBS_VAL)))
RMSE_ANN_CAL=sqrt(sumsqr(OBS_CAL-COM_CAL)/length(OBS_CAL))
RMSE_ANN_VAL=sqrt(sumsqr(OBS_VAL-COM_VAL)/length(OBS_VAL))
Ex_Var_ANN_CAL=sqrt(sumsqr(COM_CAL-mean(OBS_CAL))/sumsqr(OBS_CAL-mean(OBS_CAL)))
%ERROR_CAL=100*(OBS_CAL-COM_CAL)/OBS_CAL;
%ERROR_VAL=100*(OBS_VAL-COM_VAL)/OBS_VAL;
ANN_PEAK_CAL=(1-max(COM_CAL)/max(OBS_CAL))*100
ANN_PEAK_VAL=(1-max(COM_VAL)/max(OBS_VAL))*100

1 Kommentar

Anand Kumar
Anand Kumar am 8 Mai 2015
Please convert above attachment to forecast at least 3 to 6 point ahead

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Greg Heath
Greg Heath am 11 Mai 2015

0 Stimmen

help narxnet
doc narxnet
net = narxnet(3:6,3:6,5);
===================================================================
% ===>GEH1: WHAT DO THE NAMES DANNLM AND ET STAND FOR?
% ===> GEH2: AUTOCORR(gwl,...), CROSSCORR(GWL,RAIN,...) AND % CROSSCORR(GWL,ET,...) CAN BE USED TO FIND THE SIGNIFICANT DELAYS.
for t=5:195
Data(t-4,:)=[rain(t-4) et(t-1) gwl(t-1) gwl(t)];
end
% ===>GEH3: What is the rationale for this combination?
% ===> GEH4: NEWFF has been obsolete for at least 5 years. Regardless, this is a time series problem which is more easily solved using NARXNET or it's obsolete predecessor.
z=[a' TARTR];
% ===>GEH5: Why not compute the error mse(a'-TARTR) ???
INPVAL=Data(151:191, 1:3);
TARVAL=Data(151:191,4);
% ===> GEH6: This is TEST data, NOT VALIDATION DATA! VALIDATION DATA IS USED TO TUNE PARAMETERS. TEST DATA IS USED TO OBTAIN UNBIASED ESTIMATES OF PERFORMANCE
% THAT IS AS FAR AS I WENT. AFTER CALCULATING
NMSE = mse(error)/mean(var(target',1) and/or
R2 = 1-NMSE
%SUCCESS OR FAILURE IS DETERMINED
Hope this helps.
Thank you for formally accepting my answer
Greg

Weitere Antworten (0)

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by