{"id":233884,"date":"2025-08-16T06:16:15","date_gmt":"2025-08-16T06:16:15","guid":{"rendered":"https:\/\/www.rawchili.com\/nba\/233884\/"},"modified":"2025-08-16T06:16:15","modified_gmt":"2025-08-16T06:16:15","slug":"stacked-ensemble-model-for-nba-game-outcome-prediction-analysis","status":"publish","type":"post","link":"https:\/\/www.rawchili.com\/nba\/233884\/","title":{"rendered":"Stacked ensemble model for NBA game outcome prediction analysis"},"content":{"rendered":"<p>This study aims to develop a predictive framework for NBA game outcomes using a machine-learning strategy based on the Stacking ensemble method. This section details the materials and methods used to achieve our objective. Figure\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Fig1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a> displays the overall workflow of the proposed framework. The entire experimental procedure was carried out in a Jupyter Notebook environment using Python. We utilized several key Python libraries\u2014including NumPy, Pandas, Scikit-learn, and Matplotlib\u2014for data processing, model development, and result visualization.<\/p>\n<p>Fig. 1<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/www.nature.com\/articles\/s41598-025-13657-1\/figures\/1\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig1\" src=\"https:\/\/www.rawchili.com\/nba\/wp-content\/uploads\/2025\/08\/41598_2025_13657_Fig1_HTML.png\" alt=\"figure 1\" loading=\"lazy\" width=\"685\" height=\"496\"\/><\/a><\/p>\n<p>The proposed framework for classifying NBA game outcomes.<\/p>\n<p>Dataset<\/p>\n<p>The data used in this study were obtained from the official NBA website (<a href=\"https:\/\/www.nba.com\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/www.nba.com<\/a>), which provides a comprehensive collection of multi-dimensional information, including basic player and team statistics, advanced efficiency metrics, spatial tracking data, lineup performance, and salary and management records. These datasets are widely used in both tactical analysis and machine learning modeling.<\/p>\n<p>This study focuses primarily on game-level performance and outcomes from the regular seasons of the 2021\u20132022, 2022\u20132023, and 2023\u20132024 NBA seasons. Specifically, data were collected from all 1,230 games per season, totaling 3,690 games and 7,380 samples (accounting for both home and away teams). The dataset comprises 20 feature variables, including total field goals made, three-point shots made, and other offensive and defensive indicators. The game outcome (win or loss) serves as the target variable. Detailed descriptions of all variables are provided in Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Tab2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>.<\/p>\n<p>Table 2 Summary of feature Variables.Data processing<\/p>\n<p>To facilitate model training, the game outcome variable for all regular-season games across the three NBA seasons was encoded as a binary classification variable, where a win was labeled as 1 and a loss as 0. This binary encoding allows machine learning models to distinguish between game outcomes more effectively.<\/p>\n<p>As shown in the summary statistics presented in Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Tab3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>, the resulting dataset is balanced, containing an equal number of win and loss samples. Specifically, among the 7,380 total samples, there are 3,690 observations for each class (win and loss).<\/p>\n<p>Table 3 Summary statistics of class Distribution.Dataset partitioning<\/p>\n<p>To prevent model overfitting and ensure robust predictive performance, the dataset was randomly partitioned into training and testing subsets. Given that each regular-season game across the three NBA seasons is mutually independent, random sampling was employed for the split.<\/p>\n<p>Specifically, 80% of the data was allocated to the training set, and the remaining 20% to the testing set. The training set was used for model construction, while the testing set was used for evaluating the model\u2019s performance. The detailed distribution of samples is presented in Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Tab4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>.<\/p>\n<p>Table 4 Sample distribution between training and testing Sets.Feature selection<\/p>\n<p>Feature selection is a crucial step that directly impacts the accuracy and generalization performance of a model<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"AbdelhamidN ThabtahF,Abdel-jaberH(2017)Phishingdetection:arecentintelligentmachinelearn- ing comparison based on models content and features. In: Proceedings of the IEEE international conference on intelligence and security informatics (ISI). Beijing Beijing (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR20\" id=\"ref-link-section-d92430529e1393\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>. To prevent the issue of multicollinearity among variables, which can reduce model interpretability, key features were further screened to address this concern. We employed Exploratory Data Analysis (EDA) techniques and calculated the Pearson correlation coefficients between feature variables to assess inter-variable relationships visually. As shown in the correlation heatmap in Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>, no severe multicollinearity was observed among the 20 feature variables. Therefore, all 20 features were retained for model training and analysis. Descriptive statistics for each variable are presented in Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Tab5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>.<\/p>\n<p>Table 5 Descriptive statistics of feature Variables.Fig. 2<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/www.nature.com\/articles\/s41598-025-13657-1\/figures\/2\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig2\" src=\"https:\/\/www.rawchili.com\/nba\/wp-content\/uploads\/2025\/08\/41598_2025_13657_Fig2_HTML.png\" alt=\"figure 2\" loading=\"lazy\" width=\"685\" height=\"566\"\/><\/a><\/p>\n<p>Pearson Correlation Heatmap of Feature Variables.<\/p>\n<p>Model building<\/p>\n<p>After completing data preprocessing, this study utilizes the Scikit-Learn Python toolkit to train machine learning models. The dataset is initially divided into training and testing sets, ensuring a systematic approach to model evaluation. Various machine learning classifiers are then applied to train and evaluate the model\u2019s performance, allowing for a thorough comparison of their predictive abilities.<\/p>\n<p>To construct the baseline models, each candidate machine learning algorithm is evaluated using 5-fold cross-validation, a widely accepted technique to ensure robust and unbiased performance estimation. The model yielding the highest average accuracy across folds is selected for inclusion in the base layer of the Stacking ensemble framework. The accuracy metric computed via 5-fold cross-validation is formally defined in Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>.<\/p>\n<p>$$\\:C\\:{A}_{k}=\\frac{\\sum\\:_{i=1}^{k}{A}_{i}}{k}$$<\/p>\n<p>\n                    (1)\n                <\/p>\n<p>In this context, k represents the number of cross-validation folds, while Ai indicates the accuracy achieved on the i-th fold. The resulting CAk represents the model\u2019s average cross-validated accuracy. According to the evaluation results above, the models with the highest accuracy are selected to form the base layer of the Stacked Ensemble. The selection criterion is further specified in Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>.<\/p>\n<p>$$\\:\\forall \\:\\{ i \\in \\:N,0 &lt; i &lt; n\\} ,\\:model_{i} \\: = \\:O_{{(max \\ldots \\:min)}} (CA_{1} ,CA_{2} , \\ldots \\:,CA_{n} )$$<\/p>\n<p>\n                    (2)\n                <\/p>\n<p>Let modeli represent the selected model, while O (max\u2026min) indicates the descending order function based on the cross-validation accuracies of n different models. The top-performing models are chosen to form the foundation of the proposed Stacked Ensemble Model.<\/p>\n<p>Selected modelsMultilayer perceptron<\/p>\n<p>The Single-Layer Perceptron is limited in its ability to solve problems that are not linearly separable. The MLP was developed as an extension to address this limitation. The MLP incorporates a multilayer network architecture trained using the backpropagation algorithm. The architecture generally includes three-layer types: the input layer, one or more hidden layers, and the output layer<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 21\" title=\"Ball&#x131;, S. Data analysis of Covid-19 pandemic and short-term cumulative case forecasting using machine learning time series methods. Chaos Solitons Fractals. 142, 110512 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR21\" id=\"ref-link-section-d92430529e2517\" rel=\"nofollow noopener\" target=\"_blank\">21<\/a>. In contrast to the Single-Layer Perceptron, the MLP includes at least one intermediate (hidden) layer that enables the model to capture non-linear relationships<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 22\" title=\"Torres, R. A. &amp; Hu, Y. H. Prediction of NBA Games Based on Machine Learning Methods (University of Wisconsin, 2013).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR22\" id=\"ref-link-section-d92430529e2521\" rel=\"nofollow noopener\" target=\"_blank\">22<\/a>.<\/p>\n<p>XGBoost<\/p>\n<p>XGBoost is an ensemble learning algorithm that generates predictions by aggregating the outputs of multiple base learners, typically decision trees<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 23\" title=\"Wang, C., Deng, C. &amp; Wang, S. Imbalance-xgboost: leveraging weighted and focal losses for binary label-imbalanced classifica- Tion with Xgboost. Pattern Recogn. Lett. ;136:190&#x2013;197. (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR23\" id=\"ref-link-section-d92430529e2533\" rel=\"nofollow noopener\" target=\"_blank\">23<\/a>. While it shares structural similarities with Random Forest in using decision trees as fundamental components, XGBoost offers notable advantages over traditional Gradient Boosting Decision Tree (GBDT) methods. These include significantly faster computational speed, improved generalization performance, and superior scalability, making it well-suited for large-scale and high-dimensional machine learning tasks. Unlike many machine learning frameworks, XGBoost offers extensive support for fine-tuning regularization parameters, providing greater control over model complexity and improving overall performance<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 24\" title=\"Dhaliwal, S. S., Nahid, A-A. &amp; Abbas, R. Effective intrusion detection system using Xgboost. Information ;9(7):149. (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR24\" id=\"ref-link-section-d92430529e2537\" rel=\"nofollow noopener\" target=\"_blank\">24<\/a>. Due to its efficiency and strong generalization capability, XGBoost has become a widely used technique for predictive modeling across various domains, including sports analytics and NBA game outcome prediction.<\/p>\n<p>AdaBoost<\/p>\n<p>AdaBoost is an ensemble learning method that builds a strong classifier by iteratively combining multiple weak learners. In each iteration, more focus is placed on instances that were misclassified in the previous round, guiding subsequent classifiers to concentrate on more challenging samples. AdaBoost classifiers operate as meta-estimators, initially training a base learner on the original dataset<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 25\" title=\"Soui, M., Mansouri, N., Alhamad, R., Kessentini, M. &amp; Ghedira, K. Nsga-ii as feature selection technique and adaboost classifier for covid-19 prediction using patient&#x2019;s symptoms. Nonlinear Dyn. ;106(2):1453&#x2013;1475. (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR25\" id=\"ref-link-section-d92430529e2549\" rel=\"nofollow noopener\" target=\"_blank\">25<\/a>. In the following iterations, the same base learner is retrained multiple times but with adjusted sample weights\u2014specifically, increasing the weights of previously misclassified instances\u2014so that the model progressively improves its performance on complex examples.<\/p>\n<p>Naive Bayes<\/p>\n<p>This classification algorithm, named after the English mathematician Thomas Bayes, is based on Bayes\u2019 theorem, and relies on probabilistic reasoning. It performs classification by applying probability calculations derived from training data and assigns a new instance to the class with the highest posterior probability<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 24\" title=\"Dhaliwal, S. S., Nahid, A-A. &amp; Abbas, R. Effective intrusion detection system using Xgboost. Information ;9(7):149. (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR24\" id=\"ref-link-section-d92430529e2561\" rel=\"nofollow noopener\" target=\"_blank\">24<\/a>. The mathematical formulation of Bayes\u2019 theorem is presented in Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>.<\/p>\n<p>$$\\:P\\left(A|B\\right)=\\:\\frac{P\\left(B|A\\right)\\times\\:P\\left(A\\right)}{P\\left(B\\right)}$$<\/p>\n<p>\n                    (3)\n                <\/p>\n<p>P (A | B) represents the probability of event A occurring, given that event B has already occurred.<\/p>\n<p>P (B | A) denotes the likelihood of event B occurring, given that event A has occurred.<\/p>\n<p>P(A) and P(B) refer to the prior (unconditional) probabilities for events A and B, respectively.<\/p>\n<p>K-Nearest neighbor (KNN)<\/p>\n<p>The K-nearest neighbor (KNN) algorithm is a supervised learning technique used for both classification and regression tasks. It is a non-parametric, instance-based learning algorithm that makes predictions based on the similarity between data points. In the classification process, when a new sample needs to be categorized, the algorithm identifies the k closest data points from the training set based on a chosen distance metric (e.g., Euclidean distance, Manhattan distance, or Minkowski distance). The majority class among these K nearest neighbors is then assigned as the class label for the new sample<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Sa&#x11F;ba&#x15F;, E. A. &amp; Ball&#x131;, S. Transportation mode detection by using smartphone sensors and machine learning. 376&#x2013;383. (2016).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR26\" id=\"ref-link-section-d92430529e2598\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>.<\/p>\n<p>Logistic regression<\/p>\n<p>Logistic Regression is a regression-based classification method primarily designed for binary classification problems. It can be considered an extension of Linear Regression, optimized to estimate the probability that a given observation belongs to a particular category. In other words, Logistic Regression predicts the likelihood of an outcome based on a set of independent variables and then classifies the dependent variable accordingly<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Sa&#x11F;ba&#x15F;, E. A. &amp; Ball&#x131;, S. Transportation mode detection by using smartphone sensors and machine learning. 376&#x2013;383. (2016).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR26\" id=\"ref-link-section-d92430529e2610\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>.<\/p>\n<p>Decision tree<\/p>\n<p>A Decision Tree is a supervised learning model for classification and regression tasks. It follows a hierarchical, tree-like structure to recursively partition the dataset based on feature values, ultimately reaching a leaf node representing the predicted outcome<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 27\" title=\"Zhang, J. Dive into decision trees and forests: A theoretical demonstration. ArXiv Preprint arXiv :210108656. (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR27\" id=\"ref-link-section-d92430529e2622\" rel=\"nofollow noopener\" target=\"_blank\">27<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 28\" title=\"Elshewey, A. M., Youssef, R. Y., El-Bakry, H. M. &amp; Osman, A. M. Water potability classification based on hybrid stacked model and feature selection. Environ. Sci. Pollut. Res. 32, 7933&#x2013;7949. &#010;                  https:\/\/doi.org\/10.1007\/s11356-025-36120-0&#010;                  &#010;                 (2025).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR28\" id=\"ref-link-section-d92430529e2625\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>.<\/p>\n<p>Proposed stacked ensemble model<\/p>\n<p>This study proposes a Stacked Ensemble (Stacking) model to enhance overall performance by integrating predictions from multiple base models. Stacking enables the training of diverse machine learning models to solve similar problems, combining their outputs to construct a more robust and accurate predictive model<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 28\" title=\"Elshewey, A. M., Youssef, R. Y., El-Bakry, H. M. &amp; Osman, A. M. Water potability classification based on hybrid stacked model and feature selection. Environ. Sci. Pollut. Res. 32, 7933&#x2013;7949. &#010;                  https:\/\/doi.org\/10.1007\/s11356-025-36120-0&#010;                  &#010;                 (2025).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR28\" id=\"ref-link-section-d92430529e2638\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"Lei, L. C., Gao, S. &amp; Zeng, E. Y. Regulation strategies of ride-hailing market in china: an evolutionary game theoretic perspective. Electron. Commer. Res. 20, 535&#x2013;563 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR29\" id=\"ref-link-section-d92430529e2641\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>. In contrast to ensemble techniques like Bagging and Boosting, Stacking emphasizes the integration of heterogeneous and strong base models, utilizing their complementary capabilities to enhance overall predictive performance. By aggregating the predictions of multiple models, the approach enhances generalization ability and performance stability.<\/p>\n<p>The Stacking ensemble framework can be formally defined as follows: Given a k-fold cross-validation setup, let (x, y)k represent the k data folds, x = (x\u2081, x\u2082, \u2026, xr) corresponds to the r recorded feature values, and y = (xr+1, xr+2, \u2026, xr+p) represents the p target values to be predicted. For a given set of N potential learning algorithms, denoted as modeli, i\u2009=\u20091, \u2026, N, Let Aij represent the model created by algorithm modeli trained on x to predict xp+j. The generalizer function, denoted as Gj, is responsible for merging predictions from the base models to produce the final forecast. Gj can be either a meta-model trained via a learning algorithm or a general function such as a weighted average. Thus, the estimated prediction value \\(\\hat{x}\\) (p\u2009+\u2009j) can be formally expressed by Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>. The training process is shown in Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>. The effectiveness of the Stacking ensemble learning method relies on two key factors: (1) the performance of the base classifiers\u2014the better the performance of the base models, the higher the overall ensemble performance; and (2) the diversity among the base classifiers. Introducing heterogeneous base models allows each to contribute uniquely, improving the ensemble model\u2019s generalization capability.<\/p>\n<p>$$\\:\\hat{x}\\left( {p + j} \\right) = G_{j} (A_{{ij}} , \\ldots \\:,A_{{Nj}} )$$<\/p>\n<p>\n                    (4)\n                <\/p>\n<p>Fig. 3<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/www.nature.com\/articles\/s41598-025-13657-1\/figures\/3\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig3\" src=\"https:\/\/www.rawchili.com\/nba\/wp-content\/uploads\/2025\/08\/41598_2025_13657_Fig3_HTML.png\" alt=\"figure 3\" loading=\"lazy\" width=\"685\" height=\"280\"\/><\/a><\/p>\n<p>Training Process of the Stacking Ensemble Learning Model.<\/p>\n<p>In this study, the stacked ensemble method was constructed by selecting six classifiers\u2014XGBoost, KNN, AdaBoost, Naive Bayes, Logistic Regression, and Decision Tree\u2014from multiple candidate models based on their highest cross-validation accuracy, which served as the base layer of the ensemble model. At the second layer, a MLP was used as the meta-learner (super learner). The MLP consisted of two hidden layers, each comprising 50 neurons, and was responsible for aggregating the prediction outputs from the base classifiers to produce the final prediction.<\/p>\n<p>The complete training process is illustrated in Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a> and follows a 5-fold cross-validation scheme. Specifically, the training data were randomly divided into five equally sized folds. In each iteration, four folds were used for training and the remaining fold served as the validation set. This process was repeated five times, ensuring that each fold functioned as the validation set once. During each fold, all six base classifiers were trained on the training subset and used to generate predictions on the corresponding validation fold. This resulted in five prediction sets per classifier. These out-of-fold predictions were then concatenated to form a new feature matrix, which served as the input to the meta-learner for training.<\/p>\n<p>Simultaneously, predictions were made on the test set in each fold using the base classifiers, and the average of these predictions was used to construct the test set input for the meta-learner. Finally, the MLP meta-classifier used these new features to produce the final prediction results.<\/p>\n<p>Fig. 4<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/www.nature.com\/articles\/s41598-025-13657-1\/figures\/4\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig4\" src=\"https:\/\/www.rawchili.com\/nba\/wp-content\/uploads\/2025\/08\/41598_2025_13657_Fig4_HTML.png\" alt=\"figure 4\" loading=\"lazy\" width=\"685\" height=\"277\"\/><\/a><\/p>\n<p>Complete the Training Process of the Stacking Model with 5-Fold Cross-Validation.<\/p>\n<p>Interpretability analysis<\/p>\n<p>The model\u2019s predictions are analyzed using SHAP (Shapley Additive Explanations) values, which measure the contribution of each feature to the output for a specific instance. SHAP is grounded in cooperative game theory, where the model prediction is treated as a total reward, and the feature values are considered players contributing to this reward<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 30\" title=\"Wang, D. et al. Towards better process management in wastewater treatment plants: process analytics based on SHAP values for tree-based machine learning methods. J. Environ. Manage. 301, 113941 (2022).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR30\" id=\"ref-link-section-d92430529e2823\" rel=\"nofollow noopener\" target=\"_blank\">30<\/a>.<\/p>\n<p>Consider a dataset that contains p features, represented by the set F = {1, 2, 3, \u2026, p}. A subset of features C\u2009\u2264\u2009F is referred to as a coalition, representing a collective contribution to the prediction. The empty set, denoted as \\(\\:\\tau\\:\\), represents a scenario with no contributing features. A characteristic function v is defined to assign a real value to each subset C, such that v(C) reflects the predictive value of the coalition. To determine the individual contribution of feature i, SHAP evaluates all possible permutations of the feature set and computes the average marginal contribution of feature i across all coalitions that exclude i. The SHAP value \\(\\:\\tau\\:\\)i for feature i is formally defined in Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>.<\/p>\n<p>$$\\:{\\tau\\:}_{i}=\\frac{1}{\\left|F\\right|!}\\:\\sum\\:_{p}\\left(\\nu\\:\\left(C\\cup\\:\\left\\{i\\right\\}\\right)-\\nu\\:\\left(C\\right)\\right)\\:$$<\/p>\n<p>\n                    (5)\n                <\/p>\n<p>We utilize SHAP (Shapley Additive Explanations) analysis to enhance the interpretability of our NBA game prediction model. Specifically, we apply Kernel SHAP to perform both Global Mean Analysis and Local Interpretability, enabling us to quantify the influence of individual features on the model\u2019s predictions across different scenarios.<\/p>\n<p>Global interpretability<\/p>\n<p>Global interpretability assesses how individual features influence the model\u2019s predictions on average. The horizontal axis represents the average change in model output when a specific feature is omitted or \u201cmasked.\u201d In this context, \u201cmasked\u201d signifies that the feature is removed from the input, thereby eliminating its influence on the prediction. Let N denote the total number of samples, \\(\\:{\\varphi\\:}_{i}^{\\left(j\\right)}\\) represent the SHAP value of the i-th feature for the j-th sample, and \\(\\:{\\varPhi\\:}_{i}^{global}\\)denote the global average SHAP importance of the i-th feature. The Global SHAP value can be represented using Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> as follows:<\/p>\n<p>$$\\:{{\\Phi\\:}}_{i}^{global}=\\:\\frac{1}{N}\\sum\\:_{j=1}^{N}\\left|{\\varphi\\:}_{i}^{\\left(j\\right)}\\right|\\:\\:\\:\\:$$<\/p>\n<p>\n                    (6)\n                <\/p>\n<p>Local interpretability<\/p>\n<p>Local interpretability explains individual predictions, analyzing key factors driving specific NBA game outcomes. Where f(x): the model\u2019s prediction output for sample x; \u22050 the model\u2019s baseline output (typically the expected output over background data); \u2205i the SHAP value of feature i for the given sample, representing the individual contribution of feature i to the prediction; p the total number of features. The Local SHAP Approximation Model can be represented using Eq.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ7\" rel=\"nofollow noopener\" target=\"_blank\">7<\/a> as follows:<\/p>\n<p>$$\\:f\\left(x\\right)\\approx\\:\\varphi\\:+\\sum\\:_{i=1}^{p}{\\varnothing\\:}_{i}$$<\/p>\n<p>\n                    (7)\n                <\/p>\n<p>Performance matrix<\/p>\n<p>This study applies multiple machine learning models, with their effectiveness evaluated through performance metrics: Accuracy, Precision, Recall, and F1-score, each formally described in Eqs.\u00a08, 9, 10, and 11<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 31\" title=\"Sagar, S. P., Oliullah, K., Sohan, K. &amp; Patwary, M. F. K. Prcmla: product review classification using machine learning algorithms. In: Proceedings of international conference on trends in computational and cognitive engineering: proceedings of TCCE 2020,&#xA0;65&#x2013;75&#xA0;(Springer,&#xA0;2021).\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#ref-CR31\" id=\"ref-link-section-d92430529e3029\" rel=\"nofollow noopener\" target=\"_blank\">31<\/a>. In this context, TP, FP, TN, and FN represent True Positives, False Positives, True Negatives, and False Negatives, respectively. In addition to these conventional metrics, the Receiver Operating Characteristic &#8211; Area Under the Curve (ROC-AUC) is used to evaluate classification quality. The ROC curve depicts the relationship between the True Positive Rate (TPR), which is the same as Recall, and the False Positive Rate (FPR) as defined in Eqs.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ9\" rel=\"nofollow noopener\" target=\"_blank\">9<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41598-025-13657-1#Equ12\" rel=\"nofollow noopener\" target=\"_blank\">12<\/a>. This curve offers a comprehensive visualization of a model\u2019s diagnostic ability across all possible classification thresholds, allowing for an assessment of its overall discriminative power.<\/p>\n<p>$$\\:\\text{A}\\text{c}\\text{c}\\text{u}\\text{r}\\text{a}\\text{c}\\text{y}=\\:\\frac{\\left(TP+TN\\right)}{\\left(TP+TN+FN+FP\\right)}\\:\\:\\:\\:$$<\/p>\n<p>\n                    (8)\n                <\/p>\n<p>$$\\:\\text{P}\\text{r}\\text{e}\\text{c}\\text{i}\\text{s}\\text{i}\\text{o}=\\:\\frac{\\left(TP\\right)}{\\left(TP+FP\\right)}\\:\\:$$<\/p>\n<p>\n                    (9)\n                <\/p>\n<p>$$\\:Reca=\\:\\frac{\\left(TP\\right)}{\\left(TP+FN\\right)}\\:$$<\/p>\n<p>\n                    (10)\n                <\/p>\n<p>$$\\:\\:F1\\:scor=\\frac{\\left(2*Precision*Recall\\right)}{\\left(Precision+Recall\\right)}\\:$$<\/p>\n<p>\n                    (11)\n                <\/p>\n<p>$$\\:FPR=\\:\\frac{\\left(FN\\right)}{(TP+FN)}\\:$$<\/p>\n<p>\n                    (12)\n                <\/p>\n","protected":false},"excerpt":{"rendered":"This study aims to develop a predictive framework for NBA game outcomes using a machine-learning strategy based on&hellip;\n","protected":false},"author":2,"featured_media":233885,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[40180,7,40181,40187,40186,40189,40183,40182,40190,6,40188,40185,40184],"class_list":{"0":"post-233884","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-nba","8":"tag-applied-mathematics","9":"tag-basketball","10":"tag-computer-science","11":"tag-data-mining","12":"tag-features-selection","13":"tag-humanities-and-social-sciences","14":"tag-machine-learning","15":"tag-mathematics-and-computing","16":"tag-multidisciplinary","17":"tag-nba","18":"tag-science","19":"tag-shapley-additive-explanation-shap","20":"tag-stacked-ensemble"},"share_on_mastodon":{"url":"https:\/\/channels.im\/@nba\/115036984925863991","error":""},"_links":{"self":[{"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/posts\/233884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/comments?post=233884"}],"version-history":[{"count":0,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/posts\/233884\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/media\/233885"}],"wp:attachment":[{"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/media?parent=233884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/categories?post=233884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rawchili.com\/nba\/wp-json\/wp\/v2\/tags?post=233884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}