Zero-weights initialization in feedforward network

6 ビュー (過去 30 日間)
Christoph
Christoph 2013 年 12 月 21 日
回答済み: Christoph 2013 年 12 月 23 日
Hello everybody, i've got a problem by programming a neural network.
r=xlsread('Juni_Test_Korrelation');
u=r(2:31,3);
u1=u';
net.inputweights{1,1}.initFcn='rands';
net.biases{1}.initFcn='rands';
net=init(net)
net.IW{1,1}
net.b{1}
net=newff(minmax(u1),[5,1],{'tansig','purelin'},'trainlm');
net.trainParam.show = 50;
net.trainParam.lr = 0.09;
net.trainParam.epochs = 120;
net.trainParam.goal = 1;
At the beginning i set the initFcn for the weights and biases to "random". I init the net after this and want to have a look at the weights and biases but i always get the same values. The only this that is different is a "minus" coming randomly in front of the values. So i get this values for the weights
-0.0319
-0.0319
0.0319
-0.0319
0.0319
and these for the biases
15.8047
-12.3047
8.8047
5.3047
-1.8047
and this everytime. Even if i set the initFcn to "initzero" the weights and biases remain the same. So i dont get any reproducable conditions. Can pls someone tell me what to do, so i cant get rather constant values for initialization or just zeros? (I know, i could write the values for weights and biases manuel like this net.IW{1,1}=[0;0;...] but this will take to long for this matrices)
Thx for any helpfull advice

採用された回答

Greg Heath
Greg Heath 2013 年 12 月 22 日
編集済み: Greg Heath 2013 年 12 月 22 日
You have to define a net via net = newff before you can assign any properties or values.
With OBSOLETE functions like newff, the nets are automatically initialized with random weights.
In order to get a different set of initial weights, initialize the RNG, e.g.,
rng(0)
For details see
help rng
doc rng
Also see some of my code examples. Search NEWSGROUP and ANSWERS using
greg newff rng
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 件のコメント
Greg Heath
Greg Heath 2013 年 12 月 22 日
I recommend using all of the defaults except the number of hidden nodes. See
help newff
doc newff
for the basic examples.

サインインしてコメントする。

その他の回答 (1 件)

Christoph
Christoph 2013 年 12 月 23 日
Thanks Greg I actually could solve the problem be including one line of code:
net.layers{1}.initFcn='initwb'
And like this i can initialize the weights and biases with a zero vector and have a reproducable start. The problem i've got know, is reducing the performance to the goal I set. Theirefor theire are several ways to solve, if I'am right. Like: -trainingfunction
-layernodes
-transferfunction
-learningrate
etc.
but i do not really got the point, wich parameter will do the best change. You got any advices?
Thx for helping!!!

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by