Thread Subject: forecasting with neuro-fuzzy algorithm, Sugeno

Subject: forecasting with neuro-fuzzy algorithm, Sugeno

From: Tetiana

Date: 15 Nov, 2009 12:57:00

Message: 1 of 4

Hi everyone! I really need your help!!!!
I've got the next problem.
I have a time series (~312 observations). I use part of this time series (300 observations) for training by neuro-fuzzy algorithm, and other part left for checking (12 observations). The model for time series is Y(k+n)=F(Y(k),.....,Y(k+n-nm)). So in different variations I can have input files that consists of 2,3,4,5 columns (where the last is output). And I'm having problems with the program output. All inputs are in the range [0;11] and when I build forecast program gives me numbers like 4000, -200.... I understand that here I use Sugeno model of 2-order and when I checked parameters of the model after training (model out_fis from my algorithm) there ere numbers like: for one of outputs [-45 56 0.3 -123]...
Help me! What I did wrong in this program and how to avoid these big numbers??????
I programmed the next Algorithm:
clear all;
% input parameters
color = ['r', 'm', 'c', 'y', 'w', 'b']
for zdvizhka = 1:6 % lag
indF = zdvizhka; % index of function
NumPoint = 1;

a=load('d_83_05.txt'); last=load('last_06.txt');
h=[];
YStart=1;
YEnd=23;
for i=YStart:YEnd
    for j=1:12
        h=[h;a(i,j)];
    end;
end;

N=length(h);
in=[];
for i=1:NumPoint
    in=[in,h((1+zdvizhka*(NumPoint-i)):(N-zdvizhka*i))];
end;
out=h((1 + zdvizhka*NumPoint):N);
inout=[in,out];

fis=genfis1(inout,3,'trimf','linear');
epoch_n = 20;
out_fis = anfis(inout,fis,epoch_n);
%------------------------after anfisedit
plot(last,'k');
hold on

funcCount=indF;
startIndex1 = 277-funcCount;
k1=startIndex1;
for i=0:funcCount - 1
    h(startIndex1 + i)=evalfismex([h(k1 + i)],out_fis,NumPoint);
end;
startIndex2 = 277;
k2 = startIndex2 - indF; %+ ind2;
for i=0:11 %prognoz
    h(startIndex2 + i)=evalfismex([h(k2 + i)],out_fis,NumPoint);
end;

hold on
plh=[];
for i=277:288
    plh=[plh;h(i)];
end;
plot(plh, color(zdvizhka))
t = 0;
for i=0:11
    t = t + h(277 + i);
end;

err = 0;
for i=1:12
    err = err + (last(i)-h(276+i))^2;
end;
ERROR=(err/12)^1/2
end;

Subject: forecasting with neuro-fuzzy algorithm, Sugeno

From: tarokh

Date: 9 Feb, 2010 10:54:04

Message: 2 of 4

