Show HN: I made a machine learning model to predict 66.45% of NBA games
17 points| francio445 | 10 months ago |github.com
Hey devs, sports fans, and data nerds!
After weeks of work, I'm excited to share DeepShot – an advanced NBA game predictor powered by historical data from Basketball Reference, machine learning, and a clean NiceGUI-powered web interface.
What it does: DeepShot uses team-level rolling averages (including Exponentially Weighted Moving Averages) and an Elo rating system to accurately predict NBA game outcomes. All predictions are visualized in real time through a sleek, responsive UI.
Key Features: Data-Driven Predictions using past performance & rolling trends EWMA-based Weighted Stats Engine Elo Ratings for contextual team strength Cross-platform interface built with NiceGUI Key stats highlight to visualize matchup advantages at a glance Tech Stack: Python Pandas, Scikit-learn, XGBoost BeautifulSoup, Requests NiceGUI for the frontend Hosted locally, runs on Windows/macOS/Linux Clone it here → github.com/saccofrancesco/deepshot
Want to see how predictive modeling and sports analytics come together? This is for you.
Feedback, stars, forks, and PRs are more than welcome!
Let me know what you think, or drop your ideas for improvements — always open to suggestions!
#NBA #Python #MachineLearning #SportsAnalytics #OpenSource #NiceGUI #PredictiveModeling #GitHub #XGBoost #EWMA #EloRating #Basketball
bonzini|10 months ago
francio445|10 months ago
My model accounts for each team's evolution by incorporating trends from recent performances against all opponents, not just head-to-head matchups. This includes rolling averages and exponentially weighted metrics over the last 25 games, which help capture current form, streaks, and regressions.
As a result, the most recent head-to-head result only holds substantial predictive weight if it occurred recently and aligns with both teams’ current trajectories. Otherwise, it's treated as just one small piece of a much larger picture.
skeptrune|10 months ago
Are you hosting the full application somewhere? I would love to try it without having to run the code myself.
anfractuosity|10 months ago
francio445|10 months ago
stefanfis|10 months ago
tianqi|10 months ago
(This shows why betting on sports is almost impossible to have a long-term edge as it's already a very efficient market and the odds usually reflect the win rate very well.)
As another reference, an earlier predictor that also uses the elo rating system has an accuracy of 65.3% which is very close to the result in this post, and I guess this may be a typical range for elo-based predictors. https://github.com/luke-lite/NBA-Prediction-Modeling
By the way, I really like the interface of this "emailware". It's really fun to play with.
francio445|10 months ago
paipa|10 months ago
I'm not even considering home/away, let alone win margins, recent form, strength of schedule etc. I'm almost amazed this model couldn't make any use of them.
bangaladore|10 months ago
To what extent is 65% impressive? Naively, I imagine someone very familiar with teams and players could probably achieve similar results. I say this because I assume its obvious that Team A is better than Team B to some extent. Team A might still lose to Team B for whatever reason, but that's why its only 65%. And Team C vs Team D might be a tossup.
francio445|10 months ago
3vidence|10 months ago
That isn't said out spite or think OP is trying to be deceptive, it just shows a lack of understanding of the task at hand.
OKC is going to win around 70 of 82 games this year.
If I just naively say OKC will win every game I'm going to be 85% accurate no models required.
RockRobotRock|10 months ago