Error Analysis
A score is a summary; slice it before it stalls you
Error analysis digs into WHERE a model fails: which classes, segments or slices concentrate the mistakes? Confusion matrices, per-slice metrics and clustering failures turn a bad score into a prioritized punch list.
What you will learn
- Build confusion + per-class and per-slice error summaries
- Cluster or sample failures to find common failure modes
- Turn error analysis into ranked model/data actions
What is this?
Error analysis breaks aggregate metrics into actionable slices: per-class precision/recall, per-segment rates (category, region, recency, feature ranges), and clusters of misclassified examples. It separates 'model is 0.90 AUC' from 'the model is blind to rare classes, to new regions, or to content-type X'. The output is a ranked list of fix candidates — data, features, or model — selected by impact and effort.
Why do you need it?
- Aggregate accuracy hides silent, high-impact failures on important subgroups.
- Prioritizes work: fix the slice that matters most, first.
- Constant, current practice: error analysis on every retrain catches data drift early.
- Feeds everything else: annotation gaps, feature engineering ideas, monitoring thresholds.
Mental model
A post-mortem for every missed shot in a match
Error analysis
The team scored 70% — fine. But are the missed shots all in the last 5 minutes, all corner kicks, all against the same opponent style? That's the difference between 'practice more' and a targeted drill. Same ball game, opponent and match time decide the fix.
How it works
- Collect predictions + ground truth + features/metadata on the held-out or production sample.
- Confusion matrix → per-class precision/recall and dominant confusion pairs.
- Slice by metadata/feature groups → per-slice error rates (deltas vs overall).
- Embed + cluster or stratified-sample the errors → recurring failure modes.
- Rank fixes by error-count × business impact and validate each on a small test.
From aggregate score to a prioritized fix list.
In production
- Class-imbalance triage: recovers the rare-class recall a global F1 hides.
- Launch reviews: slice-level leaderboard answers 'does this work for our main segments?'.
- Drift watchdog: slice accuracy vs the 30-day window alerts before aggregate scores blink.
Best practices
- Define slices BEFORE looking at results (business segments, not whichever slice looks lucky).
- Sample errors with metadata attached; labels-only samples are unreadable.
- Quantify slice sizes: a big error rate on 5 examples is noise, not insight.
- Track slice metrics over time; regressions per slice are your monitoring surface.
Common mistakes
- Reading overall accuracy and skipping the confusion matrix — hiding class failure.
- Fixing a slice by adding labels without confirming the error is annotation-bound.
- Reporting slice error rates without confidence/error bars at small N.
- Slice-dredging until an interesting (but fake) pattern appears.
Common issues
Overall good, slice terribleImbalanced classes or underrepresented segment in training
Stratify sampling, upsample the slice, or add slice-balanced loss weighting.
Big confusion between two classesFeatures discriminate poorly on their boundary
Add discriminative features or label-audit the boundary classes for mislabels.
Error slices look randomSlice definitions post-hoc/too granular
Pre-register slices and use wider bins; cluster errors for modes instead of slicing randomly.
Debugging tips
- The dominant confusion pair usually names the fix: similar classes = disentangling features needed.
- Errors concentrated in one date-range often signal data drift or a label pipeline change.
- Clustering error embeddings repeatedly — stable clusters = real modes; drifting clusters = noise.
- Slice errors that persist across seeds are real; single-seed artifacts aren't.
Interview checkpoint
Hands-on lab
- Compute confusion matrix + per-class metrics
- Slice error rate by a metadata column
- Rank the output into a fix list
Slaughter Your Errors
35 min · intermediate
Quick quiz
A confusion matrix's dominant off-diagonal cell tells you:
Slice error rates are trustworthy even with as few as 3 examples in the slice.