From: Jorge Pasquotto on
Dear all,
I am trying to reproduce on matlab the same code below as indicated in the
"Technical Solutions page...
How can I predict a future value from a time series using the Neural Network Toolbox 6.0.3 (R2009b)?"
but I have struggled with an error and I dont understand why??
Please see the code and the error:
1. Code:
% Target Vector
T = [3 9 12 4 10 13 5];

% Input Vector
delaymat = toeplitz([3 0],T);
P = delaymat(2,:);

% Number of hidden neurons
S1 = 20;

% Create Network
net = newelm(P,T,S1);

% Train Network
Pseq = con2seq(P);
Tseq = con2seq(T);
net = train(net,Pseq,Tseq);

% Test the network
Y = sim(net,Pseq);
z = seq2con(Y);
diff1 = T - z{1,1};

2) The error comes after the %train network step:
% Train Network
Pseq = con2seq(P);
Tseq = con2seq(T);
net = train(net,Pseq,Tseq);
??? Error using ==> calcjxfp
Too many input arguments.

Error in ==> calcgx at 98
[gB,gIW,gLW] = feval(net.gradientFcn,net,Q,PD,BZ,IWZ,LWZ,N,Ac,gE,TS);

Error in ==> traingdx at 231
[gX,gradient] = calcgx(net,X,trainV.Pd,Zb,Zi,Zl,N,Ac,El,perf,Q,TS);

Error in ==> network.train at 219
[net,tr] = feval(net.trainFcn,net,tr,trainV,valV,testV);

Please, can somebody tell me what is wrong?
Regards
Jorge
From: Jorge Pasquotto on
Well, I find by myself the answer: it is a Matlab bug on version 2008b.
Please refer to the bug pages, the bug number is 485759
Summary
NEWELM example in documentation fails.
Description
The example in documentation for NEWELM fails:
This code generates and error of "too many arguments" for a call to CALCGX from TRAIN:
P = round(rand(1,20));
T = [0 (P(1:end-1)+P(2:end) == 2)]
Pseq = con2seq(P);
Tseq = con2seq(T);
net = newelm(P,T,10);
net = train(net,Pseq,Tseq);

Workaround
The workaround is to fix a bad network setting directly before the call to train:
net.gradientFcn = 'calcgbtt';
net = train(net,Pseq,Tseq);

Fix
This bug was fixed as of R2009a(6.0.2).
 | 
Pages: 1
Prev: Image Comparison
Next: SSMCMA