Matrix size of layer weights in neural network(Error:net.LW{2,1} must be a 0-by-3 matrix.)
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I had a Elman network with 3 hidden layers, 3 input layers and 1 output layer. I try to initial the hidden layer weights with a decent trained result which is saved before. But when I re-input the hidden layer weights into the network. Errors always bumped out. Error:net.LW{2,1} must be a 0-by-3 matrix. The error also happened when I valued the bias and input layer weights. I have two questions: (1) What does "0-by-3 matrix" mean? Does it mean the matrix should be a empty matrix? (2) I got the hidden layer weights, input layer weights and bias from the trainning result. Why it doesn't work when I re-input them into the network? They were saved in ".mat" format. They were all "cell" structure.
*%Code for saving the trainning result
iw = net.iw; % "iw" is variable of input layer weight
lw = net.lw; % "lw" is variable of hidden layer weight
theta = net.b; % "theta" is variable of bias
*%%Code for re-input the result
net.b{1} = theta{1,1};
net.lw{2,1} = lw{2,1};
net.iw{1,1} = iw{1,1};
net.b{2} = theta{2,1};
>> net.lw{2,1}
ans =
Empty matrix: 0-by-3
>> lw{2,1} % saved trainning result of hidden layer weight (variable "lw")
ans =
-1.3208 -1.4288 -0.7487
>> net.iw{1,1}
ans =
Empty matrix: 3-by-0
>> iw{1,1} % saved trainning result of input layer weight (variable "iw")
ans =
0.7936 0.7638 0.6892
-0.0306 -0.3250 -0.0438
0.8408 -1.0601 -0.9286
*
Error: network/subsasgn>network_subsasgn (line 553)
net.LW{2,1} must be a 0-by-3 matrix.
Error: network/subsasgn (line 13)
net = network_subsasgn(net,subscripts,v,netname);
Error: elman_PepperHTHS_v2 (line 65)
net.lw{2,1} = lw{2,1};
*
I can value net.b{1} successfuly but not the other three. That confused me a lot. If it could be answered, that would be appreciated so much.
0 comentarios
Respuestas (1)
Greg Heath
el 30 de Ag. de 2016
Hello, I had a Elman network with 3 hidden layers, 3 input layers and 1 output layer.
This makes no sense. Do you mean
Hello, I had a Elman network with 3 hidden nodes, 3 input nodes and 1 output node?
In addition, you never defined "net"
You'd be better off posting your code rather than trying to explain it.
Hope this helps.
Greg
0 comentarios
Ver también
Categorías
Más información sobre Define Shallow Neural Network Architectures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!