Quickstart
Get up and running — fetch data, train the model, and make your first prediction in minutes.
Data Pipeline
Learn how game data is fetched from the NBA API and stored in SQLite.
Model
Understand how the Random Forest classifier is trained, tuned, and used for inference.
Betting Engine
Convert between odds formats and evaluate whether a win probability is worth betting.
How it works
Fetch game data
Pull NBA regular season game logs for a given season using
fetch_games_teamwins(). Data is stored in a local SQLite database.Generate features
Run
generate_features_teamwins() to compute rolling averages for points, rebounds, and assists, and persist them to the team_game_stats table.Train the model
Call
train_model_teamwins() to fit a Random Forest classifier on the feature table. The trained model is saved to models/nba_model.pkl.Key features
- NBA data ingestion — Pulls team game logs directly from the NBA Stats API via
nba_api - Rolling-window features — Computes 5-game rolling averages for points, rebounds, and assists for both teams
- Random Forest classifier — 200-estimator ensemble model trained with an 70/30 train/test split
- Bet evaluation — Three-tier rating system:
Good Bet,Slight Edge, orAvoid - Odds conversion — Convert between American odds, decimal odds, and implied probabilities
Sports Predictor currently supports NBA regular season data. College basketball (CBB) model files are present but the pipeline defaults to NBA.