Why do I encounter an error in MSEREG when using the Neural Network Toolbox 4.0.1 (R12.1)?
2 views (last 30 days)
Show older comments
Why do I encounter an error in MSEREG when using the Neural Network Toolbox 4.0.1 (R12.1)?
The following code generates an error in the Neural Network Toolbox 4.0.1 (R12.1):
p = [-1 -1 2 2;0 5 0 5];
t = [-1 -1 1 1];
net=newff(minmax(p),[3,1],{'tansig','purelin'},'traingd');
net.performFcn = 'msereg';
net.performParam.ratio = 0.5;
net.trainParam.show = 5;
net.trainParam.epochs = 300;
net.trainParam.goal = 1e-5;
[net,tr]=train(net,p,t);
??? Error using ==> .^
Function '.^' not defined for variables of class 'struct'.
Error in ==> D:\Applications\MATLAB\toolbox\nnet\nnet\msereg.m
On line 126 ==> perfx = sum(sum(x.^2))/length(x);
Error in ==> C:\Temp\matlab_nnet\tp374613.m
On line 54 ==> perf = msereg(El,net,net.trainParam);
Error in ==> D:\Applications\MATLAB\toolbox\nnet\nnet\traingd.m
On line 202 ==> [perf,El,Ac,N,Zl,Zi,Zb] = feval(simfuncname,net,Pd,Ai,Tl,Q,TS);
Error in ==> D:\Applications\MATLAB\toolbox\nnet\nnet\@network\train.m
On line 278 ==> [net,tr,Ac,El] = feval(trainFcn,net,Pd,Tl,Ai,Q,TS,VV,TV);
The error seems to be caused by the format of the temporary network simulation file which the Neural Network Toolbox creates. This file calls MSEREG with the incorrect type of inputs.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This is a bug in the Neural Network Toolbox 4.0.1 (R12.1) that has been fixed in the Neural Network Toolbox 4.1 (R13).
As a workaround for version 4.0.1 (R12.1), add the following beginning with line 107 to line 114 of the file $MATLAB\toolbox\nnet\nnet\msereg.m, where $MATLAB is the root MATLAB directory:
if (nargin >= 2)
if (isa(x,'network') | isa(x,'struct'))
pp = x.performParam;
x=getx(x);
end
else
error('Not enough input arguments');
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!