Files
OpenFace/model_training/CCNF/CCRF/lib/randInitializeWeights.m

36 lines
1020 B
Matlab

function W = randInitializeWeights(L_in, L_out)
%RANDINITIALIZEWEIGHTS Randomly initialize the weights of a layer with L_in
%incoming connections and L_out outgoing connections
% W = RANDINITIALIZEWEIGHTS(L_in, L_out) randomly initializes the weights
% of a layer with L_in incoming connections and L_out outgoing
% connections.
%
% Note that W should be set to a matrix of size(L_out, 1 + L_in) as
% the column row of W handles the "bias" terms
%
% You need to return the following variables correctly
% epsilon_init = 0.12;
% epsilon_init = 0.12;
epsilon_init = 1/sqrt(L_in);
W = rand(L_out, 1 + L_in) * 2 * epsilon_init - epsilon_init;
% ====================== YOUR CODE HERE ======================
% Instructions: Initialize W randomly so that we break the symmetry while
% training the neural network.
%
% Note: The first row of W corresponds to the parameters for the bias units
%
% =========================================================================
end