Bernoulli naive Bayes is a probabilistic classifier for binary features. In document classification, each xᵢⱼ records whether word j is absent or present in document i. Conditional independence given the class makes the class-conditional density a product of one-dimensional Bernoulli densities. section 5.5
For C classes and a dictionary of size D, θⱼc parameterizes word presence for class c, while π gives class-label priors. The model has O(DC) learnable parameters. Estimation maximizes log likelihood subject to ∑πc = 1; a Lagrangian handles this constraint, and differentiating with respect to πc yields its fitted form. section 5.5
A from-scratch treatment follows this workflow:
- Represent documents with binary word-presence variables and organize parameters by dictionary term and class. section 5.5
- Derive class-conditional probabilities from the conditional-independence assumption, then optimize their log likelihood. section 5.5
Document classification
A document is converted into word-presence features and classified by comparing class probabilities. This supports applications such as email spam detection and document classification; the implementation example uses the 20 Newsgroups dataset. section 5.0
