MCPcopy Index your code
hub / github.com/lisa-lab/DeepLearningTutorials / sample_h_given_v

Method sample_h_given_v

code/rbm.py:151–163  ·  view source on GitHub ↗

This function infers state of hidden units given visible units

(self, v0_sample)

Source from the content-addressed store, hash-verified

149 return [pre_sigmoid_activation, T.nnet.sigmoid(pre_sigmoid_activation)]
150
151 def sample_h_given_v(self, v0_sample):
152 ''' This function infers state of hidden units given visible units '''
153 # compute the activation of the hidden units given a sample of
154 # the visibles
155 pre_sigmoid_h1, h1_mean = self.propup(v0_sample)
156 # get a sample of the hiddens given their activation
157 # Note that theano_rng.binomial returns a symbolic sample of dtype
158 # int64 by default. If we want to keep our computations in floatX
159 # for the GPU we need to specify to return the dtype floatX
160 h1_sample = self.theano_rng.binomial(size=h1_mean.shape,
161 n=1, p=h1_mean,
162 dtype=theano.config.floatX)
163 return [pre_sigmoid_h1, h1_mean, h1_sample]
164
165 def propdown(self, hid):
166 '''This function propagates the hidden units activation downwards to

Callers 3

gibbs_hvhMethod · 0.95
gibbs_vhvMethod · 0.95
get_cost_updatesMethod · 0.95

Calls 1

propupMethod · 0.95

Tested by

no test coverage detected