BernoulliNB - Nori12/Machine-Learning-Tutorial GitHub Wiki
Machine Learning Tutorial
BernoulliNB
BernoulliNB is applied to binary data. It has a single parameter, alpha, which controls model complexity. The way alpha works is that the algorithm adds to the data alpha many virtual data points that have positive values for all the features. This results in a “smoothing” of the statistics. A large alpha means more smoothing, resulting in less complex models. The algorithm’s performance is relatively robust to the setting of alpha, meaning that setting alpha is not critical for good performance. However, tuning it usually improves accuracy somewhat.
from sklearn.naive_bayes import BernoulliNB
model = BernoulliNB().fit(X, y)