In football, expected goals (xG) has transformed how analysts evaluate performance. Rather than judging a team by goals scored alone, xG assigns a probability to every shot based on its context—distance, angle, assist type—and aggregates those probabilities into a truer picture of quality. It separates skill from luck, revealing which teams create great chances and which simply get fortunate bounces.
No equivalent framework existed for basketball. This project set out to build one from scratch: an Expected Points (xPts) model for the NBA, trained on over four million shots spanning 1997–2020, that estimates how many points each shot should have been worth given its context.
Why Traditional Stats Fall Short
Field goal percentage (FG%) and points per game (PPG) are the go-to numbers for judging a scorer. But they're blind to context. A contested fadeaway three with two seconds on the clock is treated identically to a wide-open dunk. Looking at individual feature distributions—distance, time remaining, FG%—confirms the problem: the overlap between makes and misses is enormous. No single variable cleanly separates good from bad shots. What matters is how features interact together.
To understand why, consider LeBron James's 2018–19 season. His FG% gives one number. But mapping his shot success rate by court zone reveals dramatic variation—elite efficiency near the rim, mediocre from mid-range, streaky from three. That spatial story is invisible in aggregate stats. A multivariate model captures it.
The Model
The xPts model is an XGBoost classifier that predicts whether each shot will go in, using features that fall into four categories.
Spatial Features
Shot distance from the basket (Euclidean, from player coordinates), court zone (a 3×3 grid of the attacking half), and shot type. The NBA recognises over 50 distinct shot types—each with its own geometry and difficulty. A hook shot, taken perpendicular to the basket with a sweeping motion, is mechanically harder than a catch-and-shoot from the same spot.
Contextual Features
Time remaining in the game (in seconds), and whether the shooter was playing at home or away. As the clock winds down, possessions grow heavier, defences tighten, and shot quality drops—the "clutch" effect that analysts obsess over.
Offensive Rating
Unlike football xG models, which typically ignore who takes the shot, the talent gap between NBA players is too large to overlook. Each player receives an offensive rating derived from the previous season's points per shot, FG%, and turnover rate.
Defensive Rating
A custom team-level defensive metric quantifies how hard the opposing team makes it to score, focusing specifically on factors that affect shot quality:
FM = DFG% × (1 − DOR%) / [DFG% × (1 − DOR%) + (1 − DFG%) × DOR%]DefRating = BLK × FM × (1 − 1.07 × DOR%) + DRB × (1 − FM)DFG% = opponent FG% | DOR% = opponent offensive rebound % | BLK = blocks/game | DRB = defensive rebounds/game
Steals and turnovers were deliberately excluded—they end possessions before a shot happens and therefore don't affect shot quality directly.
Psychological Features
Two factors that are rarely modelled in sports prediction. Recent form captures short-term momentum by looking at a player's output over the preceding games, complementing the season-long offensive rating. Player fatigue is approximated by recent travel load and consecutive away games—a rough but novel proxy.
Results
The XGBoost model was compared against a PPG baseline and a Random Forest classifier using accuracy and AUC (area under the ROC curve).
For context, a PPG baseline managed 55% accuracy and 0.51 AUC, while the Random Forest reached 61% accuracy and 0.63 AUC. In basketball—a high-volume, inherently noisy sport—these numbers are on par with or slightly above prior research. The model isn't meant to nail every shot; it's meant to differentiate shot quality at scale.
What Drives Shot Success?
SHAP feature importance confirmed the intuitions baked into the model design. Shot distance was the single most influential factor by a wide margin: further shots lower success probability, closer shots raise it. Specific shot types ranked next—dunks boost probability (they require proximity to the rim), hook shots lower it. FG% and PPG followed, validating the inclusion of player-level offensive history. Time remaining, defensive rating, and recent form all contributed meaningfully, though with smaller effect sizes.
From Probabilities to Expected Points
The model's predicted probability for each shot is multiplied by the shot's value (2 or 3 points, or 1 for free throws) to produce expected points:
xPts = P(success) × Shot ValueA 2-point jump shot with P(success) = 0.60 yields 1.20 xPts, regardless of whether it goes in.
Aggregating xPts across a game, season, or career opens up several analytical applications. The most revealing is delta points—the gap between what a player or team actually scored and what the model predicted from their shot quality.
Applications
Player Efficiency Rankings
Ranking players by xPts per 100 possessions for the 2015–16 season surfaces a list dominated by centres: DeAndre Jordan, Tyson Chandler, Festus Ezeli, Clint Capela. This makes sense—centres take high-percentage shots close to the rim. The delta column adds nuance.
| Player | xPts | Actual Pts | xPts/100 | Actual/100 | Δ/100 |
|---|---|---|---|---|---|
| DeAndre Jordan | 683.6 | 773 | 140.95 | 159.38 | +18.43 |
| Tyson Chandler | 411.6 | 426 | 131.50 | 136.10 | +4.60 |
| Clint Capela | 232.1 | 248 | 126.80 | 135.52 | +8.72 |
| Rudy Gobert | 472.0 | 470 | 126.20 | 125.67 | −0.53 |
| Dwight Howard | 487.6 | 523 | 123.45 | 132.41 | +8.96 |
| Andre Iguodala | 546.2 | 572 | 121.92 | 127.68 | +5.76 |
DeAndre Jordan didn't just take the best shots—he also outperformed his shot quality by nearly 18.5 points per 100 possessions. Rudy Gobert, despite elite shot selection, scored almost exactly what xPts predicted—no over-performance, no under-performance. That's a fundamentally different conversation from what FG% alone can tell you.
Game-Level Analysis
Aggregating xPts across an entire game reveals which team "deserved" to win based on the quality of opportunities they created. In one analysed matchup between Dallas and Philadelphia, Dallas scored 101 points against an xPts of 102.9 (delta: −1.9), while Philadelphia scored 103 points against an xPts of just 86.0 (delta: +17.1). Philadelphia won the game, but the shots they created were far worse—they simply converted at an unsustainable rate.
Limitations & Future Work
The model has clear gaps. No player-tracking data means no information on defender proximity or shot contest level—arguably the biggest missing signal. Offensive ratings are season-level averages, which can misrepresent players who had uncharacteristically bad or good years. The fatigue proxy (travel and consecutive away games) showed limited predictive power, suggesting a more sophisticated approach is needed. And a dataset spanning two decades inevitably contains shifts in rules, pace, and style of play that the model treats as static.
Future iterations could integrate spatial tracking data, use recurrent architectures (LSTMs) to model possession sequences, and dynamically update offensive ratings within a season rather than using a single prior-year snapshot. Extending the framework to the WNBA or European leagues would test its generalisability across different styles of basketball.
The Bigger Picture
Expected goals reshaped how football thinks about performance. There's no reason the same philosophy can't work in basketball. Yes, basketball is noisier—more shots, faster pace, wider variance. But that's precisely why separating process from outcome matters. A team that consistently generates 110 xPts per game but scores 105 isn't failing; it's unlucky. A team that scores 115 on 100 xPts isn't great; it's due for regression.
xPts gives coaches a way to evaluate shot selection independent of results, to identify under-performing players who are actually creating great looks, and to assess defensive schemes by how much they suppress opponents' shot quality. It's a lens, not a verdict—but it's a lens that traditional stats simply cannot provide.