@@ -908,7 +908,7 @@ class BernoulliNB(_BaseDiscreteNB):
908
908
Threshold for binarizing (mapping to booleans) of sample features.
909
909
If None, input is presumed to already consist of binary vectors.
910
910
911
- fit_prior : boolean , optional (default=True)
911
+ fit_prior : bool , optional (default=True)
912
912
Whether to learn class prior probabilities or not.
913
913
If false, a uniform prior will be used.
914
914
@@ -942,22 +942,13 @@ class BernoulliNB(_BaseDiscreteNB):
942
942
classes_ : array of shape (n_classes,)
943
943
The classes labels.
944
944
945
- Examples
946
- --------
947
- >>> import numpy as np
948
- >>> rng = np.random.RandomState(1)
949
- >>> X = rng.randint(5, size=(6, 100))
950
- >>> Y = np.array([1, 2, 3, 4, 4, 5])
951
- >>> from sklearn.naive_bayes import BernoulliNB
952
- >>> clf = BernoulliNB()
953
- >>> clf.fit(X, Y)
954
- BernoulliNB()
955
- >>> print(clf.predict(X[2:3]))
956
- [3]
945
+ See Also
946
+ ----------
947
+ MultinomialNB: The multinomial Naive Bayes classifier is \
948
+ suitable for classification with discrete features.
957
949
958
950
References
959
951
----------
960
-
961
952
C.D. Manning, P. Raghavan and H. Schuetze (2008). Introduction to
962
953
Information Retrieval. Cambridge University Press, pp. 234-265.
963
954
https://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html
@@ -968,6 +959,19 @@ class BernoulliNB(_BaseDiscreteNB):
968
959
969
960
V. Metsis, I. Androutsopoulos and G. Paliouras (2006). Spam filtering with
970
961
naive Bayes -- Which naive Bayes? 3rd Conf. on Email and Anti-Spam (CEAS).
962
+
963
+ Examples
964
+ --------
965
+ >>> import numpy as np
966
+ >>> rng = np.random.RandomState(1)
967
+ >>> X = rng.randint(5, size=(6, 100))
968
+ >>> Y = np.array([1, 2, 3, 4, 4, 5])
969
+ >>> from sklearn.naive_bayes import BernoulliNB
970
+ >>> clf = BernoulliNB()
971
+ >>> clf.fit(X, Y)
972
+ BernoulliNB()
973
+ >>> print(clf.predict(X[2:3]))
974
+ [3]
971
975
"""
972
976
973
977
def __init__ (self , alpha = 1.0 , binarize = .0 , fit_prior = True ,
0 commit comments