NBA Game Simulator
Team Chemistry Predictor
Creator: Parul Laul
What would it be like for
Russell Westbrook, Stephen Curry, and Lebron James to play on the same team?
How do we test this?
Let's build a simulator!
Who would benefit?
- The NBA of course!
- Sports analysts
- Sports gamblers
Player Tracking
SportVU Technology
- Gives $(x, y)$ coordinates of
players
- Gives $(x, y, z)$ coordinates of the ball
...at 25 frames per second!
Data Snippet
game_id game_date period game_clock game_time_remain shot_clock \
0021500568 2016-01-11 1 714.04 2874.04 18.27
0021500568 2016-01-11 1 714.04 2874.04 18.27
0021500568 2016-01-11 1 714.04 2874.04 18.27
0021500568 2016-01-11 1 714.04 2874.04 18.27
team_id player_id x_loc y_loc elevation dist_to_ball \
1610612744 203110 76.21 39.70 0.00 8.47
1610612748 2548 58.97 5.88 0.00 40.30
1610612748 2547 86.70 21.05 0.00 29.35
1610612748 2736 71.32 45.91 0.00 2.19
closest_to_ball player_name player_jersey
False Draymond Green 23
False Dwyane Wade 3
False Chris Bosh 1
True Luol Deng 9
Add Context to the Data
Combine NBA play-by-play with Position data
- Deduce 'shooting side', time and location of:
shot (made or attempted), assist, block, free throw, rebound, steal or turnover
- Assume possession if player is closest and within a distance of 2ft from the ball, for a consecutive string of 15 frames (0.6 seconds)
- Deduce player passed if he had possession, and his resulting action was neither a shot or turnover
Steps to the simulator
1. Break up the court in to regions
Steps to the simulator
2. Determine Offensive Player Probabilities
- Movement:
$ \mathbb{P}(\text{move to region B} | \text{in region A}$).
- Possession:
$ \mathbb{P}(\text{has possession} | \text{his team on offense}$).
- Action:
$ \mathbb{P}(\text{action} | \text{in region A}$),
where action $=$ pass, shoot, or turnover.
Steps to the simulator
Example: Player action probabilities
Steps to the simulator
3. Defenders
- A player is considered a defender if he is the closest player on the opposing team to the player with possession.
Steps to the simulator
3. Defensive Parameters
Combine NBA stats with total number of defended possessions
- $ \mathbb{P}$(action)
= action per game / num poss defended,
where action
= steals, blocks, offensive rebounds, defensive rebounds
Steps to the simulator
4. Defense Affect
- Defenders matched to offense players in the following order: position played, height, random
- $ \mathbb{P}_o(\text{shot})$ =
$\max(0, \mathbb{P}_o(\text{shot}) - \mathbb{P}_d(\text{block}))$
- $ \mathbb{P}_o(\text{turnover})$ =
$ \min( \mathbb{P}_o(\text{turnover}) + \mathbb{P}_d(\text{steal}), 1)$
Steps to the simulator
5. Assumptions
- Each play is approx. 20 sec $\Rightarrow$ 144 plays per game
- 6 actions per play $\Rightarrow$ 848 actions per game
- Player has constant performance based on the minutes played.
(Results of each player are scaled to entire game)
Simulate!
Preliminary results after 100 simulations
PTS FGA FGM FG3A FG3M OREB DREB STL BLK TO PASS
GSW
mean 84.48 74.79 32.97 12.76 6.18 5.89 40.66 0.53 2.13 17.82 249.08
std 11.33 6.37 4.76 3.98 2.85 2.37 5.71 0.62 1.43 3.94 23.26
rmse 31.67 15.16 10.47 13.10 3.31 2.98 6.70 4.91 1.43 8.37 169.27
MIA
mean 88.22 89.46 37.75 16.56 4.24 21.24 39.62 1.09 2.89 14.16 276.95
std 10.62 6.16 4.86 3.97 2.02 4.89 5.15 0.96 1.51 3.60 22.84
rmse 43.70 25.58 18.86 6.81 2.40 4.88 21.18 1.45 1.94 6.93 117.67
Next steps
Improve the model by:
- Using more games
- Using more simulations
- Using players that play more minutes
- Validating passing and possession models