Statistical Learning Judgment
Model choice is a scientific comparison problem. This stage teaches how to match inductive bias to data and decision constraints while preventing tuning effort, seed choice or leakage from deciding the winner.
Section 2 of 8 · 11 units · about 46 hours
By the end you can Run a matched-budget comparison of two materially different model families. The ranking must survive reasonable seed and budget changes, and the report must isolate whether the next gain is more likely to come from data or model complexity.
Units
- Empirical and expected risk and the sources of generalization error4h
- Hypothesis classes, inductive bias, capacity and regularization4h
- Bias-variance signatures in learning and validation curves5h
- Choosing a model family from data, decision and operational constraints3h
- Nested selection with preprocessing and feature selection inside the loop6h
- Matched tuning, compute and wall-clock budgets with every seed retained4h
- Calibration, decision thresholds and selective risk-coverage5h
- Ensembles, diversity and correlated errors4h
- Choosing between a data intervention and a model intervention4h
- Residual, shortcut, counterfactual and slice diagnosis4h
- Bayesian prior sensitivity for high-cost decisions3h
Build it
Mini project · about 12 to 16 hours
Matched-budget comparison of two model families
In investigation, compare two materially different model families on the chartered question under one search budget, keep every choice inside the training data, and decide whether the next gain is more likely to come from data or from the model.
- 1Write a claim-to-diagnostic table: competing error explanations, the curve or residual signature each predicts, and one alternative you cannot yet rule out. Predict how a capacity change and a regularization change would move training and validation loss before you run either.
- 2Produce resampled learning and validation curves, keep every curve and compare them with your predictions. Choose two materially different families in a short memo from data, decision and operational constraints, and measure one operational constraint, such as end-to-end latency.
- 3Implement nested selection with preprocessing, feature selection and threshold choice inside the inner loop and the charter's grouping or time order in both loops. Show with a planted leak that a non-nested pipeline rewards it and yours does not.
- 4Give both families the same budget in trials and wall-clock time, including search, at two budget levels. Record every configuration, seed and failure in a run ledger, and state whether the ranking survives the budget change and other seeds.
- 5Calibrate the chosen model's probabilities or intervals on data that never touches evaluation, choose a threshold or abstention rule from the charter's costs, and report risk against coverage. Audit residuals and slices for a shortcut with a cue-only control, and test an ensemble against a single model at a matched total budget, with a duplicate-member control.
- 6Run a small crossed comparison of one data change and one model change on the same evaluation, record their marginal costs, and write the data-or-model decision. If a decision rests on a prior, add an optional appendix showing the action across a range of priors.
What you hand in
- A
models/package with both families inside the nested pipeline, and its leak test. - A run ledger with every configuration, seed, budget, time and failure, and the generated comparison table and curves.
- A
reports/model-comparison.mdcovering signatures predicted and observed, ranking stability, calibration and the decision rule, diagnosis, and the data-or-model decision.
How to check it
- Self-grade with the rubric below
How it's graded
Selection integrity
Pass: Every fitted choice sits inside the inner loop, splits respect the charter's grouping or time, and the planted-leak test separates the nested pipeline from a naive one.
Great: You report how much the naive pipeline overstated performance on your data and why the size of that gap makes sense.
Matched budgets
Pass: Both families get the same declared budget, every run is retained, and the ranking is checked under another budget and other seeds.
Great: You show which conclusion would have changed under a different budget or a selected seed, and say so in the report.
Predictions before evidence
Pass: Curve signatures were written before the curves, and the report compares them honestly, including misses.
Great: A wrong prediction leads to a specific revision of the hypothesis rather than a new story.
Calibration and decisions
Pass: Calibration and threshold or abstention choices use data separate from evaluation, and risk against coverage is reported.
Great: You separate ranking quality, calibration and decision loss, and show a case where improving one leaves another unchanged.
Data or model
Pass: The crossed comparison runs on one evaluation with marginal costs recorded, and the decision states what it does not rule out.
Great: The report shows whether the data change and the model change interact, and the shortcut and ensemble checks feed into the decision rather than sitting beside it.
Resources
- Model Evaluation, Model Selection, and Algorithm Selection in Machine LearningSebastian Raschka
Read v3 Section 1.1 (estimating a fitted model's performance, selecting a model and comparing algorithms "require different approaches"), 3.9 and Sections 4.8 to 4.15, with Figure 22 for nested cross-validation (Figure 16 is ordinary k-fold model selection). Decide which of the three claims your comparison makes before choosing a protocol. It assumes independent examples and mostly 0-1 loss, so its 5x2cv advice does not license treating clusters or folds as independent replicates.
- On Over-fitting in Model Selection and Subsequent Selection Bias in Performance EvaluationCawley and Talbot, JMLR 2010
Read Section 4 (4.1, the bias and variance of the selection criterion, Figures 2 and 3) and Section 5 (internal evaluation and the median-hyperparameter protocol, Table 5). On heart, the biased protocol reports 16.730% error against 15.720% internal, a 1.010 point bias (standard error 0.186). Treat training and selection as one fitting procedure. The same protocol for every model is not automatically fair: selection bias depends on the algorithm, and these magnitudes do not transfer to neural searches.
- Cross-validation: what does it estimate and how well does it do it?Bates, Hastie and Tibshirani
Read v4 Sections 2, 3.1 and 4.1 to 4.3 with Figure 1; proofs are optional. Cross-validation targets average error over training sets more than the error of your fitted model, and naive fold intervals undercover: nominal 10% miscoverage became 31% in their simulation. Their nested estimator of the estimator's error is not
GridSearchCVinsidecross_val_score, and Theorem 1 assumes homoskedastic Gaussian linear regression with least squares. - The Elements of Statistical Learning - Chapter 7Hastie, Tibshirani and Friedman
Second edition, corrected 12th printing: read 7.10.2 The Wrong and Right Way to Do Cross-validation (pp. 245 to 247) and 7.12 Conditional or Expected Test Error? (pp. 254 to 257); the rest of the chapter is reference. In the 7.10.2 example (50 samples, 5,000 noise predictors, screening before cross-validation) the average CV error was 3% against a true 50%: selection leakage, not a failure of cross-validation. Use the official download page.
- Probabilistic Machine Learning: An Introduction - Reject OptionKevin Murphy
In the April 18, 2025 online draft read 5.1.2 (cost-sensitive decisions, pp. 169 to 171) and 5.1.2.3, the reject option: with rejection cost and error cost , reject when the top class probability is below (Chow's rule, Eqs. 5.11 to 5.15), then derive it in Exercise 5.1. Section 12.5 adds that a constant predictor can be well calibrated and useless. Calibration and Bayesian model checking are deferred to the sequel; this is the selective-prediction source, not a calibration course.
- A Unified Theory of Diversity in Ensemble LearningWood, Mu, Webb, Reeve, Luján and Brown, JMLR 2023
Read Section 2 (what ensemble diversity is), Section 4.1 (Theorem 5, the bias-variance-diversity decomposition of ensemble loss), 4.3 (estimating diversity from data) and 6.2 to 6.3 (good and bad diversity in majority voting). Diversity is a term to trade off against the members' bias and variance, not something to maximize. Compare a matched-budget ensemble with its best single member and report the decomposition, not only the aggregate accuracy.
- Deep Learning Tuning Playbook - Scientific TuningGoogle Research
At the pinned commit read A scientific approach to improving model performance, Exploration vs exploitation, Identifying scientific, nuisance, and fixed hyperparameters, Creating a set of studies, Striking a balance between informative and affordable experiments and Detecting whether a change is useful with isolation plots. A factor's role depends on the question: comparing depths requires retuning the learning rate. Declare whether budgets are equal trials, epochs, steps or wall time, include search overhead, and keep every valid run. Isolation plots are exploratory evidence.
- Shortcut Learning in Deep Neural NetworksGeirhos et al.
arXiv:2004.07780v5: Section 3 and Figures 2 and 3, then Sections 6.1 and 6.2 for cue-only baselines and tests that distinguish intended and shortcut rules. Apply the diagnostic logic to a small tabular simulator; image-model training is not required. An input edit is a model stress test, not automatically an identified real-world causal intervention.
- STATS202 - Data Mining and AnalysisStanford University
Use only the Kfold-CV and Shrinkage notes and Assignment 3 Q3 and Q4 (subset selection and lasso against known synthetic mechanisms; least squares, ridge, lasso and PCR). Repair the protocol before use: Assignment 2 Q6(j) and Assignment 4 Problem 3(d) choose settings on the "held out" data, which makes it a validation set, so add an untouched outer test; Assignment 3 Q5 prints
y_i - g(x_i)^2where the squared residual is meant. The labs are in R; recordings and grading need a Stanford account. - An Introduction to Statistical Learning with PythonSpringer and the authors
Use the Python labs only where needed:
Ch05-resample-lab.ipynb(Cross-Validation, The Bootstrap) andCh06-varselect-lab.ipynb(selection by validation and cross-validation, ridge and lasso) at https://github.com/intro-stat-learning/ISLP_labs/tree/v2.2.1. Chapter 5 warns that the spread of split scores is not a valid estimate of the mean score's sampling variability; Chapter 6 lets only training observations choose each fold's subset. The Chapter 6 lab fits ridge withElasticNet(l1_ratio=0)and silences warnings; preferRidgeorRidgeCVwith scaling inside the folds. - CS229 Public Materials - Learning Theory and Model SelectionStanford Engineering Everywhere
Read ML-advice.pdf slides 6 to 24: capacity, optimization and objective diagnostics, and error analysis (current versus perfect performance) as distinct from ablation (baseline versus current). The slides warn that some advice does not suit novel research. notes4 (learning theory, pp. 1 to 11) is depth and notes5 (cross-validation, feature selection, Bayesian regularization) is reference; notes4 uses "bias" loosely for infinite-data error.
- scikit-learn 1.9 - Model Selection and Evaluationscikit-learn
Run the nested versus non-nested iris example (its optimism is about 0.0076 accuracy over 30 splits; the split-to-split spread is descriptive, not a confidence interval), then use the grouped iterators (
GroupKFold,StratifiedGroupKFold) in both inner and outer loops, the curve guides, andTunedThresholdClassifierCV: a decision threshold is a selected parameter, and tuning it on the fitting data overfits. Add tests that fail if preprocessing, selection or threshold tuning sees the final test fold. - scikit-learn 1.9 - Probability Calibrationscikit-learn
Read the calibration guide (curves, sigmoid, isotonic and the newer temperature method;
FrozenEstimatorfor an already-fitted model with separate calibration data), then run the calibration-curve example. A lower Brier score does not mean better calibration. Isotonic creates ties that can change ranking metrics; temperature keeps the multiclass argmax. Measure whether recalibration changes the cost-based decision and sparse-slice reliability, not only the reliability plot. - scikit-learn 1.9 - Computational Performancescikit-learn
Sections 10.2.1.1 and 10.2.1.3 to 10.2.1.6: batch size, features, representation, model complexity and feature extraction in a model-family decision. Measure the whole pipeline on the intended request shape; the source's timings and rough scaling claims are not portable targets.