Validate and communicateLesson 56 of 76 · 8 min
Compare predictions with observations
Use held-out evidence to challenge a model’s predictive behaviour.
Validation asks whether a model is adequate for its intended use. It can involve comparing predictions with observations that were not used to choose or fit the model. A model can pass arithmetic checks while failing this empirical comparison.
This illustration supplies an invented held-out demand record and compares it with an assumed Poisson prediction. Compare how often the simulated and invented observations are at or below the model’s nominal 90th percentile. With a small validation set the count is itself variable, and repeated time observations may be dependent. Nominal means the stated model level. For integer counts the P90 cutoff can cover more than 90%, so fewer than 10% may lie strictly above it even in a correct model.
A discrepancy can reveal a poor model, changed conditions, a measurement problem or a mismatched validation population. It should lead to investigation. Do not delete inconvenient validation observations or retune on them while continuing to call them an untouched test set.
- Specify the input model
- Predict a threshold
- Compare held-out observations
Does a prediction covering about 90% in its own simulated data guarantee 90% coverage on new observations?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Model nominal P90 count: 26.0 Model fraction <= threshold: 0.9231 Held-out observed fraction <= threshold: 0.5833 Holdout observations: 12
Read the first result
Discrete quantiles can have coverage above the nominal level. The held-out sample is tiny and deliberately illustrative.
Try an edit
Replace assumed_mean = 20 with assumed_mean = 26. Select Run Python again. Compare Model nominal P90 count and both coverage fractions. These rows can guide another model. If you use them to choose the mean, those rows no longer provide an independent check. What fresh observations would you hold out?
Scope. The holdout record is invented and too short for a strong calibration claim. Its purpose is to show the validation distinction.
Try a fresh case
After repeatedly tuning a model to one validation set, what is needed for a fresh assessment?
Need a hint?
Hint 1
Ask whether the observations influenced the final model.
Hint 2
Separate model revision from evaluation of the revised model.