ANN Problem: matrix dimensions must agree.

2 vues (au cours des 30 derniers jours)
Sitra
Sitra le 7 Juin 2017
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 commentaire
Sitra
Sitra le 7 Juin 2017
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

Connectez-vous pour commenter.

Réponses (1)

Greg Heath
Greg Heath le 7 Juin 2017
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

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by