NBA Predictions¶

Sports are one of the most exciting things for humans to watch. Ever since the Greeks, we have been watching the peaks of human talent and strength go head to head for our amusement. Part of watching sports is predicting player and game results. In our friend groups, we enjoy betting with each other to see who can predict the best. But what if we could use data to predict NBA results? Using these data sets, we can analyze professional predictions and hold them against real results to see whether we have any real predictions. We can even compare them to sports betting, seeing whether the general public is a good predictor of NBA games.

In [2]:
import pandas as pd
forecast = pd.read_csv('nba_elo_latest.csv')
raptor_player = pd.read_csv('latest_RAPTOR_by_player.csv')
raptor_team = pd.read_csv('latest_RAPTOR_by_team.csv')
In [3]:
forecast
Out[3]:
date season neutral playoff team1 team2 elo1_pre elo2_pre elo_prob1 elo_prob2 ... carm-elo2_post raptor1_pre raptor2_pre raptor_prob1 raptor_prob2 score1 score2 quality importance total_rating
0 2022-10-18 2023 0 NaN BOS PHI 1657.639749 1582.247327 0.732950 0.267050 ... NaN 1693.243079 1641.876729 0.670612 0.329388 126.0 117.0 96 13 55
1 2022-10-18 2023 0 NaN GSW LAL 1660.620307 1442.352444 0.862011 0.137989 ... NaN 1615.718147 1472.173711 0.776502 0.223498 123.0 109.0 67 20 44
2 2022-10-19 2023 0 NaN DET ORL 1393.525172 1366.089249 0.675590 0.324410 ... NaN 1308.969909 1349.865183 0.563270 0.436730 113.0 109.0 3 1 2
3 2022-10-19 2023 0 NaN IND WAS 1399.201934 1440.077372 0.584275 0.415725 ... NaN 1462.352663 1472.018225 0.599510 0.400490 107.0 114.0 37 28 33
4 2022-10-19 2023 0 NaN MEM NYK 1605.024654 1520.387218 0.743236 0.256764 ... NaN 1612.012431 1549.908529 0.691851 0.308149 115.0 112.0 80 25 53
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1225 2023-04-09 2023 0 NaN LAL UTA 1504.744770 1481.755984 0.669955 0.330045 ... NaN 1575.335105 1467.649966 0.790236 0.209764 NaN NaN 59 79 69
1226 2023-04-09 2023 0 NaN PHO LAC 1539.294205 1533.602843 0.647578 0.352422 ... NaN 1594.886979 1568.837386 0.706779 0.293221 NaN NaN 80 59 70
1227 2023-04-09 2023 0 NaN DEN SAC 1622.398993 1536.032304 0.745131 0.254869 ... NaN 1660.865116 1520.232102 0.775272 0.224728 NaN NaN 82 16 49
1228 2023-04-09 2023 0 NaN OKC MEM 1502.519844 1592.785654 0.514005 0.485995 ... NaN 1446.987516 1649.512477 0.331692 0.668308 NaN NaN 68 11 40
1229 2023-04-09 2023 0 NaN MIN NOP 1498.549000 1471.045258 0.675676 0.324324 ... NaN 1593.842503 1523.044878 0.643574 0.356426 NaN NaN 73 100 87

1230 rows × 27 columns

