Issue while mapping weights to a New Feedforward Neural network created using newff

1 回表示 (過去 30 日間)
sarfaraz masood
sarfaraz masood 2019 年 2 月 3 日
回答済み: Greg Heath 2019 年 2 月 4 日
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

回答 (1 件)

Greg Heath
Greg Heath 2019 年 2 月 4 日
You need to add another component equal to unity to account for a bias weight.
Thank you for formally accepting m answer.
Greg

カテゴリ

Help Center および File ExchangeSequence 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