Enhancing game outcome prediction in the Chinese basketball league through a machine learning framework based on performance data

Machine Learning


Research design

This study adopts an Ex Post Facto research design, which is appropriate for analyzing naturally occurring data without manipulating any variables. Since all data used in this study—such as game results, team performance statistics, and match contexts—are historical and observational in nature, this approach enables the examination of whether certain input features (e.g., seasonal averages, recent performance trends, and historical strength) are statistically associated with predictive outcomes in basketball match results.

Under this design, the study employs four models, including FourFactors and DefenseOfense, along with their respective extended versions, as baseline models. All computations for these models are grounded in historical game data to ensure practical predictive applicability. Building upon this foundation, the models are further enhanced by integrating three key factors: the team’s seasonal average performance, historical competitive strength, and recent performance. Figure 2 illustrates the flowchart of the proposed research framework. While this study does not directly incorporate explainability methods such as SHAP or feature importance, it emphasizes practical realism by strictly using pre-game information to avoid data leakage. This prioritization of temporal validity ensures the model’s relevance to real-world applications, and future research may extend this work with interpretability tools to support more informed decision-making.

Fig. 2
figure 2

Flowchart of the proposed machine learning framework for enhancing basketball game outcome predictions.

Dataset

In this study, the dataset includes game-by-game data from the 2021-2024 regular seasons of the Chinese Basketball Association (CBA), excluding playoff matches. For each game, the performance data of both the home and away teams is recorded. As shown in Table 2, the dataset captures a range of game-specific features, with the match outcome encoded as binary values: “1” for a victory and “0” for a defeat. The label for each game is ultimately determined by the result of the home team.

Table 2 Match features and explanations.

Baseline model construction

Following the extraction of features from each game, the next step involves processing these specific features through a series of transformations. In this study, the Four Factors and DefenseOfense models, along with their extended versions, Four Factors detailed and DefenseOfense detailed, are utilized for calculations. Subsequently, a weighted average is computed by incorporating data from previous games, forming the foundation of the baseline model proposed in this study.

Weighted calculation of game data

To construct the baseline model, game data is processed using a weighted rolling average approach, which accounts for the varying importance of past performances. The weights are assigned to prioritize more recent games, reflecting their greater relevance to the current performance trends. The weighted calculations are performed as follows:

Game Weighting Scheme Each game is assigned a weight based on its temporal proximity to the game under evaluation. Let n denote the total number of preceding games considered, and let \(w_i\) represent the weight assigned to the ith most recent game. The weights are linearly increasing, with the most recent game having the highest weight of n and the oldest game having a weight of 1:

$$\begin{aligned} w_i = n – i + 1, \quad \text {for } i = 1, 2, \dots , n. \end{aligned}$$

(7)

This scheme ensures that the sum of the weights is given by:

$$\begin{aligned} \sum _{i=1}^{n} w_i = \frac{n \cdot (n + 1)}{2}. \end{aligned}$$

(8)

Metric Aggregation with Weights  For each performance metric X, the weighted rolling average is computed as:

$$\begin{aligned} \text {Weighted Average of } X = \frac{\sum _{i=1}^{n} w_i \cdot X_i}{\sum _{i=1}^{n} w_i}, \end{aligned}$$

(9)

where \(X_i\) denotes the value of metric X in the ith most recent game. This weighted aggregation ensures that recent games have a stronger influence on the resulting averages.

Special Cases for Percentage Metrics  Certain performance metrics are expressed as percentages (e.g., 2P%, 3P%, FT%). For these metrics, the weighted averages are calculated using cumulative weighted sums of both the numerator and the denominator. For example, the weighted average of 2P% (two-point shooting percentage) is defined as:

$$\begin{aligned} \text {Weighted Average of } \texttt {2P} \texttt {\%} = \frac{\sum _{i=1}^{n} w_i \cdot \texttt {2P}_i}{\sum _{i=1}^{n} w_i \cdot \texttt {2PA}_i}, \end{aligned}$$

(10)

where 2P represents successful two-point field goals, and 2PA represents two-point field goals attempted. Similarly, effective field goal percentage (eFG%) is calculated as:

$$\begin{aligned} \text {Weighted Average of } \texttt {eFG\%} = \frac{\sum _{i=1}^{n} w_i \cdot (\texttt {FG}_i + 0.5 \cdot \texttt {3P}_i)}{\sum _{i=1}^{n} w_i \cdot \texttt {FGA}_i}, \end{aligned}$$

