Machine learning system that predicts NBA game outcomes
This system predicts who'll win NBA games before they happen. It uses three different machine learning models (XGBoost, LightGBM, and CatBoost) and combines their predictions for better accuracy.
- Three Models Working Together: XGBoost, LightGBM, and CatBoost vote on each game
- Smart Features: Elo ratings, rest days, recent form, winning streaks
- Fast Predictions: Processes all games in a day in seconds
The system is focused on pregame predictions. It looks at historical game results and team performance patterns to make predictions.
See ARCHITECTURE.md for the full technical breakdown.
NBA-Prediction/
├── src/
│ ├── models/ # Model code
│ │ └── pregame/ # Ensemble models
│ ├── data/ # Data ingestion & preprocessing
│ └── services/ # API services
├── scripts/ # Training & evaluation scripts
└── docs/ # Documentation
- Python 3.10+
- Poetry (Python package manager)
- CUDA-capable GPU (recommended)
# Clone repository
git clone https://github.com/ShauryaMallampati/NBA-Prediction.git
cd NBA-Prediction
# Install Python dependencies
poetry install
# Set any required environment variables for optional data providersSecurity tip: Never commit API keys or secrets. If you accidentally expose one, rotate it immediately through the provider's dashboard.
- Want to reproduce our results? Check
REPRODUCIBILITY.md - Using this in a paper? See
CITATION.cfffor how to cite us - Found a security issue? Open a GitHub issue (no public exploits please)
# Train base ensemble
poetry run python scripts/train_ensemble_fixed.py
# Train ensemble v2 (alt)
poetry run python scripts/training/train_ensemble_v2.py
# Build pregame features
poetry run python -m src.data.preprocess.build_pregame_features
# Train ensemble
poetry run python -m src.models.pregame.train_ensemble# Get today's predictions
poetry run python scripts/run_daily_predictions.pyIf you add tests, place them under tests/ and run:
poetry run pytest -vfrom src.models.pregame.predictor import EnsemblePredictor
# Load trained ensemble
predictor = EnsemblePredictor("artifacts/models/pregame")
# Predict on a pre-built feature set
df = ... # pandas DataFrame aligned to feature schema
probs = predictor.predict(df)
print(probs)- Game Winner Accuracy: ~63-66% baseline (varies by season)
- Calibration: Isotonic regression on ensemble outputs
- NBA Stats API (official stats)
- Basketball Reference (historical data)
See DATASET_ACKNOWLEDGMENTS.md for full attribution.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- NBA Stats API for official game data
- Basketball Reference for historical statistics
- scikit-learn, XGBoost, LightGBM, CatBoost communities
If you use this code in your research, please cite:
@software{mallampati2025nba,
title={Multi-Modal Deep Learning for NBA Game Prediction},
author={Mallampati, Shaurya},
year={2025},
url={https://github.com/ShauryaMallampati/NBA-Prediction}
}For questions or collaboration: GitHub Issues