The starting point
A model can make mostly correct predictions and still fail at the task that matters. When one class is much more common than another, accuracy can hide the errors that deserve the most attention.
First principles
Start with the cost of a mistake. Precision asks how many predicted positives were correct. Recall asks how many actual positives were found. Neither metric wins in every situation; the use case determines the trade-off.
| Concept | What it means | Why it matters |
|---|---|---|
| Accuracy | Correct predictions / all predictions | Useful when classes and error costs are reasonably balanced |
| Precision | Correct positives / predicted positives | Useful when false alarms are expensive |
| Recall | Correct positives / actual positives | Useful when missed positives are expensive |
A practical example
A small example helps make the idea concrete. This snippet is illustrative; it assumes the surrounding data and setup are already in place.
from sklearn.metrics import classification_report
predictions = model.predict(X_test)
print(classification_report(y_test, predictions))What to take away
Use a held-out test set, inspect the confusion matrix, and compare with a simple baseline. A good evaluation makes trade-offs visible instead of hiding them behind one number.
The goal isn’t to memorize a recipe. It’s to understand the choices well enough to make them deliberately.