The Python Oracle

(Python) Gaussian Bernoulli RBM on computing P(v|h)

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Life in a Drop

--

Chapters
00:00 (Python) Gaussian Bernoulli Rbm On Computing P(V|H)
00:32 Accepted Answer Score 8
00:55 Thank you

--

Full question
https://stackoverflow.com/questions/2069...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #numpy #machinelearning #neuralnetwork #rbm

#avk47



ACCEPTED ANSWER

Score 8


The notation X ~ N(μ, σ²) means that X is normally distributed with mean μ and variance σ², so in the RBM training routine, v should be sampled from such a distribution. In NumPy terms, that's

v = sigma * np.random.randn(v_size) + b + sigma * W.dot(h)

Or use scipy.stats.norm for better readable code.