Chapter 26 Instructor Notes — Predictive Modeling
Chapter: Predictive Modeling for F1: Race Outcome Prediction, Qualifying Forecasting, and Championship Simulation · Exercises · Quiz · Case Study 1 · Case Study 2 · Key Takeaways · Discussion guide
Chapter 26 is the book's lesson in forecasting honestly. It starts by defining how a forecast is scored (top-1, podium hit rate, Brier score, log loss) and by establishing the baselines a model must beat: the pole-sitter won 51.6 % of races in 1994–2026 and 55.7 % in 2014–2026. Four model families are then tested walk-forward over 273 Grands Prix. They match the pole pick on picks, beat the grid on probabilities, and fall apart on a Thursday without qualifying. The chapter shows how leaky features fake half a model's gain, forecasts qualifying from practice, and builds a Plackett–Luce championship simulator with a separate retirement model. Students build the predict.py module of Box Box.
Learning objectives
By the end of the session, students should be able to:
- Define and compute top-1 accuracy, podium hit rate, Brier score and winner log loss, and say what each rewards.
- State the baselines (pole pick, grid-slot history, championship leader) and explain why a model must be compared with them on the same races.
- Build features that use only information available before the race, using
shift(1)for rolling features. - Validate walk-forward by season and explain why random cross-validation and leaky features flatter a model.
- Read a reliability table and judge whether a model's probabilities are calibrated.
- Fit Plackett–Luce strengths with a recency half-life chosen by backtest, and simulate a championship with a separate DNF model.
- Label simulator output as model output at a stated snapshot, and backtest it.
Threshold concept
This chapter has no formal threshold concept. Its key idea is a forecast is a probability, and its value is calibration, not picks: the models gain nothing measurable over the pole rule in picking winners, but they give better-calibrated probabilities (log loss 1.304 vs 1.439). Students who have this stop asking "did the model get the winner right?" and start asking "were its 20 % calls right about 20 % of the time?"
Suggested 75-minute session plan
| Time | Segment | What happens |
|---|---|---|
| 0–8 min | Hook | "My model predicts the winner 55 % of the time." Ask the class whether that is impressive. Reveal: the pole-sitter won 55.7 % of 2014–2026 races. Every claim needs a baseline on the same races. |
| 8–25 min | Concept | Scoring rules and baselines. Work the Brier score for the 2026 Las Vegas GP at the board (exercise B1: Verstappen 0.659, won). Walk-forward validation; shift(1); why the pre-season round is hard (ρ 0.743 in stable seasons vs 0.575 after rule changes). |
| 25–42 min | Live demo | Run code/01_baselines.py (about 5 s), then show the saved scoreboard from code/03_output.txt (03 takes 70–90 s, so start it at the beginning of class if you want it live). Paired bootstrap: logit top-1 minus pole +0.026 [−0.022, +0.073]. |
| 42–62 min | Activity | Leakage hunt. Give groups a list of candidate features (including a centred rolling team gap and final championship rank). Each group marks which leak and why, then compares with the chapter: leaky features improve log loss by 0.062, about 46 % of the honest gain. |
| 62–75 min | Wrap-up | The championship simulator at round 21 of 2026 (model output at the snapshot): Verstappen P2 99.1 %; P3 Hamilton 39.0 % vs Norris 38.7 %; Red Bull P3 75.0 %. Exit ticket: "Why does the simulator draw retirements before it draws the finishing order?" |
Key numbers students should leave with
- Pole → win: 51.6 % (1994–2026), 55.7 % (2014–26), 62.6 % (2023–26). The championship leader won 42.7 % of races in 2014–26.
- Walk-forward, 2014–2026 (273 GPs): models pick the winner 54–58 % of the time vs 55.7 % for pole; no model beats pole by a margin that excludes zero.
- Probabilities: gradient boosting improves log loss over the grid baseline, 1.304 vs 1.439 (difference −0.135 [−0.251, −0.025]); logistic regression improves Brier by −0.035 [−0.064, −0.005].
- Thursday forecast (no qualifying): top-1 44–47 %; 19.0 % in 2026.
- Leakage: two leaky features fake about half the model's honest gain (−0.062 log loss vs −0.135).
- Qualifying forecast, 2023–26: last practice or SQ session finds the pole-sitter 36/89; pre-weekend model 32/90; equal blend 39/90.
- DNF rate 2026: 18.3 % of starters (83/453), using
finished, neveris_classified. - Championship backtest, 2014–2025: the eventual champion got more than 50 % at 35 of 36 checkpoints; the miss was 2025 with five GPs left (Norris 38 %).
Common misconceptions and remedies
| Misconception | Remedy |
|---|---|
| "55 % winner accuracy is a strong model." | Compare with pole (55.7 %) on the same races. Then compare log loss, where the model does help. |
| "Random cross-validation is fine for sports data." | It barely flattered the model here, but leaky features did. Validate walk-forward by season and audit every feature for information from the future. |
| "Accuracy is the right metric." | Accuracy ignores confidence. Brier and log loss reward calibrated probabilities. |
| "The model said 3 %, and he won, so the model failed." | Read the reliability table: forecasts below 10 % produced 41 winners against 30.4 expected in 2014–26. Long shots win; the question is how often. |
"is_classified means the driver finished." |
It is True for late retirements. Using it gave Piastri 97.8 % in a 2025 title simulation with five races left. Use finished. |
| "The simulator tells us who will win the title." | Both 2026 titles are already settled; the simulator answers narrower questions, and its output is labelled as model output at the snapshot. |
Exercises to assign
- Core (everyone): Part A — A1, A2, A4, A9, A10; Part B — B1 (Brier score by hand), B2 (what a log loss of 1.304 means), B4 (shrinking a DNF rate).
- Code lab: Part C — C1 (the 2025 Mexico City GP from the walk-forward predictions) and C3 (predict with fewer features). Add C7 (stress-test the 2026 simulation).
- Judgment: Part D — D3 (the 70 % model) is the best single assignment in the chapter; D1 (the 2026 Italian GP VSC from the other side) pairs with Case Study 1.
- Stretch: Part C — C5 (retrain every round) and C6 (recalibrate); Part E — E1 (a Bayesian Plackett–Luce).
- Interleaving: Part M — M1 (Ch 21 + Ch 26: Elo as a feature) and M3 (Ch 14 + Ch 26: should the forecast know about safety cars?).
Lab tips
- Run order matters:
01_baselines.pybuilds and cachesfeatures_2006_2026.parquet;03_race_models.pywriteswalkforward_predictions.parquet, whichcase_study_01.pyand exercise C1 need. Run 01 → 03 first. - Runtime: 03 takes 70–90 s and
05_leakage.pyabout 80 s;06_championship_sim.pyandproject_checkpoint.pyabout 20 s; the rest a few seconds. All run offline. Saved outputs are incode/*_output.txt. - Gotcha — finished vs classified: see the misconceptions table. Any student code that computes DNFs or finishing orders must use
finished. - Gotcha — centred smoothing leaks: Chapter 24's
development.smooth()is a centred median, fine for description and a leak as a feature (exercise A5). - Gotcha — duplicate qualifying positions: a handful of rounds in
history.qualifyingstill have tiedquali_positionvalues below P1. Rank by time, not by the position column. - Gotcha — red-flag pit times: OpenF1 records red-flag stoppages as pit-lane times of about 1,840 s (2026 Monza lap 3). The toolkit's 60 s cap removes them; students rolling their own pit-loss code must too.
- Seeds are fixed (42) for bootstraps and simulations; tell students to keep them fixed when comparing model variants.
Connections
- Backward: Chapter 14 (safety-car base rates), Chapter 16 (qualifying), Chapter 21 (Elo and driver ratings), Chapter 24 (team pace features).
- Forward: Chapter 27 simulates races lap by lap; Chapter 33 prices championship positions; Chapter 38 (betting analytics) compares these probabilities with the market.