In [4]:
raptor_player
Out[4]:
player_name player_id season poss mp raptor_box_offense raptor_box_defense raptor_box_total raptor_onoff_offense raptor_onoff_defense ... raptor_offense raptor_defense raptor_total war_total war_reg_season war_playoffs predator_offense predator_defense predator_total pace_impact
0 Precious Achiuwa achiupr01 2023 1815 884 -1.947087 0.588189 -1.358898 1.773688 -3.103238 ... -1.305684 -0.150217 -1.455902 0.578335 0.578335 0 -1.746737 0.094785 -1.651952 -0.921260
1 Steven Adams adamsst01 2023 2391 1133 -0.781226 3.871637 3.090410 5.017233 -1.021186 ... 0.381481 3.032318 3.413799 3.569110 3.569110 0 0.002454 3.559242 3.561696 0.172480
2 Bam Adebayo adebaba01 2023 4050 1997 -1.748401 3.075370 1.326969 3.106552 2.021386 ... -0.778060 3.013927 2.235867 5.059791 5.059791 0 -0.544009 3.023692 2.479683 -0.400677
3 Ochai Agbaji agbajoc01 2023 1308 610 -1.122218 -1.277537 -2.399755 0.148745 0.130974 ... -0.949953 -1.032549 -1.982501 0.238324 0.238324 0 -1.221923 -2.094835 -3.316758 -0.227829
4 Santi Aldama aldamsa01 2023 2658 1232 -0.881129 0.638420 -0.242709 -0.705088 -1.474488 ... -0.901642 0.176482 -0.725160 1.277881 1.277881 0 -0.665268 1.255711 0.590443 0.407355
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
505 McKinley Wright IV wrighmc01 2023 427 206 -2.309795 0.140190 -2.169606 -4.690802 -2.747202 ... -2.971625 -0.439241 -3.410866 -0.069261 -0.069261 0 -3.822731 -1.015922 -4.838653 -0.285504
506 Thaddeus Young youngth01 2023 1567 758 -1.368647 1.980380 0.611733 -2.022035 -2.409291 ... -1.609660 1.183832 -0.425828 0.901992 0.901992 0 -1.345448 1.738224 0.392775 0.355125
507 Trae Young youngtr01 2023 4140 1907 5.954660 -1.515906 4.438755 1.933012 -0.994529 ... 5.437224 -1.482502 3.954722 6.720606 6.720606 0 5.540542 -2.241654 3.298887 3.053295
508 Cody Zeller zelleco01 2023 97 47 -3.214858 -5.939772 -9.154631 0.030709 8.145724 ... -2.698186 -3.348513 -6.046699 -0.078376 -0.078376 0 -1.024169 -4.187561 -5.211730 -0.865123
509 Ivica Zubac zubaciv01 2023 3529 1734 -2.903855 1.062315 -1.841540 -0.410775 -3.436995 ... -2.548307 0.173025 -2.375282 0.328859 0.328859 0 -3.381719 0.884100 -2.497619 -0.807154

510 rows × 21 columns

In [5]:
raptor_team
Out[5]:
player_name player_id season season_type team poss mp raptor_box_offense raptor_box_defense raptor_box_total ... raptor_offense raptor_defense raptor_total war_total war_reg_season war_playoffs predator_offense predator_defense predator_total pace_impact
0 Precious Achiuwa achiupr01 2023 RS TOR 1815 884 -1.947087 0.588189 -1.358898 ... -1.305684 -0.150217 -1.455902 0.578335 0.578335 0 -1.746737 0.094785 -1.651952 -0.921260
1 Steven Adams adamsst01 2023 RS MEM 2391 1133 -0.781226 3.871637 3.090410 ... 0.381481 3.032318 3.413799 3.569110 3.569110 0 0.002454 3.559242 3.561696 0.172480
2 Bam Adebayo adebaba01 2023 RS MIA 4050 1997 -1.748401 3.075370 1.326969 ... -0.778060 3.013927 2.235867 5.059791 5.059791 0 -0.544009 3.023692 2.479683 -0.400677
3 Ochai Agbaji agbajoc01 2023 RS UTA 1308 610 -1.122218 -1.277537 -2.399755 ... -0.949953 -1.032549 -1.982501 0.238324 0.238324 0 -1.221923 -2.094835 -3.316758 -0.227829
4 Santi Aldama aldamsa01 2023 RS MEM 2658 1232 -0.881129 0.638420 -0.242709 ... -0.901642 0.176482 -0.725160 1.277881 1.277881 0 -0.665268 1.255711 0.590443 0.407355
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
562 McKinley Wright IV wrighmc01 2023 RS DAL 427 206 -2.309795 0.140190 -2.169606 ... -2.971625 -0.439241 -3.410866 -0.069261 -0.069261 0 -3.822731 -1.015922 -4.838653 -0.285504
563 Thaddeus Young youngth01 2023 RS TOR 1567 758 -1.368647 1.980380 0.611733 ... -1.609660 1.183832 -0.425828 0.901992 0.901992 0 -1.345448 1.738224 0.392775 0.355125
564 Trae Young youngtr01 2023 RS ATL 4140 1907 5.954660 -1.515906 4.438755 ... 5.437224 -1.482502 3.954722 6.720606 6.720606 0 5.540542 -2.241654 3.298887 3.053295
565 Cody Zeller zelleco01 2023 RS MIA 97 47 -3.214858 -5.939772 -9.154631 ... -2.698186 -3.348513 -6.046699 -0.078376 -0.078376 0 -1.024169 -4.187561 -5.211730 -0.865123
566 Ivica Zubac zubaciv01 2023 RS LAC 3529 1734 -2.903855 1.062315 -1.841540 ... -2.548307 0.173025 -2.375282 0.328859 0.328859 0 -3.381719 0.884100 -2.497619 -0.807154

567 rows × 23 columns

We can use the various statistics on players and teams, including raptor_box_offense, raptor_box_defense, pace_impact, etc. to see which statistics are a good predictor of results.