How the practitioner track works
Ten sessions, 45 minutes each, laptop open. Tonight is the foundation: what a held-out estimate is an estimate of. Session 2 builds the Thornbury shortcut and measures how hard a model leans on it. Session 3 trains twenty models that differ only by their random seed. Session 4 designs the stress set. Sessions 5 and 6 measure what selecting on a test set costs and how big a test set has to be before that cost can even be measured. Sessions 7 to 10 move outward to benchmarks, leakage across a whole literature, a finding that did not survive one more data draw, and the bench you run before you sign anything. The worked example throughout is Thornbury, a fictional hospital group predicting which patients deteriorate within 24 hours, where every true relationship is written into the generator and can therefore be checked.
★ What you walk out with tonight. A precise statement of what a held-out number estimates and what it is silent about, so you can say it out loud in a review without hedging. The three data shapes where a random split describes a world nobody will deploy into, each with the split that fixes it. A Thornbury generator running on your own machine, with the ward shortcut written in at 90 percent agreement, ready for the measurement in session 2. And the reason the rest of the track exists: the held-out set and the training set come from the same world, so a held-out score cannot see a shortcut at all.
LiveWhat a held-out estimate is unbiased for5 min▶
Hold out a random slice of your rows, train on the rest, score on the slice. What you have built is an unbiased estimate of the model's performance on the distribution the slice was drawn from. That is a real guarantee and it is worth having. It is also the whole guarantee. The estimate is not slightly informative about other distributions, or weakly informative, or informative on average: it is silent about them, because nothing in the procedure ever touched them.
The assumption doing the work has a name. The rows are treated as independent and identically distributed: each one an independent draw from one fixed distribution, so a random half of them stands in for the rest. Both halves of that phrase are claims about how the data came to exist. Independent says one row does not carry information about another. Identically distributed says the world did not move while you were collecting. Neither is something the split function can check, and neither one is repaired by drawing the slice more carefully.
Thornbury's training rows and held-out rows both come from the collection year. In that year the ward a patient was on agreed with the outcome about 90 percent of the time, so the ward was just as useful on the held-out rows as it was in training. The held-out estimate came back at 0.949 and it was correct. After the wards were reorganised the agreement fell to about 50 percent and the same model scored 0.765. Both numbers are honest measurements of different distributions.
Self-studyThe words that will keep coming back4 min▶
- Independent and identically distributed. Each row an independent draw from one fixed distribution. The assumption a random split rests on, and a statement about the world rather than about the code.
- Held-out set. Rows kept out of training and used to estimate behaviour on unseen data from the same distribution.
- Group. The unit that repeats across rows: a patient, a session, a device, an institution. If rows share a group, they are not independent draws.
- Group-aware split. A split where every row belonging to one group lands on the same side, so the score answers a question about a new group.
- Time-based split. Train on the earlier period, score on the later one, so the model is never shown the future of the period it is judged on.
- Stress set. Rows chosen to break one named assumption, scored alongside the held-out set rather than instead of it. Session 4.
- Shortcut. A feature that predicts the outcome without causing it, whose usefulness depends on an arrangement that can change. Session 2 builds one and measures the model's reliance on it.
- Accuracy and the rest of the metric family. Defined, computed and monitored in learn-model-evaluation-with-phoebe; here a metric is only ever a claim whose warrant is in question.
One world, two draws, and a number that only speaks for that world
12 min liveThe picture that makes the rest of the track obvious is the smallest one. A random split does not create two worlds. It takes one world and draws from it twice. Everything the held-out score can tell you is a statement about that single world, including every regularity in it that nobody intended to rely on.
LiveWhy a held-out score cannot see a shortcut4 min▶
This is the sentence the whole track hangs on, and it is short. A shortcut is a feature that predicts the outcome without causing it. In the collection year, Thornbury's ward agrees with the outcome about 90 percent of the time. That agreement is a property of the world the data was collected from, which means it is a property of the training rows and of the held-out rows in equal measure. A model that leans on the ward scores well on both. A model that ignores it scores worse on both, and would be rejected in review for being worse.
So the held-out set cannot distinguish the two kinds of learning, not because it is too small and not because it was built carelessly, but because it was drawn from the same place. No amount of additional held-out data changes this. The only measurements that can separate them are measurements that do something the split does not do: intervene on a feature and watch the predictions move, which is session 2, or score the model on data drawn from somewhere else, which is session 4.
LivePredicts and causes are different words, and only one of them is being used here3 min▶
Keep the language plain. The vitals drift and the lab trend at Thornbury are written into the generator as things that actually bring the outcome about. The ward is written in as something that merely agrees with the outcome, because in the collection year the high-acuity ward received most of the patients who went on to deteriorate. Both kinds of feature raise a held-out score. Only one of them keeps working when the arrangement behind the agreement is changed by somebody in facilities management.
That distinction is all that is needed tonight, and the formal machinery for reasoning about it, identification and what you may and may not adjust for, belongs to learn-causal-inference-with-phoebe. What is needed here is the habit of asking which kind a feature is, and the knowledge that the held-out score will never answer.
Self-studyUnbiased is not the same as trustworthy3 min▶
Unbiasedness is a statement about repetition: run the whole procedure many times on fresh draws from the same distribution and the estimates centre on the true value for that distribution. It says nothing about how far any single estimate sits from the truth, which is variance, and nothing about whether the distribution is the one you care about, which is validity. A large held-out set buys the first. Nothing you can do inside the collection year buys the second.
The practical reading is that precision and relevance are bought in different shops. When somebody proposes quadrupling the held-out set to increase confidence before deployment, they are buying precision on a quantity nobody disputed.
Three shapes of data where a random split is a lie about deployment
12 min liveThe independence claim and the identical-distribution claim fail in recognisable ways, and each failure has a standard repair that costs a different line of code. None of the three is a bug in the split function. Each is a mismatch between the question the split answers and the question deployment will ask.
LiveGrouped rows: the score answers a question nobody asked4 min▶
Rows are rarely the unit anybody cares about. Admissions belong to patients, clicks belong to sessions, readings belong to devices, cases belong to institutions. When a random split scatters the rows of one group across both sides, the held-out score is still an unbiased estimate, but of a strange quantity: performance on a new row from a group the model has already met. If deployment means meeting a new patient, that quantity is not the one you wanted, and it is reliably the friendlier of the two.
The repair is a group-aware split, and the only hard part is naming the group honestly. It is usually the unit that will be new at deployment time. Write it down before the split, because after the split it is invisible: the two index sets look identical in shape and completely different in meaning.
LiveTime-ordered rows: the model saw the future of the week it is graded on4 min▶
When rows carry a clock, a random split takes some rows from after the scored period and puts them in training. The model then has information about how the period turned out while being graded on it. The estimate that comes back is unbiased for a world in which you get to know the future, which is not a world anybody deploys into.
The repair is a time-based split: train on the earlier period, score on the later one, and accept a smaller and noisier number in exchange for one that means something. This is a different failure from a field that could not have been known when the prediction was made, which is leakage; the mechanics of that, how a post-outcome field reaches a feature list and how a noisy one survives review, belong to learn-model-risk-with-phoebe p3.
Self-studyA moving population, and why a stress set is not just more data3 min▶
The third shape is the one Thornbury eventually meets. Collection happens in one period; deployment happens in another; between them the people change, or the process that produces the rows changes, or an arrangement that several features quietly depended on is reorganised. Nothing inside the collection window can measure this, because every row you could add is drawn from the window.
A stress set is data chosen to break one named assumption: a later period, a different site, a rearranged version of the world. It is scored alongside the held-out set, never instead of it, and it answers a narrow question rather than a general one. Designing one, and being precise about what it can and cannot establish, is session 4.
Build the Thornbury world, then split it two ways
13 min build-alongLaptop open, numpy and scikit-learn, nothing else. Two blocks. The first writes the Thornbury generator, with both honest signals and the ward shortcut, so that from tonight onward every claim in the track can be checked against a world whose truth you typed yourself. The second splits the same frame twice and shows that the two results are different objects answering different questions.
Write the generator. Two standard-normal signals, a logit built from them, a Bernoulli outcome, and a ward that agrees with the outcome with probability p and is a coin flip otherwise. The shortcut strength is a parameter, which is what lets the same function produce the collection year and the deployment year.
Make three frames. Training and held-out at an agreement of 0.90, shifted at 0.50. Keep the seeds different so the three are genuinely separate draws.
Check the shortcut is there. Before trusting anything downstream, confirm the ward matches the outcome about 90 percent of the time in the first two frames and about 50 percent in the third. A generator you have not checked is a claim, not a fixture.
Add a group column. Give the frame two admissions per patient so the grouped shape is real rather than described.
Split it twice. Once at random, once group-aware, and count how many patients appear on both sides of each. The random split leaks patients across the boundary; the group split cannot.
Say what each score would mean. Out loud, before session 2 trains anything on either of them. One estimates performance on a new admission from a known patient. The other estimates performance on a new patient. Only one of those is deployment.
The check to keep. After any split, print how many units of the thing that will be new at deployment appear on both sides. If the answer is not zero, the score you are about to compute is an estimate of something easier than the job. This is two lines and it has caught more inflated numbers than any review meeting.
Three questions
Thornbury's held-out estimate is 0.949 and it is unbiased. Unbiased for what?
The guarantee is tied to the distribution that produced the rows. Nothing in the procedure ever touched the deployment year, so the estimate is not weakly informative about it; it is silent. Thornbury's 0.765 is an honest measurement of a different distribution, not a correction to the first one.
Your rows are admissions and most patients have several. You split at random and score 0.96. What is that number an estimate of?
The estimate is still unbiased, just for the wrong quantity. Rows from the same patient are not independent draws, so the held-out rows carry information the model already absorbed. A group-aware split changes the question back to the one deployment asks, and typically lowers the number.
Why could no amount of extra held-out data at Thornbury have revealed the ward shortcut?
Held-out rows come from the same world as training rows, so the shortcut is just as useful on both. A model that ignored the ward would have scored worse and been rejected for it. Seeing the shortcut needs a different kind of measurement: intervene on the feature, or score somewhere else. The ward is also not a leak, since it is genuinely known before the outcome is.
Before session 2
30 minKeep tonight's generator in a file you can import, because every session from here uses it. Then take one model your team already runs and answer two questions in writing. First: what is the unit that will be new at deployment, and does the split respect it? Second: name the one feature somebody on the team would call the most predictive, and say whether it causes the outcome or merely agrees with it, and what arrangement that agreement depends on. Bring the feature name to session 2, because the measurement built there applies to it directly.