DeepLearning icon indicating copy to clipboard operation
DeepLearning copied to clipboard

Quension about the updation of weight matrix.

Open xiaohu2015 opened this issue 8 years ago • 1 comments

Recently, I am learning your RBM python code. All codes are OK except the updating formula of parameters used in your contrastive_divergence function. I found that the bias vectors are updated using the mean gradient of a batch training examples, while the weight matrix is not such the case. Hence, can kindly you give some explanation about the equation (Line 61-62) in details. I am looking forward your early replay.

xiaohu2015 avatar Jul 20 '16 01:07 xiaohu2015

I think maybe the following equation is right: self.W += lr * sum([ np.dot(self.input[i,:].T, ph_mean[i,:]) - np.dot(self.nv_samples[i,:].T, nh_mean[i,:]) for i in range(self.input.shape[0]) ]) / self.input.shape[0]

xiaohu2015 avatar Jul 20 '16 01:07 xiaohu2015