Prathamesh Bhamare commited on
Commit Β·
c56dbf6
1
Parent(s): 0f0781a
Final README polish based on review feedback
Browse files
README.md
CHANGED
|
@@ -1,60 +1,45 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Kronector F1 Strategy AI
|
| 3 |
-
emoji: ποΈ
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: gray
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 7860
|
| 8 |
-
pinned: false
|
| 9 |
-
---
|
| 10 |
<div align="center">
|
| 11 |
|
| 12 |
-
|
| 13 |
-
<img src="https://img.shields.io/badge/π_STATUS-LIGHTS_OUT-00D800?style=for-the-badge&labelColor=1a1a2e" alt="Status">
|
| 14 |
-
<img src="https://img.shields.io/badge/LAPS_COMPLETED-2014--2026-E10600?style=for-the-badge&labelColor=1a1a2e" alt="Seasons">
|
| 15 |
-
<img src="https://img.shields.io/badge/PIT_CREW-4_AGENTS-7B2FF7?style=for-the-badge&labelColor=1a1a2e" alt="Agents">
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
<img src="https://img.shields.io/badge/COMMS-Llama_3.3_70B-7B2FF7?style=flat-square&logo=meta&logoColor=white" alt="Llama3">
|
| 23 |
-
<img src="https://img.shields.io/badge/PIT_LANE-FastAPI-009688?style=flat-square&logo=fastapi&logoColor=white" alt="FastAPI">
|
| 24 |
-
<img src="https://img.shields.io/badge/XAI-SHAP-FF4500?style=flat-square" alt="SHAP">
|
| 25 |
-
<img src="https://img.shields.io/badge/DRIFT-Evidently_AI-FF6F61?style=flat-square" alt="Evidently">
|
| 26 |
|
| 27 |
-
<
|
| 28 |
|
| 29 |
-
<
|
| 30 |
-
```
|
| 31 |
-
βββ ββββββββββ βββββββ ββββ βββββββββββ ββββββββββββββββ βββββββ βββββββ
|
| 32 |
-
βββ ββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββ
|
| 33 |
-
βββββββ βββββββββββ βββββββββ βββββββββ βββ βββ βββ βββββββββββ
|
| 34 |
-
βββββββ βββββββββββ βββββββββββββββββββ βββ βββ βββ βββββββββββ
|
| 35 |
-
βββ ββββββ βββββββββββββββ ββββββββββββββββββββββ βββ ββββββββββββ βββ
|
| 36 |
-
βββ ββββββ βββ βββββββ βββ βββββββββββββ βββββββ βββ βββββββ βββ βββ
|
| 37 |
-
```
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
---
|
| 46 |
|
| 47 |
-
##
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
-
## π
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
| 59 |
### Season-by-Season Out-of-Sample Performance
|
| 60 |
| Season | Winner Accuracy | Podium Accuracy |
|
|
@@ -72,7 +57,8 @@ To prove the model captures complex non-linear relationships rather than just pr
|
|
| 72 |
| Current WDC Leader Wins | ~51% |
|
| 73 |
| Pole Position Wins | ~42% |
|
| 74 |
|
| 75 |
-
### Feature Importance & ROC
|
|
|
|
| 76 |
<div align="center">
|
| 77 |
<img src="frontend/public/metrics/feature_importance.svg" width="48%">
|
| 78 |
<img src="frontend/public/metrics/roc_curve.svg" width="48%">
|
|
@@ -82,8 +68,9 @@ To prove the model captures complex non-linear relationships rather than just pr
|
|
| 82 |
|
| 83 |
## ποΈ System Architecture
|
| 84 |
|
| 85 |
-
|
| 86 |
|
|
|
|
| 87 |
```mermaid
|
| 88 |
graph TD
|
| 89 |
subgraph Data Layer
|
|
@@ -104,11 +91,15 @@ graph TD
|
|
| 104 |
end
|
| 105 |
```
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
### Why LightGBM?
|
| 108 |
-
We evaluated Neural Networks, XGBoost, and CatBoost. **LightGBM** was selected because
|
| 109 |
-
1. It natively handles categorical variables (e.g., driver and team IDs) natively without creating sparse one-hot encoded matrices.
|
| 110 |
-
2. It trains significantly faster on tabular telemetry data compared to MLPs.
|
| 111 |
-
3. It integrates seamlessly with `shap.TreeExplainer` for sub-millisecond feature importance extraction in production.
|
| 112 |
|
| 113 |
---
|
| 114 |
|
|
@@ -153,13 +144,6 @@ npm run dev
|
|
| 153 |
|
| 154 |
The FastAPI backend exposes endpoints for programmatic access.
|
| 155 |
|
| 156 |
-
### cURL Example
|
| 157 |
-
```bash
|
| 158 |
-
curl -X POST "http://localhost:8000/predict/f1" \
|
| 159 |
-
-H "Content-Type: application/json" \
|
| 160 |
-
-d '{"query": "Who will win the 2026 Canadian GP?"}'
|
| 161 |
-
```
|
| 162 |
-
|
| 163 |
### Python Requests Example
|
| 164 |
```python
|
| 165 |
import requests
|
|
@@ -176,35 +160,19 @@ print(f"SHAP Key Factors: {data['shap_values']}")
|
|
| 176 |
|
| 177 |
---
|
| 178 |
|
| 179 |
-
##
|
| 180 |
-
|
| 181 |
-
### API Interaction
|
| 182 |
-
<video src="https://github.com/prats010/kronector/raw/main/assets/swagger_ui.mp4" controls="controls" muted="muted" style="max-width: 100%;"></video>
|
| 183 |
-
|
| 184 |
-
### User Interface
|
| 185 |
-

|
| 186 |
-
|
| 187 |
-
---
|
| 188 |
-
|
| 189 |
-
## β οΈ Limitations & Roadmap
|
| 190 |
|
| 191 |
-
|
|
|
|
| 192 |
|
| 193 |
-
|
| 194 |
-
- **Safety Cars & Red Flags:** The model cannot currently predict sudden race neutralizations which reset field gaps.
|
| 195 |
-
- **Mechanical Failures (DNFs):** Engine failures are treated as noise.
|
| 196 |
-
- **Weather Chaos:** Sudden rain introduces extreme variance that tabular historical models struggle to adapt to dynamically.
|
| 197 |
|
| 198 |
-
|
| 199 |
-
-
|
| 200 |
-
- [
|
| 201 |
-
- [ ]
|
| 202 |
|
| 203 |
---
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
**Prathamesh Anil Bhamare**
|
| 208 |
-
*MSc Computer Science Student*
|
| 209 |
-
|
| 210 |
-
[](https://github.com/prats010)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<div align="center">
|
| 2 |
|
| 3 |
+
# Kronector: F1 Race Outcome Prediction & MLOps System
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
*An End-to-End Machine Learning Pipeline for Formula 1 Strategy and Intelligence.*
|
| 6 |
|
| 7 |
+
[](#)
|
| 8 |
+
[](#)
|
| 9 |
+
[](TECHNICAL_REPORT.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
<img src="assets/vercel_prediction.webp" alt="Kronector Dashboard UI" width="80%">
|
| 12 |
|
| 13 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
---
|
| 16 |
|
| 17 |
+
## π― Why This Project Exists
|
| 18 |
|
| 19 |
+
Predicting Formula 1 is notoriously difficult due to chaotic variance (weather, safety cars, mechanical failures). Most public projects use basic scikit-learn models on small, un-normalized datasets.
|
| 20 |
+
|
| 21 |
+
**Kronector** was built to demonstrate how a **production-grade ML system** tackles this problem. It solves critical engineering challenges: preventing temporal data leakage, handling regulation-era normalization, and serving sub-second inference alongside SHAP-based mathematical explainability through a natural language interface.
|
| 22 |
|
| 23 |
---
|
| 24 |
|
| 25 |
+
## β οΈ Known Limitations
|
| 26 |
|
| 27 |
+
Having a rigorous model means being transparent about its blind spots. Currently, Kronector struggles with:
|
| 28 |
+
1. **Safety Cars & Red Flags:** The model cannot dynamically predict sudden race neutralizations which reset field gaps.
|
| 29 |
+
2. **Mechanical Failures (DNFs):** Engine failures and random reliability issues are treated as statistical noise.
|
| 30 |
+
3. **Weather Chaos:** Sudden rain introduces extreme variance that tabular historical models struggle to adapt to dynamically.
|
| 31 |
|
| 32 |
+
*Roadmap: Future iterations will ingest live radar weather data and historical Safety Car probability distributions per track.*
|
| 33 |
|
| 34 |
---
|
| 35 |
|
| 36 |
+
## π Results & Performance
|
| 37 |
+
|
| 38 |
+
The model is trained on **4,400+ driver-race instances** (covering all 20 cars across every race from 2014 to 2026).
|
| 39 |
|
| 40 |
+
### Validation Methodology
|
| 41 |
+
- **Leakage Prevention:** We strictly use `TimeSeriesSplit(n=5)`. A model is trained on years $T_0 \dots T_n$ and evaluated strictly on $T_{n+1}$.
|
| 42 |
+
- **Accuracy Calculation:** "Winner Accuracy" is calculated as the **Top-1 Prediction** (does the driver with the highest predicted probability actually win the race?).
|
| 43 |
|
| 44 |
### Season-by-Season Out-of-Sample Performance
|
| 45 |
| Season | Winner Accuracy | Podium Accuracy |
|
|
|
|
| 57 |
| Current WDC Leader Wins | ~51% |
|
| 58 |
| Pole Position Wins | ~42% |
|
| 59 |
|
| 60 |
+
### Feature Importance & ROC Proofs
|
| 61 |
+
*Mathematical proof that the model relies on logical racing factors.*
|
| 62 |
<div align="center">
|
| 63 |
<img src="frontend/public/metrics/feature_importance.svg" width="48%">
|
| 64 |
<img src="frontend/public/metrics/roc_curve.svg" width="48%">
|
|
|
|
| 68 |
|
| 69 |
## ποΈ System Architecture
|
| 70 |
|
| 71 |
+
Kronector implements a complete MLOps lifecycle: data ingestion, feature engineering, model training, MLflow tracking, API serving, and Evidently AI drift monitoring.
|
| 72 |
|
| 73 |
+
*(Note: A high-resolution PNG architecture diagram is coming soon.)*
|
| 74 |
```mermaid
|
| 75 |
graph TD
|
| 76 |
subgraph Data Layer
|
|
|
|
| 91 |
end
|
| 92 |
```
|
| 93 |
|
| 94 |
+
### The 4-Agent LLM Architecture
|
| 95 |
+
A raw probability output (e.g., "0.45") is not actionable for a strategist. We wrap the LightGBM inference engine in a 4-stage Agentic Pipeline to provide explainability:
|
| 96 |
+
1. **π§ DataAgent:** Parses natural language into a strict JSON intent (resolving "Monaco 23" to `season: 2023, round: 6`).
|
| 97 |
+
2. **βοΈ PredictionAgent:** Executes the LightGBM model and extracts mathematical SHAP values.
|
| 98 |
+
3. **π‘οΈ CritiqueAgent:** A pure-Python deterministic safeguard. It rejects predictions where confidence is below 20% (statistical noise in a 20-car field).
|
| 99 |
+
4. **π» SynthesisAgent:** Translates the math and SHAP values into a natural language response formatted as a radio message.
|
| 100 |
+
|
| 101 |
### Why LightGBM?
|
| 102 |
+
We evaluated Neural Networks, XGBoost, and CatBoost. **LightGBM** was selected because it natively handles categorical variables (e.g., driver and team IDs) natively without creating sparse one-hot encoded matrices, and it integrates seamlessly with `shap.TreeExplainer` for sub-millisecond feature importance extraction in production.
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
---
|
| 105 |
|
|
|
|
| 144 |
|
| 145 |
The FastAPI backend exposes endpoints for programmatic access.
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
### Python Requests Example
|
| 148 |
```python
|
| 149 |
import requests
|
|
|
|
| 160 |
|
| 161 |
---
|
| 162 |
|
| 163 |
+
## π¨βπ» About the Author
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
+
**Prathamesh Anil Bhamare**
|
| 166 |
+
*MSc Computer Science Student | Machine Learning Engineer*
|
| 167 |
|
| 168 |
+
I built Kronector combining a passion for Formula 1 strategy with rigorous Data Science and MLOps principles.
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
+
- πΌ [LinkedIn](https://linkedin.com/in/prats010)
|
| 171 |
+
- π [Portfolio](#)
|
| 172 |
+
- π [Read the Technical Report](TECHNICAL_REPORT.md)
|
| 173 |
+
- π§ [Contact Me](mailto:example@email.com)
|
| 174 |
|
| 175 |
---
|
| 176 |
+
<div align="center">
|
| 177 |
+
<sub>Built for the passion of racing and the pursuit of perfect data.</sub>
|
| 178 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|