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

def run_visible(self, data):

    num_examples = data.shape[0]
    hidden_states = np.ones((num_examples, (self.num_hidden + 1)))
    data = np.insert(data, 0, 1, axis=1)
    hidden_activations = np.dot(data, self.weights)
    hidden_probs = self._logistic(hidden_activations)
    hidden_states[:, :] = (hidden_probs > np.random.rand(num_examples, (self.num_hidden + 1)))
    hidden_states = hidden_states[:, 1:]
    return hidden_states
