I am starting to experiment with NAR-based time-series prediction. I've followed several tutorials to write a small simple script to predict a simple sin(t) signal. The resulting prediction is quite good (as expected) at the begining, but as time progresses, the network starts failing catastrophically. Is there anything I am doing wrong?
Here is the code I am using:
DELAY=1:100;HIDDEN=[10];t=linspace(1,100,1000);prueba=cos(t);datos=prueba;net = narnet(DELAY,HIDDEN);[Xs,Xi,Ai,Ts] = preparets(net,{},{},num2cell(datos));net = train(net,Xs,Ts,Xi,Ai);net = closeloop(net);[Xs,Xi,Ai,Ts] = preparets(net,{},{},num2cell(prueba));y = net(Xs,Xi,Ai);plot(prueba(DELAY(end)+1:end),'k')hold onplot(cell2mat(y),'r')
And the results I am getting are illustrated in the next figure (target-black; prediction-red)
Best Answer