Live Analysis of DraftKings' NBA Moneyline Bets with Machine Learning

NOTE: I live in California now, where online sports betting is illegal, so this project/site is no longer active. The tables displayed are from previous moments in time when I lived in Pennsylvania. Here is a link to the GitHub repository containing the code: GitHub Repository.

Welcome to BC Bets! This website uses machine learning to identify favorable NBA money line bets. It pulls all pregame lines listed on DraftKings' website every hour and evaluates them. For each game, it picks the better of the two lines and calculates a “confidence”, with higher confidence corresponding to a better bet. The goal of course is to make money!

Doesn't the House Always Win?

The central idea behind this methodology is that sportsbooks do not necessarily set moneylines based on how likely each team is to win, but rather based on how much bettors have placed on either team. This means that due to the large number of people who simply place bets on teams they like or on intuition (“this one's a lock bro I swear”), a good predictive model can be used to give consistent positive long-term returns.

Creating a Model

The first step in this process is creating a model that can predict the win percentages for two teams that will face each other based on their stats. The process for creating the model is broken into the following steps:

  1. Data Collection: Statistics from every modern NBA game are available publicly. Data from the past 10 years was used to train the model.
  2. Feature Engineering: This critical step identifies/computes stats that are used to train the model. After testing several combinations and reviewing existing models, the following three stats were used:
    1. Team ELO: A rating system that reflects a team's win percentage adjusted by the strength of schedule.
    2. Plus-Minus over the past 10 games: Captures recent performance trends as teams improve or worsen over the season.
    3. Home/Away Team: Since the home team wins 63% of the time, this factor is key and fully independent of other stats.
  3. Model Selection: The method requires predicting win probabilities rather than just winners and losers. After testing various models, a linear regression model performed best.

The model trained on these input stats predicts NBA game outcomes correctly 68% of the time. This may sound low, but underdogs generally do win roughly 30% of the time, and the best currently existing model I could find by FiveThirtyEight is correct 70% of the time. And again, the main advantage of this model is not that it predicts a binary game outcome, but that it gives a quantifiable win percentage for each team. You may be able to predict game winners well, but how do you know if +340 or -500 is a better bet for a particular game? Or if they're both bad bets? That's what really matters in sports betting at the end of the day.

Team Metrics: Each team's ELO and their Last 10 Game Plus-Minus. These stats in addition to the Home/Away team for a given matchup are used to calculate fair odds by the model. Metrics were calculated from data on NBA's website.
Team ELO Last 10 Game Plus-Minus
BOS 1751.5 125
DEN 1663.3 88
DAL 1663.0 85
LAL 1637.2 93
MIN 1635.0 89
PHX 1630.1 64
GSW 1604.4 81
OKC 1597.5 -19
LAC 1572.7 6
IND 1558.2 63
ORL 1555.9 68
NOP 1552.0 -2
SAC 1551.9 24
NYK 1537.5 63
MIA 1535.3 82
HOU 1528.9 17
MIL 1517.8 18
ATL 1516.1 10
CHI 1513.3 22
PHI 1498.5 21
CLE 1488.9 -80
BKN 1410.5 -24
SAS 1393.5 -20
MEM 1380.0 -86
POR 1313.0 -111
UTA 1309.9 -150
CHA 1296.6 -126
TOR 1281.2 -198
WAS 1276.8 -42
DET 1251.8 -128

Identifying Good Bets

Okay now we have a model, but how exactly is it used? The key step in assessing the quality of a moneyline is computing what a “fair” win percentage is for a given moneyline is. For example, if a team has a 50% chance to win, +100 is a fair line (you will exactly break even in the long term). If a team has a 33% chance to win, then +150 is a fair line. You can compute a fair win percentage for any given moneyline. Once you have this, you simply compare the sportsbook's fair win percentage to the win percentage predicted by the model. If the sportsbook's fair win percentage is 50%, and the model gives that team a win percentage of 55%, then this is a good bet with a confidence of 5%. This site actively pulls all moneyline bets from DraftKings' website (updated every hour, pregame lines only) and goes through this evaluation process on each individual bet. For each game, it picks the better bet (higher confidence), and displays that along with the confidence in the “Predictions” tab of this site. Note that some lines will have negative confidence, which simply means both bets are bad, and it just picked the less negative one.

Bet Odds Summary: Displays matchups, odds, best bet, and model confidence for each game. Bets were pulled live from DraftKings' website by a scraping algorithm.
Matchup Line 1 Line 2 Best Bet Confidence
CHI @ WAS CHI -122 WAS +102 CHI -122 0.17050735427216301
ORL @ PHI ORL +250 PHI -310 ORL +250 0.1460983253099084
BKN @ NY BKN +425 NY -575 BKN +425 0.0629396275666112
IND @ CLE IND +130 CLE -155 IND +130 0.10795619800109924
CHA @ BOS CHA +245 BOS -298 BOS -298 0.30071211341475035
MIL @ OKC MIL +625 OKC -950 MIL +625 0.15267591987163992
LA L @ MEM LA L -1100 MEM +700 MEM +700 0.13643982328988002
PHO @ SAC PHO -198 SAC +164 SAC +164 0.12104969199639287

And that's it! I would use the above table to place my bets.

Weaknesses

In reality, you cannot simply rely on all green bets because there are events that the model cannot immediately account for. Since the features take time to recalibrate, factors such as player injuries, key players sitting out at the end of a season, or recent trades can drastically alter a team's performance before the model has a chance to adjust.

So, some level of active management is still required—follow the news and be cautious of green bets where a major change has occurred in the past few games. Allow the model time (typically over the next 5-10 games) to incorporate these changes.