0
$\begingroup$

I'm initialising DNN of shape [2 inputs, 2 hiddens, 1 output] with these weights and biases:

#hidden layer
weight1= tf.Variable(tf.random_uniform([2,2], -1, 1), 
         name="layer1");
bias1 = tf.Variable(tf.zeros([2]), name="bias1");

#output layer
weight2 = tf.Variable(tf.random_uniform([2,1], -1, 1), 
          name="layer2");
bias2 = tf.Variable(tf.zeros([1]), name="bias2");

That's what I followed some online article, however, I wonder what if I initialise bias values using tf.random_uniform instead of tf.zeros? Should I choose zero biases or random biases generically?

$\endgroup$
1
$\begingroup$

From the stanford CNN class (http://cs231n.github.io/neural-networks-2/):

Blockquote Initializing the biases. It is possible and common to initialize the biases to be zero, since the asymmetry breaking is provided by the small random numbers in the weights. For ReLU non-linearities, some people like to use small constant value such as 0.01 for all biases because this ensures that all ReLU units fire in the beginning and therefore obtain and propagate some gradient. However, it is not clear if this provides a consistent improvement (in fact some results seem to indicate that this performs worse) and it is more common to simply use 0 bias initialization.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.