class_docstr: Gaussian Naive Bayes (GaussianNB)
  
  Can perform online updates to model parameters via `partial_fit` method.
  For details on algorithm used to update feature means and variance online,
  see Stanford CS tech report STAN-CS-79-773 by Chan, Golub, and LeVeque:
  
      http://i.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf
  
  Read more in the :ref:`User Guide <gaussian_naive_bayes>`.
  
  Parameters
  ----------
  priors : array-like, shape (n_classes,)
      Prior probabilities of the classes. If specified the priors are not
      adjusted according to the data.
  
  Attributes
  ----------
  class_prior_ : array, shape (n_classes,)
      probability of each class.
  
  class_count_ : array, shape (n_classes,)
      number of training samples observed in each class.
  
  theta_ : array, shape (n_classes, n_features)
      mean of each feature per class
  
  sigma_ : array, shape (n_classes, n_features)
      variance of each feature per class
  
  Examples
  --------
  >>> import numpy as np
  >>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
  >>> Y = np.array([1, 1, 1, 2, 2, 2])
  >>> from sklearn.naive_bayes import GaussianNB
  >>> clf = GaussianNB()
  >>> clf.fit(X, Y)
  GaussianNB(priors=None)
  >>> print(clf.predict([[-0.8, -1]]))
  [1]
  >>> clf_pf = GaussianNB()
  >>> clf_pf.partial_fit(X, Y, np.unique(Y))
  GaussianNB(priors=None)
  >>> print(clf_pf.predict([[-0.8, -1]]))
  [1]
class_docstr_tok: ["Gaussian","Naive","Bayes","(","GaussianNB",")","Can","perform","online","updates","to","model","parameters","via","`","partial_fit","`","method",".","For","details","on","algorithm","used","to","update","feature","means","and","variance","online",",","see","Stanford","CS","tech","report","STAN-CS-79-773","by","Chan",",","Golub",",","and","LeVeque",":","http",":","\/\/i.stanford.edu\/pub\/cstr\/reports\/cs\/tr\/79\/773\/CS-TR-79-773.pdf","Read","more","in","the",":","ref",":","`","User","Guide","<","gaussian_naive_bayes",">","`",".","Parameters","--","--","--","--","--","priors",":","array-like",",","shape","(","n_classes",",",")","Prior","probabilities","of","the","classes",".","If","specified","the","priors","are","not","adjusted","according","to","the","data",".","Attributes","--","--","--","--","--","class_prior_",":","array",",","shape","(","n_classes",",",")","probability","of","each","class",".","class_count_",":","array",",","shape","(","n_classes",",",")","number","of","training","samples","observed","in","each","class",".","theta_",":","array",",","shape","(","n_classes",",","n_features",")","mean","of","each","feature","per","class","sigma_",":","array",",","shape","(","n_classes",",","n_features",")","variance","of","each","feature","per","class","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","X","=","np.array","(","[","[","-1",",","-1","]",",","[","-2",",","-1","]",",","[","-3",",","-2","]",",","[","1",",","1","]",",","[","2",",","1","]",",","[","3",",","2","]","]",")",">",">",">","Y","=","np.array","(","[","1",",","1",",","1",",","2",",","2",",","2","]",")",">",">",">","from","sklearn.naive_bayes","import","GaussianNB",">",">",">","clf","=","GaussianNB","(",")",">",">",">","clf.fit","(","X",",","Y",")","GaussianNB","(","priors=None",")",">",">",">","print","(","clf.predict","(","[","[","-0.8",",","-1","]","]",")",")","[","1","]",">",">",">","clf_pf","=","GaussianNB","(",")",">",">",">","clf_pf.partial_fit","(","X",",","Y",",","np.unique","(","Y",")",")","GaussianNB","(","priors=None",")",">",">",">","print","(","clf_pf.predict","(","[","[","-0.8",",","-1","]","]",")",")","[","1","]"]
docstr: Compute online update of Gaussian mean and variance.
  
  Given starting sample count, mean, and variance, a new set of
  points X, and optionally sample weights, return the updated mean and
  variance. (NB - each dimension (column) in X is treated as independent
  -- you get variance, not covariance).
  
  Can take scalar mean and variance, or vector mean and variance to
  simultaneously update a number of independent Gaussians.
  
  See Stanford CS tech report STAN-CS-79-773 by Chan, Golub, and LeVeque:
  
  http://i.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf
  
  Parameters
  ----------
  n_past : int
      Number of samples represented in old mean and variance. If sample
      weights were given, this should contain the sum of sample
      weights represented in old mean and variance.
  
  mu : array-like, shape (number of Gaussians,)
      Means for Gaussians in original set.
  
  var : array-like, shape (number of Gaussians,)
      Variances for Gaussians in original set.
  
  sample_weight : array-like, shape (n_samples,), optional (default=None)
      Weights applied to individual samples (1. for unweighted).
  
  Returns
  -------
  total_mu : array-like, shape (number of Gaussians,)
      Updated mean for each Gaussian over the combined set.
  
  total_var : array-like, shape (number of Gaussians,)
      Updated variance for each Gaussian over the combined set.
