Introduction

  • TL;DR: Build a probability-first NBA predictor (P(home_win)). Start with a fully documented Elo baseline (update + season reversion), expand to leakage-safe schedule/rest and rolling efficiency features, train GBDT models, calibrate probabilities, and then extend to in-game win probability via a streaming state pipeline.
  • Probability products must be evaluated with proper scoring rules (LogLoss/Brier) and calibration, not just accuracy.

1) Product scope: pre-game first, in-game later

  • Pre-game: batch predictions before tip-off
  • In-game: real-time updates based on game state (clock, score differential, possession, fouls, etc.) Bayesian approaches for in-game win probability estimation have been proposed in the literature.

Why it matters: Pre-game is easier to ship and monitor; in-game requires a dedicated low-latency streaming architecture.

2) Data sources and usage constraints

  • nba_api is commonly used for prototyping as an NBA.com API client.
  • NBA.com provides Terms of Use that govern access to their digital platforms.

Why it matters: Data stability and rights/terms can become the real production bottleneck.

3) Elo baseline: make the math reproducible (update + season reversion)

3.1 Expected win probability

Classic Elo expectation uses a logistic transform on rating difference.

3.2 Post-game update with margin-of-victory multiplier

FiveThirtyEight documents NBA Elo details including a MOV multiplier formula and a K-factor of 20.

3.3 Season reversion / reset

FiveThirtyEight’s “pure Elo” reverts each team 1/4 of the way toward 1505 at the start of each season.

3.4 NBA-specific signals (rest/travel/altitude)

FiveThirtyEight’s 2015-16 methodology describes concrete examples for fatigue (back-to-back penalty), travel penalties, and altitude boosts.

Why it matters: Elo is as much a data product as a model - without explicit update and reset rules, you cannot reproduce or monitor it reliably.

4) Pre-game feature set (50) with leakage-safe definitions

Below is a practical “50-feature” plan. Rolling features must be computed strictly as-of the prediction timestamp.

4.1 Rating/strength (10)

  • elo_home, elo_away, elo_diff, elo_diff_hca, elo_recent_change_*, elo_winprob_base, elo_spread_proxy, season_revert_applied, is_playoff

4.2 Schedule/rest/travel (14)

  • rest_days_*, b2b_*, games_last_7_*, three_in_four_*, four_in_six_*, travel_km_*, timezone_change_away, altitude_home Peer-reviewed findings report performance and win likelihood differences across rest configurations.

4.3 Rolling team performance (20)

  • Scoring/margin rolls (8): *_pts_roll_N, *_opp_pts_roll_N, *_margin_roll_N, *_winrate_roll_N
  • Efficiency/pace rolls (12): *_ortg_roll_N, *_drtg_roll_N, *_nrtg_roll_N, *_pace_roll_N, plus home/road splits ORtg is commonly defined as points per 100 possessions.

4.4 Availability (6, optional)

  • Counts of inactive/questionable players; flags for top-minute players out (only if the information is known pre-game)

Why it matters: Feature growth increases leakage risk; a smaller, trustworthy set usually beats a large but noisy one.

5) Evaluation and calibration

  • log_loss and brier_score_loss are standard proper scoring rules for probabilistic classifiers.
  • scikit-learn provides calibration methods (Platt/sigmoid, isotonic) and reliability diagrams.

Why it matters: Calibrated probabilities enable robust thresholding and product policies.

