Doc numpydoc validation for docstrings in BernoulliNB
@@ -908,7 +908,7 @@ class BernoulliNB(_BaseDiscreteNB):
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)
+ fit_prior : bool, optional (default=True)
Whether to learn class prior probabilities or not.
If false, a uniform prior will be used.
@@ -942,22 +942,13 @@ class BernoulliNB(_BaseDiscreteNB):
classes_ : array of shape (n_classes,)
The classes labels.
- Examples
- --------
- >>> import numpy as np
- >>> rng = np.random.RandomState(1)
- >>> X = rng.randint(5, 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()
- >>> print(clf.predict(X[2:3]))
- [3]
+ See Also
+ ----------
+ MultinomialNB: The multinomial Naive Bayes classifier is \
+ suitable for classification with discrete features.
References
----------
-
C.D. Manning, P. Raghavan and H. Schuetze (2008). Introduction to
Information Retrieval. Cambridge University Press, pp. 234-265.
https://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html
@@ -968,6 +959,19 @@ class BernoulliNB(_BaseDiscreteNB):
V. Metsis, I. Androutsopoulos and G. Paliouras (2006). Spam filtering with
naive Bayes -- Which naive Bayes? 3rd Conf. on Email and Anti-Spam (CEAS).
+
+ Examples
+ --------
+ >>> import numpy as np
+ >>> rng = np.random.RandomState(1)
+ >>> X = rng.randint(5, 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()
+ >>> print(clf.predict(X[2:3]))
+ [3]
"""
def __init__(self, alpha=1.0, binarize=.0, fit_prior=True,