docstr_tok: ["Compute","online","update","of","Gaussian","mean","and","variance",".","Given","starting","sample","count",",","mean",",","and","variance",",","a","new","set","of","points","X",",","and","optionally","sample","weights",",","return","the","updated","mean","and","variance",".","(","NB","-","each","dimension","(","column",")","in","X","is","treated","as","independent","--","you","get","variance",",","not","covariance",")",".","Can","take","scalar","mean","and","variance",",","or","vector","mean","and","variance","to","simultaneously","update","a","number","of","independent","Gaussians",".","See","Stanford","CS","tech","report","STAN-CS-79-773","by","Chan",",","Golub",",","and","LeVeque",":","http",":","\/\/i.stanford.edu\/pub\/cstr\/reports\/cs\/tr\/79\/773\/CS-TR-79-773.pdf","Parameters","--","--","--","--","--","n_past",":","int","Number","of","samples","represented","in","old","mean","and","variance",".","If","sample","weights","were","given",",","this","should","contain","the","sum","of","sample","weights","represented","in","old","mean","and","variance",".","mu",":","array-like",",","shape","(","number","of","Gaussians",",",")","Means","for","Gaussians","in","original","set",".","var",":","array-like",",","shape","(","number","of","Gaussians",",",")","Variances","for","Gaussians","in","original","set",".","sample_weight",":","array-like",",","shape","(","n_samples",",",")",",","optional","(","default=None",")","Weights","applied","to","individual","samples","(","1.","for","unweighted",")",".","Returns","--","--","--","-","total_mu",":","array-like",",","shape","(","number","of","Gaussians",",",")","Updated","mean","for","each","Gaussian","over","the","combined","set",".","total_var",":","array-like",",","shape","(","number","of","Gaussians",",",")","Updated","variance","for","each","Gaussian","over","the","combined","set","."]
code: def _update_mean_variance(n_past, mu, var, X, sample_weight=None):
      """Compute online update of Gaussian mean and variance.
  
      Given starting sample count, mean, and variance, a new set of
      points X, and optionally sample weights, return the updated mean and
      variance. (NB - each dimension (column) in X is treated as independent
      -- you get variance, not covariance).
  
      Can take scalar mean and variance, or vector mean and variance to
      simultaneously update a number of independent Gaussians.
  
      See Stanford CS tech report STAN-CS-79-773 by Chan, Golub, and LeVeque:
  
      http://i.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf
  
      Parameters
      ----------
      n_past : int
          Number of samples represented in old mean and variance. If sample
          weights were given, this should contain the sum of sample
          weights represented in old mean and variance.
  
      mu : array-like, shape (number of Gaussians,)
          Means for Gaussians in original set.
  
      var : array-like, shape (number of Gaussians,)
          Variances for Gaussians in original set.
  
      sample_weight : array-like, shape (n_samples,), optional (default=None)
          Weights applied to individual samples (1. for unweighted).
  
      Returns
      -------
      total_mu : array-like, shape (number of Gaussians,)
          Updated mean for each Gaussian over the combined set.
  
      total_var : array-like, shape (number of Gaussians,)
          Updated variance for each Gaussian over the combined set.
      """
      if X.shape[0] == 0:
          return mu, var
  
      # Compute (potentially weighted) mean and variance of new datapoints
      if sample_weight is not None:
          n_new = float(sample_weight.sum())
          new_mu = np.average(X, axis=0, weights=sample_weight / n_new)
          new_var = np.average(
              (X - new_mu) ** 2, axis=0, weights=sample_weight / n_new
          )
      else:
          n_new = X.shape[0]
          new_var = np.var(X, axis=0)
          new_mu = np.mean(X, axis=0)
  
      if n_past == 0:
          return new_mu, new_var
  
      n_total = float(n_past + n_new)
  
      # Combine mean of old and new data, taking into consideration
      # (weighted) number of observations
      total_mu = (n_new * new_mu + n_past * mu) / n_total
  
      # Combine variance of old and new data, taking into consideration
      # (weighted) number of observations. This is achieved by combining
      # the sum-of-squared-differences (ssd)
      old_ssd = n_past * var
      new_ssd = n_new * new_var
      total_ssd = (
          old_ssd
          + new_ssd
          + (n_past / float(n_new * n_total))
          * (n_new * mu - n_new * new_mu) ** 2
      )
      total_var = total_ssd / n_total
  
      return total_mu, total_var
  
imports: from abc import ABCMeta, abstractmethod
  import numpy
  from scipy.sparse import issparse
  from .base import BaseEstimator, ClassifierMixin
  from .preprocessing import binarize
  from .preprocessing import LabelBinarizer
  from .preprocessing import label_binarize
  from .utils import check_X_y, check_array
  from .utils.extmath import safe_sparse_dot, logsumexp
  from .utils.multiclass import _check_partial_fit_first_call
  from .utils.fixes import in1d
  from .utils.validation import check_is_fitted
  from .externals import six
label_desc: Use image node_id 3 for calling the GaussianNB obj's underlying member method code with example usage: obj._update_mean_variance(n_past, mu, var, X, sample_weight) and returns: total_mu,  total_var, mu,  var, new_mu,  new_var