S ScienceFairProjects.info
Medium⏱ time2 hr$ cost0

Spam Email Classifier

Train a model on example messages so it can flag new ones as spam or not.

Start building ↓
fig — working model Result first

The build

Step 01

Prepare text

Clean and split messages into words.

Step 02

Vectorise

Turn words into number features (bag-of-words).

Step 03

Train classifier

Fit a model on labelled spam/ham.

Step 04

Test

Check accuracy on unseen messages.

Working Principle

The model learns which words appear more in spam, then scores a new message by the words it contains to decide spam or not.

The science behind it

A closer look

A Naive Bayes classifier multiplies word probabilities; common spam words tip the balance toward the spam label.

Take it further

Variables to test

  • 1 Add more training examples — accuracy up?
  • 2 Find words that fool it — why?

More AI