<jupyter_start><jupyter_text>Naive Bayes BernoulliNBLike 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.https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.BernoulliNB.htmlsklearn.naive_bayes.BernoulliNB<jupyter_code>from sklearn.naive_bayes import BernoulliNB
import numpy as np

X = np.random.randint(5, size=(6, 100))
y = np.array([1, 2, 3, 4, 5, 6])

model = BernoulliNB()
model.fit(X, y)

print("The mean accuracy on the given test data and labels: ", model.score(X, y))
print("Perform classification on an array of test vectors X: ", model.predict(X[2:3]))<jupyter_output>The mean accuracy on the given test data and labels:  1.0
Perform classification on an array of test vectors X:  [3]
{'fraction_non_alphanumeric': 0.09741784037558686, 'fraction_numerical': 0.018779342723004695, 'mean_word_length': 5.824, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '77630', 'license': 'MIT', 'n_tokens_mistral': 304, 'n_tokens_neox': 279, 'n_words': 91, 'path': 'NaiveBayes/Algorithms/BernoulliNB.ipynb', 'repo_name': 'the-code-experiments/experiment-scikit-learn', 'size': '852'}