https://github.com/lisa-lab/DeepLearningTutorials/blob/ea2c59fb40c3bdb6aacdd9e8b3917b948c6ce3db/code/rbm.py#L188 I may be wrong but if the number of trials is one (n=1) then the binomial distribution simplifies to f_b(x) = p ie h1_sample = h1_mean.