Skip to content

dcheongsee/NBA-Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🏀 NBA Game Outcome Predictor

Predicts whether the home team wins an NBA game from a minimal set of box‑score stats.

Tech stack: Python · Pandas · Scikit‑learn · Google Colab

At a glance

Data 26 000+ games (2004 – 2020) from public box-score archives
Pre-processing Full-row NaN purge · automatic binary Win label generation
Features FG % (home & away) · rebounds (home) · assists (home)
Model Random Forest, 100 trees, max_depth=None
Validation Stratified 20 % hold-out · 79 % accuracy
Diagnostics Confusion-matrix heat map to verify class balance
Extras Match-up Simulator – plug your stats ⇒ instant W/L call

Quick start (Colab)

Click the badge or run:

!git clone https://github.com/dcheongsee/NBA‑Predictor.git

Open NBA_Predictor.ipynb in Colab and execute Run All – the notebook rebuilds the entire pipeline end‑to‑end in under two minutes on free tier hardware.

Local run

python -m venv .venv && source .venv/bin/activate
pip install pandas scikit-learn matplotlib notebook
jupyter notebook NBA_Predictor.ipynb

Repository layout

.
├── NBA_Predictor.ipynb   # Reproducible workflow
|                         # CLI + Match‑up simulator
├── nba_games.csv         # cached CSV
└── README.md

Results

  • Accuracy   79 %
  • F1‑score   0.78

See NBA_Predictor.ipynb for full metrics.

Why it matters

A compact but end‑to‑end example of sports analytics: raw CSV ingestion through cleaning, feature engineering, modelling and live inference. Reproducible in a single notebook.

License

MIT-licensed. Keep the copyright header, otherwise do whatever you like

About

ML applied to sports analytics - includes data cleaning, model training, and a 79% accurate live inference (win predictions) on a sample set NBA box-scores from 2004 to 2020.

Resources

Stars

Watchers

Forks

Contributors