Enterprise AI Bootcamp Demo 2

Measurement leakage, and what happens when it is removed

The first model was not detecting an impending failure. It was detecting a failure already in progress — and the features that let it do so are the obvious, honest features any competent engineer would build first.

Why the naive feature set cannot fail

An air leak under high stress is, by definition, the compressor never unloading. So the sensors that describe "the compressor is working hard right now" are near-deterministic restatements of the label, not predictors of it.

SensorMean, normal Mean, in failure windowLift
TP21.2328.1156.6×
TP38.9998.2880.9×
H17.7200.0380.0×
DV_pressure0.0201.86094.8×
Reservoirs8.9998.2900.9×
Oil_temperature62.38375.5981.2×
Motor_current1.9805.5322.8×
COMP0.8540.0040.0×
This is not a synthetic trap. No feature was planted to make this happen. The leak is native to the obvious framing of the problem, which is exactly why it is worth twenty minutes of a training course.

The score, as each form of leakage is removed

R3 — in-window label
0.995
AUPRC. Publishable.
R4 — same features, time-ordered
0.022
AUPRC. The collapse.
R7 — strictly causal features
0.019
AUPRC, against a prevalence floor of 0.0200

Three changes separate the first bar from the last, and each is a discipline rather than a technique:

  1. The label became a prediction. "Is it failing now" became "does a failure start within the next 24 hours". The first question has no operational value; by the time it is answered the machine has stopped.
  2. The features became causal. Every rolling statistic is computed on a window ending strictly before the prediction time and shifted by one step. Failure windows and the repair-recovery period are excluded from training entirely, and a 30-minute guard band is dropped, because an alert ten minutes ahead is worthless.
  3. The split became time-ordered with a 48-hour embargo between train and test. A random shuffle puts the ten minutes either side of a failure in both halves.

What the leaky model was actually using

Permutation importance on the in-window model. Every top feature is a present-tense state, not a trend.

FeatureImportance
now_DV_pressure_min0.0131
whole_duty_vs_overall0.0069
now_TP2_max0.0046
now_DV_pressure_max0.0027
now_Oil_temperature_std0.0016
now_DV_pressure_std0.0015
now_TP3_min0.0015
now_Reservoirs_min0.0013

The four leakage patterns

  1. Contemporaneous state (L1) — a feature that is a consequence of the label. Isolated as run R5: AUPRC 0.0212.
  2. Whole-series aggregates (L3) — any statistic, scaler or normalisation fitted across the full series leaks the future backwards. Run R6: 0.0172.
  3. Downstream artefacts — maintenance flags and repair codes, recorded because the failure happened.
  4. Group leakage — the same unit or batch either side of the split.
The diagnostic habit worth taking away: a score that looks too good is evidence of leakage, not of skill. Investigate before celebrating.

Computed by scripts/build_models.py in 86.4s at 2026-08-09T19:08:15+00:00 · scikit-learn 1.6.1 · seed 20260809 · source: MetroPT-3 (Air Production Unit of a Metro do Porto train), CC BY 4.0, DOI 10.24432/C5VW3R. Nothing on this page is hardcoded.