Prathamesh Bhamare commited on
Commit
c56dbf6
Β·
1 Parent(s): 0f0781a

Final README polish based on review feedback

Browse files
Files changed (1) hide show
  1. README.md +47 -79
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
- <!-- Badges Row 1: Status -->
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
- <br>
18
 
19
- <!-- Badges Row 2: Tech -->
20
- <img src="https://img.shields.io/badge/ENGINE-LightGBM-FF6B00?style=flat-square&logo=scikit-learn&logoColor=white" alt="LightGBM">
21
- <img src="https://img.shields.io/badge/TELEMETRY-MLflow-0194E2?style=flat-square&logo=mlflow&logoColor=white" alt="MLflow">
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
- <br><br>
28
 
29
- <!-- ASCII Art Header -->
30
- ```
31
- β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
32
- β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
33
- β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
34
- β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
35
- β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘
36
- β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•
37
- ```
38
 
39
- <h3>🏎️ Formula 1 Race Outcome Prediction & MLOps Pipeline</h3>
40
 
41
- <p><i>An End-to-End Machine Learning System for F1 Race Intelligence.</i></p>
42
 
43
- </div>
 
 
44
 
45
  ---
46
 
47
- ## 🏁 Overview
48
 
49
- **KRONECTOR** is an end-to-end Machine Learning operations (MLOps) pipeline that predicts Formula 1 race outcomes. It ingests 12 years of F1 telemetry data (2014-2026), trains a LightGBM classification model, and serves predictions via an asynchronous FastAPI backend wrapped in a multi-agent LLM architecture for natural language explainability.
 
 
 
50
 
51
- > πŸ“„ **Technical Deep Dive:** Read the full mathematical and architectural breakdown in the [Technical Report](TECHNICAL_REPORT.md).
52
 
53
  ---
54
 
55
- ## πŸ“Š Historical Results & Model Validation
 
 
56
 
57
- The model is trained on **4,400+ historical race entries** (2014–2026) using `TimeSeriesSplit(n=5)` cross-validation to strictly prevent chronological data leakage.
 
 
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
- The repository implements a complete lifecycle: data ingestion, feature engineering, model training, MLflow tracking, API serving, and Evidently AI drift monitoring.
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
- ## πŸ“Έ Dashboards & Demos
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
- ![Vercel App Prediction](assets/vercel_prediction.webp)
186
-
187
- ---
188
-
189
- ## ⚠️ Limitations & Roadmap
190
 
191
- While the model significantly outperforms simple baselines, it is inherently limited by the stochastic nature of motorsports.
 
192
 
193
- **Current Limitations:**
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
- **Project Roadmap:**
199
- - [ ] Integrate Live Weather Radar API.
200
- - [ ] Incorporate per-track historical Safety Car probability distributions.
201
- - [ ] Expand prediction granularity to Top 5 finishing orders (Ordinal Regression).
202
 
203
  ---
204
-
205
- ## πŸ‘¨β€πŸ’» About the Author
206
-
207
- **Prathamesh Anil Bhamare**
208
- *MSc Computer Science Student*
209
-
210
- [![GitHub](https://img.shields.io/badge/GitHub-prats010-181717?style=flat-square&logo=github)](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
+ [![Live Demo](https://img.shields.io/badge/Live_App-Ready-00f0ff?style=for-the-badge&logo=vercel&logoColor=black)](#)
8
+ [![API Docs](https://img.shields.io/badge/API_Docs-Swagger-009688?style=for-the-badge&logo=fastapi&logoColor=white)](#)
9
+ [![Technical Report](https://img.shields.io/badge/Technical_Report-Read_Here-b026ff?style=for-the-badge&logo=markdown&logoColor=white)](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>