[PR #168] [MERGED] Bayesian state-space tyre degradation model #190

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

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/168
Author: @skandas1304
Created: 1/13/2026
Status: Merged
Merged: 1/29/2026
Merged by: @IAmTomShaw

Base: mainHead: bayesian-tyre-degradation


📝 Commits (7)

  • 6699ce1 Add Bayesian state-space tyre degradation model
  • 4c8052c Stabilize tyre degradation estimation using median slopes and compound-specific priors
  • 2e4d537 Merge branch 'main' into bayesian-tyre-degradation
  • ee44b8f Refactoring the tyre degradation to universal and condition-aware model
  • b481ebc Minor cleanup
  • ae22204 Merge branch 'bayesian-tyre-degradation' of https://github.com/skandas1304/f1-race-replay into bayesian-tyre-degradation
  • b2c92a7 Merge branch 'main' into bayesian-tyre-degradation

📊 Changes

5 files changed (+905 additions, -1 deletions)

View changed files

📝 src/arcade_replay.py (+1 -1)
src/bayesian_tyre_model.py (+664 -0)
📝 src/interfaces/race_replay.py (+25 -0)
src/tyre_degradation_integration.py (+164 -0)
📝 src/ui_components.py (+51 -0)

📄 Description

Summary

This PR introduces a Bayesian state-space tyre degradation model for the race replay system.

  • The model introduces a latent-state formulation as an alternative to heuristic or curve-smoothed approaches

The implementation is inspired by recent state-space approaches used in motorsport analytics and is designed to be robust to noisy race telemetry.


Model overview

Tyre performance is modeled as a latent pace state that evolves lap-by-lap:

  • Degradation is treated as a stochastic process rather than a fixed curve
  • Lap times are observations of the latent state, corrupted by noise
  • A Kalman filter is used to update the latent pace in real time
  • Compound-specific degradation rates are learned from data

This allows degradation behavior to adapt naturally across tracks, compounds, and stint lengths.

Note: This model applies to slick tyres only (Soft, Medium, Hard).
Wet and Intermediate tyres are excluded because lap times in wet conditions depend primarily on track wetness evolution, tyre mismatch effects, and non-monotonic performance changes, which are not captured by a degradation-driven state-space model.


Health vs degradation (important clarification)

The UI exposes a “tyre health” value derived from the model output.

This value does not represent physical tyre wear or “tyre life remaining”.
Instead, it represents distance from peak performance within a strategy-relevant window.

Key implications:

  • A tyre reaching 0% health does not mean it is unusable
  • It means the tyre is no longer near its optimal performance window
  • Teams may (and often do) continue running tyres well past this point for strategic reasons

This distinction is especially important for tracks like Mexico, where thermal effects cause early loss of peak pace but tyres remain usable for many laps.


Track-dependent behavior

The model intentionally produces different degradation signatures depending on circuit characteristics:

  • Bahrain: high effective degradation due to abrasion and traction
  • COTA: moderate degradation with strong compound separation
  • Mexico: low mechanical wear but rapid thermal performance drop on soft tyres

These effects emerge naturally from the data rather than being hard-coded.


Paper reference

The structure of this model is inspired by state-space approaches to tyre degradation modeling, in particular:

Cole Cappello, Andrew Hoegh (2025)
A State-Space Approach to Modeling Tire Degradation in Formula 1 Racing
https://arxiv.org/abs/2512.00640

While this implementation uses a fast MAP-style estimation suitable for real-time replay, the architecture allows future extension to full Bayesian inference (e.g. PyMC / Stan).


Integration details

  • The Bayesian model is fully encapsulated in bayesian_tyre_model.py
  • A thin integrator layer preserves the existing UI and rendering logic
  • No major UI changes are required to adopt the new model
  • Degradation uncertainty is explicitly estimated and can be surfaced if needed

Validation

The model was tested on multiple races with expected qualitative behavior:

  • Correct compound ordering (HARD < MEDIUM < SOFT)
  • Higher degradation at abrasive circuits
  • Thermal-dominated degradation at high-altitude tracks

This confirms the model behaves realistically across track types.


After the addition of the tyre health bar

image

A demo video at 128x ( taken at 128x to achieve a video size less than 10MB)

https://github.com/user-attachments/assets/cb13c998-27ae-40b1-814f-b17589c97afd


🔄 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/168 **Author:** [@skandas1304](https://github.com/skandas1304) **Created:** 1/13/2026 **Status:** ✅ Merged **Merged:** 1/29/2026 **Merged by:** [@IAmTomShaw](https://github.com/IAmTomShaw) **Base:** `main` ← **Head:** `bayesian-tyre-degradation` --- ### 📝 Commits (7) - [`6699ce1`](https://github.com/IAmTomShaw/f1-race-replay/commit/6699ce13328b5c334829fd70dc1ddc2075ed4661) Add Bayesian state-space tyre degradation model - [`4c8052c`](https://github.com/IAmTomShaw/f1-race-replay/commit/4c8052c2780d84e31b78f0e74fdea9435b3f911c) Stabilize tyre degradation estimation using median slopes and compound-specific priors - [`2e4d537`](https://github.com/IAmTomShaw/f1-race-replay/commit/2e4d537f7710f55810991e7da1cdfa2feda175c1) Merge branch 'main' into bayesian-tyre-degradation - [`ee44b8f`](https://github.com/IAmTomShaw/f1-race-replay/commit/ee44b8fde1145f99567d7bc97b13d263bf0ab255) Refactoring the tyre degradation to universal and condition-aware model - [`b481ebc`](https://github.com/IAmTomShaw/f1-race-replay/commit/b481ebc80060c1deb99159a84903708ffd7230af) Minor cleanup - [`ae22204`](https://github.com/IAmTomShaw/f1-race-replay/commit/ae2220402b4f7c9f4bc3d389654b329e31164c76) Merge branch 'bayesian-tyre-degradation' of https://github.com/skandas1304/f1-race-replay into bayesian-tyre-degradation - [`b2c92a7`](https://github.com/IAmTomShaw/f1-race-replay/commit/b2c92a754f82ccdff50fc1dcfba805b552ea3cdb) Merge branch 'main' into bayesian-tyre-degradation ### 📊 Changes **5 files changed** (+905 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/arcade_replay.py` (+1 -1) ➕ `src/bayesian_tyre_model.py` (+664 -0) 📝 `src/interfaces/race_replay.py` (+25 -0) ➕ `src/tyre_degradation_integration.py` (+164 -0) 📝 `src/ui_components.py` (+51 -0) </details> ### 📄 Description ### Summary This PR introduces a Bayesian state-space tyre degradation model for the race replay system. - The model introduces a latent-state formulation as an alternative to heuristic or curve-smoothed approaches The implementation is inspired by recent state-space approaches used in motorsport analytics and is designed to be robust to noisy race telemetry. --- ### Model overview Tyre performance is modeled as a latent pace state that evolves lap-by-lap: - Degradation is treated as a stochastic process rather than a fixed curve - Lap times are observations of the latent state, corrupted by noise - A Kalman filter is used to update the latent pace in real time - Compound-specific degradation rates are learned from data This allows degradation behavior to adapt naturally across tracks, compounds, and stint lengths. > **Note: This model applies to slick tyres only (Soft, Medium, Hard). > Wet and Intermediate tyres are excluded because lap times in wet conditions depend primarily on track wetness evolution, tyre mismatch effects, and non-monotonic performance changes, which are not captured by a degradation-driven state-space model.** --- ### Health vs degradation (important clarification) The UI exposes a **“tyre health”** value derived from the model output. This value does **not** represent physical tyre wear or “tyre life remaining”. Instead, it represents **distance from peak performance** within a strategy-relevant window. Key implications: - A tyre reaching 0% health does not mean it is unusable - It means the tyre is no longer near its optimal performance window - Teams may (and often do) continue running tyres well past this point for strategic reasons This distinction is especially important for tracks like Mexico, where thermal effects cause early loss of peak pace but tyres remain usable for many laps. --- ### Track-dependent behavior The model intentionally produces different degradation signatures depending on circuit characteristics: - Bahrain: high effective degradation due to abrasion and traction - COTA: moderate degradation with strong compound separation - Mexico: low mechanical wear but rapid thermal performance drop on soft tyres These effects emerge naturally from the data rather than being hard-coded. --- ### Paper reference The structure of this model is inspired by state-space approaches to tyre degradation modeling, in particular: > Cole Cappello, Andrew Hoegh (2025) > *A State-Space Approach to Modeling Tire Degradation in Formula 1 Racing* > https://arxiv.org/abs/2512.00640 While this implementation uses a fast MAP-style estimation suitable for real-time replay, the architecture allows future extension to full Bayesian inference (e.g. PyMC / Stan). --- ### Integration details - The Bayesian model is fully encapsulated in `bayesian_tyre_model.py` - A thin integrator layer preserves the existing UI and rendering logic - No major UI changes are required to adopt the new model - Degradation uncertainty is explicitly estimated and can be surfaced if needed --- ### Validation The model was tested on multiple races with expected qualitative behavior: - Correct compound ordering (HARD < MEDIUM < SOFT) - Higher degradation at abrasive circuits - Thermal-dominated degradation at high-altitude tracks This confirms the model behaves realistically across track types. --- After the addition of the tyre health bar <img width="1915" height="1001" alt="image" src="https://github.com/user-attachments/assets/f987ec9e-76d4-49c4-bf25-6fe1837a3d9e" /> A demo video at 128x ( taken at 128x to achieve a video size less than 10MB) https://github.com/user-attachments/assets/cb13c998-27ae-40b1-814f-b17589c97afd --- <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:07 +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#190
No description provided.