Concept - Bernoulli Naive Bayes (BNB)

  • Input: binary indicators (word present = 1, word absent = 0) (s.148).
  • Assumption: each word is a binary feature (s.148).
  • Effect: only presence/absence of a word matters, not how many times it appears (s.148).
  • Typical use cases: short texts (tweets, product reviews); when word repetition is less informative (s.148).
  • Example: “cheap meds online” -> ; identical to the multinomial vector here because no word repeats, but “in longer documents the difference matters”: MNB counts how many times, BNB only whether at least once (s.150).

Source: 03 Text Classification - Chunk 05 (s.121-150)

Concept - Multinomial Naive Bayes, Concept - Naive Bayes, Concept - Bag of Words

Worked example and formulas (s.156-161, from 03 Text Classification - Chunk 06 (s.151-180))

  • Smoothed likelihood: where = number of documents of class containing and = documents in class (=2, denominator 4); absence: (s.156-157).
  • Document likelihood over the whole vocabulary: (s.158).
  • For “cheap project meds”: ; (s.159).
  • Scores with priors 0.5: spam 0.00555, ham 0.000275 -> spam, ratio about 20x; normalized 0.953 vs 0.047 (s.159-161). More confident than MNB (95% vs 82%).
  • Key difference from MNB: absent words are explicitly used in the product (s.158).