class_docstr: Naive Bayes classifier for multivariate Bernoulli models.
  
  Like MultinomialNB, this classifier is suitable for discrete data. The
  difference is that while MultinomialNB works with occurrence counts,
  BernoulliNB is designed for binary/boolean features.
  
  Read more in the :ref:`User Guide <bernoulli_naive_bayes>`.
  
  Parameters
  ----------
  alpha : float, optional (default=1.0)
      Additive (Laplace/Lidstone) smoothing parameter
      (0 for no smoothing).
  
  binarize : float or None, optional (default=0.0)
      Threshold for binarizing (mapping to booleans) of sample features.
      If None, input is presumed to already consist of binary vectors.
  
  fit_prior : boolean, optional (default=True)
      Whether to learn class prior probabilities or not.
      If false, a uniform prior will be used.
  
  class_prior : array-like, size=[n_classes,], optional (default=None)
      Prior probabilities of the classes. If specified the priors are not
      adjusted according to the data.
  
  Attributes
  ----------
  class_log_prior_ : array, shape = [n_classes]
      Log probability of each class (smoothed).
  
  feature_log_prob_ : array, shape = [n_classes, n_features]
      Empirical log probability of features given a class, P(x_i|y).
  
  class_count_ : array, shape = [n_classes]
      Number of samples encountered for each class during fitting. This
      value is weighted by the sample weight when provided.
  
  feature_count_ : array, shape = [n_classes, n_features]
      Number of samples encountered for each (class, feature)
      during fitting. This value is weighted by the sample weight when
      provided.
  
  Examples
  --------
  >>> import numpy as np
  >>> X = np.random.randint(2, size=(6, 100))
  >>> Y = np.array([1, 2, 3, 4, 4, 5])
  >>> from sklearn.naive_bayes import BernoulliNB
  >>> clf = BernoulliNB()
  >>> clf.fit(X, Y)
  BernoulliNB(alpha=1.0, binarize=0.0, class_prior=None, fit_prior=True)
  >>> print(clf.predict(X[2:3]))
  [3]
  
  References
  ----------
  
  C.D. Manning, P. Raghavan and H. Schuetze (2008). Introduction to
  Information Retrieval. Cambridge University Press, pp. 234-265.
  http://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html
  
  A. McCallum and K. Nigam (1998). A comparison of event models for naive
  Bayes text classification. Proc. AAAI/ICML-98 Workshop on Learning for
  Text Categorization, pp. 41-48.
  
  V. Metsis, I. Androutsopoulos and G. Paliouras (2006). Spam filtering with
  naive Bayes -- Which naive Bayes? 3rd Conf. on Email and Anti-Spam (CEAS).
class_docstr_tok: ["Naive","Bayes","classifier","for","multivariate","Bernoulli","models",".","Like","MultinomialNB",",","this","classifier","is","suitable","for","discrete","data",".","The","difference","is","that","while","MultinomialNB","works","with","occurrence","counts",",","BernoulliNB","is","designed","for","binary\/boolean","features",".","Read","more","in","the",":","ref",":","`","User","Guide","<","bernoulli_naive_bayes",">","`",".","Parameters","--","--","--","--","--","alpha",":","float",",","optional","(","default=1.0",")","Additive","(","Laplace\/Lidstone",")","smoothing","parameter","(","0","for","no","smoothing",")",".","binarize",":","float","or","None",",","optional","(","default=0.0",")","Threshold","for","binarizing","(","mapping","to","booleans",")","of","sample","features",".","If","None",",","input","is","presumed","to","already","consist","of","binary","vectors",".","fit_prior",":","boolean",",","optional","(","default=True",")","Whether","to","learn","class","prior","probabilities","or","not",".","If","false",",","a","uniform","prior","will","be","used",".","class_prior",":","array-like",",","size=","[","n_classes",",","]",",","optional","(","default=None",")","Prior","probabilities","of","the","classes",".","If","specified","the","priors","are","not","adjusted","according","to","the","data",".","Attributes","--","--","--","--","--","class_log_prior_",":","array",",","shape","=","[","n_classes","]","Log","probability","of","each","class","(","smoothed",")",".","feature_log_prob_",":","array",",","shape","=","[","n_classes",",","n_features","]","Empirical","log","probability","of","features","given","a","class",",","P","(","x_i|y",")",".","class_count_",":","array",",","shape","=","[","n_classes","]","Number","of","samples","encountered","for","each","class","during","fitting",".","This","value","is","weighted","by","the","sample","weight","when","provided",".","feature_count_",":","array",",","shape","=","[","n_classes",",","n_features","]","Number","of","samples","encountered","for","each","(","class",",","feature",")","during","fitting",".","This","value","is","weighted","by","the","sample","weight","when","provided",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","X","=","np.random.randint","(","2",",","size=","(","6",",","100",")",")",">",">",">","Y","=","np.array","(","[","1",",","2",",","3",",","4",",","4",",","5","]",")",">",">",">","from","sklearn.naive_bayes","import","BernoulliNB",">",">",">","clf","=","BernoulliNB","(",")",">",">",">","clf.fit","(","X",",","Y",")","BernoulliNB","(","alpha=1.0",",","binarize=0.0",",","class_prior=None",",","fit_prior=True",")",">",">",">","print","(","clf.predict","(","X","[","2:3","]",")",")","[","3","]","References","--","--","--","--","--","C.D",".","Manning",",","P.","Raghavan","and","H.","Schuetze","(","2008",")",".","Introduction","to","Information","Retrieval",".","Cambridge","University","Press",",","pp",".","234-265.","http",":","\/\/nlp.stanford.edu\/IR-book\/html\/htmledition\/the-bernoulli-model-1.html","A.","McCallum","and","K.","Nigam","(","1998",")",".","A","comparison","of","event","models","for","naive","Bayes","text","classification",".","Proc",".","AAAI\/ICML-98","Workshop","on","Learning","for","Text","Categorization",",","pp",".","41-48",".","V.","Metsis",",","I.","Androutsopoulos","and","G.","Paliouras","(","2006",")",".","Spam","filtering","with","naive","Bayes","--","Which","naive","Bayes","?","3rd","Conf",".","on","Email","and","Anti-Spam","(","CEAS",")","."]
docstr: Count and smooth feature occurrences.
docstr_tok: ["Count","and","smooth","feature","occurrences","."]
code: def _count(self, X, Y):
      """Count and smooth feature occurrences."""
      if self.binarize is not None:
          X = binarize(X, threshold=self.binarize)
      self.feature_count_ += safe_sparse_dot(Y.T, X)
      self.class_count_ += Y.sum(axis=0)
  
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 BernoulliNB obj's underlying member method code with example usage: obj._count(X, Y) without return types