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
Best Answer