10000 [MRG] naive_bayes.py documentation update by jigna-panchal · Pull Request #15508 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] naive_bayes.py documentation update #15508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
108 changes: 50 additions & 58 deletions sklearn/naive_bayes.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


import numpy as np
from scipy.sparse import issparse

from .base import BaseEstimator, ClassifierMixin
from .preprocessing import binarize
Expand Down Expand Up @@ -139,26 +138,23 @@ class GaussianNB(BaseNB):

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.

class_prior_ : array, shape (n_classes,)
probability of each class.

classes_ : array, shape (n_classes,)
class labels known to the classifier

theta_ : array, shape (n_classes, n_features)
mean of each feature per class
epsilon_ : float
absolute additive value to variances

sigma_ : array, shape (n_classes, n_features)
variance of each feature per class

epsilon_ : float
absolute additive value to variances

classes_ : array-like, shape (n_classes,)
Unique class labels.
theta_ : array, shape (n_classes, n_features)
mean of each feature per class

Examples
--------
Expand Down Expand Up @@ -689,38 +685,36 @@ class MultinomialNB(BaseDiscreteNB):

Attributes
----------
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.

class_log_prior_ : array, shape (n_classes, )
Smoothed empirical log probability for each class.

intercept_ : array, shape (n_classes, )
Mirrors ``class_log_prior_`` for interpreting MultinomialNB
as a linear model.

feature_log_prob_ : array, shape (n_classes, n_features)
Empirical log probability of features
given a class, ``P(x_i|y)``.
classes_ : array, shape (n_classes,)
Class labels known to the classifier

coef_ : array, shape (n_classes, n_features)
Mirrors ``feature_log_prob_`` for interpreting MultinomialNB
as a linear model.

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.

classes_ : array, shape (n_classes,)
Class labels known to the classifier

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.

feature_log_prob_ : array, shape (n_classes, n_features)
Empirical log probability of features
given a class, ``P(x_i|y)``.

intercept_ : array, shape (n_classes, )
Mirrors ``class_log_prior_`` for interpreting MultinomialNB
as a linear model.

n_features_ : int
Number of features of each sample.

classes_ : array-like, shape (n_classes,)
Unique class labels.

Examples
--------
Expand Down Expand Up @@ -804,34 +798,31 @@ class ComplementNB(BaseDiscreteNB):

Attributes
----------
class_log_prior_ : array, shape (n_classes, )
Smoothed empirical log probability for each class. Only used in edge
case with a single class in the training set.

feature_log_prob_ : array, shape (n_classes, n_features)
Empirical weights for class complements.

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.

class_log_prior_ : array, shape (n_classes, )
Smoothed empirical log probability for each class. Only used in edge
case with a single class in the training set.

classes_ : array, shape (n_classes,)
Class labels known to the classifier

feature_all_ : array, shape (n_features,)
Number of samples encountered for each feature 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.

feature_log_prob_ : array, shape (n_classes, n_features)
Empirical weights for class complements.

n_features_ : int
Number of features of each sample.

feature_all_ : array, shape (n_features,)
Number of samples encountered for each feature during fitting. This
value is weighted by the sample weight when provided.

classes_ : array of shape (n_classes,)
The classes labels.

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -919,16 +910,13 @@ class BernoulliNB(BaseDiscreteNB):

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.

class_log_prior_ : array, shape = [n_classes]
Log probability of each class (smoothed).

classes_ : array, shape (n_classes,)
Class labels known to the classifier

Expand All @@ -937,11 +925,12 @@ class BernoulliNB(BaseDiscreteNB):
during fitting. This value is weighted by the sample weight when
provided.

feature_log_prob_ : array, shape = [n_classes, n_features]
Empirical log probability of features given a class, P(x_i|y).

n_features_ : int
Number of features of each sample.

classes_ : array of shape (n_classes,)
The classes labels.

Examples
--------
Expand Down Expand Up @@ -1045,22 +1034,25 @@ class CategoricalNB(BaseDiscreteNB):

Attributes
----------
class_log_prior_ : array, shape (n_classes, )
Smoothed empirical log probability for each class.

feature_log_prob_ : list of arrays, len n_features
category_count_ : list of arrays, len n_features
Holds arrays of shape (n_classes, n_categories of respective feature)
for each feature. Each array provides the empirical log probability
of categories given the respective feature and class, ``P(x_i|y)``.
for each feature. Each array provides the number of samples
encountered for each class and category of the specific feature.

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.

category_count_ : list of arrays, len n_features
class_log_prior_ : array, shape (n_classes, )
Smoothed empirical log probability for each class.

classes_ : array, shape (n_classes,)
Class labels known to the classifier

feature_log_prob_ : list of arrays, len n_features
Holds arrays of shape (n_classes, n_categories of respective feature)
for each feature. Each array provides the number of samples
encountered for each class and category of the specific feature.
for each feature. Each array provides the empirical log probability
of categories given the respective feature and class, ``P(x_i|y)``.

n_features_ : int
Number of features of each sample.
Expand Down
0