"Tetiana " <kotavi@i.ua> wrote in message <hdotqs$h5q$1@fred.mathworks.com>...
> Hi everyone! I really need your help!!!!
> I've got the next problem.
> I have a time series (~312 observations). I use part of this time series (300 observations) for training by neuro-fuzzy algorithm, and other part left for checking (12 observations). The model for time series is Y(k+n)=F(Y(k),.....,Y(k+n-nm)). So in different variations I can have input files that consists of 2,3,4,5 columns (where the last is output). And I'm having problems with the program output. All inputs are in the range [0;11] and when I build forecast program gives me numbers like 4000, -200.... I understand that here I use Sugeno model of 2-order and when I checked parameters of the model after training (model out_fis from my algorithm) there ere numbers like: for one of outputs [-45 56 0.3 -123]...
> Help me! What I did wrong in this program and how to avoid these big numbers??????
> I programmed the next Algorithm:
> clear all;
> % input parameters
> color = ['r', 'm', 'c', 'y', 'w', 'b']
> for zdvizhka = 1:6 % lag
> indF = zdvizhka; % index of function
> NumPoint = 1;
>
> a=load('d_83_05.txt'); last=load('last_06.txt');
> h=[];
> YStart=1;
> YEnd=23;
> for i=YStart:YEnd
> for j=1:12
> h=[h;a(i,j)];
> end;
> end;
>
> N=length(h);
> in=[];
> for i=1:NumPoint
> in=[in,h((1+zdvizhka*(NumPoint-i)):(N-zdvizhka*i))];
> end;
> out=h((1 + zdvizhka*NumPoint):N);
> inout=[in,out];
>
> fis=genfis1(inout,3,'trimf','linear');
> epoch_n = 20;
> out_fis = anfis(inout,fis,epoch_n);
> %------------------------after anfisedit
> plot(last,'k');
> hold on
>
> funcCount=indF;
> startIndex1 = 277-funcCount;
> k1=startIndex1;
> for i=0:funcCount - 1
> h(startIndex1 + i)=evalfismex([h(k1 + i)],out_fis,NumPoint);
> end;
> startIndex2 = 277;
> k2 = startIndex2 - indF; %+ ind2;
> for i=0:11 %prognoz
> h(startIndex2 + i)=evalfismex([h(k2 + i)],out_fis,NumPoint);
> end;
>
> hold on
> plh=[];
> for i=277:288
> plh=[plh;h(i)];
> end;
> plot(plh, color(zdvizhka))
> t = 0;
> for i=0:11
> t = t + h(277 + i);
> end;
>
> err = 0;
> for i=1:12
> err = err + (last(i)-h(276+i))^2;
> end;
> ERROR=(err/12)^1/2
> end;

Subject: forecasting with neuro-fuzzy algorithm, Sugeno

From: xing

Date: 24 Feb, 2010 09:12:03

Message: 3 of 4

I found the same problem also.
It seems that the anfis prediction always give one-step lag in prediction

I don not know why....

and I hope that some one could give me the help


"tarokh " <dfaljnlkjkju@gmail.com> wrote in message <hkresc$g8g$1@fred.mathworks.com>...
> "Tetiana " <kotavi@i.ua> wrote in message <hdotqs$h5q$1@fred.mathworks.com>...
> > Hi everyone! I really need your help!!!!
> > I've got the next problem.
> > I have a time series (~312 observations). I use part of this time series (300 observations) for training by neuro-fuzzy algorithm, and other part left for checking (12 observations). The model for time series is Y(k+n)=F(Y(k),.....,Y(k+n-nm)). So in different variations I can have input files that consists of 2,3,4,5 columns (where the last is output). And I'm having problems with the program output. All inputs are in the range [0;11] and when I build forecast program gives me numbers like 4000, -200.... I understand that here I use Sugeno model of 2-order and when I checked parameters of the model after training (model out_fis from my algorithm) there ere numbers like: for one of outputs [-45 56 0.3 -123]...
> > Help me! What I did wrong in this program and how to avoid these big numbers??????
> > I programmed the next Algorithm:
> > clear all;
> > % input parameters
> > color = ['r', 'm', 'c', 'y', 'w', 'b']
> > for zdvizhka = 1:6 % lag
> > indF = zdvizhka; % index of function
> > NumPoint = 1;
> >
> > a=load('d_83_05.txt'); last=load('last_06.txt');
> > h=[];
> > YStart=1;
> > YEnd=23;
> > for i=YStart:YEnd
> > for j=1:12
> > h=[h;a(i,j)];
> > end;
> > end;
> >
> > N=length(h);
> > in=[];
> > for i=1:NumPoint
> > in=[in,h((1+zdvizhka*(NumPoint-i)):(N-zdvizhka*i))];
> > end;
> > out=h((1 + zdvizhka*NumPoint):N);
> > inout=[in,out];
> >
> > fis=genfis1(inout,3,'trimf','linear');
> > epoch_n = 20;
> > out_fis = anfis(inout,fis,epoch_n);
> > %------------------------after anfisedit
> > plot(last,'k');
> > hold on
> >
> > funcCount=indF;
> > startIndex1 = 277-funcCount;
> > k1=startIndex1;
> > for i=0:funcCount - 1
> > h(startIndex1 + i)=evalfismex([h(k1 + i)],out_fis,NumPoint);
> > end;
> > startIndex2 = 277;
> > k2 = startIndex2 - indF; %+ ind2;
> > for i=0:11 %prognoz
> > h(startIndex2 + i)=evalfismex([h(k2 + i)],out_fis,NumPoint);
> > end;
> >
> > hold on
> > plh=[];
> > for i=277:288
> > plh=[plh;h(i)];
> > end;
> > plot(plh, color(zdvizhka))
> > t = 0;
> > for i=0:11
> > t = t + h(277 + i);
> > end;
> >
> > err = 0;
> > for i=1:12
> > err = err + (last(i)-h(276+i))^2;
> > end;
> > ERROR=(err/12)^1/2
> > end;

