'Inner fit for one mini-batch.
Adjust the parameters to maximize the likelihood of v using
Stochastic Maximum Likelihood (SML).
Parameters
v_pos : array-like, shape (n_samples, n_features)
The data to use for training.
rng : RandomState
Random number generator to use for sampling.'

def _fit(self, v_pos, rng):

    h_pos = self._mean_hiddens(v_pos)
    v_neg = self._sample_visibles(self.h_samples_, rng)
    h_neg = self._mean_hiddens(v_neg)
    lr = (float(self.learning_rate) / v_pos.shape[0])
    update = safe_sparse_dot(v_pos.T, h_pos, dense_output=True).T
    update -= np.dot(h_neg.T, v_neg)
    self.components_ += (lr * update)
    self.intercept_hidden_ += (lr * (h_pos.sum(axis=0) - h_neg.sum(axis=0)))
    self.intercept_visible_ += (lr * (np.asarray(v_pos.sum(axis=0)).squeeze() - v_neg.sum(axis=0)))
    h_neg[(rng.uniform(size=h_neg.shape) < h_neg)] = 1.0
    self.h_samples_ = np.floor(h_neg, h_neg)
