F1 Strategy Regret Explorer

Quantifying pit-stop brilliance and blunders across the last three Formula 1 seasons. Compare races head-to-head, inspect the live duel ladder, and deep dive into the data pipeline behind the experience.

Strategy Regret, Quantified

Formula 1 weekends hinge on tire timing. This project distils the 2022–2024 seasons into strategy features, summarises every race, and lets fans vote on which weekend delivered the wildest storyline. Votes feed an Elo ladder persisted in Supabase so the excitement table improves over time.

Key Numbers at a Glance

Races analysed

68

Seasons 2022–2024 with per-race summaries, regret statistics, and duel seeds.

Unique strategy share

68.7%

Average portion of the grid running one-of-one pit plans.

Average stops

1.9

Mean pit frequency per classified driver, highlighting tyre wear.

Max regret window

78s

Mean size of the weekend’s largest strategic miss.

Unique Strategy Share

Measures how many drivers chose a pit-stop lap pattern no one else followed. Useful for spotting chaotic stops triggered by safety cars or compound fall-off.

# Notebook snippet
pit_stop_distribution = (
    pit_stops_with_meta
    .groupby(["raceId", "driverId"]).size().rename("stop_count")
    .reset_index()
)
unique_share = (
    pit_stop_distribution
    .groupby("raceId")["stop_count"]
    .transform(lambda s: (s == s.value_counts().index).mean())
)

Max Regret (s)

Largest gap between a finisher’s race time and the best time recorded for the same lap count, effectively the weekend’s biggest strategic blunder.

# From regret_finishers dataframe
regret_finishers["race_best_ms"] = regret_finishers.groupby("raceId")["milliseconds"].transform("min")
regret_finishers["regret_vs_winner_ms"] = regret_finishers["milliseconds"] - regret_finishers["race_best_ms"]
max_regret = regret_finishers.groupby("raceId")["regret_vs_winner_ms"].max() / 1000

Elo Update

Every vote acts like a match: the chosen race gains rating, the other loses. We use a K-factor of 24.

// lib/elo.ts
export function updateElo(rating: number, opponent: number, score: 0 | 1) {
  const expected = 1 / (1 + 10 ** ((opponent - rating) / 400));
  return rating + 24 * (score - expected);
}

Top Mover

Tracks the driver who made the largest net gain from grid to finish. Helpful context alongside DNFs and safety-car chaos.

position_df["position_gain"] = position_df["grid_num"] - position_df["positionOrder"]
top_mover = (
    position_df.groupby("raceId")["position_gain"]
    .idxmax()
    .map(position_df["driver_name"].__getitem__)
)

Sample Summaries

Summaries are stitched together in the notebook by combining feature thresholds with templated sentences. Tweak the logic and regenerate the CSV to experiment with different tones.

2022 • Round 1Bahrain Grand Prix

Bahrain Grand Prix 2022 saw Charles Leclerc take the win, ahead of Carlos Sainz and Lewis Hamilton. Strategy roulette defined the race, with 90% of drivers on unique pit plans. High degradation forced an average of 2.9 stops per driver. Yuki Tsunoda was the top mover, gaining 8 grid spots. The biggest strategy miss cost about 63 seconds.

2022 • Round 2Saudi Arabian Grand Prix

Saudi Arabian Grand Prix 2022 saw Max Verstappen take the win, ahead of Charles Leclerc and Carlos Sainz. Creative pit timing defined the race, with 20% of drivers on unique pit plans. Lewis Hamilton was the top mover, gaining 5 grid spots. Attrition was heavy with 7 retirements. The biggest strategy miss cost about 91 seconds.

2022 • Round 3Australian Grand Prix

Australian Grand Prix 2022 saw Charles Leclerc take the win, ahead of Sergio Pérez and George Russell. Strategy roulette defined the race, with 40% of drivers on unique pit plans. Alexander Albon was the top mover, gaining 10 grid spots. The biggest strategy miss cost about 88 seconds.

Elo-style Excitement Model

  1. Seeding. Weighted blend of unique-strategy share, pit intensity, attrition, peak regret, and top-mover gain sets the initial Elo at roughly 1500 ±120.
  2. Expected score. For races A vs B, we compute the standard Elo probability curve; the underdog gets more credit if voters pick it.
  3. Update. Winners gain Elo, losers drop. Supabase stores the duel record so we can replay or audit the ladder later.