Issue while mapping weights to a New Feedforward Neural network created using newff
3 views (last 30 days)
Show older comments
while testing a weight initialization technique, i am creating an ANN using the newff function as follows :
net = newff(tr_x,tr_t,H,{'logsig','logsig'},tr_algo);
tr_x : input vector ( size = 15 x 563)
tr_t : target vector ( size = 2 x 563)
H : hidden layer nodes ( size = 16 )
{Actv Fucnt for Input to Hidden, Actv Funct for Hidden to Output layers}
"Traingd" the training algorithm.
My Code
net = newff(tr_x,tr_t,H,{'logsig','logsig'},tr_algo);
net = configure(net,tr_x,tr_t);
net.divideParam.trainRatio = 1.0;
net.divideParam.valRatio = 0.0;
net.divideParam.testRatio = 0.0;
net.trainParam.showWindow=0;
net.trainParam.epochs = 3000;
net.trainParam.goal = 0.0001;
net.IW{1,1} = IW; %% Problem statement
now the problem is when i try to map some sample weights (IW) to the net.IW variable, it says that a 14 x 16 matrix should be provided, although the size of input to hidden layer is 14 x 15 as per my inputs.
I dont know from where is it adding one more column to my input vector and asking for 16 instead of 15.
All the details can be seen in the snapshot of my screen which contains the code and the workspace details.
Thank you
0 Comments
Answers (1)
Greg Heath
on 4 Feb 2019
You need to add another component equal to unity to account for a bias weight.
Thank you for formally accepting m answer.
Greg
0 Comments
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!