Machine learning / race simulation

F1 Race Strategy Decision Support

A decision-support application that combines lap-time prediction with Monte Carlo simulation to compare Formula 1 pit-stop strategies across real 2021–2025 race data.

PythonStreamlitscikit-learnPandasNumPyFastF1Altair
Intent

Why this system exists

Race strategy couples tyre degradation, pit loss, weather, and uncertainty. Manually reasoning over every combination is impractical, so the system makes the trade-offs explorable.

Critical decision

What shaped the architecture

Predict race-normalized lap delta rather than raw lap time, compare Ridge with HistGradientBoosting, and sample residuals plus pit loss to return P10/P50/P90 strategy-time bands instead of a single false-precision answer.

Architecture / simplified
  1. 01FastF1 telemetry
  2. 02Feature engineering
  3. 03Rolling split
  4. 04Lap-time model
  5. 05Monte Carlo simulation
  6. 06Strategy bands
  7. 07Interactive dashboard
Reliability work

Designed for imperfect conditions

  • Rolling chronological validation
  • Pinned model metadata
  • Model-loading smoke tests
  • Residual-based uncertainty
  • Ridge baseline comparison
  • CSV export
HGB MAE
1.41s
Monte Carlo runs
2,000
Race data
2021–25
Working result

What exists now

  • HistGradientBoosting achieved 1.41s MAE and 2.25s RMSE on rounds 17–24.
  • Supports up to 2,000 Monte Carlo simulations per strategy with P10/P50/P90 bands.
  • A Belgian GP case study recommended a Medium-to-Hard one-stop comparable to the actual strategy.
Next pass

What I would improve

Build a dedicated wet-weather model, add traffic, safety-car, and overtake effects, and investigate the Las Vegas residual spike.