(11)

where FG, 3P, and FGA are field goals made, three-point field goals made, and field goals attempted, respectively. For true shooting percentage (TS%), which considers all scoring opportunities, the weighted average is defined as:

$$\begin{aligned} \text {Weighted Average of } \texttt {TS\%} = \frac{\sum _{i=1}^{n} w_i \cdot \texttt {PTS}_i}{2 \cdot \left( \sum _{i=1}^{n} w_i \cdot \texttt {FGA}_i + 0.44 \cdot \sum _{i=1}^{n} w_i \cdot \texttt {FTA}_i\right) }, \end{aligned}$$

(12)

where PTS represents total points scored, and FTA represents free throw attempts.

Implementation and Integration The weighted averages for all metrics are updated dynamically for each game, forming the input features for the baseline model. This methodology allows the model to capture real-time performance trends, ensuring that the predictive framework is both robust and responsive to recent variations in team performance. By leveraging these weighted averages, the baseline model effectively integrates historical performance with current game dynamics, providing a solid foundation for further analysis and modeling.

Four factors model

Dean Oliver17 proposed the “Four Factors of Basketball Success” framework that identified the key contributors to winning games. According to his analysis, shooting efficiency accounts for 40% of a team’s success, turnovers 25%, rebounding 20% and free throws 15%. These values represent the relative importance of each factor and highlight their collective influence on a team’s performance.

In the context of predicting basketball game outcomes, the Four Factors are evaluated independently for both home and away teams. Using the weights described in “Weighted calculation of game data” section, the offensive and defensive factors (Offense_Factor and Defense_Factor) for both teams are then computed. As this study uses the home team’s win-loss results as the target labels, the focus is on calculating the Offense_Factor and Defense_Factor for the home team. By incorporating the weighted basic metrics outlined above, a weighted Four Factors model is established, Table 3 provides the formulas used to compute the offensive and defensive factors. Meanwhile, Table 4 illustrates the detailed structure of the Four Factors model, offering a comprehensive framework for its application.

Table 3 Four Factors calculation formula.
Table 4 The structure of Four Factors model.

Four factors detailed model

This model is a derivative of the Four Factors model, constructed using the eight features outlined in Table 3. It has been employed in26 for hybrid feature extraction. These features and explanations are shown in Table 5.

Table 5 The structure of Four Factors detailed model.

DefenseOfense model

Horvat et al.25 applied the “DefenseOfense” model to predict the match, based on basic basketball statistics. This model is another model that counts the offense and defense of a team, focusing on the statistics of the home team and away team. Serkan Ballı et al.26 referred to the calculation results as i_offense and i_defense, respectively. In order to distinguish this from the Four Factors model, OFFENSE and DEFENSE will be used here to represent it. This model has two features and one label. Calculation methods are given in Table 6.

Table 6 The structure of DefenseOfense model.

DefenseOfense detailed model

This model is an extension of the DefenseOfense model, incorporating 16 sub-features from the original. It consists of a total of sixteen features and one label26, with detailed descriptions and explanations provided in Table 7.

Table 7 The structure of DefenseOfense detailed model.

Enhanced model

Following the identification of the four baseline models, the subsequent step involves developing enhanced models. Building upon the foundation of the baseline models, this study introduces three critical factors to augment their predictive capabilities: the team’s seasonal average performance, historical competitive strength, and recent performance. By incorporating these additional dimensions, the enhanced models aim to provide a more comprehensive and nuanced understanding of the factors that shape team performance, ultimately yielding a more robust analytical framework.

Seasonal average performance

To evaluate seasonal average performance, we compute a series of key performance metrics that capture various aspects of a basketball team’s contributions during the season. These metrics are derived from the season-long average data for both the home and away teams. The general formula used for these calculations is given by:

$$\begin{aligned} \text {Metric Percentage} = \frac{\text {Home Value}}{\text {Home Value} + \text {Away Value}} \end{aligned}$$

(13)

If the denominator (\(\text {Home Value} + \text {Away Value}\)) equals zero, the metric defaults to a balanced value of 0.5, indicating equal contributions from both teams. Table 8 provides a comprehensive summary of these metrics.

In addition to these normalized percentages, offensive efficiency and defensive efficiency are also directly assigned from the home and away teams’ season averages without normalization. The formulas for offensive efficiency and defensive efficiency are given as:

