Unit 5.7 · about 3 h
166 / 324Learning curves, error taxonomies and slices
Aggregate scores average away the slice that fails. Curves say whether to buy data; slices say where the model is wrong.
- measure
You can now
- Read training and validation curves to separate bias (more data will not help) from variance (more data may help).
- Build an error taxonomy with slice support counts and refuse conclusions a slice cannot support.
- Turn the worst supported slice into a testable hypothesis with a follow-up slice.
Covers
- Learning curves, error taxonomies and slice support counts
Study, in this order
2 steps
- Validation curves and learning curvesscikit-learn - model selection and evaluation route
Sections 3.5.1 (
validation_curveandValidationCurveDisplay: high train with low validation means overfit) and 3.5.2 (learning_curveandLearningCurveDisplay: Naive Bayes flat and low versus SVM converging)Depth · Skip the scalability example. The digits snippet numbers in Reproduce are your check.
- Slice, error and data-size requirementsClassical ML Scientific Investigation
Milestones B (record predictions and errors per item), C (prescribed ablations and learning/data-size probes) and E (subgroup, time and source slices with paired uncertainty and practical significance)
Focus on
- Both scores low means bias (capacity or features); train high with validation low means variance. Validation above train is rare and usually means the two are measured differently: augmentation or dropout at train time, an easier or tiny validation split, or leakage.
- Never tune on the validation curve's peak and report that peak. The curve diagnoses; a fresh split evaluates.
- Every slice needs its support count beside the rate: 100% error on \(n=3\) is a hint, not a finding.
- Slice by deployment axes (source, time, subgroup), not by the model's own confidence alone, or the taxonomy confirms itself.
Reproduce closed-book
learning_curve for LogisticRegression(max_iter=2000) on digits with train_sizes [0.1, 0.5, 1.0] and cv=3 (119, 599 and 1198 training rows) and read the regime. Reference run: train 1.00 at every size, validation 0.823, 0.918, 0.926, so variance at small \(n\) with a closing gap. Then tabulate one error slice with support counts.Traps
- Concluding that more data will fix flat converging curves. The Naive Bayes panel shows both scores stuck low: capacity, not data.
- Slicing until a bad slice appears, then reporting it raw. Unplanned slices are multiple comparisons, so pre-register slices or adjust.
- Averaging slice metrics without support weights while claiming deployment impact. Impact is rate times slice share.
Practice
scikit-learn learning-curve digits check
Reproduce the Naive Bayes versus SVC learning-curve comparison on digits and state the bias or variance reading for each panel
Match the qualitative pattern (flat low Naive Bayes, converging SVM), not pixel values. Then repeat on your own data with support-counted slices.
Self-test
-
Train 1.00 with validation 0.82 at small \(n\), then 1.00 with 0.93 at full \(n\). Diagnosis?
Variance-dominated with a closing gap: more data helped and the model still memorizes train. Some overfit remains, so try regularization, not just data. -
Both curves sit flat at 0.70 from 10% to 100% of data. Next step?
Bias: capacity or features are the ceiling. More of the same data will not move it, so change the model or the representation. -
Slice A is 2/3 wrong. Slice B is 40/400 wrong. Which finding is stronger?
B: 10% error on \(n=400\) has a tight interval, while 67% on \(n=3\) is noise. Report both with counts and intervals. -
Why slice by source or time rather than by low model confidence?
Confidence slices re-select the model's own failures and cannot show where deployment breaks. Source and time slices test the deployment axes.
Completion criterion
Stop when
Your curve reading names bias or variance with the numbers that show it, and every slice claim carries \(n\) and an interval.
Mark passed, then open 5.8 Only mark this when you can do it without notes.Leads to
- 5.8 Permutation importance and partial dependence Explain the worst slice with importance and dependence views.
- 5.10 Ablations, negative controls, threats to validity and decision memos Test the slice hypothesis with controls.
Comes after
- 2.5 Residual, leverage, separation and misspecification diagnosticsFold residual and slice analysis into the evaluation harness.
- 3.4 XGBoost, LightGBM and CatBoost configurationDiagnose the early-stopped runs with learning curves.
- 5.5 Cost-sensitive thresholds, imbalance and prevalence changeFind where the thresholded errors concentrate.
- 5.6 Paired bootstrap, permutation tests and multiplicityLocalize the significant gap to slices.
Resources for this unit
- scikit-learn - model selection and evaluation route Follow Cross-validation, Hyperparameter tuning, Decision threshold tuning, Metrics and scoring, Probability calibration, Validation curves, Permutation importance and Common Pitfalls. Retain raw predictions and independently hand-check central metrics.
- Classical ML Scientific Investigation Use Core requirements, architecture constraints, Milestones A-F and failure injection as the standard for end-to-end evidence. The full project remains a later capstone route.
Also in this section
- ISLP - resampling and multiple testing Use Chapter 5 and the relevant selection-history parts of Chapter 13 with their Python labs. Connect resampling to uncertainty and multiplicity without repeating the full statistics stage.
- D2L - Environment and Distribution Shift Read 4.7, then construct one controlled covariate, label and concept shift. Record what changes, which signal detects it and what response the evidence supports.
- Deep-ML candidate - evaluation problems After the platform admission check, use at most one of 18 K-Fold CV, 260 Expected Calibration Error, 276 ROC, 277 AUC or 840 Stratified K-Fold. Hand-checked local metrics remain the evidence.
- SciPy - Resampling and Monte Carlo methods tutorials Work the notebooks linked from this page: Tutorial 3 (The Bootstrap) with
scipy.stats.bootstrap, includingpaired=True, and Tutorial 2b (Paired-Sample Permutation Tests) withpermutation_testandpermutation_type='samples'. Keep one resampling index stream across compared models. - El-Yaniv and Wiener - On the Foundations of Noise-free Selective Classification Read the Abstract and Section 2 (Preliminary Definitions: Definitions 1 and 2 for coverage and selective risk) for the risk-coverage tradeoff. Stop before the noise-free learning bounds.