Forecast with GRNN

Hello,
I would like to make a multi step ahead prediction with GRNN network. My idea is: I make a one step ahead prediction and with a for loop I train the network again with the earlier predicted data. So I get a multi step forecast. I made the code, but the prediction is always a horizontal line! I do not know what is the problem!
Here is my code:
%--------------Paraméterek------------------
adatSzam = 500;
N = 20;
%--------------Adatok betöltése, előkészítése--------------
load('C:\Neuroforex\Adatok\HMA35nnagy.mat');
imputSeries1 = HMA35nnagy(1:adatSzam)';
for i=1:N
X = [1:length(imputSeries1)]
T = imputSeries1;
%--------------GRNN előállítása------------------
spread = 0.1;
net = newgrnn(X,T,spread);
view(net);
trainOutput = net(X);
%-------------Becslés beállítása----------------
predictSeries = [length(imputSeries1)+1];
yPred = net(predictSeries);
%-----------------Plot 1 lefutásra-------------------------
hold on;
%Bemeneti adatok plottolása
plot(X,T,'k','markersize',2,'color','black')
outputline = plot(X,trainOutput,'o','markersize',2,'color','blue');
%Becslés plottolása
%plot(predictSeries,[yPred(1:end-1),nan(1,1)],'linewidth',1,'color','red')
predict = plot(predictSeries,[nan(1,length(predictSeries-1)),yPred],'o','markersize',2,'color','green');
%plot([nan(1,length(imputSeries1)),yPred(end:end)],'linewidth',1,'color','green');
title('Becslés eredménye')
xlabel('Gyertyaszám')
ylabel('Keresztárfolyam')
%-----------Jelenlegi becslés hozzáadása a bemeneti adatokhoz--------
imputSeries1 = [imputSeries1, yPred(end:end)];
end
Picture of the predict:
Thanks Adam

 Risposta accettata

Greg Heath
Greg Heath il 29 Nov 2011

0 voti

Newgrnn is not appropriate for timeseries prediction.
Use newfftd.
help newfftd
doc newfftd
Search the archives
newfftd
heath newfftd
Hope this helps.
Greg

1 Commento

Adam Farkas
Adam Farkas il 29 Nov 2011
Hi Greg,
I have already made a NARX network, but my forecasted results weren't good enough. Thats's why I started to search for other solutions. I found an article with GRNN prediction:
http://www.neural-forecasting-competition.com/downloads/NN3/methods/44-NN3_WeizhongYan.pdf
I already tried to define delays in grnn.m file. So my question is: Is there any way to predict with GRNN?
Thanks Adam

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by