liveBook · Manning

Spam classification

Also called spam detection

Spam classification is the task of labeling messages or other content as unwanted spam or legitimate communication.

How 2 Manning books explain it

Build a Large Language Model (From Scratch)

The text classification task of deciding whether an email or message is spam or legitimate.

How it is used
Deploys a pretrained GPT model as a supervised binary classifier for spam and legitimate messages.
How deep it goes
Explains model loading, head replacement, parameter freezing, tensor shapes, and last-token selection, without detailing the full training loop.
Examples
Uses a prize-message prompt, a four-token input, two-class logits, and a GPT-2-small architecture.
What you can do after
Builds a GPT-based binary classifier by loading weights, replacing the output head, selecting final-token logits, and configuring trainable layers.

Read how Build a Large Language Model (From Scratch) explains spam classification →

Grokking Machine Learning, Second Edition

The task of determining whether an email is unwanted or non-spam mail.

How it is used
Applies machine learning to decide whether incoming emails are spam or ham.
How deep it goes
Defines the task and works through a frequency-based prediction, but defers model evaluation and improvement.
Examples
Uses Bob’s last 10 emails, a six-to-four spam-to-ham count, and a 60% prediction for the next message.
What you can do after
Apply it with the remember-formulate-predict method to classify a new email from observed message history.

Read how Grokking Machine Learning, Second Edition explains spam classification →

Also covered in

What to know first

Related concepts

Questions about spam classification

What is spam classification?

Spam classification is the task of labeling messages or other content as unwanted spam or legitimate communication.

Which Manning books explain spam classification?

Build a Large Language Model (From Scratch) and Grokking Machine Learning, Second Edition.

What should I know before learning spam classification?

Manning books that teach spam classification usually introduce transformer architecture first.

What is spam classification a kind of?

Spam classification is a kind of classifier. A classifier is a predictive model that assigns an input to one or more discrete classes or categories.

What is spam classification also called?

Spam classification is also called spam detection.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.