A high-performance Machine Learning system for Formula 1® analysis, prediction, and race simulation.
DRS Data (Data Racing Strategies) is an end-to-end ML pipeline designed to model Formula 1 race weekends — from raw telemetry to race outcome prediction.
The system collects session data via FastF1, engineers domain-specific features, trains predictive models, simulates race scenarios, and explains performance using SHAP — all in a modular, extensible pipeline.
| Metric | Value |
|---|---|
| 🏎️ Qualifying MAE | 2.18 – 2.88 positions |
| 🏁 Race MAE | ~2.5 positions |
| 📈 R² Score | up to 0.65 |
The model captures meaningful performance patterns despite the inherently stochastic nature of Formula 1 racing.
| Module | Description |
|---|---|
| 📈 Qualifying Prediction | Predicts grid positions using session telemetry |
| 🏁 Race Pace Analysis | Models race-long pace and tire degradation |
| 🔁 Race Simulation | Simulates race scenarios lap by lap |
| 🔍 SHAP Explainability | Explains what drives each prediction |
| 📊 Automated Reporting | Generates JSON logs and Markdown summaries |
| ⚙️ Modular Pipeline | Clean flow: training → prediction → simulation |
drs_data/
├── src/
│ ├── data/ # Track context data
│ ├── training/ # Data collection, feature engineering, model training
│ ├── prediction/ # Qualifying and race predictions
│ ├── simulation/ # Race simulation engine and pace analysis
│ └── analysis/ # Model accuracy reporting
│
├── data/ # Raw & processed datasets
├── models/ # Trained models (.pkl)
├── cache/ # FastF1 session cache
├── outputs_predictions/ # Generated prediction outputs
├── requirements.txt
└── README.md
git clone https://github.com/palomacdev/drs_data
cd drs_datapip install -r requirements.txt⏳ First run may take a while — process data year by year for best results.
python src/training/collect_qualifying_data.py
python src/training/data_enrichment.pypython src/training/train_quali_model.pypython src/prediction/predict_qualifying.pyGenerate automated accuracy reports (JSON + Markdown):
python src/analysis/accuracy_report.pySimulate full race scenarios using trained models:
# Step 1 — run race pace analysis
python src/simulation/race_pace_overview.py
# Step 2 — run the race simulator
python src/simulation/race_simulator.py- Weather integration (rain probability, temperature, humidity)
- Tire strategy modeling (compound, age, undercut windows)
- Real-time prediction pipeline
- REST API or Streamlit dashboard
- Improved simulation realism (safety car, pit stops)
Contributions are welcome — from bug fixes to new features and experiments!
Check CONTRIBUTING.md for branch conventions, guidelines, and ideas on where to start.
Distributed under the MIT License.
Built by someone who loves both data and the sound of a V10. If you're into F1, ML, or both — this project is for you. 🏁
⭐ Star this repo if you find it useful!