cannot get good result by newff
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone, i have 12 years daily data,and i'm trying to use newff to forecast daily, monthly.i define my data as first 3 years as input and forth years as target.it means i have a (1905:4) matrix.and i'm using nn code as below, but unfortunately i don't get good result.as i'm new in matlab cannot figure out the problem.please someone help me(new code,new advice,...). and another question is how should i define my data for monthly forecasting. thanks reza
my code is:
Close all;
clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% to create the data for the model"
% and preprocess it to be compatable with neural network%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load Input
num=data;
input1=num(:,1);
input2=num(:,2);
input3=num(:,3);
t=num(:,4);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this part to start the trainign session for the ANN model%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p1=num(1:750,(1:3)); p11=p1';
A =t(1:750,1); A1=A';
net_gas = newff([ 0 1;0 1;0 1],[10,25,1],{'tansig','tansig','purelin'},'trainlm');
net_gas.trainParam.show = 100;
net_gas.trainParam.epochs = 150;
%net5.performFcn = 'msereg';
%net5.performParam.ratio = 0.1;
net_gas.trainParam.goal = 1e-10;
%training session
net_gas=train(net_gas,p11,A1);
save net_gas
%Simulation session
y1 = sim(net_gas,p11);
y1f= y1;
H1=y1f';
%H2=H1*388.8;
%Neural Network Performance
Error= (H1-dm(1:750))./dm(1:750)*100;
figure
x= 1:1:750;
plot (x, Error); grid
xlabel('Expr#');
ylabel('%Error');
title('NN performance for H');
axis([1 750 -25 25]);
%Test session
pt1=num((751:1095),(1:3));
pt11=pt1';
yt1 = sim(net_gas,pt11);
yt1f= yt1;
Ht1=yt1f';
%Ht2= Ht1*388.8;
Error_test= (Ht1-dm(751:1095))./dm(751:1095)*100;
figure
xt= 1:1:365;
plot (xt, Error_test); grid
xlabel('Exp#');
ylabel('%Error_test');
title('NN performance for H');
axis([1 365 -100 100]);
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!