JT / SAGE IDEAS Work with me

Lab · Machine learning · Synthetic data

Watch a model lie, then catch it.

A tiny model, trained live in your browser on made-up machine-failure data. Flip the split and the leaky feature: one honest problem produces a score that looks like a breakthrough, or like a coin flip.

leakage-lab / run
  • Real model
  • Simulated data

Run it yourself

01 Train/test split

02 Features

Rows removed after the cut. Only the purged split uses it. Labels look 8 rows ahead, so the gap should be at least that.

03 Same data, two ways to evaluate it

Before

Random split + leaky feature

...AUC

A lie.

After

Purged time split + honest features

...AUC

What the data supports.

Training the first model...

Loading...

Train AUC...
Test AUC...
Train - test gap...
Rows train / test / dropped...

04 Timeline of the split

Timeline of the split Rows from oldest to newest, bucketed into columns. Three lanes show which rows are used for training, testing, or dropped. TRAINTESTDROPPED oldest rownewest row

Timeline.

  • Top lane: training rows
  • Middle lane: test rows
  • Bottom lane: purged or embargoed rows (unused)
  • Backward arcs: a feature reading the future

05 Calibration on the test rows

Calibration chart Predicted failure probability against observed failure rate. Points on the diagonal mean the probabilities can be trusted. predicted probability observed rate 01 ideal: predicted = observed

Calibration.

06 Six leakage smells

...

    Smells light up from your settings and from the measured run, not from a script. "Too good" fires above AUC 0.85; "regimes seen" fires when over half of the test rows share a production batch with training.

    AUC is the chance a random failing row is scored above a random healthy one. 0.50 is a coin flip, 1.00 is perfect.

    What this is

    A machine learns when a pump will fail from noisy sensor readings. Done honestly it is a hard problem. Done carelessly it looks easy, because the test is not really a test. This page lets you do it both ways on the same data and see the gap.

    Change the settings above and watch the two headline scores, the timeline, the six smells and the calibration chart react.

    Real vs simulated

    • Real

      A seeded generator builds 2400 time-ordered rows. A logistic regression written from scratch (gradient descent, a quarter of a second at most) trains on every change. The three splits, purge, embargo, AUC and calibration table all come from that run.

    • Simulated

      The data: invented machines, an invented wear process, invented batches. The leaky feature is a noisy copy of future failures, built on purpose. The timeline is a schematic: rows are bucketed and the boundary bracket is not to scale.

    What this does NOT prove

    • It says nothing about the performance of any real model, mine or anyone else's. The data is invented and the model is deliberately tiny.
    • The size of the gap depends on how I built the synthetic world. Press "New synthetic world" and the numbers move. The pattern, an inflated score from a leaky feature and a shuffled split, does not.
    • A purged, honest result is a floor on honesty, not proof that a model works. A real evaluation also needs costs, drift checks and a pass line written down in advance.
    • This is a teaching tool for method. It is not a claim about trading, returns or hit rates.

    Have a system that needs to work?

    Tell me the problem. I will tell you honestly whether I am the right engineer for it.

    Book a 15-minute call Run a free audit Not sure what you need? Answer 3 questions