ANN Problem: matrix dimensions must agree.

2 次查看(过去 30 天)
Hi Dears,
I'm facing the following error message:
Matrix dimensions must agree.
Error in nn7.grad2 (line 104)
gN{i} = Fdot .* gA{i};
Error in nn7.perfs_sig_grad (line 23)
[gB,gIW,gLW,gA] = nn7.grad2(net,trainData.Pc,trainData.Pd,...
Error in trainb>train_network (line 149)
nn7.perfs_sig_grad(net,trainData,valData,testData,needGradient,fcns);
Error in trainb (line 56)
[out1,out2] = train_network(varargin{2:end});
Error in network/train (line 353)
[net,tr] = feval(net.trainFcn,'apply',net,tr,data,calcMode.options,hints,net.trainParam);
Error in ANN2 (line 90)
[net,tr] = train(net,Xs,T);
I tried to figure-out the sources of this problem, and I get the following indication:
when I put the following command just before train command, I get:
whos net
[net,tr] = train(net,Xs,T);
Name Size Bytes Class Attributes
T 18x1000 144000 double
Xs 18x1000 144000 double
net 1x1 44008 network
Every time I run the program, the preceding error pops-up when net's bytes limit decreases down to 44008!!!
It seems to me that there is a minimum limit of network's bytes, because it happens when net's byte is less than 44008 (or it could happen when it is slightly larger than 44008)
What is the exact minimum information needed for the network, and how can we avoid the above problem?
I have checked many questions raised in this forum and no one works with me!
Thank you so much
  1 个评论
Sitra
Sitra 2017-6-7
New observations that may help others:
I found that error when I use some training functions, such as: trainb, traingdx, trains, traingdm, traincgf
Should I normalize my data for such these training functions? because I heard that MATLAB's fitnet and other functions automatically normalize and de-normalize the dataset?
Thank you again

请先登录,再进行评论。

回答(1 个)

Greg Heath
Greg Heath 2017-6-7
Whenever faced with the error message
Matrix dimensions must agree
The commands SIZE & WHOS have always led me to the cause of the problem.
Hope this helps.
Thank you for formally accepting my answer
Greg

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by