Skip to content

Predicting NBA games with Elo ratings and machine learning

  • Article
  • Sports

Read the announcement on Facebook

Anyone who follows basketball has a theory about which teams will win. Josh Weiner, Jack Rosener, and Jackson Joffe, students at the University of Pennsylvania, tried to turn that into a model. Their project, written up on Towards Data Science, set out to predict the outcome of any NBA game, regular season or otherwise, using team statistics and Elo ratings.

The motivation

The group’s starting point was that existing NBA prediction models were not very good. They wanted something playoff-agnostic, meaning it would not specialise in predicting playoff series but would work on any game, and they focused on win-loss records at home and away rather than on point totals. Beyond the model itself, the stated aim was to show how much statistics can contribute to understanding sports.

Elo as the core feature

The central input was the Elo rating. Elo is a system, originally from chess, that gives every team a number, raises it when the team wins, lowers it when it loses, and adjusts the size of each change by how strong the opponent was. Beating a top team moves a rating more than beating a weak one. That makes Elo a compact way to represent a team’s strength over many seasons while accounting for the fact that not all teams are created equal. The article’s chart of Elo over time for the Golden State Warriors, Cleveland Cavaliers, and Detroit Pistons from 2009 to 2020 shows the Warriors climbing past 1800 in the mid-2010s while the Pistons drift around 1400 to 1500.

Elo was combined with conventional team statistics, and two models were trained on the result: linear regression and a random forest classifier.

Results

The models reached a win-prediction accuracy of about 66.95 to 67.15 percent. That figure sounds modest until you consider how much variance a basketball game contains. The study confirmed that Elo is a better determinant of wins than points, and that Elo and the quantities that feed into it are better features to train on than raw scoring when the goal is predicting the outcome of NBA games.

Where it could go

The authors were open about the limits. Some of the features they used were inefficient, and they invited others to improve on them in the hope of building a more definitive system for predicting basketball games in general. The post’s summary put it plainly: machine learning offers many possibilities, but useful findings only come with the right statistics behind them.

Source: Predicting the outcome of NBA games with Machine Learning, Josh Weiner, Towards Data Science (2021)

Originally shared on Facebook.

Query console

Connected to dssoc. Type \h for the commands this console understands.