ANN Problem: matrix dimensions must agree.

조회 수: 1 (최근 30일)
Sitra
Sitra 2017년 6월 7일
답변: Greg Heath 2017년 6월 7일
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