Skip to content
The Collection

03 · Real-Time ML

0.996

R² accuracy

Real-time F1 pit-wall strategy simulator that runs 10,000 Monte Carlo race simulations in under 0.2 seconds.

The Exhibit

01·Problem

“

Race strategists need to predict how a driver's lap times will evolve as tires degrade and fuel burns off, then simulate thousands of "what if" scenarios — different pit windows, undercuts, safety cars — fast enough to matter in a live race.

02·Approach

  1. 01

    Two-stage ML pipeline: Ridge regression with degree-2 polynomial features trained on 10 circuits predicts a baseline lap time per track (extrapolating to unseen circuits like Monza).

  2. 02

    XGBoost predicts the per-lap residual using race-state features (tyre age, compound, position, fuel load, stint, weather) anchored to the GP median pace.

  3. 03

    Vectorized Monte Carlo engine in NumPy runs 10,000 simulations injecting model residuals and Gaussian noise.

  4. 04

    WebSocket-driven live race state: chaos events (rain, safety cars, crashes) triggered from an iPad "steward" view ripple into new simulations instantly across all connected Pit Wall clients.

  5. 05

    Gemini generates a context-aware radio call narrating outcomes — purely for presentation, no computation.

  6. 06

    FastF1 pipeline extracts historical timing, weather, and telemetry into static JSON for the Next.js frontend, avoiding heavy backend REST payloads.

03·Architecture

Swipe to explore

04·Results

0.996

R² (5-fold CV lap KFold)

0.35s

mean absolute error

<0.2s

for 10K MC simulations

05·Stack

Next.js · FastAPI · WebSockets · Ridge Regression · XGBoost · NumPy · Gemini