100 Days of Code, Day 17: Machine Learning, LeBron, and Russ Part 2

Last year, I messed around with the machine learning features in the Python library scikit. I created a program that could tell the difference between LeBron James and Russel Westbrook. Using stats from the first half of the season, the program could determine which stats from games in the second half of the season belonged to which player.

That post was pretty popular, so for the next phase of the 100 Days of Code Challenge, I decided to revisit my code to see how I can improve my work. My hope is that after a few days, I will have a readable and reusable program that can tell the difference between any player in the NBA

First of all, why Python?

Other than R and MATLAB, Python is one of the most used programming languages for academic research. It allows users to easily manipulate arrays of data and provides some great open source libraries for mathematical analysis (numpy and scipy, for example). Plus, Python is really readable.

What does the current program do?

The current iteration of the program takes in data from over 20 different statistical categories for both players for the first 40 games of the 2016 season. This data is used to train the model. Training a model means that we give our machine learning algorithm enough data points to identify future inputs based on specific characteristics.

Using the trained model, the program compares the stats from the rest of the games to a profile it’s developed for each player. It correctly identified each player with 98% accuracy.

Next steps…

Check out the newest repository an GitHub so you can run the program locally. I’m still working through some issues with how I built my arrays (I’ve come a long way since 2017), but this will be the basis for the coming days!

For tomorrow, I will focus on repairing the arrays and abstracting the code to accept data from different players. Check back tomorrow to see my progress!

One thought on “100 Days of Code, Day 17: Machine Learning, LeBron, and Russ Part 2

Leave a comment