02 · See it in action
Follow the steps
- Define labels and ensure they are consistent.
- Measure class balance before fitting.
- Create a baseline that predicts the most common class.
- Compare a model using a confusion matrix and a suitable metric.
Worked example
Dataset: 95 ordinary messages, 5 spam messages
Always predict ordinary -> 95% accuracy
Spam recall -> 0 / 5 = 0
High accuracy, no useful spam detection.
Read the example once, then explain each part aloud in your own words. If it includes Python, you can understand the idea first and run the code later in a local Python environment. Code is shown as text; this page does not execute it.
Sign in to save your reading progress.
Sign in