Real-time in-game win probability with live SHAP explainability — deployed FastAPI + Streamlit
| Metric | Value |
|---|---|
| Brier Score | 0.089 |
| Log Loss | 0.213 |
| AUC-ROC | 0.941 |
| Calibration Error | 0.012 |
- Predicts win probability at every play-by-play event in real time
- Explains each prediction with SHAP values (which factors matter most)
- Exposes a
/predictREST endpoint and live Streamlit dashboard - Trained on 500K+ plays across 5 NBA seasons
Raw play-by-play (nba_api)
→ Feature engineering (score diff, pace, possession, time)
→ XGBoost + isotonic calibration
→ SHAP TreeExplainer
→ FastAPI /predict endpoint
→ Streamlit live dashboard
Python XGBoost SHAP FastAPI Streamlit scikit-learn nba_api Docker Plotly
pip install -r requirements.txt
python data/pull_pbp.py # Pull NBA play-by-play data
python model/train.py # Train + calibrate model
uvicorn api.main:app --reload # Start API
streamlit run app/dashboard.py # Launch dashboardcurl -X POST http://localhost:8000/predict \
-H "Content-Type: application/json" \
-d '{"score_diff": 5, "time_remaining": 420, "possession": 1, "pace": 98.4}'
# → {"win_prob": 0.714, "shap_values": {...}}