r/learnmachinelearning • u/krishyalla • 3d ago
I built LightsToFlag, an F1 race predictor in Python and Streamlit. Tonight’s Vegas pick: Verstappen from P2
What my project does
LightsToFlag predicts the full finishing order of the next F1 race and gives each driver a win, podium and top-10 chance from 5,000 simulated races.
- Data: race results and grids from the free Jolpica F1 API
- Model: a scikit-learn gradient-boosting model trained on 2022–2026 results
- App: a Streamlit dashboard with a race list, season charts in Plotly, editable “what-if” grids for penalties, a chat page to ask questions about the data, and synthesized engine sounds
Target audience
F1 fans who like data, and anyone learning ML who wants a real-world project. It’s a learning project, not betting advice.
Comparison / what I learned
I tested it fairly: each race is predicted using only earlier races, and 10 races were held back for a final check. On those:
- The tuned model got 83% of podium finishers right, against 60% for “everyone finishes where they start.”
- Picking the winner barely beats “pole wins” (6/10 vs 7/10). Results data alone can’t do much better than that.
- Leaving crashes and breakdowns out of training was the single biggest improvement.
- My win percentages were too cautious. Calibrating the simulation’s randomness made them more honest on the held-out races too.
- I also tried a LightGBM ranking model. Alone it was worse, and blended with the original it only tied on the held-out races, so I didn’t ship it.
Tonight (Las Vegas GP): Verstappen 45% from P2, Antonelli 33% from pole. I’ll report back after the race.
- Live app: lightstoflag.streamlit.app
- Code: github.com/lightstoflag/lightstoflag
Feedback is welcome, especially ideas for adding practice pace with FastF1.