0PricingLogin
NLP Academy · Lesson

Building a Spam Detector

Train on labeled messages.

Your First Real Model

Time to build something useful: a spam filter. You will train a classifier on labeled messages and let it judge brand-new ones.

Start With Labeled Data

Every supervised model needs examples with answers. Here each message comes with a label of spam or ham, the friendly name for not-spam.

messages = ["win cash now", "lunch at noon?", "free prize click"]
labels = ["spam", "ham", "spam"]
print(len(messages), len(labels))

All lessons in this course

  1. The Intuition Behind Naive Bayes
  2. Building a Spam Detector
  3. Multinomial vs Bernoulli Models
  4. Reading the Model's Predictions
← Back to NLP Academy