Neural Network result offset by one
Mostra commenti meno recenti
I am learning the Neural Networks toolbox and I worked through a simple example using narxnet to predict the output of a sine function:
proffset = 5; % target offset to train for prediction
tdelay = 2; % length of delay line
x = [1:tstep:15]; % create the example function
y = 2*sin(x)+1; % y = f(x(t)), x(t)=t
xo = x(1:end-proffset); % training inputs, x(t)
yo = y(proffset+1:end); % training targets, y(t-T)
net = narxnet(1:tdelay,1:tdelay,10); % default values
[Xs,Xi,Ai,Ts,Ew,tshift] = preparets(net,num2cell(xo),{},num2cell(yo));
net = train(net,Xs,Ts,Xi,Ai);
[yn, xn, an] = net(Xs,Xi,Ai);
plot(xo(tdelay+1:end),cell2mat(yn),'o-g');
This works fine. The outputs match the targets very closely, as expected for a simple function.

However, when I use my real data in this code framework, the output results are clearly shifted by -1, even though the number of outputs is correct (i.e., number of outputs = number of targets - length of delay line).

The example seems very straightforward, and I can't figure out why "real" data would produce this kind of behavior. What can cause this kind of offset? Thank you!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Modeling and Prediction with NARX and Time-Delay Networks in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!