How yashpatel2777/f1_race_strategy_predictor works
This project learns F1 pit strategy from historical session data, then trains and evaluates a PPO agent in a configurable race simulator. The main workflow runs from data download and tire-model fitting through simulated strategy training, baseline comparison, and race visualization. The graph also includes telemetry visualization as a separate capability. Some script and subsystem wiring is based on the README and tree; unsampled implementation details are not inferred.
Main entry points: race_simulator.py Race simulator · fastf1_loader.py Session loader · telemetry_loader.py Telemetry pipeline · evaluate_agent.py Evaluate agent
Components 22
Historical Data
- Download sessions
scripts/download_data.py - Session loader
src/data/fastf1_loader.py - Lap preprocessing
src/data/data_preprocessor.py - Cached session data
data
Models
- Fit degradation
scripts/fit_degradation.py - Tire degradation
src/models/tire_degradation.py - Lap-time model
src/models/lap_time_model.py
Race Simulation
- Track configuration
track_database.yaml - Race state
src/environment/race_state.py - Race simulator
src/environment/race_simulator.py - Gym strategy env
src/environment/f1_strategy_env.py - PPO agent
src/models/ppo_agent.py - Train agent
scripts/train_agent.py - Strategy baselines
src/models/baselines.py
Evaluation & Visualization
- Evaluate agent
scripts/evaluate_agent.py - Race charts
scripts/visualize_race.py - Telemetry pipeline
src/data_pipeline/telemetry_loader.py - Telemetry plots
src/visualization/telemetry_plots.py - Track maps
src/visualization/track_maps.py - Lap animation
src/visualization/animator.py
Other components
- Engineer
- FastF1
Connections 22
- Engineer → Download sessions: starts workflow
- Download sessions → Session loader: requests sessions
- Session loader → FastF1: loads session
- Session loader → Cached session data: caches data
- Fit degradation → Lap preprocessing: prepares laps
- Lap preprocessing → Session loader: loads laps
- Fit degradation → Tire degradation: fits model
- Tire degradation → Lap-time model: supplies degradation
- Train agent → PPO agent: trains
- PPO agent → Gym strategy env: learns policy
- Gym strategy env → Race simulator: advances race
- Race simulator → Race state: updates
- Race simulator → Lap-time model: predicts lap time
- Race simulator → Track configuration: reads track settings
- Evaluate agent → PPO agent: loads agent
- Evaluate agent → Strategy baselines: compares strategies
- Evaluate agent → Gym strategy env: runs races
- Race charts → Race simulator: visualizes races
- Telemetry pipeline → Session loader: loads session data
- Telemetry plots → Telemetry pipeline: plots telemetry
- Track maps → Telemetry pipeline: maps telemetry
- Lap animation → Telemetry pipeline: animates telemetry