Neural Network NAR-based time-series prediction starts failing after several timesteps
Mostrar comentarios más antiguos
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 on
plot(cell2mat(y),'r')
And the results I am getting are illustrated in the next figure (target-black; prediction-red)

Respuesta aceptada
Más respuestas (1)
Greg Heath
el 15 de Mzo. de 2013
I took a look at the openloop problem
N = 1000
dx = 0.1
x = dx*(0:N-1);
t = cos(x);
[ I N ] = size(x)
[O N ] = size(t)
X = con2seq(x);
T = con2seq(t);
ID = [];
FD = 1:63; % One Period
[trnind,valind,tstind] = divideblock( N, 0.7, 0.15, 0.15);
ttrn = t(trnind); tval = t(valind); ttst = t(tstind);
Ntrn = length(ttrn), Nval = length(tval), Ntst = length(ttst)
MSEtrn00 = mean(var(ttrn',1))
MSEtrn00a = mean(var(ttrn',0))
MSEval00 = mean(var(tval',1))
MSEtst00 = mean(var(ttst',1))
Ntrneq = Ntrn*O
NID = length(ID)*I
NFD = length(FD)*O
ND = NID+NFD
LDB = max([ ID, FD ])
if min(ID)==0 & max(ID)>=max(FD)
LDB = LDB+1
end
%Nw = (ND+1)*H+(H+1)*O
Hub = -1 + ceil((Ntrneq-O)/(ND+O+1)) % 10
Hmax = Hub, dH = 1, Hmin = 0
Ntrials = 10
for H = Hmin:dH:Hmax
for i = 1:Ntrials
-----SNIP
end
end
% maxBestepoch =
% 1 15 17 9 10 7 6 6 7 6 6
% maxR2trn =
% -0.597 0.990 0.992 0.992 0.994 0.993 0.995 0.996 0.997 0.998 0.999
% maxR2trna =
% -0.755 0.989 0.990 0.989 0.990 0.987 0.989 0.987 0.9898 0.988 0.989
% maxR2val =
% -0.567 0.989 0.991 0.992 0.993 0.993 0.995 0.995 0.997 0.998 0.999
% maxR2tst =
% -0.951 0.990 0.992 0.993 0.994 0.992 0.995 0.996 0.997 0.998 0.999
Well, the H=0 results are lousy but the H = 1 results are very good.
I am surprised at both results.
Greg
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!