The Python Oracle

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

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping

--

Chapters
00:00 Question
01:01 Accepted answer (Score 8)
01:31 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.