class_docstr: Abstract base class for naive Bayes on discrete/categorical data
  
  Any estimator based on this class should provide:
  
  __init__
  _joint_log_likelihood(X) as per BaseNB
class_docstr_tok: ["Abstract","base","class","for","naive","Bayes","on","discrete\/categorical","data","Any","estimator","based","on","this","class","should","provide",":","__init__","_joint_log_likelihood","(","X",")","as","per","BaseNB"]
docstr: Incremental fit on a batch of samples.
  
  This method is expected to be called several times consecutively
  on different chunks of a dataset so as to implement out-of-core
  or online learning.
  
  This is especially useful when the whole dataset is too big to fit in
  memory at once.
  
  This method has some performance overhead hence it is better to call
  partial_fit on chunks of data that are as large as possible
  (as long as fitting in the memory budget) to hide the overhead.
  
  Parameters
  ----------
  X : {array-like, sparse matrix}, 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.
  
  sample_weight : array-like, shape = [n_samples], optional (default=None)
      Weights applied to individual samples (1. for unweighted).
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["Incremental","fit","on","a","batch","of","samples",".","This","method","is","expected","to","be","called","several","times","consecutively","on","different","chunks","of","a","dataset","so","as","to","implement","out-of-core","or","online","learning",".","This","is","especially","useful","when","the","whole","dataset","is","too","big","to","fit","in","memory","at","once",".","This","method","has","some","performance","overhead","hence","it","is","better","to","call","partial_fit","on","chunks","of","data","that","are","as","large","as","possible","(","as","long","as","fitting","in","the","memory","budget",")","to","hide","the","overhead",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}",",","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",".","sample_weight",":","array-like",",","shape","=","[","n_samples","]",",","optional","(","default=None",")","Weights","applied","to","individual","samples","(","1.","for","unweighted",")",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def partial_fit(self, X, y, classes=None, sample_weight=None):
      """Incremental fit on a batch of samples.
  
      This method is expected to be called several times consecutively
      on different chunks of a dataset so as to implement out-of-core
      or online learning.
  
      This is especially useful when the whole dataset is too big to fit in
      memory at once.
  
      This method has some performance overhead hence it is better to call
      partial_fit on chunks of data that are as large as possible
      (as long as fitting in the memory budget) to hide the overhead.
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, 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.
  
      sample_weight : array-like, shape = [n_samples], optional (default=None)
          Weights applied to individual samples (1. for unweighted).
  
      Returns
      -------
      self : object
          Returns self.
      """
      X = check_array(X, accept_sparse="csr", dtype=np.float64)
      _, n_features = X.shape
  
      if _check_partial_fit_first_call(self, classes):
          # This is the first call to partial_fit:
          # initialize various cumulative counters
          n_effective_classes = len(classes) if len(classes) > 1 else 2
          self.class_count_ = np.zeros(
              n_effective_classes, dtype=np.float64
          )
          self.feature_count_ = np.zeros(
              (n_effective_classes, n_features), dtype=np.float64
          )
      elif n_features != self.coef_.shape[1]:
          msg = "Number of features %d does not match previous data %d."
          raise ValueError(msg % (n_features, self.coef_.shape[-1]))
  
      Y = label_binarize(y, classes=self.classes_)
      if Y.shape[1] == 1:
          Y = np.concatenate((1 - Y, Y), axis=1)
  
      n_samples, n_classes = Y.shape
  
      if X.shape[0] != Y.shape[0]:
          msg = "X.shape[0]=%d and y.shape[0]=%d are incompatible."
          raise ValueError(msg % (X.shape[0], y.shape[0]))
  
      # label_binarize() returns arrays with dtype=np.int64.
      # We convert it to np.float64 to support sample_weight consistently
      Y = Y.astype(np.float64)
      if sample_weight is not None:
          sample_weight = np.atleast_2d(sample_weight)
          Y *= check_array(sample_weight).T
  
      class_prior = self.class_prior
  
      # Count raw events from data before updating the class log prior
      # and feature log probas
      self._count(X, Y)
  
      # XXX: OPTIM: we could introduce a public finalization method to
      # be called by the user explicitly just once after several consecutive
      # calls to partial_fit and prior any call to predict[_[log_]proba]
      # to avoid computing the smooth log probas at each call to partial fit
      self._update_feature_log_prob()
      self._update_class_log_prior(class_prior=class_prior)
      return self
  
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 2 for calling the BaseDiscreteNB obj's underlying member method code with example usage: obj.partial_fit(X, y, classes, sample_weight) and returns: self