MATLAB Answers

How to implement nguyen widrow weight initialization ?

11 views (last 30 days)
crixus
crixus on 4 Apr 2017
Commented: crixus on 18 May 2018
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

  0 Comments

Sign in to comment.

Answers (2)

Ênio Viana
Ênio Viana on 18 May 2018
I want to know this too. Thanks in advance

  0 Comments

Sign in to comment.


Ênio Viana
Ênio Viana on 18 May 2018
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 Comment

crixus
crixus on 18 May 2018
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);

Sign in to comment.

Products