What it does
It essentially allows for users to visualize the real time win probability of a game based on factors like strength of team, current performance, and value of plays.
How we built it
I created a NFL win probability model with the help of Python, Streamlit, and a RandomForestRegressor that has been trained on simulated data. To generate my training data, I created 500 synthetic games with randomized offensive and defensive ratings for each team, used a simple rule to derive the outcome of the game, and had a momentum effect that captures streaks and shifts in possession.
I pre-processed the data with pandas, made a few play level features such as score_diff, time_remaining, and epa, and encoded the outcomes as home win probabilities ranging from 0 to 1. After training the model, I saved it as a pickle file to be deployed later.
The user experience in Streamlit entails selecting teams and using sliders to adjust the offensive and defensive ratings, while the application runs a simulation of a stream of plays to update the score_diff, time_remaining, and epa. When a user presses "Next Play," the simulation advances, which provides a predicted home win probability, along with a progress bar that gives an in-the-moment, dynamic feel to the experience.
Challenges we ran into
One challenge was creating a realistic dataset for a live win probability demo. In the absence of real-time NFL data, I had to simulate plays featuring score changes, expected points added, and time remaining. The random factors were hard to balance with plausibility-the more random, the more unrealistically the predictions swung; too little, and the game was predictable. I solved this by adding bounded momentum effects to each play.
Another challenge in this data set was adapting the model for play-by-play predictions. The original model was focused on final outcomes, so I added score_diff, time_remaining, and epa columns and changed the target to a continuous home win probability. Careful preprocessing was needed to make sure the features lined up when training and predicting.
Integrating it with Streamlit finally presented quite a challenge. Maintaining game state through button clicks, updating metrics on the fly, and showing the probability of each play without breaking the interface needed some careful session state handling and design of UI. These steps made the app interactive and engaging while keeping it responsive.
Built With
- joblib
- numpy
- pandas
- python
- scikit-learn
- streamlit

Log in or sign up for Devpost to join the conversation.