$$\begin{aligned} \text {Offensive Efficiency}&= \frac{\text {Team Points}}{\text {Possessions}} \end{aligned}$$

(14)

$$\begin{aligned} \text {Defensive Efficiency}&= \frac{\text {Opponent Points}}{\text {Possessions}} \end{aligned}$$

(15)

where the calculation of possessions is provided in36.

$$\begin{aligned} \text {Possessions} = (\texttt {2PA} + \texttt {3PA}) + 0.44 \times \texttt {FTA} – \texttt {OREB} + \texttt {TO} \end{aligned}$$

(16)

By combining these metrics, this framework provides a robust analysis of a team’s seasonal average performance. These indicators not only reflect the relative strengths of the home and away teams across various dimensions but also serve as foundational inputs for advanced predictive models. Table 8 shows the structure of seasonal average performance.

Table 8 The structure of Seasonal average performance.

Historical competitive strength

When predicting the outcomes of games, it is crucial to consider not only the seasonal average performance of the teams but also their historical strength, which serves as a significant factor. There are numerous methods to evaluate a team’s historical strength, including rankings from previous seasons, historical win rates, and accolades achieved. However, to provide a more precise and objective assessment, this study employs the Elo rating system.

Elo is a widely used mechanism in competitive gaming to evaluate players’ skills. Under this system, defeating a higher-rated opponent—indicating greater strength—earns a player more points, whereas defeating a lower-rated opponent yields fewer points. Conversely, losses follow a similar logic. This dynamic adjustment makes the ELO system a more scientific and nuanced approach to assessing performance. The calculation formula is as follows:

$$\begin{aligned} E_A^{
(17)

where \(E_A^{
(18)

where \(E_B^{(t-1)}\) is the rating of the opposing team B before game t. This formulation is derived from the Elo rating system, which models the expected outcome as a function of the rating difference between the two teams. Table 9 presents the features of historical competitive strength along with detailed explanations.

In recent years, Elo ratings have been increasingly adopted in the sports field. For instance, Tzai Lampis et al.30 incorporated the Elo metric into its research and achieved promising results. In this study, based on the summary of multiple experiments, the initial Elo ratings for all teams were set to 1000, and the K-value was set to 32.

Besides the setting of Elo ratings, factors across seasons also need to be taken into account. The dataset utilized in this study encompasses data spanning multiple seasons. Given that each team undergoes certain personnel changes at the end of a season, these transitions often result in more substantial shifts in team composition and performance compared to intra-season variations. Consequently, it becomes necessary to implement a reset mechanism for Elo ratings when transitioning between seasons. In this study, we employ a mean-averaging approach for the reset process, as detailed in the following formula:

$$\begin{aligned} E_{\text {new}} = E_{\text {previous}} \cdot (1 – r) + E_{\text {base}} \cdot r \end{aligned}$$

(19)

where \(E_{\text {current}}\) represents the Elo rating for the new season, \(E_{\text {previous}}\) represents the Elo rating for the previous season, \(E_{\text {base}}\) is the baseline Elo rating (default value is 1000), and r is the regression ratio (default value is 0.5).

Table 9 The structure of Historical competitive strength.

Recent performance

The final component incorporated into the enhanced features is the recent performance of the team. The recent performance of a team serves as a valuable indicator of its current form, which plays a crucial role in predicting the outcomes of the upcoming matches. To capture this, the study utilizes a metric that reflects the team’s Elo rating change over its most recent five games. This metric effectively summarizes short-term performance trends, providing a reliable measure of the team’s current state. The calculation is expressed as follows:

$$\begin{aligned} \Delta E_{\text {recent}} = E_{\text {current}} – E_{\text {five}\_\text {games}\_\text {ago}} \end{aligned}$$

(20)

where \(E_{\text {current}}\) represents the team’s current Elo rating ,and \(E_{\text {five}\_\text {games}\_\text {ago}}\) denotes the Elo rating recorded five games prior. If fewer than five games are available, the calculation considers the Elo rating from the earliest game available instead.

This formulation ensures that recent performance fluctuations are effectively captured, making it a critical factor for enhancing the predictive accuracy of the model. By reflecting the short-term dynamics of a team’s performance, this feature provides meaningful insights into the current state of the team and its potential in the upcoming match and the structure of recent performance is provided in Table 10.

Table 10 The structure of Recent performance.



Source link