Subject: forecasting with neuro-fuzzy algorithm, Sugeno

From: Riyman

Date: 3 Mar, 2010 10:39:04

Message: 4 of 4

"Tetiana " <kotavi@i.ua> wrote in message <hdotqs$h5q$1@fred.mathworks.com>...
> Hi everyone! I really need your help!!!!
> I've got the next problem.
> I have a time series (~312 observations). I use part of this time series (300 observations) for training by neuro-fuzzy algorithm, and other part left for checking (12 observations). The model for time series is Y(k+n)=F(Y(k),.....,Y(k+n-nm)). So in different variations I can have input files that consists of 2,3,4,5 columns (where the last is output). And I'm having problems with the program output. All inputs are in the range [0;11] and when I build forecast program gives me numbers like 4000, -200.... I understand that here I use Sugeno model of 2-order and when I checked parameters of the model after training (model out_fis from my algorithm) there ere numbers like: for one of outputs [-45 56 0.3 -123]...
> Help me! What I did wrong in this program and how to avoid these big numbers??????
> I programmed the next Algorithm:
> clear all;
> % input parameters
> color = ['r', 'm', 'c', 'y', 'w', 'b']
> for zdvizhka = 1:6 % lag
> indF = zdvizhka; % index of function
> NumPoint = 1;
>
> a=load('d_83_05.txt'); last=load('last_06.txt');
> h=[];
> YStart=1;
> YEnd=23;
> for i=YStart:YEnd
> for j=1:12
> h=[h;a(i,j)];
> end;
> end;
>
> N=length(h);
> in=[];
> for i=1:NumPoint
> in=[in,h((1+zdvizhka*(NumPoint-i)):(N-zdvizhka*i))];
> end;
> out=h((1 + zdvizhka*NumPoint):N);
> inout=[in,out];
>
> fis=genfis1(inout,3,'trimf','linear');
> epoch_n = 20;
> out_fis = anfis(inout,fis,epoch_n);
> %------------------------after anfisedit
> plot(last,'k');
> hold on
>
> funcCount=indF;
> startIndex1 = 277-funcCount;
> k1=startIndex1;
> for i=0:funcCount - 1
> h(startIndex1 + i)=evalfismex([h(k1 + i)],out_fis,NumPoint);
> end;
> startIndex2 = 277;
> k2 = startIndex2 - indF; %+ ind2;
> for i=0:11 %prognoz
> h(startIndex2 + i)=evalfismex([h(k2 + i)],out_fis,NumPoint);
> end;
>
> hold on
> plh=[];
> for i=277:288
> plh=[plh;h(i)];
> end;
> plot(plh, color(zdvizhka))
> t = 0;
> for i=0:11
> t = t + h(277 + i);
> end;
>
> err = 0;
> for i=1:12
> err = err + (last(i)-h(276+i))^2;
> end;
> ERROR=(err/12)^1/2
> end;




Hi ,
Could you sned the input:
'd_83_05.txt' and 'last_06.txt'

r_iman_2008@hotmail.com

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
forecasting neu... Tetiana 15 Nov, 2009 07:59:04
rssFeed for this Thread

Contact us at files@mathworks.com