'Sample from the distribution P(h|v).
Parameters
v : array-like, shape (n_samples, n_features)
Values of the visible layer to sample from.
rng : RandomState
Random number generator to use.
Returns
h : array-like, shape (n_samples, n_components)
Values of the hidden layer.'

def _sample_hiddens(self, v, rng):

    p = self._mean_hiddens(v)
    return (rng.random_sample(size=p.shape) < p)
