Each NBA season, 30 groups compete for one thing just one will obtain: the legacy of a championship. From energy rankings to commerce deadline chaos and accidents, followers and analysts alike speculate endlessly about who will increase the Larry O’Brien Trophy.
However what if we might transcend the recent takes and predictions, and use information and Machine Learning to, on the finish of the common season, forecast the NBA Champion?
On this article, I’ll stroll by this course of — from gathering and getting ready the info, to coaching and evaluating the mannequin, and eventually utilizing it to make predictions for the upcoming 2024–25 Playoffs. Alongside the best way, I’ll spotlight a number of the most stunning insights that emerged from the evaluation.
All of the code and information used can be found on GitHub.
Understanding the drawback
Earlier than diving into mannequin coaching, crucial step in any machine studying venture is knowing the issue:
What query are we making an attempt to reply, and what information (and mannequin) will help us get there?
On this case, the query is straightforward: Who’s going to be the NBA Champion?
A pure first thought is to border this as a classification drawback: every workforce in every season is labeled as both Champion or Not Champion.
However there’s a catch. There’s solely one champion per 12 months (clearly).
So if we pull information from the final 40 seasons, we’d have 40 constructive examples… and a whole bunch of unfavourable ones. That lack of constructive samples makes it extraordinarily exhausting for a mannequin to study significant patterns, specifically contemplating that successful an NBA title is such a uncommon occasion that we merely don’t have sufficient historic information — we’re not working with 20,000 seasons. That shortage makes it extraordinarily tough for any classification mannequin to actually perceive what separates champions from the remaining.
We want a wiser option to body the issue.
To assist the mannequin perceive what makes a champion, it’s helpful to additionally educate it what makes an nearly champion — and the way that differs from a workforce that was knocked out within the first spherical. In different phrases, we wish the mannequin to study levels of success within the playoffs, somewhat than a easy sure/no end result.
This led me to the idea of Champion Share — the proportion of playoff wins a workforce achieved out of the entire wanted to win the title.
From 2003 onward, it takes 16 wins to turn into a NBA Champion. Nevertheless, between 1984 and 2002, the primary spherical was a best-of-five sequence, so throughout that interval the entire required was 15 wins.
A workforce that loses within the first spherical might need 0 or 1 win (Champion Share = 1/16), whereas a workforce that makes the Finals however loses might need 14 wins (Champion Share = 14/16). The Champion has a full share of 1.0.
This reframes the duty as a regression drawback, the place the mannequin predicts a steady worth between 0 and 1 — representing how shut every workforce got here to successful all of it.
On this setup, the workforce with the highest predicted worth is our mannequin’s choose for the NBA Champion.
This can be a related method to the MVP prediction from my earlier article.
Information
Basketball — and the NBA particularly — is without doubt one of the most enjoyable sports activities to work with in information science, due to the amount of freely obtainable statistics. For this venture, I gathered information from Basketball Reference utilizing my python bundle BRScraper, that permits easy accessibility to the gamers’ and groups information. All information assortment was finished in accordance with the web site’s tips and price limits.
The information used consists of team-level statistics, closing common season standings (e.g., win share, seeding), in addition to player-level statistics for every workforce (restricted to gamers who appeared in not less than 30 video games) and historic playoff efficiency indicators.
Nevertheless, it’s necessary to be cautious when working with uncooked, absolute values. For instance, the common factors per recreation (PPG) within the 2023–24 season was 114.2, whereas in 2000–01 it was 94.8 — a rise of almost 20%.
This is because of a sequence of things, however the truth is that the sport has modified considerably over time, and so have the metrics derived from it.
To account for this shift, the method right here avoids utilizing absolute statistics instantly, opting as an alternative for normalized, relative metrics. For instance:
- As an alternative of a workforce’s PPG, you should utilize their rating in that season.
- As an alternative of counting what number of gamers common 20+ PPG, you’ll be able to take into account what number of are within the prime 10 in scoring, and so forth.
This allows the mannequin to seize relative dominance inside every period, making comparisons throughout many years extra significant and thus allowing the inclusion of older seasons to complement the dataset.
Information from the 1984 to 2024 seasons have been used to coach and take a look at the mannequin, totaling 40 seasons, with a complete of 70 variables.
Earlier than diving into the mannequin itself, some fascinating patterns emerge from an exploratory evaluation when evaluating championship groups to all playoff groups as an entire:

