'Actual implementation of Gaussian NB fitting.
Parameters
X : array-like, shape (n_samples, n_features)
Training vectors, where n_samples is the number of samples and
n_features is the number of features.
y : array-like, shape (n_samples,)
Target values.
classes : array-like, shape (n_classes,), optional (default=None)
List of all the classes that can possibly appear in the y vector.
Must be provided at the first call to partial_fit, can be omitted
in subsequent calls.
_refit: bool, optional (default=False)
If true, act as though this were the first time we called
_partial_fit (ie, throw away any past fitting and start over).
sample_weight : array-like, shape (n_samples,), optional (default=None)
Weights applied to individual samples (1. for unweighted).
Returns
self : object
Returns self.'

def _partial_fit(self, X, y, classes=None, _refit=False, sample_weight=None):

    (X, y) = check_X_y(X, y)
    if (sample_weight is not None):
        sample_weight = check_array(sample_weight, ensure_2d=False)
        check_consistent_length(y, sample_weight)
    epsilon = (1e-09 * np.var(X, axis=0).max())
    if _refit:
        self.classes_ = None
    if _check_partial_fit_first_call(self, classes):
        n_features = X.shape[1]
        n_classes = len(self.classes_)
        self.theta_ = np.zeros((n_classes, n_features))
        self.sigma_ = np.zeros((n_classes, n_features))
        self.class_count_ = np.zeros(n_classes, dtype=np.float64)
        n_classes = len(self.classes_)
        if (self.priors is not None):
            priors = np.asarray(self.priors)
            if (len(priors) != n_classes):
                raise ValueError('Number    of    priors    must    match    number    of    classes.')
            if (priors.sum() != 1.0):
                raise ValueError('The    sum    of    the    priors    should    be    1.')
            if (priors < 0).any():
                raise ValueError('Priors    must    be    non-negative.')
            self.class_prior_ = priors
        else:
            self.class_prior_ = np.zeros(len(self.classes_), dtype=np.float64)
    else:
        if (X.shape[1] != self.theta_.shape[1]):
            msg = 'Number    of    features    %d    does    not    match    previous    data    %d.'
            raise ValueError((msg % (X.shape[1], self.theta_.shape[1])))
        self.sigma_[:, :] -= epsilon
    classes = self.classes_
    unique_y = np.unique(y)
    unique_y_in_classes = np.in1d(unique_y, classes)
    if (not np.all(unique_y_in_classes)):
        raise ValueError(('The    target    label(s)    %s    in    y    do    not    exist    in    the    initial    classes    %s' % (unique_y[(~ unique_y_in_classes)], classes)))
    for y_i in unique_y:
        i = classes.searchsorted(y_i)
        X_i = X[(y == y_i), :]
        if (sample_weight is not None):
            sw_i = sample_weight[(y == y_i)]
            N_i = sw_i.sum()
        else:
            sw_i = None
            N_i = X_i.shape[0]
        (new_theta, new_sigma) = self._update_mean_variance(self.class_count_[i], self.theta_[i, :], self.sigma_[i, :], X_i, sw_i)
        self.theta_[i, :] = new_theta
        self.sigma_[i, :] = new_sigma
        self.class_count_[i] += N_i
    self.sigma_[:, :] += epsilon
    if (self.priors is None):
        self.class_prior_ = (self.class_count_ / self.class_count_.sum())
    return self
