03 02 tire degradation modeling - VforVitorio/F1_Strat_Manager GitHub Wiki
Tire Degradation Modeling
Relevant source files
- scripts/ML_tyre_pred/ML_utils/N01_tire_prediction.py
- scripts/ML_tyre_pred/ML_utils/N02_model_tire_predictions.py
- scripts/ML_tyre_pred/ML_utils/pitstops_bar.jpg
- scripts/ML_tyre_pred/N01_tire_prediction.ipynb
- scripts/ML_tyre_pred/N02_model_tire_predictions.ipynb
Purpose and Scope
This document details the tire degradation modeling subsystem of the F1 Strategy Manager. The system uses machine learning to predict how tire performance deteriorates over successive laps in a Formula 1 race, which is critical for optimal pit stop strategy planning. This module provides accurate predictions of future tire performance that feed directly into the expert system's rule engine. For information about how these predictions are used in strategy decisions, see Degradation Rules.
Core Concepts
Tire Degradation in Formula 1
Tire degradation in Formula 1 racing refers to the progressive loss of tire performance over the course of a stint. This degradation is reflected in increasing lap times as tires wear out. The degradation pattern is not strictly linear and depends on multiple factors:
- Tire compound (Soft, Medium, Hard)
- Track conditions (temperature, surface)
- Driving style
- Fuel load Our system models this complex relationship using sequence-based machine learning techniques that can capture non-linear patterns in the data. The tire life cycle follows three distinct phases:
- Initial Phase: First few laps where performance is stable
- Critical Monitoring Phase: When meaningful degradation patterns emerge
- Soft Compounds: ~6 laps
- Medium Compounds: ~12 laps
- Hard Compounds: ~25 laps
- End-of-Life Phase: Severe performance drop-off ("cliff") Our modeling focuses particularly on the Critical Monitoring Phase, as this is when strategic decisions become most relevant.
Fuel Effect Adjustment
A key aspect of accurate tire degradation modeling is isolating the tire effect from the fuel effect. As cars burn fuel during a race, they become lighter and therefore faster, which can mask the true tire degradation. Our system uses a constant value of 0.055 seconds per lap as the empirical improvement due to fuel burn. This value is added back to the lap times to create "fuel-adjusted" metrics that more accurately reflect the pure tire degradation.
FuelAdjustedLapTime = ActualLapTime + (LapsFromBaseline * 0.055)
Data Processing Pipeline
The tire degradation modeling system follows a sophisticated data processing pipeline that transforms raw telemetry data into prediction-ready inputs.
Data Pipeline Diagram
- scripts/ML_tyre_pred/N02_model_tire_predictions.py119-233
- scripts/ML_tyre_pred/N02_model_tire_predictions.py258-367
- scripts/ML_tyre_pred/N02_model_tire_predictions.py432-501
Required Input Data
The tire degradation model requires specific telemetry data for each lap:
Column Name | Description | Purpose |
---|---|---|
LapTime | Time taken to complete the lap | Primary performance metric |
CompoundID | Tire compound (1=Soft, 2=Medium, 3=Hard) | Determines degradation pattern |
TyreAge | Number of laps tire has completed | Primary predictor of degradation |
Stint | Current stint number | Tracks tire changes |
SpeedI1, SpeedI2, SpeedFL | Speed at various track points | Additional performance indicators |
FuelLoad | Estimated fuel load in kg | Used in fuel adjustment |
Position | Current race position | Race context |
DriverNumber | Driver's race number | Identifies the driver |
Degradation Metrics Calculation
The system calculates several key metrics to quantify tire degradation:
- FuelAdjustedLapTime: Actual lap time with fuel effect added back
- FuelAdjustedDegPercent: Percentage degradation compared to baseline (first lap on a new set)
- DegradationRate: Rate of change in lap time from one lap to the next
Sequence Creation
The system treats tire degradation as a sequential problem, using a window of consecutive laps to predict future degradation. Sequences are created based on compound-specific starting laps:
These thresholds focus the model on the most strategically relevant phases of tire life.
Model Architecture
Temporal Convolutional Network (TCN)
The tire degradation prediction system uses an enhanced Temporal Convolutional Network (TCN) architecture, which is well-suited for capturing both short and long-term patterns in sequential data.
Key Model Components
- Multi-scale Dilated Convolutions: Captures patterns at different time scales
- Dilation rates: 1, 2, 4, 8
- Each block includes BatchNorm and ReLU activation
- Residual connections to help with gradient flow
- Temporal Attention Mechanism: Focuses the model on the most relevant time steps
- Implemented as a learnable weighted sum over the time dimension
- Helps extract key information from the input sequence
- Fully Connected Layers: Transform convolutional features into predictions
- Dropout (0.3) for regularization
- Output is the predicted degradation for the next 3 laps
Ensemble Prediction Approach
The system employs an ensemble approach that combines:
- Global Model: Trained on data from all tire compounds
- Specialized Models: Separate models trained specifically for each compound Predictions are combined using a weighted average based on model performance:
ensemble_prediction = (global_weight * global_prediction +
specialized_weight * specialized_prediction)
Weights are derived from the inverse of each model's RMSE (Root Mean Square Error):
Model | RMSE | Use Case |
---|---|---|
Global | 0.355017 | General predictions across all compounds |
Soft (ID: 1) | 0.334325 | Specialized predictions for soft tires |
Medium (ID: 2) | 0.392661 | Specialized predictions for medium tires |
Hard (ID: 3) | 0.295417 | Specialized predictions for hard tires |
Prediction Process
Model Loading and Preparation
The system loads pre-trained models from disk, including both the global model and any available compound-specific models:
Making Predictions
The prediction process involves several steps:
- Sequence Preparation: Convert sequences of laps into tensors
- Global Model Prediction: Get predictions from the global model
- Specialized Model Prediction: For applicable compounds, get predictions from specialized models
- Ensemble Weighting: Combine predictions with appropriate weighting
- Formatting Results: Structure predictions in an easy-to-use format
Output Format
The final output of the tire degradation prediction system is a structured DataFrame containing:
Column | Description |
---|---|
DriverNumber | Driver identifier |
Stint | Current stint number |
CompoundID | Numeric compound ID |
CompoundName | Human-readable compound name (Soft, Medium, Hard) |
CurrentTyreAge | Current age of tires in laps |
CurrentLapTime | Most recent lap time |
FutureLap | Future lap number (TyreAge) |
LapsAheadPred | How many laps ahead of current (1-3) |
PredictedDegradationRate | Predicted degradation rate in seconds |
Real-time Prediction for Strategy Decisions
The system supports real-time prediction during a race, with monitoring starting at compound-specific lap thresholds:
This approach focuses computational resources on strategically relevant predictions while aligning with how F1 teams monitor tires during races.
Conclusion
The tire degradation modeling subsystem provides crucial strategic intelligence for F1 race strategy. By accurately predicting how tire performance will evolve over future laps, it enables more informed pit stop decisions and compound selections. Key strengths of the system include:
- Fuel-adjusted metrics that isolate true tire degradation
- Compound-specific modeling that accounts for different degradation patterns
- Ensemble approach that combines general and specialized knowledge
- Integration with expert system for actionable strategy recommendations This module represents a critical component in the F1 Strategy Manager's ability to provide data-driven strategy recommendations.