Naive Bayes

Step 11 of 21 in Machine Learning · Build · Easy

Apply Bayes' theorem assuming features are independent given the class. Wrong assumption, yet fast and strong for text.

Build it

  1. Spam filter

    Multinomial Naive Bayes from scratch with Laplace smoothing on the SMS Spam dataset.

    Done when: Over 95% accuracy; top spam words printed.

Case study: Paul Graham: A Plan for Spam (2002)

  • A simple Bayesian filter caught 99.5% of spam with very few false positives.
  • Learned per user, so each person's filter matched their mail.
  • Spammers adapted, showing adversarial drift in deployed ML.

Read the case study

Resources

Earn this star

On the map, you log what you built. Finish the step and its star lights.

Open this step on the map