Models that learn from data arriving over time, such as sensor streams, hospital records or surveillance counts, slowly go out of date. Drift detectors are meant to warn us when that happens. In my own work I learned that a detector can be working perfectly and still mislead you, because it cannot tell a change in the world from a change in how the world was recorded.
This note gives a short map of drift detection for time-series and sequential data, a trap that is specific to this kind of data, and a case study from my ICU work where the alarm turned out to be mostly a recording artifact.
Three kinds of drift
- Data drift (covariate shift): the inputs change. Patients arrive sicker, or a sensor reads higher.
- Concept drift: the link between inputs and outcome changes. The same vital signs now mean something different, perhaps because treatment improved.
- Label drift: the outcome itself becomes more or less common.
Time series make all three harder to see. Trends and seasonality look like drift but are expected. Change can be sudden, such as a new device, or gradual, such as slowly changing practice. And the data come in order, so the most recent window is always small.
Three families of detectors
| Family | Examples | Needs labels? | Main weakness |
|---|---|---|---|
| Per-feature tests | PSI, Kolmogorov–Smirnov, chi-squared | No | Look at one feature at a time; thresholds are rules of thumb; with large samples they flag tiny, harmless shifts |
| Multivariate tests | Classifier two-sample test (C2ST) [1], shift tests on model outputs [2] | No | Say that the data changed, not whether the change matters for the model |
| Performance-based | DDM, ADWIN, Page–Hinkley on the error stream [3]; accuracy against a baseline | Yes | Labels often arrive late, so the warning comes after the damage; small windows are noisy |
A C2ST trains a classifier to tell recent data from reference data. If it cannot do better than chance (AUROC near 0.5), the two look alike; the higher the AUROC, the larger the shift. Because the classifier sees all features at once, it can catch changes in how features relate to each other that per-feature tests miss.
The families answer different questions, so none replaces the others. Data can drift without any visible drop in accuracy [4], and accuracy can drop for reasons a data test does not see.
A trap specific to time series
Most of these tests assume that samples are independent. Time-series points are not: neighbouring hours from the same sensor, or repeated stays of the same patient, are correlated. Treating them as independent makes a test far too confident, and it raises false alarms.
The fix is to resample whole units rather than single points: blocks of time, or whole patients. In my own detector, cross-validation folds are grouped by patient and the confidence interval comes from a patient-level bootstrap, and I check the false-alarm rate on two halves of the training data where no shift should exist.
The question none of them answers
Every detector above can tell you that the data changed. None can tell you why. In practice, a large share of apparent drift comes from the recording process: a hospital changes its coding, a device is replaced, an app samples less often, or a testing policy changes. To a detector, these look exactly like a real change, and a model retrained on them will learn the artifact.
Case study: an alarm caused by missing records
In my work on ICU prediction with MIMIC-IV (2008–2022), an earlier version of my drift gate, built on per-feature PSI scores and an accuracy check, fired at only one point: the 2020–2022 era, at about 24 times its baseline score. The features driving it were treatment features, such as total crystalloid volume and insulin infusions.
Those features come from the table that records infusions. When I split each era into stays that have infusion records and stays that have none, the picture changed:
| Era | Stays with no infusion records | Insulin infusion, all stays | Insulin infusion, stays with records | Crystalloid (mL), all stays | Crystalloid (mL), stays with records |
|---|---|---|---|---|---|
| 2008–2013 | 0.1% | 15.4% | 15.4% | 900 | 901 |
| 2014–2016 | 0.1% | 14.2% | 14.2% | 778 | 778 |
| 2017–2019 | 0.5% | 14.1% | 14.2% | 664 | 667 |
| 2020–2022 | 53.9% | 6.2% | 13.5% | 263 | 569 |
Aggregate figures from about 80,000 ICU stays in my cohort. Stays with no infusion records have zero crystalloid and no insulin infusion by construction, because both features are built from that table.
More than half of the 2020–2022 stays had no infusion records at all. Among stays that did, insulin use barely moved, so its apparent fall from about 15% to 6% was almost entirely an artifact. Crystalloid volume was declining steadily in every era, which is plausibly a real change in practice, but about half of its 2020–2022 drop came from the missing records. The detector had done its job. The alarm was real; its cause was not clinical.
This does not mean nothing changed. After removing stays without records, a label-free C2ST still separated each later era from the training data, physiology included. Real drift and recording drift were both present, and the first detector could not tell them apart.
A practical checklist
- Check the recording first. Track, per period, how many records are missing from each source table, and whether codes or definitions changed. This is cheap and catches the largest artifacts.
- Run a multivariate test such as a C2ST, on all features and on groups of features, so you know which part of the data moved.
- Check whether the change reaches the model by testing for a shift in its predicted probabilities. Not every data change matters.
- Confirm with accuracy once labels arrive, using a confidence interval rather than a fixed cut-off.
- Fix thresholds in advance, calibrated on data where no shift should exist, and respect the time-series dependence when resampling.
What is still open
Methods exist that attribute a model's performance change to shifts in specific parts of the data-generating process [5], but they assume a causal graph and labelled data from both periods. Telling a real change from a recording change, without labels and in time to act before a model is updated, is still largely an open problem. It matters wherever models learn from streams of data: in hospitals, in wearable and smartphone studies, and in public-health surveillance, where a change in testing or reporting can look just like a change in the disease itself.
The audit, drift tests and update experiments behind the case study are described in my preprint Audit Before You Update (project page), with code at github.com/empresst/DataAudit.
References
- D. Lopez-Paz and M. Oquab. Revisiting classifier two-sample tests. ICLR, 2017.
- S. Rabanser, S. Günnemann and Z. C. Lipton. Failing loudly: an empirical study of methods for detecting dataset shift. NeurIPS, 2019.
- J. Gama, I. Žliobaitė, A. Bifet, M. Pechenizkiy and A. Bouchachia. A survey on concept drift adaptation. ACM Computing Surveys, 2014.
- A. Kore et al. Empirical data drift detection experiments on real-world medical imaging data. Nature Communications, 2024.
- H. Zhang, H. Singh, M. Ghassemi and S. Joshi. "Why did the model fail?": attributing model performance changes to distribution shifts. ICML, 2023.
MIMIC-IV requires credentialed PhysioNet access. Following its data use agreement, this note reports only aggregate figures.