kyleskom/NBA-Machine-Learning-Sports-Betting
kyleskom/NBA-Machine-Learning-Sports-Betting has 1,775 GitHub stars and 575 forks. GitHot measured +6 in 7 days and +15 in 15 days. Last checked 2026-11-09 06:48 UTC. Last push 2026-09-12.
NBA sports betting using machine learning
What you can do
- Moneyline and totals predictions (XGBoost and Neural Net models).
- Expected value calculation and optional Kelly Criterion sizing.
- Odds ingest from supported sportsbooks or manual input.
- Data processing pipeline and model training scripts.
Measured star growth
- in 24h
- Update delayed
- in 7 days
- +6
- in 15 days
- +15
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalNBA Sports Betting Using Machine Learning

Overview
This project predicts NBA game winners and totals (over/under) using team stats and sportsbook odds. It pulls team data from 2007-08 through the current season, builds matchup features, and runs trained models to estimate win probabilities and totals outcomes. It also outputs expected value and optional Kelly Criterion stake sizing.
Features
- Moneyline and totals predictions (XGBoost and Neural Net models).
- Expected value calculation and optional Kelly Criterion sizing.
- Odds ingest from supported sportsbooks or manual input.
- Data processing pipeline and model training scripts.
- Flask web app for browsing outputs.
How it works
- Collect stats and odds:
Get_Datapulls daily team stats from NBA endpoints and stores them in SQLite.Get_Odds_Datapulls sportsbook odds and scores from SBR and stores them in a separate SQLite DB. - Build game features:
Create_Gamesmerges team stats, odds, scores, and days-rest into a training dataset. - Train models: XGBoost/NN scripts in
src/Train-Modelsfit moneyline and totals models. - Predict today:
main.pyfetches today’s schedule, builds matchup features, loads trained models, and prints predictions, expected value, and optional Kelly Criterion sizing.
Requirements
- Python 3.11
- Packages: Tensorflow, XGBoost, NumPy, Pandas, Colorama, Tqdm, Requests, Scikit-learn
Install dependencies:
pip3 install -r requirements.txt
Quick start
python3 main.py -xgb -odds=fanduel
Odds will be fetched automatically when -odds is provided. Supported books:
fanduel, draftkings, betmgm, pointsbet, caesars, wynn, bet_rivers_ny
If -odds is omitted, the script will prompt for manual odds and totals.
Optional flags:
-nnrun neural network model-xgbrun XGBoost model-Arun all models-kcshow Kelly Criterion bankroll fraction
Flask web app

cd Flask
flask --debug run
Data pipeline and training
# Create/update datasets
cd src/Process-Data
python -m Get_Data
python -m Get_Odds_Data
python -m Create_Games
# Train models
cd ../Train-Models
python -m XGBoost_Model_ML --dataset dataset_2012-26 --trials 100 --splits 5 --calibration sigmoid
python -m XGBoost_Model_UO --dataset dataset_2012-26 --trials 100 --splits 5 --calibration sigmoid
python -m NN_Model_ML
python -m NN_Model_UO
python -m Logistic_Regression_ML --dataset dataset_2012-26_new --trials 50 --splits 5 --calibration sigmoid
python -m Logistic_Regression_UO --dataset dataset_2012-26_new --trials 50 --splits 5 --calibration sigmoid
Neural network notes
- The current NN training scripts are the original versions with hard-coded dataset and model paths.
- They train on
dataset_2012-24_newand save intoModels/with timestamped names. - If you want configurable flags or feature/scaler sidecars, switch back to the newer NN scripts.
Backfilling missing data
Get_Data normally fetches only new dates in the current season. To fill missing dates:
cd src/Process-Data
python -m Get_Data --backfill
To backfill a single season:
cd src/Process-Data
python -m Get_Data --backfill --season 2025-26
Backfilling odds data
Get_Odds_Data normally fetches only new dates in the current season. To fill missing odds dates:
cd src/Process-Data
python -m Get_Odds_Data --backfill
To backfill a single season:
cd src/Process-Data
python -m Get_Odds_Data --backfill --season 2025-26
Contributing
Contributions are welcome. If you change model behavior or data pipelines, add a note in the README and update any related scripts or docs.
Explore related projects
tensorflow/tensorflow
An Open Source Machine Learning Framework for Everyone
201,427 starshuggingface/transformers
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
168,711 starsAUTOMATIC1111/stable-diffusion-webui
Stable Diffusion web UI
165,274 starsComfy-Org/ComfyUI
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
146,024 stars