03 Text Classification - Cheat Sheet

Up: 03 Text Classification - Index | 03 Text Classification - Mind Map

Core definitions

Key comparison

MethodInput featuresModel ofNotes
Concept - Multinomial Naive Bayesword counts / TF-IDF$p(wclass)$ per word occurrence
Concept - Bernoulli Naive Bayesbinary presence/absencepresence prob. per wordAlso penalizes absent words
Concept - Gaussian Naive Bayescontinuous valuesone Gaussian per feature per classUse log scores
Concept - Logistic Regressionany vector (e.g. BoW)$p(yx)$ directly
Concept - Decision Treeattributesrecursive splitsEasy to read, prone to overfit

Evaluation formulas

Decision trees

Ensembles

Worked numbers to remember

  • Likes/dislikes: 300 of 1000 like, so , (s.27).
  • Spam example: , ; “Dear Friend” scores 0.09 (normal) vs 0.01 (spam), so normal; “Lunch Money Money Money Money” gives spam 0 until smoothing (s.65-135).
  • Gaussian NB Troll 2: log scores about -124 (loves) vs -48 (does not love), so “Does not love” (s.211-238).

Likely exam questions (across the deck)

  1. Explain Naive Bayes, the independence assumption and why it is “naive”. (s.21-23, 136-145)
  2. Describe the zero-probability problem and how smoothing fixes it. (s.29-30, 119-135)
  3. MLE vs MAP. (s.19)
  4. Multinomial vs Bernoulli vs Gaussian NB: when to use each. (s.146-181)
  5. Why use logs in NB? (s.204-214)
  6. Why is linear regression a poor classifier; what does the sigmoid fix? (s.253-263)
  7. Naive Bayes vs logistic regression (generative vs discriminative). (s.292-295)
  8. Define precision, recall, F1; why accuracy fails on imbalanced data. (s.272-283)
  9. ID3: compute entropy / information gain / Gini on a small table. (s.311-327)
  10. Overfitting, pruning, and how bagging/boosting/stacking differ. (s.331-360)
  11. Inter-annotator agreement and getting labels. (s.374-381)

See also Past Exam - Question Bank & Style Guide for the exam style.