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 elevate the Larry O’Brien Trophy.
However what if we may transcend the recent takes and predictions, and use knowledge and Machine Learning to, on the finish of the common season, forecast the NBA Champion?
On this article, I’ll stroll by way of this course of — from gathering and getting ready the information, 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 shocking insights that emerged from the evaluation.
All of the code and knowledge used can be found on GitHub.
Understanding the downside
Earlier than diving into mannequin coaching, an important step in any machine studying venture is knowing the issue:
What query are we making an attempt to reply, and what knowledge (and mannequin) may also help us get there?
On this case, the query is easy: Who’s going to be the NBA Champion?
A pure first thought is to border this as a classification downside: every group in every season is labeled as both Champion or Not Champion.
However there’s a catch. There’s solely one champion per yr (clearly).
So if we pull knowledge from the final 40 seasons, we’d have 40 optimistic examples… and tons of of adverse ones. That lack of optimistic samples makes it extraordinarily arduous for a mannequin to be taught significant patterns, specifically contemplating that successful an NBA title is such a uncommon occasion that we merely don’t have sufficient historic knowledge — we’re not working with 20,000 seasons. That shortage makes it extraordinarily troublesome for any classification mannequin to actually perceive what separates champions from the remainder.
We’d like a better method to body the issue.
To assist the mannequin perceive what makes a champion, it’s helpful to additionally train it what makes an virtually champion — and the way that differs from a group that was knocked out within the first spherical. In different phrases, we wish the mannequin to be taught levels of success within the playoffs, moderately than a easy sure/no final result.
This led me to the idea of Champion Share — the proportion of playoff wins a group achieved out of the full wanted to win the title.
From 2003 onward, it takes 16 wins to grow to be a NBA Champion. Nevertheless, between 1984 and 2002, the primary spherical was a best-of-five collection, so throughout that interval the full required was 15 wins.
A group that loses within the first spherical might need 0 or 1 win (Champion Share = 1/16), whereas a group 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 downside, the place the mannequin predicts a steady worth between 0 and 1 — representing how shut every group got here to successful all of it.
On this setup, the group with the highest predicted worth is our mannequin’s choose for the NBA Champion.
It is a related method to the MVP prediction from my earlier article.
Information
Basketball — and the NBA particularly — is among the most enjoyable sports activities to work with in knowledge science, due to the amount of freely out there statistics. For this venture, I gathered knowledge from Basketball Reference utilizing my python package deal BRScraper, that permits easy accessibility to the gamers’ and groups knowledge. All knowledge assortment was achieved in accordance with the web site’s pointers and price limits.
The information used contains team-level statistics, ultimate common season standings (e.g., win proportion, seeding), in addition to player-level statistics for every group (restricted to gamers who appeared in at the least 30 video games) and historic playoff efficiency indicators.
Nevertheless, it’s vital to be cautious when working with uncooked, absolute values. For instance, the common factors per sport (PPG) within the 2023–24 season was 114.2, whereas in 2000–01 it was 94.8 — a rise of practically 20%.
This is because of a collection 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 a substitute of a group’s PPG, you need to use their rating in that season.
- As a substitute of counting what number of gamers common 20+ PPG, you may think about what number of are within the high 10 in scoring, and so forth.
This permits the mannequin to seize relative dominance inside every period, making comparisons throughout a long time 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 group with the worst common season document 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 finest total group (sixth within the West).
One other notable pattern is that champions are likely to have a barely greater common age, suggesting that have performs an important function as soon as the playoffs start. The youngest championship group 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 seek out extra success within the postseason.
Modeling
The mannequin used was LightGBM, a tree-based algorithm well known as one of the efficient strategies for tabular knowledge, alongside others like XGBoost. A grid search was achieved to establish the most effective hyperparameters for this particular downside.
The mannequin efficiency was evaluated utilizing the basis imply squared error (RMSE) and the coefficient of dedication (R²).
You’ll find the method 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 as a way to higher assess the mannequin’s efficiency on more moderen knowledge. Importantly, all groups have been included within the dataset — not simply those who certified for the playoffs — permitting the mannequin to be taught patterns with out counting on prior information of postseason qualification.
Outcomes
Right here we are able to see a comparability between the “distributions” of each the predictions and the true values. Whereas it’s technically a histogram — since we’re coping with a regression downside — 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 are able to see, the predictions and the true 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 traditional distribution. This means that the mannequin is ready to seize and reproduce the underlying patterns current within the knowledge.
When it comes to efficiency metrics, the most effective 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 inexpensive rationalization of how every characteristic impacts the mannequin’s predictions.
Once more, a deeper rationalization about SHAP and find out how to interpret its chart might be present in Predicting the NBA MVP with Machine Learning.

From the SHAP chart, a number of vital insights emerge:
- Seed and W/L% rank among the many high three most impactful options, highlighting the significance of group efficiency within the common season.
- Workforce-level stats reminiscent of Internet Ranking (NRtg), Opponent Factors Per Sport (PA/G), Margin of Victory (MOV) and Adjusted Offensive Ranking (ORtg/A) additionally play a major function in shaping playoff success.
- On the participant aspect, superior metrics stand out: the variety of gamers within the high 30 for Field Plus/Minus (BPM) and high 3 for Win Shares per 48 Minutes (WS/48) are among the many most influential.
Apparently, the mannequin additionally captures broader traits — groups with the next common age are likely to carry out higher within the playoffs, and a robust displaying within the earlier postseason usually correlates with future success. Each patterns level once more to expertise as a precious asset within the pursuit of a championship.
Let’s now take a better take 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 most effective regular-season document at 58–24 (.707), however an damage to Giannis Antetokounmpo harm their playoff run. The Bucks have been eradicated 4–1 within the first spherical by the Miami Warmth, who went on to achieve the Finals — a shocking 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 sturdy 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 latest playoff success.
Nonetheless, as everyone knows, something can occur in sports activities — and we’ll solely get the true reply by the tip of June.

Conclusions
This venture demonstrates how machine studying might be utilized to advanced, dynamic environments like sports activities. Utilizing a dataset spanning 4 a long time 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 selections and higher perceive the elements that contribute to postseason success.
One of many largest challenges on this downside is accounting for accidents. They’ll fully reshape the playoff panorama — notably after they have an effect on star gamers in the course of the playoffs or late within the common season. Ideally, we may incorporate damage histories and availability knowledge to raised account for this. Sadly, constant and structured open knowledge on this matter— particularly on the granularity wanted for modeling — is tough to return by. In consequence, this stays one of many mannequin’s blind spots: it treats all groups at full energy, which is commonly not the case.
Whereas no mannequin can completely predict the chaos and unpredictability of sports activities, this evaluation exhibits that data-driven approaches can get shut. Because the 2025 playoffs unfold, will probably be thrilling to see how the predictions maintain up — and what surprises the sport nonetheless has in retailer.

I’m at all times out there on my channels (LinkedIn and GitHub).
Thanks on your consideration!👏
Gabriel Speranza Pastorello