6) Pre-game batch pipeline (Mermaid)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
flowchart LR
  subgraph S[Sources]
    S1[Schedule / Game Results]
    S2[Team Box Score]
    S3[Player Availability optional]
  end

  subgraph I[Ingestion]
    I1[Batch Collector]
    I2[(Raw Storage)]
    I3[(Warehouse)]
  end

  subgraph F[Feature Engineering - as-of time]
    F1[Data Quality Checks]
    F2[Elo Updater\n(time-ordered)]
    F3[Rolling Team Metrics\nshift(1)]
    F4[Rest/Travel Features]
    F5[(Feature Store - Offline)]
  end

  subgraph T[Training]
    T1[Time Split\n(season holdout / walk-forward)]
    T2[Baseline\nElo+Logistic]
    T3[GBDT Model]
    T4[Calibration]
    T5[Eval\nLogLoss/Brier/Calibration]
    T6[(Model Registry)]
  end

  subgraph P[Prediction]
    P1[Daily Batch Scoring]
    P2[(Predictions DB)]
    P3[Dashboard/API]
  end

  S --> I1 --> I2 --> I3
  I3 --> F1 --> F2 --> F3 --> F4 --> F5
  F5 --> T1 --> T2 --> T3 --> T4 --> T5 --> T6
  T6 --> P1 --> P2 --> P3

7) In-game extension: streaming state + low-latency inference

In-game models typically ingest PBP events and transform them into state features. Bayesian in-game win probability estimation has been studied for basketball contexts.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flowchart LR
  subgraph Live[Live Stream]
    L1[PBP Events]
  end
  subgraph Stream[Streaming]
    K1[Message Bus]
    K2[Stream Processor]
  end
  subgraph State[State Store]
    S1[(Redis/Key-Value)]
  end
  subgraph Feat[Online Features]
    O1[Update State]
    O2[Build Features\n(time, score_diff, possession...)]
  end
  subgraph Infer[Inference]
    M1[Online Model]
    M2[Online Calibration optional]
    M3[(WinProb DB)]
    M4[UI/API]
  end

  Live --> K1 --> K2 --> O1 --> S1
  S1 --> O2 --> M1 --> M2 --> M3 --> M4

Conclusion

  • Start with a reproducible Elo baseline (update + season reversion), then expand to leakage-safe schedule/rest and rolling efficiency features.
  • Evaluate probability quality with LogLoss/Brier and enforce calibration.
  • Extend to in-game win probability with a dedicated streaming state pipeline.

Summary

  • Probability-first NBA prediction (pre-game → in-game).
  • Elo math must be fully specified (update + season reset).
  • 50 leakage-safe features: rating, schedule/rest/travel, rolling efficiency/pace, optional availability.
  • Proper scoring rules + calibration are mandatory for production.
  • In-game requires streaming, state store, and low-latency inference.

#NBA #sportsanalytics #machinelearning #winprobability #Elo #calibration #LogLoss #BrierScore #MLOps #DataEngineering

References

  • (How We Calculate NBA Elo Ratings, 2015-05-21)[https://fivethirtyeight.com/features/how-we-calculate-nba-elo-ratings/]
  • (How Our NBA Predictions Work, 2025-12-28)[https://fivethirtyeight.com/methodology/how-our-nba-predictions-work/]
  • (How Our 2015-16 NBA Predictions Work, 2015-12-07)[https://fivethirtyeight.com/features/how-our-2015-16-nba-predictions-work/]
  • (Probability calibration, 2025-12-28)[https://scikit-learn.org/stable/modules/calibration.html]
  • (log_loss, 2025-12-28)[https://scikit-learn.org/stable/modules/generated/sklearn.metrics.log_loss.html]
  • (brier_score_loss, 2025-12-28)[https://scikit-learn.org/stable/modules/generated/sklearn.metrics.brier_score_loss.html]
  • (Terms of Use, 2025-12-28)[https://www.nba.com/termsofuse]
  • (nba_api, 2025-12-28)[https://github.com/swar/nba_api]
  • (Effect of travel and rest on performance of professional basketball players, 1997-01-01)[https://pubmed.ncbi.nlm.nih.gov/9381060/]
  • (Basketball performance is affected by the schedule congestion cycles, 2021-03-10)[https://pubmed.ncbi.nlm.nih.gov/32172667/]
  • (Basketball-Reference Glossary, 2025-12-28)[https://www.basketball-reference.com/about/glossary.html]
  • (Bayesian estimation of in-game home team win probability for college basketball, 2022-04-26)[https://arxiv.org/pdf/2204.11777]