How kyleskom/nba-machine-learning-sports-betting works
This repository is an NBA betting prediction application. Its primary workflow gathers current team statistics and a schedule, obtains sportsbook odds or accepts manual odds, constructs matchup features, runs moneyline and totals models, then reports probabilities, expected value, and optional Kelly sizing. A separate historical-data workflow stores team statistics and odds, builds game datasets, and trains models. The README also documents a Flask interface for browsing outputs. Relationships for unsampled training and web internals are limited to documented capabilities; the excerpts do not establish their detailed runtime calls.
Main entry points: main.py Prediction Orchestrator · Create_Games.py Game Dataset Builder · NN_Runner.py Neural Net Inference · XGBoost_Runner.py XGBoost Inference
Components 25
Live Predictions
- Prediction Orchestrator
main.py - NBA Data Utilities
src/Utils/tools.py - Live Odds Provider
src/DataProviders/SbrOddsProvider.py - Matchup Features
main.py
Data Preparation
- Team Indexes
src/Utils/Dictionaries.py - Team Stats Ingest
src/Process-Data/Get_Data.py - Team Stats Store
Data/TeamData.sqlite - Historical Odds Ingest
src/Process-Data/Get_Odds_Data.py - Odds Store
Data/OddsData.sqlite - Rest-Day Processing
src/Process-Data/Add_Days_Rest.py - Game Dataset Builder
src/Process-Data/Create_Games.py - Training Dataset
Data/dataset.sqlite
Models and Betting
- Neural Net Inference
src/Predict/NN_Runner.py - XGBoost Inference
src/Predict/XGBoost_Runner.py - Neural Net Models
Models/NN_Models - XGBoost Models
Models/XGBoost_Models - Expected Value
src/Utils/Expected_Value.py - Kelly Sizing
src/Utils/Kelly_Criterion.py - Model Training
src/Train-Models
Web Interface
- Flask Application
Flask/app.py - Web UI
Flask/static/app.js
Other components
- User
- NBA Stats API
- Sportsbook Odds
- Browser User
Connections 31
- User → Prediction Orchestrator: requests predictions
README.md - Prediction Orchestrator → Live Odds Provider: fetches odds
main.py - Live Odds Provider → Sportsbook Odds: reads odds
src/DataProviders/SbrOddsProvider.py - Prediction Orchestrator → NBA Stats API: fetches stats
README.md - Prediction Orchestrator → NBA Data Utilities: uses data helpers
main.py - Prediction Orchestrator → Matchup Features: builds matchups
main.py - NBA Data Utilities → Team Indexes: uses team indexes
src/Utils/tools.py - Prediction Orchestrator → Neural Net Inference: runs selected model
README.md - Prediction Orchestrator → XGBoost Inference: runs selected model
README.md - Neural Net Inference → Neural Net Models: loads models
src/Predict/NN_Runner.py - XGBoost Inference → XGBoost Models: loads models
src/Predict/XGBoost_Runner.py - Neural Net Inference → Expected Value: calculates value
src/Predict/NN_Runner.py - Neural Net Inference → Kelly Sizing: calculates stakes
src/Predict/NN_Runner.py - XGBoost Inference → Expected Value: calculates value
src/Predict/XGBoost_Runner.py - XGBoost Inference → Kelly Sizing: calculates stakes
src/Predict/XGBoost_Runner.py - Prediction Orchestrator → User: prints results
README.md - Team Stats Ingest → NBA Stats API: requests stats
README.md - Team Stats Ingest → NBA Data Utilities: parses responses
src/Process-Data/Get_Data.py - Team Stats Ingest → Team Stats Store: stores daily stats
README.md - Historical Odds Ingest → Sportsbook Odds: collects odds
README.md - Historical Odds Ingest → Odds Store: stores odds
README.md - Rest-Day Processing → Team Stats Store: adds rest data
- Game Dataset Builder → Team Stats Store: reads stats
README.md - Game Dataset Builder → Odds Store: reads odds
README.md - Game Dataset Builder → Training Dataset: writes games
README.md - Game Dataset Builder → Team Indexes: uses season indexes
src/Process-Data/Create_Games.py - Model Training → Training Dataset: trains from
README.md - Model Training → Neural Net Models: saves trained models
README.md - Model Training → XGBoost Models: saves trained models
README.md - Browser User → Web UI: browses outputs
README.md - Web UI → Flask Application: uses application