'Assuming the RBM has been trained (so that weights for the network have been learned),
run the network on a set of hidden units, to get a sample of the visible units.
Parameters
data: A matrix where each row consists of the states of the hidden units.
Returns
visible_states: A matrix where each row consists of the visible units activated from the hidden
units in the data matrix passed in.'

def run_hidden(self, data):

    num_examples = data.shape[0]
    visible_states = np.ones((num_examples, (self.num_visible + 1)))
    data = np.insert(data, 0, 1, axis=1)
    visible_activations = np.dot(data, self.weights.T)
    visible_probs = self._logistic(visible_activations)
    visible_states[:, :] = (visible_probs > np.random.rand(num_examples, (self.num_visible + 1)))
    visible_states = visible_states[:, 1:]
    return visible_states
