[PR #246] [CLOSED] feat: add live overtaking probability insight panel #248

Closed
opened 2026-05-07 00:19:23 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/246
Author: @pdf1802
Created: 3/11/2026
Status: Closed

Base: mainHead: feature/data-analysis


📝 Commits (10+)

  • f8f189e Add tyre degradation analysis notebook
  • e74fc85 Delete analysis/notebooks directory
  • 2c44bd8 Add analysis folder structure
  • b9a406f Add tyre degradation
  • 60c2895 Add tyre degradation
  • 97c081a Rename tyre_degradation.ipynb to tyre_degradation.ipynb
  • f31d646 Delete D:\Proyectos\f1-race-replay\analysis\notebooks\tyre_degradation.ipynb
  • fa56ebd First tyre degadation graphic
  • 7c1cb51 Add EDA visualizations and documentation
  • 9881d83 Add lap time model notebook

📊 Changes

11 files changed (+11154 additions, -5 deletions)

View changed files

analysis/models/.gitkeep (+1 -0)
analysis/notebooks/.gitkeep (+1 -0)
analysis/notebooks/driver_style_fingerprinting.ipynb (+3446 -0)
analysis/notebooks/lap_time_model.ipynb (+3020 -0)
analysis/notebooks/overtaking_model.ipynb (+1851 -0)
analysis/notebooks/race_simulator.ipynb (+1573 -0)
analysis/notebooks/tyre_degradation.ipynb (+570 -0)
📝 src/gui/insights_menu.py (+19 -0)
src/insights/overtaking_insight.py (+372 -0)
📝 src/interfaces/race_replay.py (+32 -5)
src/overtaking_integrator.py (+269 -0)

📄 Description

What this adds

A new pit wall insight panel — Overtaking Probability — under a new
"Race Analysis" category in the insights menu.

For each pair of adjacent cars within DRS range (~1.0s), displays a live
overtake probability bar from a trained XGBoost classifier.

How it works

  1. Drivers sorted by track position each frame (lap × circuit_length + dist)
  2. Adjacent pairs with gap < 1.0s identified
  3. Gap approximated: gap_s ≈ gap_metres / car_behind_speed_ms
  4. XGBoost classifier returns probability 0–1
  5. Colour: red ≥50%, amber ≥25%, green <25%

Stream improvement

race_replay.py now augments the broadcast with compound and tyre_life
per driver from the existing degradation integrator. Insight panels
receive full tyre data without needing their own FastF1 session.

Model

XGBoost trained on FastF1 race data, 2023–2025 seasons.

Pattern

Follows TyreDegradationIntegrator throughout.

Setup — models required

The panel requires two model files that are not included in this repo
(binary files don't belong in git):

  • overtaking_model.pkl — XGBoost overtaking classifier
  • compound_map.json — compound name → integer encoding

To generate them: run analysis/notebooks/overtaking_model.ipynb
in Google Colab. The notebook trains and saves both files to
MyDrive/f1_models/ automatically.

To point the panel at your models, set the F1_MODEL_DIR
environment variable before launching:

  • Linux/Mac: export F1_MODEL_DIR=/path/to/your/models
  • Windows PowerShell: $env:F1_MODEL_DIR = "C:\path\to\your\models"

Default path if not set: ./models

Captura de pantalla 2026-03-10 194312

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/246 **Author:** [@pdf1802](https://github.com/pdf1802) **Created:** 3/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/data-analysis` --- ### 📝 Commits (10+) - [`f8f189e`](https://github.com/IAmTomShaw/f1-race-replay/commit/f8f189ed657d12c83be32bae896fbb1580406345) Add tyre degradation analysis notebook - [`e74fc85`](https://github.com/IAmTomShaw/f1-race-replay/commit/e74fc85c9f6af2e407b75b6a9d7feee9b82895f7) Delete analysis/notebooks directory - [`2c44bd8`](https://github.com/IAmTomShaw/f1-race-replay/commit/2c44bd8f04fa3cdad8930308a7effc01ff5cf2f0) Add analysis folder structure - [`b9a406f`](https://github.com/IAmTomShaw/f1-race-replay/commit/b9a406fa1ee6dee756a1e66d0ad0197df6feb4ff) Add tyre degradation - [`60c2895`](https://github.com/IAmTomShaw/f1-race-replay/commit/60c2895e06957d5a1c24c3c8a1de298ef06ac689) Add tyre degradation - [`97c081a`](https://github.com/IAmTomShaw/f1-race-replay/commit/97c081a0fa4b77836dd4713b137f51145c1017f4) Rename tyre_degradation.ipynb to tyre_degradation.ipynb - [`f31d646`](https://github.com/IAmTomShaw/f1-race-replay/commit/f31d64613938576c6ab21bea31eb366b5a25b1f3) Delete D:\Proyectos\f1-race-replay\analysis\notebooks\tyre_degradation.ipynb - [`fa56ebd`](https://github.com/IAmTomShaw/f1-race-replay/commit/fa56ebd5024ed0af76e92eb3428f1fbf318ea9f5) First tyre degadation graphic - [`7c1cb51`](https://github.com/IAmTomShaw/f1-race-replay/commit/7c1cb51ecad6cc3c7b860ae4e10e4364a62ad58b) Add EDA visualizations and documentation - [`9881d83`](https://github.com/IAmTomShaw/f1-race-replay/commit/9881d83b1b6d01571774ac965845f8fa46dc7e4d) Add lap time model notebook ### 📊 Changes **11 files changed** (+11154 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `analysis/models/.gitkeep` (+1 -0) ➕ `analysis/notebooks/.gitkeep` (+1 -0) ➕ `analysis/notebooks/driver_style_fingerprinting.ipynb` (+3446 -0) ➕ `analysis/notebooks/lap_time_model.ipynb` (+3020 -0) ➕ `analysis/notebooks/overtaking_model.ipynb` (+1851 -0) ➕ `analysis/notebooks/race_simulator.ipynb` (+1573 -0) ➕ `analysis/notebooks/tyre_degradation.ipynb` (+570 -0) 📝 `src/gui/insights_menu.py` (+19 -0) ➕ `src/insights/overtaking_insight.py` (+372 -0) 📝 `src/interfaces/race_replay.py` (+32 -5) ➕ `src/overtaking_integrator.py` (+269 -0) </details> ### 📄 Description ## What this adds A new pit wall insight panel — Overtaking Probability — under a new "Race Analysis" category in the insights menu. For each pair of adjacent cars within DRS range (~1.0s), displays a live overtake probability bar from a trained XGBoost classifier. ## How it works 1. Drivers sorted by track position each frame (lap × circuit_length + dist) 2. Adjacent pairs with gap < 1.0s identified 3. Gap approximated: gap_s ≈ gap_metres / car_behind_speed_ms 4. XGBoost classifier returns probability 0–1 5. Colour: red ≥50%, amber ≥25%, green <25% ## Stream improvement race_replay.py now augments the broadcast with compound and tyre_life per driver from the existing degradation integrator. Insight panels receive full tyre data without needing their own FastF1 session. ## Model XGBoost trained on FastF1 race data, 2023–2025 seasons. ## Pattern Follows TyreDegradationIntegrator throughout. ## Setup — models required The panel requires two model files that are not included in this repo (binary files don't belong in git): - `overtaking_model.pkl` — XGBoost overtaking classifier - `compound_map.json` — compound name → integer encoding **To generate them:** run `analysis/notebooks/overtaking_model.ipynb` in Google Colab. The notebook trains and saves both files to `MyDrive/f1_models/` automatically. **To point the panel at your models**, set the `F1_MODEL_DIR` environment variable before launching: - **Linux/Mac:** `export F1_MODEL_DIR=/path/to/your/models` - **Windows PowerShell:** `$env:F1_MODEL_DIR = "C:\path\to\your\models"` Default path if not set: `./models` <img width="465" height="392" alt="Captura de pantalla 2026-03-10 194312" src="https://github.com/user-attachments/assets/a82f823d-d2c4-4d5a-b705-7ff7ee25993d" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:19:23 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#248
No description provided.