7 routes42 sections324 units

Unit 5.9 · about 4 h

168 / 324

Covariate, label and concept shift, drift and label delay

Test error assumes tomorrow looks like yesterday. Each shift type breaks a different link, so each needs its own detector and response.

  • explain
  • measure

You can now

  • Classify a change as covariate, label or concept shift by naming which distribution moved.
  • Build a domain-classifier covariate-shift detector and apply importance weights with the support condition checked.
  • Separate data drift from performance drift and design monitoring that survives label delay.

Covers

  • Covariate, label and concept shift
  • Data drift, performance drift and label delay

Study, in this order

3 steps

  1. D2L Section 4.7: shift types and corrections
    D2L - Environment and Distribution Shift

    Types (covariate: \(P(y \mid x)\) fixed with \(p(x)\) moved; label: \(P(y)\) moved with \(P(x \mid y)\) fixed; concept: \(P(y \mid x)\) moved), Correction (importance weights \(\beta = p(x)/q(x)\) via a domain classifier, the label-shift confusion-matrix solve) and Taxonomy (batch versus online deployment)

    Depth · Skim the anecdotes and fairness sections. Work the math in Correction.

  2. D2L 4.7 Exercises: detector and corrector
    D2L - Environment and Distribution Shift

    Exercises 2 and 3: implement a covariate shift detector (hint: build a classifier) and a covariate shift corrector

  3. Shift probes, label delay and monitoring design
    Classical ML Scientific Investigation

    Milestones C (shift probes) and E (slices with paired uncertainty), failure injection (label delay, shifted prevalence, group overlap) and the monitoring-design stretch goal

Focus on

  • Name the moving piece: covariate moves \(p(x)\), label moves \(p(y)\), concept moves \(P(y \mid x)\). The detector and the fix follow the name.
  • Covariate correction reweights by \(\beta = p_{\text{test}}(x)/p_{\text{train}}(x)\), estimated as \(\exp(h(x))\) from a train-versus-test logistic domain classifier on equal sample counts (otherwise scale by the count ratio), capped as \(\min(\exp(h), c)\). It needs train support everywhere test reaches.
  • Label shift solves mean-test-predictions equals confusion-matrix times new priors. It needs \(P(x \mid y)\) fixed and a validated confusion matrix.
  • Data drift without performance drift is a warning, not a failure. With label delay, performance drift stays unobservable until labels land, so monitor input drift and slice volumes meanwhile.

Reproduce closed-book

Closed-book, simulate a covariate shift on a toy problem (train on one \(x\)-range, test shifted), train the domain classifier, compute capped weights \(\beta = \min(\exp(h), c)\), and show the weighted error estimate moving toward the test error.

Traps

  • Correcting with weights where test reaches and train never went. Importance weights cannot invent unseen regions; collect data instead.
  • Reading a domain-classifier AUC near 0.5 as no shift. It may be a weak detector, so check slice volumes and the performance series too.
  • Waiting for late labels to detect breakage. Design input-drift and volume monitors that fire before labels land.

Practice

D2L 4.7 Exercises: shift detector and corrector

Exercises 2 and 3: a domain-classifier covariate-shift detector and an importance-weighted corrector on a controlled synthetic shift

Control the shift yourself (one variable moves) so you know the ground truth the detector must find.

Self-test

  1. Cat photos train, cartoon cats test. Which shift, and what stays fixed?

  2. Disease prevalence doubles with identical symptoms per disease. Which shift, and what is the fix?

  3. Spammers keep crafting messages unlike anything seen before, month after month. Which kind of shift, and what helps?

  4. Input drift alarms fire but held-out accuracy holds. Ship or stop?

Completion criterion

Stop when

You classify a new change into covariate, label or concept shift on sight, and your detector plus weighted estimate respond correctly to a synthetic shift you control.

Mark passed, then open 5.10 Only mark this when you can do it without notes.

Leads to

Comes after

Resources for this unit

  • Classical ML Scientific Investigation
    Roadmap-Finalreferenceassessment
    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.
  • D2L - Environment and Distribution Shift
    D2L authorssupporttheory
    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.

Also in this section

  • scikit-learn - model selection and evaluation route
    scikit-learnprimarycourse
    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.
  • ISLP - resampling and multiple testing
    James, Witten, Hastie, Tibshirani and Taylorrequiredtheory
    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.
  • Deep-ML candidate - evaluation problems
    Deep-MLoptionalpractice
    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
    SciPy developersreferencereference
    Work the notebooks linked from this page: Tutorial 3 (The Bootstrap) with scipy.stats.bootstrap, including paired=True, and Tutorial 2b (Paired-Sample Permutation Tests) with permutation_test and permutation_type='samples'. Keep one resampling index stream across compared models.
  • El-Yaniv and Wiener - On the Foundations of Noise-free Selective Classification
    JMLRreferencereference
    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.

Quick find

Search Michi

Type to search every route, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels