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 may transcend the recent takes and predictions, and use knowledge and Machine Studying to, on the finish of the common season, forecast the NBA Champion?
On this article, I’ll stroll via this course of — from gathering and making 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 few of the most stunning 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, a very powerful 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 crew 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 detrimental ones. That lack of optimistic samples makes it extraordinarily laborious 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 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 train it what makes an virtually champion — and the way that differs from a crew that was knocked out within the first spherical. In different phrases, we wish the mannequin to be taught levels of success within the playoffs, reasonably than a easy sure/no consequence.
This led me to the idea of Champion Share — the proportion of playoff wins a crew achieved out of the full wanted to win the title.
From 2003 onward, it takes 16 wins to develop into a NBA Champion. Nevertheless, between 1984 and 2002, the primary spherical was a best-of-five sequence, so throughout that interval the full required was 15 wins.
A crew that loses within the first spherical might need 0 or 1 win (Champion Share = 1/16), whereas a crew 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 crew got here to successful all of it.
On this setup, the crew with the highest predicted worth is our mannequin’s decide for the NBA Champion.
This can be a related strategy to the MVP prediction from my earlier article.
Information
Basketball — and the NBA particularly — is without doubt one of the most fun sports activities to work with in knowledge science, because of the amount of freely obtainable statistics. For this venture, I gathered knowledge from Basketball Reference utilizing my python package deal BRScraper, that enables easy accessibility to the gamers’ and groups knowledge. All knowledge assortment was accomplished in accordance with the web site’s pointers and fee limits.
The info used contains team-level statistics, ultimate common season standings (e.g., win share, seeding), in addition to player-level statistics for every crew (restricted to gamers who appeared in not less than 30 video games) and historic playoff efficiency indicators.
Nevertheless, it’s essential 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 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 strategy right here avoids utilizing absolute statistics straight, opting as an alternative for normalized, relative metrics. For instance:
- As an alternative of a crew’s PPG, you should utilize their rating in that season.
- As an alternative of counting what number of gamers common 20+ PPG, you may contemplate what number of are within the prime 10 in scoring, and so forth.
This permits 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 counterpoint the dataset.
Information from the 1984 to 2024 seasons had 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 attention-grabbing patterns emerge from an exploratory evaluation when evaluating championship groups to all playoff groups as a complete:

Champions have a tendency to return from the highest seeds and with greater successful percentages, unsurprisingly. The crew 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 coming into the playoffs as solely the tenth greatest total crew (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 crew within the database with a median 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 probably the most efficient strategies for tabular knowledge, alongside others like XGBoost. A grid search was accomplished to determine the most effective hyperparameters for this particular downside.
The mannequin efficiency was evaluated utilizing the basis imply squared error (RMSE) and the coefficient of willpower (R²).
You will discover the formulation and clarification of every metric in my earlier MVP article.
The seasons used for coaching and testing had been randomly chosen, with the constraint of reserving the final three seasons for the take a look at set with the intention to higher assess the mannequin’s efficiency on more moderen knowledge. Importantly, all groups had 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 data of postseason qualification.
Outcomes
Right here we will 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 will see, the predictions and the true values observe an analogous 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 implies that the mannequin is ready to seize and reproduce the underlying patterns current within the knowledge.
By way of 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 strategy for visualizing the important thing variables influencing the mannequin’s predictions is thru SHAP Values, atechnique that gives an affordable clarification of how every characteristic impacts the mannequin’s predictions.
Once more, a deeper clarification about SHAP and the way to interpret its chart may be present in Predicting the NBA MVP with Machine Studying.

From the SHAP chart, a number of essential insights emerge:
- Seed and W/L% rank among the many prime three most impactful options, highlighting the significance of crew efficiency within the common season.
- Staff-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 big position in shaping playoff success.
- On the participant aspect, 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.
Apparently, the mannequin additionally captures broader traits — groups with the next common age are likely to carry out higher within the playoffs, and a powerful displaying within the earlier postseason typically 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 more in-depth have a look at how the mannequin carried out in predicting the final three NBA champions:

The mannequin accurately 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 harm to Giannis Antetokounmpo damage their playoff run. The Bucks had been eradicated 4–1 within the first spherical by the Miami Warmth, who went on to achieve 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 true reply by the top of June.

Conclusions
This venture demonstrates how machine studying may be utilized to advanced, 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 selections and higher perceive the elements that contribute to postseason success.
One of many greatest challenges on this downside is accounting for accidents. They will utterly reshape the playoff panorama — notably after they have an effect on star gamers throughout the playoffs or late within the common season. Ideally, we may incorporate harm 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 difficult to return by. Consequently, this stays one of many mannequin’s blind spots: it treats all groups at full energy, which is usually 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, will probably 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 on your consideration!👏
Gabriel Speranza Pastorello