Champions have a tendency to return from the highest seeds and with greater successful percentages, unsurprisingly. The workforce with the worst common season report to win all of it on this interval was the 1994–95 Houston Rockets, led by Hakeem Olajuwon, ending 47–35 (.573) and getting into the playoffs as solely the tenth greatest general workforce (sixth within the West).
One other notable pattern is that champions are likely to have a barely greater common age, suggesting that have performs a vital position as soon as the playoffs start. The youngest championship workforce within the database with a mean of 26.6 years is the 1990–91 Chicago Bulls, and the oldest is the 1997–98 Chicago Bulls, with 31.2 years — the primary and final titles from the Michael Jordan dinasty.
Equally, groups with coaches who’ve been with the franchise longer additionally have a tendency to search out extra success within the postseason.
Modeling
The mannequin used was LightGBM, a tree-based algorithm widely known as one of the vital efficient strategies for tabular information, alongside others like XGBoost. A grid search was finished to establish the perfect hyperparameters for this particular drawback.
The mannequin efficiency was evaluated utilizing the foundation imply squared error (RMSE) and the coefficient of dedication (R²).
You’ll find the system and rationalization of every metric in my previous MVP article.
The seasons used for coaching and testing have been randomly chosen, with the constraint of reserving the final three seasons for the take a look at set with a view to higher assess the mannequin’s efficiency on more moderen information. Importantly, all groups have been included within the dataset — not simply people who certified for the playoffs — permitting the mannequin to study patterns with out counting on prior data of postseason qualification.
Outcomes
Right here we will see a comparability between the “distributions” of each the predictions and the actual values. Whereas it’s technically a histogram — since we’re coping with a regression drawback — it nonetheless works as a visible distribution as a result of the goal values vary from 0 to 1. Moreover, we additionally show the distribution of the residual error for every prediction.

As we will see, the predictions and the actual values observe an identical sample, each concentrated close to zero — as most groups don’t obtain excessive playoff success. That is additional supported by the distribution of the residual errors, which is centered round zero and resembles a standard distribution. This means that the mannequin is ready to seize and reproduce the underlying patterns current within the information.
When it comes to efficiency metrics, the perfect mannequin achieved an RMSE of 0.184 and an R² rating of 0.537 on the take a look at dataset.
An efficient method for visualizing the important thing variables influencing the mannequin’s predictions is thru SHAP Values, atechnique that gives an affordable rationalization of how every characteristic impacts the mannequin’s predictions.
Once more, a deeper rationalization about SHAP and tips on how to interpret its chart will be present in Predicting the NBA MVP with Machine Learning.

From the SHAP chart, a number of necessary insights emerge:
- Seed and W/L% rank among the many prime three most impactful options, highlighting the significance of workforce efficiency within the common season.
- Group-level stats corresponding to Web Score (NRtg), Opponent Factors Per Sport (PA/G), Margin of Victory (MOV) and Adjusted Offensive Score (ORtg/A) additionally play a big position in shaping playoff success.
- On the participant facet, superior metrics stand out: the variety of gamers within the prime 30 for Field Plus/Minus (BPM) and prime 3 for Win Shares per 48 Minutes (WS/48) are among the many most influential.
Curiously, the mannequin additionally captures broader developments — groups with a better common age are likely to carry out higher within the playoffs, and a robust displaying within the earlier postseason typically correlates with future success. Each patterns level once more to expertise as a useful asset within the pursuit of a championship.
Let’s now take a more in-depth have a look at how the mannequin carried out in predicting the final three NBA champions:

The mannequin appropriately predicted two of the final three NBA champions. The one miss was in 2023, when it favored the Milwaukee Bucks. That season, Milwaukee had the perfect regular-season report at 58–24 (.707), however an harm to Giannis Antetokounmpo damage their playoff run. The Bucks have been eradicated 4–1 within the first spherical by the Miami Warmth, who went on to succeed in the Finals — a stunning and disappointing postseason exit for Milwaukee, who had claimed the championship simply two years earlier.
2025 Playoffs Predictions
For this upcoming 2025 playoffs, the mannequin is predicting the Boston Celtics to go back-to-back, with OKC and Cleveland shut behind.
Given their robust common season (61–21, 2nd seed within the East) and the truth that they’re the reigning champions, I are likely to agree. They mix present efficiency with current playoff success.
Nonetheless, as everyone knows, something can occur in sports activities — and we’ll solely get the actual reply by the tip of June.

Conclusions
This venture demonstrates how machine studying will be utilized to complicated, dynamic environments like sports activities. Utilizing a dataset spanning 4 many years of basketball historical past, the mannequin was capable of uncover significant patterns into what drives playoff success. Past prediction, instruments like SHAP allowed us to interpret the mannequin’s choices and higher perceive the elements that contribute to postseason success.
One of many largest challenges on this drawback is accounting for accidents. They will fully reshape the playoff panorama — notably once they have an effect on star gamers in the course of the playoffs or late within the common season. Ideally, we might incorporate harm histories and availability information to raised account for this. Sadly, constant and structured open information on this matter— particularly on the granularity wanted for modeling — is tough to return by. Because of this, this stays one of many mannequin’s blind spots: it treats all groups at full power, which is commonly not the case.
Whereas no mannequin can completely predict the chaos and unpredictability of sports activities, this evaluation reveals that data-driven approaches can get shut. Because the 2025 playoffs unfold, it is going to be thrilling to see how the predictions maintain up — and what surprises the sport nonetheless has in retailer.

I’m all the time obtainable on my channels (LinkedIn and GitHub).
Thanks to your consideration!👏
Gabriel Speranza Pastorello