Rodolfo Gaspary

NBA career longevity

Naive Bayes classifier that predicts whether an NBA rookie will still be in the league five years later. Right 84% of the time it predicts a long career.

View the notebook Notebook · .ipynb

Confusion matrix with 105 true negatives, 22 false positives, 94 false negatives and 114 true positives, next to the four metrics compared with the 0.621 baseline
The 94 false negatives are the weak spot: players who did last five years and the model ruled out.
Role
Modelling and evaluation, individual work
Context
Lab · Google Advanced Data Analytics
Data
1,340 players · rookie-season statistics
Tools
Python, pandas, scikit-learn

Will an NBA rookie still be in the league five years from now? A Gaussian Naive Bayes classifier trained on first-season statistics. It is right 84% of the time it predicts a long career, but it misses almost half of them.

The problem

A firm that advises NBA teams wants to know which players are most likely to last in the league. The target is binary: whether a player reaches a five-year career. The predictors are ten first-year statistics — field-goal, three-point and free-throw percentages, rebounds, assists, steals, blocks and turnovers — plus two variables built in an earlier feature-engineering lab: total points and efficiency.

Approach

Results

Precision
0.838
Recall
0.548
Accuracy
0.654
F1
0.663

What the numbers say

65% accuracy looks acceptable until it is compared with the simplest alternative. 62% of the test players did last five years, so always predicting "yes" is already right 62.1% of the time. The model improves on that by barely three points. Judged on accuracy alone, it would look useful without being so.

Its value is in precision. When the model says a player will last, it is right in 84 cases out of 100; it makes that mistake only 22 times. The trade-off is that it is cautious: of 208 players who lasted, it recognises 114. It can back a bet on a player, not rule anyone out.

What I would change

Deliverables

View the notebook Notebook · .ipynb

Practice lab for The Nuts and Bolts of Machine Learning, part of the Google Advanced Data Analytics programme on Coursera. The data is NBA rookie statistics prepared in the previous feature-engineering lab.

← All projects