【机器学习】-Week5.5 Random Initialization

Initializing all theta weights to zero does not work with neural networks. When we backpropagate, all nodes will update to the same value repeatedly. Instead we can randomly initialize our weights for our Θ matrices using the following method:

【机器学习】-Week5.5 Random Initialization_第1张图片

Hence, we initialize each Θ(l)ij to a random value between[−ϵ,ϵ]. Using the above formula guarantees that we get the desired bound. The same procedure applies to all the Θ's. Below is some working code you could use to experiment.

rand(x,y) is just a function in octave that will initialize a matrix of random real numbers between 0 and 1.

(Note: the epsilon used above is unrelated to the epsilon from Gradient Checking)


【机器学习】-Week5.5 Random Initialization_第2张图片

来源:coursera 斯坦福 吴恩达 机器学习

你可能感兴趣的:(【机器学习】-Week5.5 Random Initialization)