Narxnet: time shift of predicted value with respect to real target value
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ilaria Di Fresco
el 23 de Oct. de 2015
Respondida: Ilaria Di Fresco
el 12 de En. de 2016
I am writing NARX for forecasting the wind speed one day ahead, based on the historical data of wind speed and wind direction. One of my problem is that when I plot the results, the output are time shifted to the left of one time step.
WHY DOES THIS HAPPEN?
HOW CAN I SOLVE IT?
X=con2seq(V1');
T=con2seq(V2');
N=24; %number of steps ahead
%the number of Hidden layer and delay ARE NOT OPTIMIZED YET! I will use the
%function nncorr as suggested in many posts
delay=2;
neurons=5;
inputseries=X(1:end-N);
targetseries=T(1:end-N);
inputseriesval=X(end-N+1:end);
targetseriesval=T(end-N+1:end);
%openloop
net=narxnet(1:delay,1:delay,neurons);
net.divideFcn = 'divideblock';
[Xs,Xi,Ai,Ts]=preparets(net,inputseries,{},targetseries);
net=train(net,Xs,Ts,Xi,Ai);
[Y,Xf,Af]=net(Xs,Xi,Ai);
perf=perform(net,Ts,Y);
%closeloop
netc=closeloop(net,Xf,Af);
[Xc,Xic,Aic,Tc]=preparets(netc,inputseries,{},targetseries);
netc=train(netc,Xc,Tc,Xic,Aic);%I train the closeloop to get a more accurate closeloop
Ypred=netc(inputseriesval,Xic,Aic);
multistepperf=perform(netc,Ypred,targetseriesval);
view(netc) figure;
%operation required because I first normalized the input and target data.
%In this way the graph represent a real quantity (wind speed)
[A]=unnormalize(Ypred,m);
[C]=unnormalize(Y,m);
[B]=unnormalize(T,m);
plot([C,A]);
hold on;
plot(B,'red');
The performance still need to be improved for 24 HOURS AHEAD forecast. As you can see the prediction in blues has a lag compared to the target values (in red).
Thanks for your help.
Ilaria
0 comentarios
Respuesta aceptada
Greg Heath
el 4 de En. de 2016
Editada: Greg Heath
el 6 de En. de 2016
1. By default, TRAIN automatically divides the data. As long as you use divideblock, I see no reason for you to explicitly decompose X and T.
2. The red curve lags the blue curve. Not vice versa.
3. The blue curve should be shifted to the right because the initial delays were not taken into consideration.
Hope this helps.
Thank you for formally accepting my answer
Greg
0 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!