How to implement nguyen widrow weight initialization ?

4 ビュー (過去 30 日間)
crixus
crixus 2017 年 4 月 4 日
コメント済み: crixus 2018 年 5 月 18 日
Hi, I'm interested to use nguyen widrow weight initialization but i do not want to use the existing matlab function. I have the pseudo code and I want to try coding it myself. One thing I'm not sure on is how the technique calculate the norm of weights ? suppose I have input weights of [5x3] do i calculate the norm of entire matrix or column ? Thanks in advance

回答 (2 件)

Ênio Viana
Ênio Viana 2018 年 5 月 18 日
I want to know this too. Thanks in advance

Ênio Viana
Ênio Viana 2018 年 5 月 18 日
In this link you can see a Matlab code implementation Stack Overflow but I didn't test this. See that code...
a = -1;
b = 1;
% WIDROW weights for Layer Input to Hidden Layer 1
sum_sq_wts = 0;
for k=1:30
iw(:,:) = zeros(num_input, nodes_hidden_layer);
for i=1:num_input
for j=1:nodes_hidden_layer
iw(i,j)=(b-a)*rand(1,1) + a;
sum_sq_wts = sum_sq_wts + (iw(i,j)*iw(i,j));
end
end
norm = sqrt(sum_sq_wts);
beta = 0.7*nodes_hidden_layer.^(1/num_input);
for i=1:num_input
for j=1:nodes_hidden_layer
iw(i,j) = beta*iw(i,j)/norm;
end
end
IW{k}=iw';
end
% WIDROW weights for Hidden Layer 1 to output Layer
sum_sq_wts = 0;
for k=1:30
lw(:,:) = zeros(nodes_hidden_layer,1);
for i=1:nodes_hidden_layer
for j=1:1
iw(i,j)=(b-a)*rand(1,1) + a;
sum_sq_wts = sum_sq_wts + iw(i,j)*iw(i,j);
end
end
norm = sqrt(sum_sq_wts);
beta = 0.7*nodes_hidden_layer.^(1/num_input);
for i=1:nodes_hidden_layer
for j=1:1
lw(i,j) = beta*lw(i,j)/norm;
end
end
LW{k}=lw';
end
WidNgu{1,1} = IW;
WidNgu{1,2} = LW;
  1 件のコメント
crixus
crixus 2018 年 5 月 18 日
not sure if it's like this
InputWeight=rand(NumberofHiddenNeurons,NumberofInputNeurons)*2-1; beta = 0.7*(NumberofHiddenNeurons^(1/NumberofInputNeurons)); InputWeight = InputWeight/norm(InputWeight) * beta;
xmin=min(min(InputWeight)); xmax=max(max(InputWeight)); BiasofHiddenNeurons=xmin+rand(NumberofHiddenNeurons,1)*(xmax-xmin);

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

カテゴリ

Help Center および File ExchangeQuantum Mechanics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by