@@ -139,23 +139,23 @@ class GaussianNB(_BaseNB):
139
139
140
140
Attributes
141
141
----------
142
- class_prior_ : array, shape (n_classes,)
143
- probability of each class.
144
-
145
142
class_count_ : array, shape (n_classes,)
146
143
number of training samples observed in each class.
147
144
145
+ class_prior_ : array, shape (n_classes,)
146
+ probability of each class.
147
+
148
148
classes_ : array, shape (n_classes,)
149
149
class labels known to the classifier
150
150
151
- theta_ : array, shape (n_classes, n_features)
152
- mean of each feature per class
151
+ epsilon_ : float
152
+ absolute additive value to variances
153
153
154
154
sigma_ : array, shape (n_classes, n_features)
155
155
variance of each feature per class
156
156
157
- epsilon_ : float
158
- absolute additive value to variances
157
+ theta_ : array, shape (n_classes, n_features)
158
+ mean of each feature per class
159
159
160
160
Examples
161
161
--------
@@ -685,33 +685,33 @@ class MultinomialNB(_BaseDiscreteNB):
685
685
686
686
Attributes
687
687
----------
688
+ class_count_ : array, shape (n_classes,)
689
+ Number of samples encountered for each class during fitting. This
690
+ value is weighted by the sample weight when provided.
691
+
688
692
class_log_prior_ : array, shape (n_classes, )
689
693
Smoothed empirical log probability for each class.
690
694
691
- intercept_ : array, shape (n_classes, )
692
- Mirrors ``class_log_prior_`` for interpreting MultinomialNB
693
- as a linear model.
694
-
695
- feature_log_prob_ : array, shape (n_classes, n_features)
696
- Empirical log probability of features
697
- given a class, ``P(x_i|y)``.
695
+ classes_ : array, shape (n_classes,)
696
+ Class labels known to the classifier
698
697
699
698
coef_ : array, shape (n_classes, n_features)
700
699
Mirrors ``feature_log_prob_`` for interpreting MultinomialNB
701
700
as a linear model.
702
701
703
- class_count_ : array, shape (n_classes,)
704
- Number of samples encountered for each class during fitting. This
705
- value is weighted by the sample weight when provided.
706
-
707
- classes_ : array, shape (n_classes,)
708
- Class labels known to the classifier
709
-
710
702
feature_count_ : array, shape (n_classes, n_features)
711
703
Number of samples encountered for each (class, feature)
712
704
during fitting. This value is weighted by the sample weight when
713
705
provided.
714
706
707
+ feature_log_prob_ : array, shape (n_classes, n_features)
708
+ Empirical log probability of features
709
+ given a class, ``P(x_i|y)``.
710
+
711
+ intercept_ : array, shape (n_classes, )
712
+ Mirrors ``class_log_prior_`` for interpreting MultinomialNB
713
+ as a linear model.
714
+
715
715
n_features_ : int
716
716
Number of features of each sample.
717
717
@@ -797,31 +797,31 @@ class ComplementNB(_BaseDiscreteNB):
797
797
798
798
Attributes
799
799
----------
800
- class_log_prior_ : array, shape (n_classes, )
801
- Smoothed empirical log probability for each class. Only used in edge
802
- case with a single class in the training set.
803
-
804
- feature_log_prob_ : array, shape (n_classes, n_features)
805
- Empirical weights for class complements.
806
-
807
800
class_count_ : array, shape (n_classes,)
808
801
Number of samples encountered for each class during fitting. This
809
802
value is weighted by the sample weight when provided.
810
803
804
+ class_log_prior_ : array, shape (n_classes, )
805
+ Smoothed empirical log probability for each class. Only used in edge
806
+ case with a single class in the training set.
807
+
811
808
classes_ : array, shape (n_classes,)
812
809
Class labels known to the classifier
813
810
811
+ feature_all_ : array, shape (n_features,)
812
+ Number of samples encountered for each feature during fitting. This
813
+ value is weighted by the sample weight when provided.
814
+
814
815
feature_count_ : array, shape (n_classes, n_features)
815
816
Number of samples encountered for each (class, feature) during fitting.
816
817
This value is weighted by the sample weight when provided.
817
818
819
+ feature_log_prob_ : array, shape (n_classes, n_features)
820
+ Empirical weights for class complements.
821
+
818
822
n_features_ : int
819
823
Number of features of each sample.
820
824
821
- feature_all_ : array, shape (n_features,)
822
- Number of samples encountered for each feature during fitting. This
823
- value is weighted by the sample weight when provided.
824
-
825
825
Examples
826
826
--------
827
827
>>> import numpy as np
@@ -909,16 +909,13 @@ class BernoulliNB(_BaseDiscreteNB):
909
909
910
910
Attributes
911
911
----------
912
- class_log_prior_ : array, shape = [n_classes]
913
- Log probability of each class (smoothed).
914
-
915
- feature_log_prob_ : array, shape = [n_classes, n_features]
916
- Empirical log probability of features given a class, P(x_i|y).
917
-
918
912
class_count_ : array, shape = [n_classes]
919
913
Number of samples encountered for each class during fitting. This
920
914
value is weighted by the sample weight when provided.
921
915
916
+ class_log_prior_ : array, shape = [n_classes]
917
+ Log probability of each class (smoothed).
918
+
922
919
classes_ : array, shape (n_classes,)
923
920
Class labels known to the classifier
924
921
@@ -927,26 +924,12 @@ class BernoulliNB(_BaseDiscreteNB):
927
924
during fitting. This value is weighted by the sample weight when
928
925
provided.
929
926
927
+ feature_log_prob_ : array, shape = [n_classes, n_features]
928
+ Empirical log probability of features given a class, P(x_i|y).
929
+
930
930
n_features_ : int
931
931
Number of features of each sample.
932
932
933
- See Also
934
- ----------
935
- MultinomialNB: The multinomial Naive Bayes classifier is \
936
- suitable for classification with discrete features.
937
-
938
- References
939
- ----------
940
- C.D. Manning, P. Raghavan and H. Schuetze (2008). Introduction to
941
- Information Retrieval. Cambridge University Press, pp. 234-265.
942
- https://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html
943
-
944
- A. McCallum and K. Nigam (1998). A comparison of event models for naive
945
- Bayes text classification. Proc. AAAI/ICML-98 Workshop on Learning for
946
- Text Categorization, pp. 41-48.
947
-
948
- V. Metsis, I. Androutsopoulos and G. Paliouras (2006). Spam filtering with
949
- naive Bayes -- Which naive Bayes? 3rd Conf. on Email and Anti-Spam (CEAS).
950
933
951
934
Examples
952
935
--------
@@ -960,6 +943,19 @@ class BernoulliNB(_BaseDiscreteNB):
960
943
BernoulliNB()
961
944
>>> print(clf.predict(X[2:3]))
962
945
[3]
946
+
947
+ References
948
+ ----------
949
+ C.D. Manning, P. Raghavan and H. Schuetze (2008). Introduction to
950
+ Information Retrieval. Cambridge University Press, pp. 234-265.
951
+ https://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html
952
+
953
+ A. McCallum and K. Nigam (1998). A comparison of event models for naive
954
+ Bayes text classification. Proc. AAAI/ICML-98 Workshop on Learning for
955
+ Text Categorization, pp. 41-48.
956
+
957
+ V. Metsis, I. Androutsopoulos and G. Paliouras (2006). Spam filtering with
958
+ naive Bayes -- Which naive Bayes? 3rd Conf. on Email and Anti-Spam (CEAS).
963
959
"""
964
960
965
961
def __init__ (self , alpha = 1.0 , binarize = .0 , fit_prior = True ,
@@ -1036,22 +1032,25 @@ class CategoricalNB(_BaseDiscreteNB):
1036
1032
1037
1033
Attributes
1038
1034
----------
1039
- class_log_prior_ : array, shape (n_classes, )
1040
- Smoothed empirical log probability for each class.
1041
-
1042
- feature_log_prob_ : list of arrays, len n_features
1035
+ category_count_ : list of arrays, len n_features
1043
1036
Holds arrays of shape (n_classes, n_categories of respective feature)
1044
- for each feature. Each array provides the empirical log probability
1045
- of categories given the respective feature and class, ``P(x_i|y)`` .
1037
+ for each feature. Each array provides the number of samples
1038
+ encountered for each class and category of the specific feature .
1046
1039
1047
1040
class_count_ : array, shape (n_classes,)
1048
1041
Number of samples encountered for each class during fitting. This
1049
1042
value is weighted by the sample weight when provided.
1050
1043
1051
- category_count_ : list of arrays, len n_features
1044
+ class_log_prior_ : array, shape (n_classes, )
1045
+ Smoothed empirical log probability for each class.
1046
+
1047
+ classes_ : array, shape (n_classes,)
1048
+ Class labels known to the classifier
1049
+
1050
+ feature_log_prob_ : list of arrays, len n_features
1052
1051
Holds arrays of shape (n_classes, n_categories of respective feature)
1053
- for each feature. Each array provides the number of samples
1054
- encountered for each class and category of the specific feature .
1052
+ for each feature. Each array provides the empirical log probability
1053
+ of categories given the respective feature and class, ``P(x_i|y)`` .
1055
1054
1056
1055
n_features_ : int
1057
1056
Number of features of each sample.
0 commit comments