r/Python • • 24d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

28 Upvotes

169 comments sorted by

View all comments

1

u/krishyalla 7d ago

LightsToFlag: F1 race predictor (scikit-learn + Streamlit)

It predicts the full finishing order of the next F1 race and gives each driver a win and podium chance from 5,000 simulated races. It’s built with pandas, scikit-learn, Plotly and Streamlit, using free data from the Jolpica F1 API. It’s a learning project, not betting advice.

What I learned from testing it fairly (each race predicted using only earlier races, plus 10 races held back for a final check):

  • It got 83% of podium finishers right, against 60% for “everyone finishes where they start.”
  • Picking the winner barely beats “pole wins.” Results data alone has limits.
  • Leaving crashes out of training was the biggest single improvement.

Tonight’s Vegas pick: Verstappen 45% from P2.

1

u/krishyalla 6d ago

Update: the Vegas prediction got the winner right (Verstappen from P2, 45%) and 2 of 3 on the podium.

New since posting: a grid-penalty feature. The free F1 API only has the qualifying order before a race, so penalties weren't included, and that's why the model missed Piastri climbing from 17th to 3rd. You can now add place drops, back-of-grid or pit-lane starts, and the app rebuilds the grid by F1's rules and re-predicts. The logic is a small pure function, so it was easy to unit test.

Live: lightstoflag.streamlit.app