Abstract
Background/Objectives: Machine learning studies of student mental health require careful consideration of outcome validity, class imbalance, and model-selection bias. This study aimed to develop and evaluate a stacking ensemble for classifying a binary self-reported depression-status label using a validation framework intended to reduce optimistic performance estimates. Methods: Random Forest (RF), Stochastic Gradient Descent, Support Vector Machine, Gradient Boosting (GB), and K-Nearest Neighbors were used as first-level learners, with XGBoost as the meta-learner. SMOTE-NC was applied within training folds. Particle Swarm Optimization (PSO), Grey Wolf Optimization (GWO), sequential PSO–GWO, and Random Search were compared with baseline stacking using nested five-by-three-fold stratified cross-validation. The mean outer-fold Matthews correlation coefficient (MCC) was used for model selection, followed by evaluation on an internal hold-out test set. Results: GWO achieved the highest mean outer-fold MCC (0.909), although differences from PSO and PSO–GWO were small. On the hold-out set, GWO-stacking achieved 97.16% accuracy, a 94.26% F1-score, and an MCC of 0.9238. However, 175 of 670 internal hold-out observations (26.1%) shared identical predictor patterns with the development set. In an additional group-aware nested cross-validation analysis, GWO-stacking achieved an MCC of 0.8992 ± 0.0202, compared with 0.8826 for fixed RF and 0.8785 for tuned RF. McNemar’s and DeLong’s tests showed no statistically significant differences in classification errors or ROC-AUC relative to the main comparators. The selected model also showed lower Brier score and log loss. Permutation importance identified health condition as the strongest predictor, while SHapley Additive exPlanations analysis indicated greater reliance on GB and RF outputs. Although Health condition was described as self-reported physical health status, its original questionnaire wording, category meanings, and measurement timing could not be verified. Conclusions: The findings suggest that careful validation, calibration, and assessment of predictor dependence may be as important as optimizer selection. The gains associated with optimization were modest and should be interpreted as incremental rather than broad performance improvements.
1. Introduction
Depression is still one of the most serious public health issues in the world. It affects people of all ages, but in recent years, it has sharply increased among young adults and college students. The scope of the issue is highlighted by recent analyses of the global burden of disease, which show that the disease burden attributable to anxiety and depression continued to rise [1]. University students are particularly vulnerable to depressive symptoms due to a combination of financial strain, social transition, and academic pressure. This vulnerability has been extensively documented in the mental health literature, particularly in the wake of the COVID-19 pandemic.
Similar modeling efforts have looked at how depression developed among Argentinean college students during pandemic-related quarantine periods [2], and predictive machine learning models have already been used to evaluate stress, anxiety, and depression among Lebanese university students during the COVID-19 period [3]. These studies motivate further investigation of computational approaches to student mental health. However, the interpretation and potential application of such models depend on how the outcome is defined and measured. Classification of a general self-reported status does not establish the ability to predict future depression or identify a clinical disorder.
Depression assessment may involve validated self-report screening instruments and clinical interviews, which serve different purposes and should not be considered interchangeable. Machine learning provides a complementary analytical approach for investigating associations between academic, demographic, and psychosocial characteristics and self-reported mental health outcomes among university students. However, models developed using self-reported outcomes without established clinical validity should not be interpreted as validated screening or diagnostic tools. Unlike established screening instruments such as the Patient Health Questionnaire-9 (PHQ-9), which use standardized symptom questions and scoring procedures, the binary outcome in the present dataset has no documented correspondence with validated screening scores or clinical diagnostic criteria [4]. Accordingly, the proposed framework should be regarded as an exploratory classification approach rather than an alternative to established depression-screening instruments. A growing body of research using algorithms such as Random Forest (RF), Support Vector Machine (SVM), Gradient Boosting (GB), and K-Nearest Neighbors (KNN) on student mental health datasets has been spurred by this potential and has generally reported encouraging discriminative performance. However, since each learning algorithm captures a distinct feature of the underlying data structure and none consistently dominates across all evaluation criteria, single-model approaches frequently reveal a persistent trade-off between sensitivity and precision.
Ensemble learning offers a potential approach to addressing these limitations. It has been demonstrated that stacking architectures enhance both predictive accuracy and generalization in mental health prediction tasks by combining the complementary strengths of several base learners through a meta-learner rather than depending on a single classifier. In order to directly address dataset imbalance within the ensemble pipeline, stacking ensemble techniques in conjunction with oversampling methods have already been used to predict depression among university students [5]. Transferability studies of ensemble and stacking frameworks across healthcare contexts, including research showing that machine-learning algorithms for predicting mental health crises can maintain performance across transatlantic clinical settings, have confirmed their reliability beyond depression specifically [6].
Class imbalance is a persistent challenge in this field of study since in real-world and survey-based datasets, depressed cases are generally underrepresented compared to non-depressive cases. This biases classifiers toward the majority class and masks poor minority-class recall while inflating apparent accuracy. One of the most popular methods for resolving this imbalance in health-related classification tasks is the Synthetic Minority Over-sampling Technique (SMOTE), and recent theoretical research has further elucidated the statistical characteristics underlying its synthetic sample generation [7]. To lessen noise introduced during oversampling, refinements like filtering-based SMOTE variants have also been proposed [8], reflecting an ongoing and dynamic field of study.
Hyperparameter optimization presents an additional challenge in stacking frameworks. Although grid or Random Search (RS) strategies are computationally costly and prone to converging on local optima, meta-learner performance is highly sensitive to parameter configuration. By striking a balance between exploration and exploitation during the search process, metaheuristic algorithms and hybrid variants in particular have demonstrated promise in overcoming these constraints. For example, a hybrid PSO–GWO approach outperforms individually tuned models when used to optimize hyperparameters within a stacking ensemble for diabetes detection [9]. The application of hybrid metaheuristic optimization to stacking-based depression prediction is still relatively unexplored, despite such successes in related clinical domains. This raises questions about how much additional benefit these strategies can provide once base-learner and initial-stacking performance already appear strong.
In the present dataset, the outcome is a binary variable labeled “Depressed with life.” The available repository documentation does not establish that this label was obtained using a validated depression-screening instrument or a clinical diagnostic assessment. Its correspondence with validated screening scores or diagnostic criteria is therefore unknown. The present study evaluates classification of this recorded self-reported status; it does not validate a depression-screening tool or establish clinical diagnostic performance.
This study evaluates a two-level stacking framework for classifying self-reported depression status among university students. RF, stochastic gradient descent logistic classification, SVM, GB, and KNN serve as first-level learners, with Extreme Gradient Boosting (XGBoost) as the meta-learner. Hyperparameters of both the first-level learners and the meta-learner are optimized using PSO, GWO, sequential PSO–GWO, and Random Search. These strategies are compared with baseline stacking using nested stratified cross-validation, with mean outer-fold MCC as the selection criterion. The selected strategy is subsequently evaluated on a held-out internal test set from the same dataset.
The main contributions of this study are as follows. First, five heterogeneous first-level learners are combined using an XGBoost meta-learner, and all six algorithms are also evaluated as individual benchmarks. Second, baseline stacking is compared with stacking configurations tuned using PSO, GWO, sequential PSO–GWO, and Random Search under a common nominal search budget. Third, preprocessing and SMOTE-NC are fitted within the relevant training folds, and hyperparameter tuning is separated from performance evaluation through nested cross-validation. Finally, discrimination, classification performance, calibration, uncertainty, and predictor dependence are examined to assess the extent and limitations of the gains associated with optimization. Accordingly, the primary contribution of this study lies in the systematic evaluation of the predictive benefits, computational costs, and methodological limitations of established optimization strategies, rather than in the development of a novel optimization algorithm.
2. Materials and Methods
2.1. Dataset and Study Design
The dataset was obtained from the Student Depression Detection Dataset, Version 1, published in Mendeley Data by Haque and Alom [10]. The repository describes 3350 observations and 12 variables concerning urban university students. The outcome, “Depressed with life,” is described as a binary indicator of whether the respondent reports experiencing depression in life. However, the repository description does not provide the original questionnaire wording, response options, assessment timeframe, or the procedure used to generate the binary label. It also does not document the use of a validated depression instrument or clinical diagnostic assessment. Accordingly, the outcome was interpreted as the recorded self-reported status rather than a clinically established diagnosis. The available documentation therefore does not allow us to determine whether this indicator reflects perceived distress, depressive symptoms, or a self-reported previous diagnosis.
The repository description does not specify participant recruitment procedures, eligibility criteria, the data collection period, or the timing of predictor measurement relative to outcome assessment. Temporal precedence of the predictors therefore cannot be established. This analysis evaluates classification of the recorded self-reported status; it does not establish prospective prediction of future depression or validity for clinical screening.
After removal of the target variable, 11 predictors remained: four numerical variables (Age, Current Semester, CGPA, and Per Month Cost) and seven categorical variables (Gender, Family Background, Relationship Status, Marital Status, Living Style, Good Friend Circle, and Health condition). The class distribution comprised 2524 negative and 826 positive observations, corresponding to a positive-class prevalence of 24.66%. One missing value was present in Health condition. The repository describes Health condition as self-reported physical health status. Four numerical category codes (0–3) were observed, but their original verbal labels, the item wording, assessment procedure, and timing relative to outcome assessment are not documented. It therefore cannot be established whether the item excluded previous mental health diagnoses or other information related to the outcome. The observed codes and frequencies are reported in Supplementary Table S2. These unresolved documentation gaps limit the interpretation of the construct represented by the recorded binary outcome and do not allow potential conceptual or operational overlap with Health condition to be ruled out.
The data were divided once into an 80% development set (n = 2680; 2019 negative and 661 positive observations) and a 20% internal hold-out test set (n = 670; 505 negative and 165 positive observations) using stratified sampling with random_state = 42. Both the development and hold-out partitions originated from the same source dataset; therefore, the hold-out evaluation represents internal testing rather than external validation. The hold-out set was not used for preprocessing estimation, hyperparameter tuning, optimizer comparison, or model selection. All development decisions were made within the 80% partition, and the hold-out set was accessed only after the model-selection procedure had been completed. This separation was used to limit optimistic bias from repeated use of the same test observations and is consistent with the general reporting principles emphasized in TRIPOD + AI [11]. The overall analytical workflow, including data partitioning, nested cross-validation, stacking-based model development, hyperparameter optimization, and internal hold-out evaluation, is summarized in Figure 1.
Figure 1.
Overview of the proposed model development, optimization, and evaluation workflow.
An additional post hoc data-integrity audit was performed to examine duplicate observations and potential overlap between the development and internal hold-out partitions. Exact duplicate records were identified using all recorded variables, while repeated predictor patterns were identified using the 11 input variables without the target label. Hold-out observations whose complete predictor patterns matched at least one observation in the development set were identified. Using the previously saved model predictions, performance was evaluated separately for hold-out observations with and without exact predictor-pattern overlap. This retrospective analysis did not modify the original data partition, model training, or model selection procedures.
As an additional exploratory robustness analysis, five-fold stratified cross-validation was compared with five-fold stratified group cross-validation within the development partition (n = 2680). Observations with identical values across all 11 predictors were assigned to the same group, ensuring that no identical predictor pattern appeared in both training and validation folds under the group-aware procedure. The RF benchmark was fitted using its fixed baseline hyperparameters. The GWO-stacking architecture was also refitted using the previously selected hyperparameters, without repeating the optimization procedure. Consequently, this analysis was intended to assess sensitivity to predictor-pattern overlap rather than to provide an unbiased nested cross-validation estimate of the fully optimized model. To further address predictor-pattern overlap, an additional group-aware nested cross-validation analysis was conducted within the development partition. Identical predictor patterns were kept together during outer validation, inner hyperparameter optimization, and internal stacking cross-validation.
As a further post hoc assessment of potentially highly similar observations, a Gower-type mixed-data distance analysis was performed between the development and internal hold-out partitions. The analysis included all 11 predictors, comprising four numerical and seven categorical variables, without using the outcome label. To reduce the influence of extreme numerical values, numerical variables were clipped using 1.5 × IQR limits derived exclusively from the development partition and normalized by their corresponding clipped development-set ranges. Categorical variables were compared using binary mismatch indicators, and all predictors received equal weight. For each hold-out observation, the minimum distance to any development observation was calculated. Several exploratory distance thresholds were examined to assess the sensitivity of the overlap estimates. The original data partition, model fitting, and saved predictions were not modified.
2.2. Data Preprocessing
Preprocessing was fitted separately within the relevant training portion of each resampling procedure. Numerical and categorical predictors were handled through separate branches of the pipeline, and all data-dependent preprocessing parameters were estimated without access to the corresponding validation or hold-out observations [12].
For numerical predictors, missing values were replaced by the median estimated from the training data. Potentially extreme values were then bounded using the conventional interquartile-range rule, with lower and upper limits defined as Q1 − 1.5 × IQR and Q3 + 1.5 × IQR, respectively [13,14]. Values outside these limits were clipped to the corresponding boundary rather than deleted. The numerical variables were subsequently transformed using the Yeo–Johnson power transformation and standardized to zero mean and unit variance [15,16].
Categorical missing values were imputed using the most frequent category. Because the dataset included both continuous and nominal predictors, class imbalance was handled with the SMOTE-NC. Before resampling, categorical predictors were temporarily represented using ordinal codes so that SMOTE-NC could distinguish categorical from continuous dimensions. After resampling, the categorical variables were converted to one-hot encoded indicators before classifier fitting. The procedure was implemented with imbalanced-learn [17,18,19,20].
SMOTE-NC was implemented with the seven categorical predictors specified by their positions (indices 4–10) in the pre-resampling feature matrix. The default settings of imbalanced-learn were retained for the sampling strategy (‘auto’) and the number of nearest neighbors (“k_neighbors = 5”). The random state was set using the seed assigned to the corresponding model and cross-validation fold. Missing categorical values were imputed using the most frequent category in the training data. Categorical predictors were temporarily ordinal-encoded before SMOTE-NC and subsequently one-hot encoded for classifier training. All transformations and resampling operations were fitted within the corresponding training folds. The observed category codes and their frequencies in the original dataset are provided in Supplementary Table S2. As the original response labels were not established from the available data file, the categories were treated as nominal values without assigning additional interpretations.
SMOTE-NC was applied only within training data. It was not applied to inner-validation folds, outer-validation folds, or the internal hold-out test set. The same rule was retained inside each base-learner pipeline used by the stacking classifier. Consequently, imputation, numerical transformation, categorical encoding, and synthetic resampling were all fitted within the appropriate training fold rather than before cross-validation. The remaining preprocessing and modeling steps were implemented with scikit-learn [21,22,23].
2.3. Machine Learning Models and Stacking Architecture
Five supervised learning algorithms with different inductive structures were used as first-level learners: RF, stochastic gradient descent logistic classification (SGD), support vector machine with a radial-basis-function kernel (SVM), GB, and KNN. RF provides randomized tree-based ensemble learning [24,25]; SVM permits nonlinear decision boundaries through kernel functions [26,27]; GB builds an additive model in a stagewise manner [28]; KNN is a non-parametric neighborhood-based classifier [29]; and the SGD classifier optimized a logistic-loss objective using stochastic gradient updates [30].
XGBoost was evaluated separately as an individual benchmark and was also used as the second-level meta-learner in the stacking architecture [31]. It was not included among the first-level learners. This design allowed the meta-model to learn from the probabilistic outputs of heterogeneous base classifiers rather than from a duplicate XGBoost prediction at both levels.
The ensemble followed the stacked-generalization framework described by Wolpert [32]. For observation i, let pk(xi) denote the estimated probability of the positive class generated by base learner hk. With five first-level learners, H = {RF, SGD, SVM, GB, KNN}, the meta-level feature vector was defined as given in Equation (1),
The XGBoost meta-learner, g(.), was fitted to these first-level probabilities, yielding the final probability estimate . The original predictors were not passed directly to the meta-learner (passthrough = False). Thus, the second level operated only on the five base-model probability outputs.
To avoid fitting the meta-learner on in-sample predictions from the base learners, first-level meta-features were generated by stratified internal cross-validation. In the full analysis, three internal folds were used. Each base learner retained its complete preprocessing and SMOTE-NC pipeline inside this internal procedure. The XGBoost meta-learner was then trained on the resulting out-of-fold first-level predictions.
For the RBF-based SVM, probability estimation was enabled by setting ‘probability = True’ in scikit-learn’s SVC implementation. The class probabilities were generated using the internal probability calibration procedure based on Platt scaling. The positive-class probabilities obtained through ‘predict_proba’ were used as inputs to the XGBoost meta-learner. During meta-learner training, these probabilities were generated as out-of-fold predictions using the stratified cross-validation procedure implemented in scikit-learn’s StackingClassifier (‘stack_method = “predict_proba”’), thereby preventing the use of in-sample predictions as meta-features.
2.4. Hyperparameter Optimization and Search Strategies
Hyperparameter optimization was performed only within the inner cross-validation loop of the development data. Let θ denote a candidate vector of hyperparameters for the five base learners and the XGBoost meta-learner. Candidate solutions were evaluated according to the mean MCC across the three inner validation folds as defined in Equation (2):
MCC was used as the primary optimization criterion because it incorporates all four entries of the binary confusion matrix and is informative when class frequencies are unequal [33]. The internal hold-out test set played no role in hyperparameter optimization or optimizer selection.
The search space contained 17 hyperparameters spanning RF, SGD, SVM, GB, KNN, and the XGBoost meta-learner. Log-scale parameterization was used for the SGD regularization coefficient and for SVM C and gamma; the remaining parameters were represented by bounded integer, continuous, or binary search variables. The ranges are summarized in Table 1. The fixed baseline values and the final hyperparameter configuration selected by GWO are provided in Supplementary Table S1.
Table 1.
Hyperparameter search space used for the stacking optimization.
Integer-valued hyperparameters were rounded to the nearest integer after being restricted to their predefined search bounds. Parameters searched on a logarithmic scale were converted to their original scale before model fitting. The categorical KNN weighting parameter was represented as a continuous search variable and mapped to either uniform or distance weighting using a threshold of 0.5.
Four search strategies were compared: PSO, GWO, sequential PSO–GWO, and RS. PSO updated each candidate according to its current velocity, its personal best position, and the global best position identified by the swarm [34]. The implementation used an inertia weight w = 0.70 and cognitive and social coefficients c1 = c2 = 1.50. The initial PSO velocities were generated from independent zero-mean Gaussian samples with a standard deviation of 0.10 and scaled by the corresponding hyperparameter search-range widths. Equations (3) and (4) define the candidate positions that were clipped to the predefined search bounds after each update.
GWO followed the alpha–beta–delta population hierarchy described by Mirjalili et al. [35]. At each iteration, the three highest-scoring solutions in the current population were selected as leaders. For each candidate, three leader-guided positions were calculated using independently sampled random coefficient vectors and the corresponding distance terms. The candidate’s updated position was obtained by averaging these three positions and clipping the result to the predefined search bounds, as detailed in Equation (5). Equation (5) represents the GWO position-update mechanism implemented in this study, including leader-specific distance calculations, stochastic coefficient vectors, candidate position updates, and boundary clipping, rather than a simplified average of the alpha, beta, and delta positions. All population positions were updated simultaneously. The exploration coefficient was calculated as a(t) = 2 − 2(t − 1)/T, where t = 1, …, T and T denotes the number of update iterations. For the eight-iteration standalone GWO search, this coefficient decreased from 2.00 to 0.25. The best solution encountered during initialization and all subsequent iterations was retained as the final solution.
Here, Xi(t) denotes the position of candidate i before update t, and Xk(t) denotes the corresponding leader position. The random vectors r1,i,k(t) and r2,i,k(t) are independently generated for each candidate–leader pair at each iteration, with components sampled uniformly from [0, 1]. The symbol ⊙ denotes element-wise multiplication, and absolute values are taken element-wise. The vectors L and U specify the lower and upper search bounds, respectively. For the sequential strategy, PSO was run first and the terminal PSO population was then used to initialize GWO. The best PSO solution was explicitly retained in the initial GWO population. The exploration coefficient was restarted at the beginning of the four-iteration GWO stage and followed Equation (5), decreasing from 2.00 to 0.50. The sequential procedure was evaluated as an empirical search strategy and was not assumed in advance to outperform either PSO or GWO used alone. RS was included as a conventional reference method [36].
To make the optimizer comparison less dependent on unequal computational effort, the stochastic search methods were assigned the same nominal budget of 72 objective evaluations per inner optimization procedure. Standalone PSO and GWO each used eight candidate solutions and eight iterations, corresponding to eight initial evaluations followed by 64 iterative evaluations. The sequential PSO-to-GWO strategy used eight candidate solutions with four PSO iterations followed by four GWO iterations; because the terminal PSO population was reused at the beginning of GWO, the nominal total remained 72 evaluations. RS was restricted to 72 sampled configurations. Memoization prevented previously evaluated hyperparameter configurations from being fitted again if they reappeared during the search. According to the saved optimization records, PSO, GWO, sequential PSO–GWO, and RS each evaluated 72 unique hyperparameter configurations per outer fold. The final GWO on the complete development set also evaluated 72 unique configurations. The searches terminated after the predefined iteration counts or sampled-configuration budget; no convergence-based early-stopping criterion was used.
2.5. Nested Cross-Validation and Model Selection
Model development used a nested cross-validation design within the 80% development partition. The outer loop consisted of five stratified folds and was used to estimate comparative performance, whereas the inner loop consisted of three stratified folds and was used for hyperparameter optimization. The folds were shuffled, and fixed random seeds were used to make the split construction reproducible.
For each outer fold, all tuning was performed using only the outer-training subset. Candidate hyperparameter configurations were compared by mean inner-fold MCC, after which the selected configuration for each strategy was refitted on the complete outer-training subset and evaluated on the previously unseen outer-validation subset. Performance across the five outer folds was summarized as mean ± standard deviation. This separation between tuning and outer-fold evaluation was used to limit the optimistic bias that can occur when the same resampling results are used both for tuning and for reporting performance [37,38].
The final stacking strategy was selected according to the highest mean MCC across the five outer validation folds. The choice was made among the baseline and optimized stacking strategies before the hold-out data were examined. The six individual classifiers were evaluated within the same outer folds using fixed baseline hyperparameters, without separate inner-loop tuning. They served as descriptive benchmarks and did not determine the selected stacking optimization strategy. Their outer-fold performance is reported in Supplementary Table S7. Additional tuning was performed only for RF in the post hoc comparison described below. Among the individual models, the model with the highest mean outer-fold MCC was retained as the principal individual comparator for the paired hold-out analyses.
Although hyperparameter tuning was conducted within the inner cross-validation loops, the same outer-fold MCC estimates were used both to compare the optimization strategies and to select the final strategy. Therefore, the reported outer-fold performance of the selected GWO-stacking model may be subject to selection-induced optimism and should not be interpreted as an independent estimate of its comparative generalization performance. The internal hold-out test set was used to evaluate the selected strategy after model selection, but the alternative optimization strategies were not evaluated on that set. Accordingly, the outer-fold comparison in Table 2 should be regarded as part of the optimizer-selection process, rather than as an unbiased comparative assessment of the generalization performance of the optimization strategies.
Table 2.
Outer cross-validation performance of the stacking strategies (mean ± standard deviation across five outer folds).
To address the overlap of identical predictor patterns, an additional group-aware nested cross-validation analysis was conducted within the development partition (n = 2680). Groups were defined by exact matches across all 11 predictor variables, excluding the outcome. Group separation was maintained throughout five-fold outer validation, three-fold inner hyperparameter optimization, and three-fold internal stacking cross-validation. The outer group-stratified folds were constructed within the development partition, whereas inner optimization folds were generated separately within each outer-training subset. Internal stacking folds were constructed within the corresponding inner-training or outer-training subset, ensuring that identical predictor patterns were not shared between training and validation folds at any level.
All three cross-validation levels used StratifiedGroupKFold with shuffle = True and a base random seed of 42. The outer validation used five folds with random_state = 42. Within each outer-training partition, three-fold inner hyperparameter optimization used random_state = 42 + 100k, where k denotes the one-based outer-fold index. For each inner-training subset, three group-stratified stacking folds were generated separately using random_state = 42 + 100k + 10j, where j denotes the one-based inner-fold index. After hyperparameter selection, the stacking model was fitted within the corresponding outer-training partition using three group-stratified folds with random_state = 42 + 100k + 9999. Group identifiers were supplied to the splitter at each level, ensuring that identical predictor patterns remained within the same fold.
After strategy selection, the chosen stacking strategy was optimized once more on the complete development set using the same three-fold inner cross-validation objective. A final stacking model was then fitted to the full development data and evaluated once on the internal hold-out test set. Baseline stacking and the individual benchmark models were likewise fitted on the complete development partition and evaluated on the same hold-out observations for comparison. None of these hold-out results was used retrospectively to change the selected stacking strategy.
Additional post hoc comparisons were performed using the five outer folds of the original stratified nested cross-validation procedure. RF hyperparameters were tuned within each outer-training partition using 72 randomized-search trials and three-fold stratified inner cross-validation, with MCC as the selection criterion. A simpler stacking comparator replaced the XGBoost meta-learner with logistic regression while retaining the original fold-specific GWO-selected base-learner hyperparameters. Its regularization parameter C was selected from {0.01, 0.1, 1, 10, 100} using three-fold stratified inner cross-validation and MCC. These comparisons used different tuning scopes and were not treated as an equal-budget comparison of independently optimized architectures. The original hold-out set was not used in these additional comparisons. The main stratified nested cross-validation, metaheuristic hyperparameter optimization, and stacking classification procedures are presented in Supplementary Algorithm S1. The additional group-aware nested cross-validation procedure, including group-separated inner optimization and internal stacking folds, is detailed in Supplementary Algorithm S2.
2.6. Performance Evaluation Metrics
Performance was summarized using complementary threshold-dependent and threshold-independent measures: accuracy, precision, sensitivity, specificity, F1-score, balanced accuracy, MCC, Cohen’s kappa, ROC-AUC, and PR-AUC. Reporting several measures was considered important because the positive class represented approximately one quarter of the sample. Equations (6)–(11) define the evaluation metrics utilized for the performance evaluation.
Accuracy = (TP + TN) / (TP + TN + FP + FN)
Sensitivity = TP / (TP + FN)
Specificity = TN / (TN + FP)
Precision = TP / (TP + FP)
F1 = 2 × (Precision × Sensitivity) / (Precision + Sensitivity)
Balanced accuracy = (Sensitivity + Specificity) / 2
Balanced accuracy gives equal weight to the two outcome classes [39]. MCC was the prespecified primary metric for hyperparameter optimization and strategy selection and was calculated as in Equation (12),
MCC ranges from −1 to 1 and incorporates all four confusion-matrix cells [33]. Cohen’s kappa was included as a complementary chance-adjusted agreement measure [40,41]. ROC-AUC summarized ranking discrimination across thresholds, while PR-AUC summarized the precision–recall relationship and was included because it is informative when the positive class is less frequent [42]. PR-AUC was calculated as average precision using the average_precision_score function in scikit-learn, which summarizes the precision–recall curve through a recall-weighted average of precision values. Threshold-dependent predictions were obtained from each classifier’s default decision rule; no classification threshold was tuned on the hold-out set.
2.7. Statistical Analysis and Uncertainty Estimation
Post-analysis was performed using the saved predictions from the internal hold-out test set. To quantify sampling uncertainty, stratified non-parametric bootstrap resampling was applied separately to each model. Two thousand bootstrap samples were generated with replacement while preserving the numbers of positive and negative observations in the hold-out set. Accuracy, precision, sensitivity, specificity, F1-score, balanced accuracy, MCC, Cohen’s kappa, ROC-AUC, and PR-AUC were recalculated in each bootstrap sample. Percentile-based 95% confidence intervals were defined by the 2.5th and 97.5th percentiles of the corresponding bootstrap distribution [43,44,45].
Paired bootstrap differences were calculated for the selected stacking model against baseline stacking and against the individual comparator selected by outer-cross-validation MCC. The same resampled observation indices were used for both models in each replicate, and the distribution of model A minus model B was used to obtain the 95% confidence interval for each metric difference.
Paired classification errors were compared with the exact two-sided McNemar test [46]. Differences in ROC-AUC were assessed with the paired non-parametric DeLong procedure for correlated ROC curves [47]. Four formal p-values were generated from the two comparator pairs and the two paired tests; Holm’s sequential procedure was additionally used to obtain multiplicity-adjusted p-values [48]. A two-sided alpha level of 0.05 was used for formal testing. Statistical tests were performed only after model selection and were used to characterize differences among already specified models rather than to select a model retrospectively. Interpretation therefore emphasized effect sizes and confidence intervals alongside p-values.
2.8. Calibration and Model Interpretability
Probability calibration was evaluated on the internal hold-out test set for the selected stacking model, baseline stacking, and the principal individual comparator. Predicted probabilities were bounded away from 0 and 1 for numerical stability. Probabilistic error was summarized with the Brier score and log loss. Calibration curves were constructed using 10 quantile-based probability groups, with mean predicted probability plotted against the observed fraction of positive outcomes [49,50].
Calibration intercept and slope were jointly estimated by fitting a logistic recalibration model of the observed binary outcome on the logit of the predicted probability. Calibration-in-the-large was estimated separately using a logistic model with the logit of the predicted probability included as an offset, fixing its coefficient at 1 and estimating only the intercept. The reference values are 0 for both intercept measures and 1 for the calibration slope. Negative calibration-in-the-large values indicate overall overprediction. These analyses were descriptive; the fitted recalibration models were not used to modify the reported predictions. Uncertainty in the calibration intercept, calibration slope, and calibration-in-the-large was assessed using 2000 stratified non-parametric bootstrap resamples of the hold-out observations. The numbers of positive and negative cases were preserved in each resample. The calibration models were refitted for each bootstrap sample, and percentile-based 95% confidence intervals were calculated. The underlying prediction models were not retrained.
Interpretability was examined at two levels. First, grouped permutation importance was calculated directly on the final end-to-end stacking pipeline using the original, unencoded predictors. Each original variable was permuted as a whole before preprocessing and prediction, avoiding interpretation of separate one-hot dummy columns. Thirty independent permutations were performed for each predictor. Importance was summarized primarily as the reduction in MCC relative to the unpermuted hold-out predictions, with the reduction in ROC-AUC reported as a complementary measure. Mean and standard deviation across the 30 repetitions were retained [51].
SHAP values were calculated at the stacking meta-learner level [52]. The final fitted stacking model was transformed to obtain the five first-level probability outputs for each hold-out observation. Tree Explainer was then applied to the fitted XGBoost meta-learner using these five meta-features. Mean absolute SHAP values were used to summarize global reliance on each base-learner output, and a SHAP bee swarm plot was used to display the direction and distribution of individual contributions. These analyses were interpreted as descriptions of model reliance and not as evidence of causal effects.
2.9. Sensitivity and Subgroup Analyses
Additional descriptive analyses examined the association between Health condition and the recorded outcome within the development partition. A cross-tabulation reported the number of negative and positive observations within each observed category, with missing values reported separately. A logistic regression classifier using Health condition as its sole predictor was evaluated using five-fold stratified cross-validation on the development partition. Missing values were imputed using the most frequent training category, and Health condition was one-hot encoded. Logistic regression used C = 1, the lbfgs solver, and a maximum of 2000 iterations. No resampling was applied, and preprocessing was fitted within each training fold. These analyses were intended to characterize the information carried by this predictor rather than establish its clinical validity or demonstrate outcome leakage.
Because the permutation analysis indicated pronounced model dependence on Health condition, a secondary sensitivity analysis examined the effect of removing this predictor. To avoid repeating the computationally intensive stacking optimization, the analysis was conducted with the RF benchmark using the same fixed baseline RF hyperparameters in both conditions. No additional hyperparameter retuning was performed. The full-feature model and the model excluding Health condition used the same preprocessing sequence and SMOTE-NC procedure as the main analysis.
An additional post hoc ablation analysis was performed using the selected GWO-stacking framework. Within each of the original five outer folds, the model was refitted after excluding Health condition, while retaining the hyperparameters previously selected for that fold using all predictors. Preprocessing and SMOTE-NC were fitted within the corresponding training data. No hyperparameter retuning was performed. This analysis assesses sensitivity to predictor removal under the existing configuration rather than the performance achievable by a separately optimized model without this predictor.
Additional post hoc analyses compared imbalance-handling strategies using the same five outer folds of the development partition. RF was evaluated with SMOTE-NC, without resampling, and without resampling but with class_weight = “balanced”, while retaining fixed baseline hyperparameters. GWO-stacking was also refitted without resampling using the original fold-specific GWO-selected hyperparameters and compared with its saved SMOTE-NC results. All preprocessing was fitted within the corresponding training data. No hyperparameter retuning or additional hold-out evaluation was performed.
The two RF feature sets were compared in five-fold stratified cross-validation within the development data and were also fitted on the complete development set and evaluated on the internal hold-out test set. Accuracy, precision, sensitivity, specificity, F1-score, balanced accuracy, MCC, ROC-AUC, and PR-AUC were recorded. This analysis was intended to assess sensitivity to the information carried by Health condition rather than to estimate the exact causal or incremental contribution of that variable to the final optimized stacking model.
An exploratory subgroup analysis was also performed for Gender using the selected stacking model’s hold-out predictions. Subgroups containing fewer than 30 observations were excluded from subgroup summaries. Within each retained coded level, positive-class prevalence, accuracy, precision, sensitivity, specificity, F1-score, MCC, and ROC-AUC were calculated. The original coded group levels were retained without assigning semantic labels that were not explicitly available in the analysis output. No formal between-group hypothesis test was performed; subgroup results were treated as descriptive.
2.10. Computational Environment and Reproducibility
The main model-development workflow was implemented in Python (version 3.9.18) in a single analysis script, and the uncertainty, calibration, interpretability, sensitivity, and subgroup procedures were implemented in a separate post-analysis script. Core preprocessing, cross-validation, model construction, and evaluation used scikit-learn; mixed-type oversampling used imbalanced-learn; XGBoost provided the meta-learner; and the post-analysis additionally used SciPy, matplotlib, SHAP, and joblib.
A fixed random state of 42 was used for the development/hold-out split and outer cross-validation. For outer fold k (k = 1, …, 5), the optimizer random seed was defined as 42 + 100k, resulting in seeds of 142, 242, 342, 442, and 542. The corresponding final model within each outer fold was fitted using seed 42 + k. During inner cross-validation, model seeds were derived by adding the inner-fold index to the optimizer seed. The final optimization performed on the complete development set used seed 1041. NumPy’s default_rng was used to initialize the stochastic optimizers. These deterministic seed assignments were intended to support reproducibility of the reported experiments rather than to establish stability across independent random initializations. Each optimization strategy was run once within each outer fold using a fixed, derived random seed. No repeated optimization runs with different seeds were performed within the same fold. Consequently, the reported outer-fold standard deviations reflect variation across data partitions and their associated seeded searches; they do not separately quantify variability attributable to optimizer initialization. The full model-development configuration used five outer folds, three inner folds, three internal stacking folds, eight candidate solutions for the population-based optimizers, and the 72-evaluation nominal search budget described in Section 2.4. Optimizer trajectories, outer-fold results, out-of-fold predictions, hold-out predictions, selected hyperparameters, and final performance summaries were written to disk during execution. The main model-development workflow required approximately 16.50 h (59,390.8 s) and was executed on a workstation equipped with two Intel Xeon E5-2620 v4 processors (Intel Corporation, Santa Clara, CA, USA) operating at 2.10 GHz and 64 GB of RAM, running Windows 10 (build 19045, Microsoft Corporation, Redmond, WA, USA). The reported runtime covers the main model-development workflow and excludes the separate post-analysis and reviewer-requested supplementary analyses.
The exact software versions recorded from the computational environment used for the final model-development and post-analysis workflows were NumPy 1.26.0, pandas 2.1.4, scikit-learn 1.4.2, imbalanced-learn 0.12.4, XGBoost 1.7.6, SciPy 1.11.4, matplotlib 3.8.3, SHAP 0.49.1, and joblib 1.2.0. Reporting the installed versions rather than only broad dependency ranges was used to provide a more precise record of the analysis environment.
To improve methodological transparency, detailed model configurations, fold-specific hyperparameters, and supporting analytical results are provided in Supplementary Tables S1–S13. In addition, Supplementary Algorithm S1 provides a structured algorithmic description of the main stratified nested cross-validation, preprocessing, SMOTE-NC, metaheuristic hyperparameter optimization, stacking architecture, and final model evaluation procedures. The additional group-aware nested cross-validation procedure, including group-separated outer validation, inner hyperparameter optimization, and internal stacking cross-validation, is described separately in Supplementary Algorithm S2. These materials are intended to facilitate independent methodological assessment. The availability of the custom source code and intermediate computational outputs is clarified in the Data Availability Statement.
3. Results
The results are reported according to the evaluation framework described in Section 2. Model development was performed within the 80% development partition using five-fold outer and three-fold inner stratified cross-validation. Preprocessing and SMOTE-NC were fitted within the corresponding training folds, and the stacking model combined RF, stochastic gradient descent (SGD), SVM, GB, and KNN as first-level learners, with XGBoost used as the meta-learner. Baseline stacking was compared with PSO, GWO, sequential PSO–GWO, and RS using the same nominal search budget. Mean outer-fold MCC was the prespecified criterion for model selection, whereas the 20% internal hold-out test set was used only after model selection. The results are presented first for nested cross-validation and then for internal hold-out evaluation; the subsequent subsections address statistical uncertainty, calibration, model interpretation, and sensitivity analyses.
3.1. Nested Cross-Validation and Optimization Performance
The outer cross-validation analysis provided a descriptive comparison of the baseline stacking framework and the PSO, GWO, sequential PSO–GWO, and RS-based optimization strategies. Because the final optimization strategy was selected using these same outer-fold results, the comparison should not be interpreted as an independent assessment of the relative generalization performance of the optimization strategies. The mean performance values obtained across the five outer folds are presented in Table 2.
Among the prespecified stacking optimization strategies, the GWO-optimized stacking model yielded the highest mean MCC and was therefore selected according to the prespecified model-selection criterion. Across the five outer folds, the GWO configuration achieved an MCC of 0.9091 ± 0.0282, an accuracy of 0.9664 ± 0.0105, an F1-score of 0.9311 ± 0.0214, a sensitivity of 0.9198 ± 0.0242, a specificity of 0.9817 ± 0.0085, a ROC-AUC of 0.9735 ± 0.0068, and a PR-AUC of 0.9456 ± 0.0211.
The corresponding mean MCC values for PSO and sequential PSO–GWO were 0.9076 and 0.9068, respectively, while RS and the baseline stacking configuration yielded values of 0.8977 and 0.8965. Compared with baseline stacking, the GWO configuration showed an absolute increase of 0.0127 in MCC and 0.0104 in F1-score. Sensitivity was also higher by 0.0212, whereas specificity differed only slightly (−0.0010). Thus, the observed difference was mainly reflected in sensitivity and overall classification balance rather than in a uniform improvement across all evaluation measures.
The performance differences among GWO, PSO, and sequential PSO–GWO were small. Because the outer-fold estimates were also used for strategy selection, the observed ranking may be affected by selection-induced optimism and does not establish the generalization superiority of GWO. Moreover, the internal hold-out evaluation included only the selected GWO configuration, precluding a direct hold-out comparison among optimization strategies.
Outer-fold results for all six individual benchmarks are provided in Supplementary Table S7. Among these fixed-hyperparameter models, RF achieved the highest mean MCC (0.8910 ± 0.0340), followed by XGBoost (0.8884 ± 0.0251). These results are descriptive comparisons rather than comparisons of independently tuned models. In a post hoc comparison using the same five outer folds, stacking with an inner-tuned logistic meta-learner achieved a mean MCC of 0.9111 ± 0.0245, compared with 0.9091 ± 0.0282 for the selected GWO-stacking model. RF tuned using 72 randomized-search trials achieved an MCC of 0.8921 ± 0.0288, with slightly higher ROC-AUC and PR-AUC than GWO-stacking (Supplementary Table S6). These descriptive results suggest that a simpler meta-learner can provide comparable performance. However, the comparisons used different tuning scopes and do not establish superiority of either architecture.
3.2. Internal Hold-Out Test Performance
Following model selection, the GWO-optimized stacking configuration was re-optimized using the complete development set and evaluated once on the 20% internal hold-out test set. The corresponding results are summarized in Table 3. The model correctly classified 651 of 670 observations, corresponding to an accuracy of 0.9716. The confusion matrix comprised 495 true negatives, 10 false positives, 9 false negatives, and 156 true positives. Precision was 0.9398, sensitivity 0.9455, specificity 0.9802, F1-score 0.9426, balanced accuracy 0.9628, and MCC 0.9238 ROC-AUC and PR-AUC were 0.9772 and 0.9384, respectively.
Table 3.
Performance of the selected stacking model and principal comparators on the internal hold-out test set.
On the same hold-out observations, baseline stacking produced an accuracy of 0.9642, F1-score of 0.9273, and MCC of 0.9035. The corresponding absolute differences for the selected GWO-stacking model were approximately 0.75 percentage points in accuracy, 1.53 percentage points in F1-score, and 0.0203 in MCC. Sensitivity was also higher for the selected model (0.9455 vs. 0.9273).
RF yielded an accuracy of 0.9701 and MCC of 0.9187 on the hold-out set. Its ROC-AUC (0.9804) and PR-AUC (0.9517) were slightly higher than those of the selected GWO-stacking model. Thus, no single model was highest across all reported metrics. The GWO-stacking model was retained because model selection had been prespecified on outer-cross-validation MCC rather than on the hold-out results. To quantify the uncertainty around these point estimates and the observed between-model differences, bootstrap intervals and paired statistical comparisons were examined next.
The post hoc data-integrity audit identified 545 duplicate full records beyond their first occurrences, leaving 2805 distinct predictor patterns among the 3350 observations. No conflicting target labels were observed among records sharing identical predictor patterns. Of the 670 internal hold-out observations, 175 (26.12%) had predictor patterns identical to at least one observation in the development set.
The selected GWO-stacking model correctly classified all 175 overlapping observations. When evaluation was restricted to the 495 hold-out observations without exact predictor-pattern overlap, accuracy was 0.9616, MCC was 0.8997, ROC-AUC was 0.9659, and PR-AUC was 0.9151. These values were lower than the corresponding full hold-out estimates of 0.9716, 0.9238, 0.9772, and 0.9384, respectively. This exploratory comparison indicates that the original internal test performance may have been influenced by repeated predictor patterns across the development and hold-out partitions.
In the exploratory cross-validation robustness analysis, the RF benchmark achieved a mean MCC of 0.8910 ± 0.0340 under ordinary stratified cross-validation and 0.8817 ± 0.0142 under group-aware cross-validation. The corresponding ROC-AUC values were 0.9731 ± 0.0063 and 0.9632 ± 0.0196, respectively. Using the previously selected GWO hyperparameters, stacking achieved a mean MCC of 0.9080 ± 0.0282 under ordinary stratified cross-validation and 0.8898 ± 0.0236 under group-aware cross-validation. The corresponding ROC-AUC values were 0.9700 ± 0.0105 and 0.9624 ± 0.0143. No identical predictor patterns were shared between training and validation folds in the group-aware evaluation. These comparisons were exploratory and did not involve independent hyperparameter re-optimization within the group-aware folds. The complete comparison of accuracy, MCC, ROC-AUC, and PR-AUC under ordinary and group-aware cross-validation is presented in Supplementary Table S3.
In the additional group-aware nested cross-validation analysis, the GWO-stacking framework achieved a mean MCC of 0.8992 ± 0.0202, compared with 0.9091 ± 0.0282 in the original stratified nested cross-validation. Under the group-aware nested protocol, the fixed RF benchmark achieved an MCC of 0.8826 ± 0.0049, while RF with independent hyperparameter tuning achieved 0.8785 ± 0.0180. The complete results are presented in Table 4. Fold-specific performance estimates are provided in Supplementary Table S11, while the hyperparameters selected within each outer-training fold for GWO-stacking and tuned RF are reported in Supplementary Tables S12 and S13, respectively. Although the GWO-stacking framework retained a higher mean MCC than either RF configuration, the differences were modest and did not establish a clinically meaningful advantage.
Table 4.
Group-aware nested cross-validation performance within the development partition (mean ± standard deviation across five outer folds).
The exploratory Gower-distance analysis identified 136 additional non-identical hold-out observations within a distance threshold of 0.02. Including the 175 exact matches, 311 of 670 observations (46.42%) were within this threshold. Among the remaining 359 observations, GWO-stacking achieved an accuracy of 0.9554, an MCC of 0.8871, and a ROC-AUC of 0.9589. However, the results were sensitive to the selected distance threshold and numerical scaling. These exploratory findings are summarized in Supplementary Table S4.
3.3. Statistical Uncertainty and Paired Model Comparisons
Point estimates on a single hold-out sample do not indicate the uncertainty associated with model performance. For this reason, the hold-out results were supplemented with bootstrap confidence intervals and paired comparisons. The 95% bootstrap confidence intervals obtained from 2000 resamples for the selected GWO-stacking model are summarized in Table 5.
Table 5.
Bootstrap 95% confidence intervals for the selected GWO-stacking model on the internal hold-out test set.
The estimated accuracy of the selected model was 0.9716 (95% CI: 0.9582–0.9836), while the corresponding intervals for sensitivity and specificity were 0.9455 (95% CI: 0.9091–0.9758) and 0.9802 (95% CI: 0.9663–0.9921), respectively. The F1-score was 0.9426 (95% CI: 0.9156–0.9666), and the MCC was 0.9238 (95% CI: 0.8879–0.9557). For threshold-independent measures, ROC-AUC was estimated as 0.9772 (95% CI: 0.9593–0.9917), whereas PR-AUC was 0.9384 (95% CI: 0.8864–0.9806).
Paired bootstrap comparisons were subsequently used to examine the magnitude and uncertainty of the differences between the selected model and the two principal comparators. Relative to baseline stacking, the GWO-stacking model showed differences of 0.0075 in accuracy, 0.0182 in sensitivity, 0.0153 in F1-score, and 0.0203 in MCC. The corresponding bootstrap interval for balanced accuracy was entirely above zero, whereas the intervals for several other measures reached or included zero. ROC-AUC and PR-AUC were slightly lower for the selected model than for baseline stacking, with bootstrap intervals that included zero.
The comparison with RF showed a similar trade-off. The selected stacking model had higher sensitivity by 0.0303 (95% CI: 0.0061–0.0606), whereas precision and specificity were lower by 0.0220 and 0.0079, respectively. Differences in accuracy, F1-score, MCC, ROC-AUC, and PR-AUC included zero in their bootstrap intervals. These results indicate that the models differed more in the balance between positive- and negative-class classification than in overall discrimination.
Formal paired tests were consistent with this pattern (Table 6). McNemar’s test did not indicate a difference in paired classification errors between GWO-stacking and baseline stacking (p = 0.180) or between GWO-stacking and RF (p = 1.000). Similarly, the DeLong comparisons did not indicate a detectable difference in ROC-AUC between GWO-stacking and baseline stacking (p = 0.663) or RF (p = 0.578). After applying the Holm correction across the four paired statistical tests, the adjusted p-value was 0.7188 for the McNemar comparison with baseline stacking and 1.0000 for the remaining three tests. Thus, none of the comparisons reached statistical significance after adjustment for multiple testing.
Table 6.
Paired comparisons of the selected GWO-stacking model with the principal comparators.
The ROC curves for the three models are shown in Figure 2, while the corresponding precision–recall curves are presented in Figure 3. The curves were closely positioned over most of their ranges, which is consistent with the relatively small differences in ROC-AUC observed in the paired analysis. The selected GWO-stacking model had a ROC-AUC of 0.9772, compared with 0.9794 for baseline stacking and 0.9804 for RF. For PR-AUC, the corresponding values were 0.9384, 0.9547, and 0.9517.
Figure 2.
ROC curves of the selected GWO-stacking model, baseline stacking, and RF on the internal hold-out test set. The red dashed diagonal line represents the no-discrimination reference (AUC = 0.5).
Figure 3.
Precision–recall curves of the selected GWO-stacking model, baseline stacking, and RF on the internal hold-out test set.
These comparisons provide a measure of uncertainty around the final performance estimates. Since discrimination alone does not describe the reliability of the predicted probabilities, probability calibration was examined next.
3.4. Calibration Analysis
Calibration was assessed for the selected GWO-stacking model, baseline stacking, and RF using Brier score, log loss, calibration intercept, and calibration slope. The resulting values are presented in Table 7, and the corresponding calibration curves are shown in Figure 4.
Table 7.
Calibration measures for the internal hold-out test set, with bootstrap 95% confidence intervals for calibration coefficients.
Figure 4.
Calibration curves of the selected GWO-stacking model and the principal comparators on the internal hold-out test set.
The selected GWO-stacking model had a Brier score of 0.0237 and a log loss of 0.1079. Baseline stacking produced values of 0.0284 and 0.1178, respectively, while RF yielded a Brier score of 0.0326 and a log loss of 0.1419. Thus, within this hold-out sample, the selected stacking model had the lowest average probability-error measures among the three evaluated models.
The jointly estimated calibration intercept and slope were −0.1989 and 1.0384 for GWO-stacking, −0.2511 and 0.9592 for baseline stacking, and −0.3292 and 1.3429 for RF, respectively. Calibration-in-the-large, estimated separately with the slope fixed at 1, was −0.2115 for GWO-stacking, −0.2371 for baseline stacking, and −0.5002 for RF. Although all three calibration-in-the-large point estimates were negative, the 95% bootstrap confidence intervals included zero for GWO-stacking and baseline stacking. In contrast, the interval for RF remained below zero. The calibration slope intervals included 1 for both stacking models, whereas the interval for RF was above 1. These findings suggest some uncertainty in the calibration estimates, particularly for the stacking models, and should be interpreted within the internal hold-out sample. The corresponding calibration curves are shown in Figure 4. All estimates should be interpreted in the context of the available hold-out sample size.
After examining predictive discrimination and probability calibration, the analysis was extended to the variables and first-level model outputs on which the final stacking model relied.
3.5. Model Interpretability
Model interpretation was examined at two levels. First, grouped permutation importance was calculated for the original predictors to assess the change in predictive performance when the information carried by each variable was disrupted. Second, SHAP values were calculated for the outputs of the five first-level learners to examine their contribution to the XGBoost meta-learner.
The grouped permutation results are presented in Figure 5. Health condition produced the largest reduction in performance when permuted. The mean decrease in MCC was 0.8811 ± 0.0349, while the corresponding decrease in ROC-AUC was 0.3892 ± 0.0164. The next largest MCC changes were observed for CGPA (0.1061 ± 0.0123), Current Semester (0.0749 ± 0.0173), Relationship Status (0.0611 ± 0.0128), and Good Friend Circle (0.0562 ± 0.0110). The remaining variables produced comparatively small changes under the same permutation procedure.
Figure 5.
Grouped permutation importance of the original predictors based on the decrease in MCC after permutation. Error bars represent variation across 30 repetitions.
The permutation results therefore indicate that the predictions of the fitted model were particularly sensitive to the information contained in Health condition. These values describe model dependence on the predictors and should not be interpreted as evidence of causal relationships with the outcome.
A complementary view was obtained from SHAP analysis of the XGBoost meta-learner. As shown in Figure 6a, the GB output had the largest mean absolute SHAP value (1.474), followed by RF (1.102), SVM (0.432), SGD (0.267), and KNN (0.124). Accordingly, variation in the GB and RF first-level predictions contributed more to the meta-model output than variation in the other three learner outputs. The distribution of SHAP values is shown in Figure 6b. For GB and RF in particular, higher first-level predicted values were generally associated with positive SHAP contributions, whereas lower values were more often associated with negative contributions. The magnitude and direction of these contributions varied across observations, reflecting the way in which the meta-learner combined the predictions generated by the individual base models.
Figure 6.
SHAP-based interpretation of the XGBoost meta-learner: (a) mean absolute SHAP values of the five first-level learner outputs and (b) SHAP beeswarm plot showing the distribution of individual contributions. The vertical grey line in (b) represents the zero SHAP value, separating positive and negative contributions to the model output.
Because Health condition had a considerably larger permutation importance than the remaining original predictors, an additional sensitivity analysis was conducted to examine how predictive performance changed when this variable was omitted.
3.6. Health-Condition Sensitivity and Subgroup Analyses
The influence of Health condition was examined using the RF benchmark by comparing models fitted with all predictors and models fitted after removing this variable. The analysis was conducted both across the outer cross-validation folds and on the internal hold-out test set. The results are summarized in Table 8. The development-set cross-tabulation showed a strong association between Health condition and the recorded outcome (Supplementary Table S9). Positive-outcome proportions were 96.30%, 20.31%, 4.64%, and 2.36% for category codes 0, 1, 2, and 3, respectively. Logistic regression using this variable alone achieved a mean five-fold MCC of 0.8095 ± 0.0388 and ROC-AUC of 0.9287 ± 0.0194 (Supplementary Table S10). These findings indicate that substantial predictive information is concentrated in this variable, but do not establish whether this association reflects independent characteristics or information overlapping with the outcome.
Table 8.
Sensitivity analysis of RF with and without the health condition predictor.
Using all predictors, RF achieved a mean outer-CV accuracy of 0.9601, MCC of 0.8910, ROC-AUC of 0.9731, and PR-AUC of 0.9468. After excluding Health condition, the corresponding values decreased to 0.7448, 0.3293, 0.7615, and 0.5621, respectively. A similar pattern was observed on the hold-out set. Accuracy decreased from 0.9701 to 0.7239, MCC from 0.9187 to 0.2728, ROC-AUC from 0.9804 to 0.7633, and PR-AUC from 0.9517 to 0.5483.
Sensitivity was also reduced from 0.9152 to 0.4727 on the hold-out set, while specificity decreased from 0.9881 to 0.8059. The reduction was therefore not confined to a single evaluation measure. Taken together with the permutation analysis, these findings indicate that a substantial part of the predictive information available to the RF benchmark was associated with the Health condition variable.
The additional fixed-hyperparameter GWO-stacking ablation showed a substantial reduction in performance after excluding Health condition. The results are summarized in Supplementary Table S5. Across the five outer folds, mean MCC decreased from 0.9091 ± 0.0282 to 0.3250 ± 0.0378, ROC-AUC from 0.9735 ± 0.0068 to 0.7660 ± 0.0147, PR-AUC from 0.9456 ± 0.0211 to 0.5669 ± 0.0254, and sensitivity from 0.9198 ± 0.0242 to 0.2906 ± 0.1087. These findings extend the RF sensitivity results and demonstrate substantial dependence of the selected stacking configuration on this predictor. They do not, by themselves, establish outcome leakage or quantify the performance achievable after retuning without Health condition.
The imbalance-handling comparisons are reported in Supplementary Table S8. For RF, SMOTE-NC yielded a mean MCC of 0.8910, compared with 0.8763 without resampling and 0.8899 with class weighting. Corresponding sensitivities were 0.8789, 0.8517, and 0.8759. For GWO-stacking, mean MCC was 0.9091 with SMOTE-NC and 0.9101 without resampling. These descriptive results suggest that the benefit of SMOTE-NC was model- and metric-dependent and do not establish that synthetic oversampling was necessary for this dataset. As an additional descriptive analysis, the performance of the selected stacking model was examined across the two coded levels of the Gender variable. Since the post-analysis output retained the original numerical category coding, the groups are reported here as levels 0 and 1 rather than assigning labels not contained in the analysis output. The subgroup results are shown in Table 9.
Table 9.
Performance of the selected GWO-stacking model across the coded Gender subgroups.
For Gender level 0 (n = 285), accuracy was 0.9649, sensitivity 0.9362, specificity 0.9791, F1-score 0.9462, MCC 0.9203, and ROC-AUC 0.9714. For level 1 (n = 385), the corresponding values were 0.9766, 0.9577, 0.9809, 0.9379, 0.9238, and 0.9847. The prevalence of the positive class differed between the two groups (0.330 and 0.184, respectively), which should be considered when comparing threshold-dependent performance measures. No formal subgroup-comparison test was performed; therefore, these results are presented descriptively.
4. Discussion
The present study examined whether optimization of a stacking-based classification framework improved the classification of self-reported depression status in students. GWO achieved the highest mean outer-fold MCC and was selected according to the predefined criterion, although its performance differed only slightly from PSO and sequential PSO–GWO. Because the same outer-fold estimates informed both strategy selection and comparison, the observed ranking may be affected by selection-induced optimism. Furthermore, only the selected GWO configuration was evaluated on the internal hold-out test set. Therefore, the findings do not establish the generalization superiority of GWO over the other optimization strategies.
The selected configuration used XGBoost as the meta-learner and GWO to optimize the hyperparameters of the stacking framework. It achieved the highest mean outer-fold MCC (0.9091), although the corresponding values for PSO (0.9076) and sequential PSO–GWO (0.9068) were close. On the internal hold-out test set, the selected model achieved an accuracy of 0.9716, sensitivity of 0.9455, F1-score of 0.9426, and MCC of 0.9238. However, RF achieved slightly higher ROC-AUC and PR-AUC, and the paired tests did not establish statistically significant differences in classification errors or ROC-AUC relative to the main comparators. These findings support a modest, metric-dependent benefit rather than consistent superiority of the selected configuration. Table 10 summarizes reported results and evaluation characteristics of related studies; differences in datasets, outcomes, and validation procedures limit direct comparisons.
Table 10.
Reported performance measures and evaluation characteristics of related depression-classification studies.
Although several studies reported accuracy values of approximately 97–98%, these results cannot be directly compared with those of the present study because of differences in datasets, study populations, outcome definitions, and validation procedures. In addition, the reported performance measures are not consistent across studies. Accuracy, ROC-AUC, and AUPRC reflect different aspects of model performance, and their numerical values should not be interpreted as equivalent. Differences in class distributions may also affect the interpretation of these measures, particularly AUPRC. In the present study, the GWO-stacking model achieved an accuracy of 97.16%, an F1-score of 94.26%, and an MCC of 0.9238 on the internal hold-out test set. These findings indicate strong classification performance within the analyzed dataset, although they should be interpreted in light of the self-reported outcome and the characteristics of the available data. While the hold-out set was kept separate from model development and selection, it originated from the same data source and therefore does not provide evidence of external generalizability. Further evaluation using independently collected datasets with more clearly defined outcome measures would be necessary to assess the applicability of the proposed framework to other student populations.
Compared with baseline stacking, the absolute differences were modest, including increases of approximately 0.0075 in accuracy and 0.0203 in MCC. The selected model also showed somewhat higher sensitivity. At the same time, RF remained highly competitive and produced slightly higher ROC-AUC and PR-AUC values than the optimized stacking model. Therefore, the results do not support the interpretation that the optimized ensemble was uniformly better than the simpler comparator across all aspects of performance. Instead, the models appeared to differ mainly in how they balanced positive-class detection, specificity, and overall classification agreement.
These differences are further supported by a cautious interpretation from the uncertainty analyses. Point estimates for different threshold-dependent metrics agreed with the selected GWO-stacking configuration, but bootstrap confidence intervals for many paired differences included or were close to zero. Exact McNemar tests did not detect statistically significant differences in paired classification errors between GWO-stacking and either baseline stacking or RF. Likewise, ROC-AUC was not significantly different by DeLong comparisons. The findings suggest that the numerical improvements observed for the selected model are to be understood as small shifts in the sample rather than as proof of broad statistical superiority. The increased sensitivity seen in comparison to RF was one of the more consistent differences but was associated with a slight decrease in precision and specificity.
Probability calibration provided an additional perspective that was not fully reflected by discrimination metrics. The selected GWO-stacking model had the lowest Brier score and log loss among the three principal models examined. Its calibration slope was close to 1. The calibration-in-the-large point estimate was negative (−0.2115), suggesting some overall overprediction; however, its 95% bootstrap confidence interval included zero. This indicates that the direction and magnitude of the calibration error remain uncertain in the available internal test sample. The jointly estimated calibration intercept was reported separately and was not used alone to infer overall overprediction. The calibration results are relevant because a model with good discrimination does not necessarily provide well-calibrated probabilities. Nevertheless, these estimates were obtained from the same hold-out sample used for final evaluation, and their interpretation should remain cautious in the absence of an independent external validation dataset.
Interpretability analyses revealed that the variable “Health condition” has a strong influence on the predictive performance of the model. In the grouped permutation analysis, the MCC and ROC-AUC values decreased more markedly by removing the information corresponding to this variable than by removing the other variables. Variables like CGPA, Current Semester, Relationship Status and Good Friend Circle were also found to be contributing to the model’s predictions, but with more limited permutation effects. However, this should not be taken as suggesting a causal relationship between health condition and depression. The findings merely indicate that the model relies heavily on the information contained in the Health condition variable within the existing dataset when generating its predictions.
The sensitivity analysis provided further evidence of this dependence. When Health condition was removed from the RF benchmark, performance decreased across multiple measures in both outer cross-validation and hold-out evaluation. On the hold-out set, MCC decreased from 0.9187 to 0.2728, while ROC-AUC decreased from 0.9804 to 0.7633. The magnitude of this reduction suggests that a substantial proportion of the predictive signal available to the model was associated with this single variable. This result is important when interpreting the high overall performance of the full-feature models. It also indicates that model performance may not transfer directly to datasets in which the same variable is measured differently, has a different distribution, or is unavailable. The additional GWO-stacking ablation confirmed this dependence: mean outer-fold MCC decreased from 0.9091 to 0.3250 after removing Health condition. Because the original fold-specific hyperparameters were retained without retuning, this result describes the sensitivity of the selected configuration rather than the best performance achievable without the predictor. Thus, the high performance of the full-feature models should be interpreted alongside the substantially lower performance observed after excluding Health condition.
The repository describes Health condition as self-reported physical health status but does not provide the original item wording or establish whether its content overlaps with the outcome. The available documentation also does not establish that this predictor would be available independently of outcome assessment in a screening setting. Therefore, conceptual or operational overlap cannot be excluded, and the high full-feature performance should not be interpreted as evidence of clinically valid prediction from independently measured characteristics.
The SHAP analysis of the meta-learner provided a complementary view of the stacking architecture. Among the first-level predictions, GB and RF had the largest mean absolute SHAP values, whereas SVM, SGD, and KNN made smaller contributions to the XGBoost meta-learner. This suggests that the meta-learner relied more strongly on the outputs of the two tree-based models when combining the first-level predictions. However, the presence of smaller SHAP values for the remaining learners does not necessarily imply that those models were unnecessary, since ensemble performance can also depend on complementary errors and interactions among predictors that are not captured by global importance values alone.
The subgroup analysis showed broadly comparable performance across the two coded Gender groups, although the positive-class prevalence differed substantially between them. Accuracy, MCC, and specificity were similar, while some differences were observed in sensitivity and F1-score. Because no formal statistical comparison was performed and the subgroup sizes and prevalence differed, these findings should be treated as descriptive. They do not establish equivalent performance across demographic groups, but they provide an initial indication that the model did not show an obvious large deterioration in either coded subgroup within this dataset.
A key limitation is the use of a single dataset without independent external validation, which restricts generalizability to other student populations. The outcome, “Depressed with life,” is a recorded binary label whose original questionnaire wording and psychological meaning could not be verified. Consequently, the reported performance reflects classification of this label rather than clinically established depression. Model performance also depended strongly on Health condition, whose original meaning and measurement timing remain undocumented. Although removing this predictor substantially reduced performance, the GWO-stacking ablation was performed without hyperparameter retuning and does not establish the best achievable performance in its absence. These findings raise concerns about construct interpretation but do not, by themselves, demonstrate outcome leakage. Furthermore, the uncertainty and calibration estimates were derived from the same data source, and the modest benefits of optimization should be considered alongside the additional model complexity and computational cost.
An additional limitation is the presence of duplicate records and identical predictor patterns across the development and internal hold-out partitions. Approximately 26% of hold-out observations shared an identical predictor pattern with at least one development observation. Because participant identifiers were unavailable, it could not be determined whether these records represented repeated measurements of the same individuals. Such overlap may contribute to optimistic internal performance estimates, as suggested by the lower performance observed among non-overlapping hold-out observations. Although the additional group-aware nested cross-validation yielded a similar mean MCC under group-separated partitions, it does not eliminate predictor-pattern overlap in the original internal hold-out evaluation.
Furthermore, the lack of documented information on institutional diversity, participant recruitment, and questionnaire administration limits the representativeness and external generalizability of the findings. The original dataset depositors were not contacted to clarify the questionnaire wording, category definitions, recruitment procedures, or measurement timing. Consequently, the study relied exclusively on publicly available dataset documentation, and these aspects of the original data collection process could not be independently verified. Independent validation using newly collected student data therefore remains necessary.
The exploratory group-aware cross-validation analysis provided additional evidence that predictive performance was sensitive to how repeated predictor patterns were distributed across validation partitions. Both the RF benchmark and the fixed-parameter GWO-stacking model showed lower mean MCC values under group-aware evaluation than under ordinary stratified cross-validation. Nevertheless, the differences should not be attributed exclusively to duplicate patterns because the validation partitions also differed between the procedures. Furthermore, the GWO hyperparameters were not re-optimized within the group-aware folds. Therefore, these results should be interpreted as supplementary robustness evidence rather than definitive estimates of external generalizability.
The additional group-aware nested evaluation addressed an important limitation of the exploratory analysis by repeating hyperparameter optimization within group-separated training folds. The mean MCC of GWO-stacking decreased only modestly from 0.9091 in the original stratified nested evaluation to 0.8992 under the group-aware protocol. GWO-stacking also retained a modest MCC advantage over both fixed and tuned RF, although RF achieved slightly higher ROC-AUC and PR-AUC. Thus, the additional analysis supports the robustness of the observed internal classification performance to exact predictor-pattern overlap, but it does not establish the superiority of the more complex framework or resolve uncertainties regarding predictor meaning, clinical applicability, or external generalizability. Nevertheless, the group-aware nested analysis evaluated the previously selected GWO strategy and did not repeat the selection among competing optimization strategies. Therefore, it should not be interpreted as an independent group-aware comparison of the optimization strategies.
The Gower-distance analysis extended the exact-duplicate audit by examining potentially similar, but non-identical, predictor patterns. Although additional near-similar observations were identified, their prevalence depended substantially on numerical scaling and the selected distance threshold. Moreover, predictive performance did not vary monotonically with increasing distance from the development set. Therefore, the analysis does not establish that near-similar observations caused the observed performance differences. The findings nevertheless reinforce the need for caution when interpreting internal validation results from a dataset containing repeated and similar predictor patterns. Because participant identifiers were unavailable, neither exact nor near-similar predictor patterns could be confirmed as repeated measurements of the same individuals. Independent data collection and external validation remain necessary.
The optimizer comparison was based on a single seeded run of each strategy within each outer fold. Although fixed seeds support reproducibility, they do not establish the stability of the optimizer ranking across independent initializations. The mean outer-fold MCC values for GWO (0.9091), PSO (0.9076), and sequential PSO–GWO (0.9068) were close, and their ordering may depend on the chosen random seeds. GWO should therefore be interpreted as the strategy selected under the evaluated partitions and seeds, rather than as a consistently superior optimizer. Repeated searches using multiple optimizer seeds within identical data partitions are needed to assess ranking stability.
The practical benefit of GWO was further examined in relation to computational cost. Based on the recorded outer-fold execution times, GWO-stacking required an average of 2771.2 ± 295.4 s per fold, compared with 2869.8 ± 382.4 s for PSO-stacking and 2944.8 ± 382.9 s for sequential PSO–GWO. Although GWO was moderately faster than these two optimized configurations in the recorded experiments, its execution time was substantially greater than that of baseline stacking (13.3 ± 1.1 s) and RF (1.19 ± 0.03 s). These times include hyperparameter search where applicable, final model fitting, and outer-fold evaluation. Moreover, GWO did not consistently outperform PSO or sequential PSO–GWO across all five outer folds. Therefore, the small MCC improvements should be weighed against the substantially increased computational cost, and the present results do not establish a clear practical advantage of GWO over simpler alternatives. The post hoc logistic-meta comparison also yielded a similar mean MCC (0.9111 versus 0.9091; Supplementary Table S6), providing no clear evidence that the additional complexity of the XGBoost meta-learner was necessary under the evaluated conditions. Similarly, the post hoc imbalance analyses showed comparable performance with class-weighted RF and with stacking without resampling (Supplementary Table S8). Given the moderate positive-class prevalence of 24.66%, these findings do not establish that SMOTE-NC was necessary; its observed contribution depended on the model and evaluation metric.
The methodological contribution of this study lies not in proposing a new optimization algorithm or stacking architecture, but in systematically evaluating established optimization strategies within a common modeling framework. By combining nested cross-validation, a common nominal optimization budget, internal hold-out evaluation, calibration assessment, model interpretability, and predictor-dependence analyses, the study provides a broader assessment of the benefits and limitations of metaheuristic optimization. Importantly, the findings indicate that increased optimization complexity does not necessarily translate into meaningful improvements in classification performance. Thus, the contribution is primarily methodological and evaluative, emphasizing the importance of careful evaluation, interpretability, and computational efficiency when assessing complex ensemble models.
The results indicate that the proposed optimized stacking framework achieved strong internal classification performance, particularly in terms of sensitivity and MCC. However, its incremental benefit over simpler alternatives was limited. Notably, a stacking configuration with a logistic regression meta-learner achieved comparable descriptive performance (mean MCC: 0.9111 versus 0.9091 for GWO-stacking with XGBoost). Considering these findings, the modest differences observed in the group-aware nested evaluation, and the substantially higher computational cost, the present analyses do not establish a clear practical advantage for the more complex architecture.
Furthermore, performance metrics alone are insufficient to characterize model behavior. Calibration, prediction uncertainty, feature dependencies, and sensitivity analyses provide complementary information for interpreting model outputs. Future research should therefore prioritize validation using independently collected datasets, assessment of generalizability across heterogeneous student populations, and clarification of the definitions and measurement procedures for influential predictors such as Health condition.
Supplementary Materials
The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/diagnostics16234156/s1, Table S1: Baseline hyperparameters and final hyperparameters selected by GWO for the stacking ensemble; Table S2: Observed categorical codes and their frequencies in the original dataset; Table S3: Exploratory comparison of ordinary and predictor-pattern-grouped five-fold cross-validation performance on the development partition (n = 2680); Table S4: Exploratory Gower-distance sensitivity of the internal hold-out set (n = 670); Table S5: Post-hoc fixed-hyperparameter ablation of Health condition in GWO-stacking; Table S6: Post-hoc comparison of GWO-stacking with simpler model alternatives; Table S7: Outer-fold performance of the six individual classifiers with fixed baseline hyperparameters; Table S8: Post-hoc comparison of imbalance-handling strategies; Table S9: Cross-tabulation of Health condition and the recorded outcome in the development partition; Table S10: Five-fold cross-validation performance of logistic regression using Health condition as the sole predictor; Table S11: Outer-fold classification performance under group-aware nested cross-validation; Table S12: GWO-stacking hyperparameters selected within each outer-training fold; Table S13: Tuned RF hyperparameters selected within each outer-training fold; Algorithm S1: GWO-Optimized Stacking Framework with Nested Cross-Validation; and Algorithm S2: Group-Aware Nested Cross-Validation for GWO-Optimized Stacking.
Author Contributions
Conceptualization, T.Ö.O., R.U.A. and İ.Ş.Y.; methodology, R.U.A. and İ.Ş.Y.; software İ.Ş.Y.; resources, T.Ö.O.; data curation, R.U.A. and İ.Ş.Y.; writing—original draft preparation, T.Ö.O., İ.Ş.Y. and R.U.A.; writing—review and editing, R.U.A. and T.Ö.O.; visualization, T.Ö.O. and R.U.A., supervision, T.Ö.O.; and project administration, İ.Ş.Y. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The dataset analyzed in this study is publicly available through Mendeley Data as the Student Depression Detection Dataset [10]. Detailed methodological descriptions, model configurations, fold-specific hyperparameters, and supporting analytical results are provided in the manuscript and Supplementary Materials (Tables S1–S13). The main stratified nested cross-validation and metaheuristic optimization procedures are described in Supplementary Algorithm S1, while the additional group-aware nested cross-validation procedure is detailed in Supplementary Algorithm S2. The custom Python source code and intermediate computational outputs are not publicly available. We acknowledge that the absence of executable source code limits direct computational reproducibility.
Acknowledgments
During the preparation of this manuscript, the authors used ChatGPT (GPT-5; OpenAI, San Francisco, CA, USA) only for minor language editing. The authors subsequently reviewed and revised the edited text and remain fully responsible for the accuracy, originality, and integrity of the final manuscript.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Liu, J.; Ning, W.; Zhang, N.; Zhu, B.; Mao, Y. Estimation of the global disease burden of depression and anxiety between 1990 and 2044: An analysis of the Global Burden of Disease Study 2019. Healthcare 2024, 12, 1721. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- López Steinmetz, L.C.; Sison, M.; Zhumagambetov, R.; Godoy, J.C.; Haufe, S. Machine learning models predict the emergence of depression in Argentinean college students during periods of COVID-19 quarantine. Front. Psychiatry 2024, 15, 1376784. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- El Morr, C.; Jammal, M.; Bou-Hamad, I.; Hijazi, S.; Ayna, D.; Romani, M.; Hoteit, R. Predictive machine learning models for assessing Lebanese University students’ depression, anxiety, and stress during COVID-19. J. Prim. Care Community Health 2024, 15, 1–12. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kroenke, K.; Spitzer, R.L.; Williams, J.B. The PHQ-9: Validity of a Brief Depression Severity Measure. J. Gen. Intern. Med. 2001, 16, 606–613. [Google Scholar] [PubMed]
- Vergaray, A.D.; Miranda, J.C.H.; Cornelio, J.B.; Carranza, A.R.L.; Ponce Sánchez, C.F. Predicting the depression in university students using stacking ensemble techniques over oversampling method. Inform. Med. Unlocked 2023, 41, 101295. [Google Scholar] [CrossRef] [Scilit]
- Guerreiro, J.; Garriga, R.; Lozano Bagén, T.; Sharma, B.; Karnik, N.S.; Matić, A. Transatlantic transferability and replicability of machine-learning algorithms to predict mental health crises. npj Digit. Med. 2024, 7, 227. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Elreedy, D.; Atiya, A.F.; Kamalov, F. A theoretical distribution analysis of synthetic minority oversampling technique (SMOTE) for imbalanced learning. Mach. Learn. 2024, 113, 4903–4923. [Google Scholar] [CrossRef] [Scilit]
- Xu, Z.; Shen, D.; Kou, Y.; Nie, T. A synthetic minority oversampling technique based on Gaussian mixture model filtering for imbalanced data classification. IEEE Trans. Neural Netw. Learn. Syst. 2024, 35, 3740–3753. [Google Scholar] [CrossRef] [PubMed]
- Ulutaş, H.; Günay, R.B.; Şahin, M.E. Detecting diabetes in an ensemble model using a unique PSO-GWO hybrid approach to hyperparameter optimization. Neural Comput. Appl. 2024, 36, 18313–18341. [Google Scholar] [CrossRef] [Scilit]
- Haque, O.; Alom, S. Student Depression Detection Dataset, Version 1; Mendeley Data, 2026. Available online: https://data.mendeley.com/datasets/mcx8g57trw/1 (accessed on 9 October 2026).
- Collins, G.S.; Moons, K.G.M.; Dhiman, P.; Riley, R.D.; Beam, A.L.; Van Calster, B.; Ghassemi, M.; Liu, X.; Reitsma, J.B.; van Smeden, M.; et al. TRIPOD+AI statement: Updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ 2024, 385, e078378. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ichwani, A.; Kesuma, R.I.; Setiawan, A.; Wicaksono, I.; Hanifah, R. Preventing data leakage in classification via integrated machine learning pipelines: Preprocessing, feature transformation, and hyperparameter tuning. J. Tek. Inform. 2026, 7, 391–410. [Google Scholar] [CrossRef] [Scilit]
- Tukey, J.W. Exploratory Data Analysis; Addison-Wesley: Reading, MA, USA, 1977. [Google Scholar]
- Berkelmans, G.F.; Read, S.; Gudbjörnsdottir, S.; Wild, S.; Franzén, S.; Van Der Graaf, Y.; Eliasson, B.; Visseren, F.; Paynter, N.; Dorresteijn, J. Population median imputation was noninferior to complex approaches for imputing missing values in cardiovascular prediction models in clinical practice. J. Clin. Epidemiol. 2022, 145, 70–80. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Yeo, I.K.; Johnson, R.A. A new family of power transformations to improve normality or symmetry. Biometrika 2000, 87, 954–959. [Google Scholar] [CrossRef] [Scilit]
- Sujon, K.M.; Hassan, R.; Towshi, Z.T.; Othman, M.A.; Samad, M.A.; Choi, K. When to use standardization and normalization: Empirical evidence from machine learning models and XAI. IEEE Access 2024, 12, 135300–135314. [Google Scholar] [CrossRef] [Scilit]
- Chawla, N.V.; Bowyer, K.W.; Hall, L.O.; Kegelmeyer, W.P. SMOTE: Synthetic minority over-sampling technique. J. Artif. Intell. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef] [Scilit]
- Lemaitre, G.; Nogueira, F.; Aridas, C.K. Imbalanced-learn: A Python toolbox to tackle the curse of imbalanced datasets in machine learning. J. Mach. Learn. Res. 2017, 18, 1–5. [Google Scholar]
- Fonseca, J.; Bação, F. Geometric SMOTE for imbalanced datasets with nominal and continuous features. Expert Syst. Appl. 2023, 234, 121053. [Google Scholar] [CrossRef] [Scilit]
- Chuang, C.-W.; Wu, C.-K.; Wu, C.-H.; Shia, B.; Chen, M. Enhancing model generalizability in medical artificial intelligence: Systematic comparison of categorical encoding and sampling techniques for imbalanced data. JMIR Med. Inform. 2025, 14, e75655. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn: Machine learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. [Google Scholar]
- Căvescu, A.; Popescu, A. Leakage-free evaluation for employee attrition prediction on tabular data. Information 2026, 17, 308. [Google Scholar] [CrossRef] [Scilit]
- Zhang, Y.; Zhu, Y.; Wang, X.; Wen, S.; Zheng, P. Heterogeneous stacking framework with adaptive Borderline-SMOTE for imbalanced binary classification: A multi-institutional validation study. J. King Saud Univ. Comput. Inf. Sci. 2026, 38, 772. [Google Scholar] [CrossRef] [Scilit]
- Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Scilit]
- Kim, Y.; Kim, S.Y.; Kim, H. Asymmetric feature weighting for diversity-enhanced random forests. Symmetry 2026, 18, 73. [Google Scholar] [CrossRef] [Scilit]
- Cortes, C.; Vapnik, V. Support-vector networks. Mach. Learn. 1995, 20, 273–297. [Google Scholar] [CrossRef] [Scilit]
- Kuyoro, A.; Alimi, S.; Awodele, O. Comparative analysis of the performance of various support vector machine kernels. In Proceedings of the 2022 5th Information Technology for Education and Development (ITED), Abuja, Nigeria, 1–3 November 2022; pp. 1–7. [Google Scholar] [CrossRef] [Scilit]
- Friedman, J.H. Greedy function approximation: A gradient boosting machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef] [Scilit]
- Cover, T.M.; Hart, P.E. Nearest neighbor pattern classification. IEEE Trans. Inf. Theory 1967, 13, 21–27. [Google Scholar] [CrossRef] [Scilit]
- Bottou, L. Large-scale machine learning with stochastic gradient descent. In Proceedings of the COMPSTAT 2010, Paris, France, 22–27 August 2010; pp. 177–186. [Google Scholar]
- Chen, T.; Guestrin, C. XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar] [CrossRef] [Scilit]
- Wolpert, D.H. Stacked generalization. Neural Netw. 1992, 5, 241–259. [Google Scholar] [CrossRef] [Scilit]
- Chicco, D.; Jurman, G. The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation. BMC Genom. 2020, 21, 6. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95—International Conference on Neural Networks, Perth, Australia, 27 November–1 December 1995; Volume 4, pp. 1942–1948. [Google Scholar] [CrossRef] [Scilit]
- Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey Wolf Optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [Google Scholar] [CrossRef] [Scilit]
- Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
- Cawley, G.C.; Talbot, N.L.C. On over-fitting in model selection and subsequent selection bias in performance evaluation. J. Mach. Learn. Res. 2010, 11, 2079–2107. [Google Scholar]
- Dubray-Vautrin, A.; Choussy, O.; Lamy, C.; Marret, G.; Martin, J.; Klijanienko, J.; Vacher, S.; Ahmanache, L.; Bièche, I.; Dupain, C.; et al. A clustering-stratified cross-validation framework for validating omics survival models: Application to head and neck cancer. BMC Med. Res. Methodol. 2025, 25, 277. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Brodersen, K.H.; Ong, C.S.; Stephan, K.E.; Buhmann, J.M. The balanced accuracy and its posterior distribution. In Proceedings of the 20th International Conference on Pattern Recognition, Istanbul, Turkey, 23–26 August 2010; pp. 3121–3124. [Google Scholar] [CrossRef] [Scilit]
- Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20, 37–46. [Google Scholar] [CrossRef] [Scilit]
- Almehrizi, R. Coefficient lambda for interrater agreement among multiple raters: Correction for category prevalence. Educ. Psychol. Meas. 2025, 86, 287–319. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Saito, T.; Rehmsmeier, M. The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLoS ONE 2015, 10, e0118432. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Efron, B.; Tibshirani, R.J. An Introduction to the Bootstrap; Chapman & Hall: New York, NY, USA, 1993. [Google Scholar]
- Sujon, K.M.; Hassan, R.; Choi, K.; Samad, M.A. Accuracy, precision, recall, F1-score, or MCC? Empirical evidence from advanced statistics, ML, and XAI for evaluating business predictive models. J. Big Data 2025, 12, 268. [Google Scholar] [CrossRef] [Scilit]
- Imani, M.; Joudaki, M.; Bagheri, A.; Arabnia, H. Why ROC-AUC is misleading for highly imbalanced data: In-depth evaluation of MCC, F2-score, H-measure, and AUC-based metrics across diverse classifiers. Technologies 2026, 14, 54. [Google Scholar] [CrossRef] [Scilit]
- McNemar, Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 1947, 12, 153–157. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- DeLong, E.R.; DeLong, D.M.; Clarke-Pearson, D.L. Comparing the areas under two or more correlated receiver operating characteristic curves: A nonparametric approach. Biometrics 1988, 44, 837–845. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Holm, S. A simple sequentially rejective multiple test procedure. Scand. J. Stat. 1979, 6, 65–70. [Google Scholar]
- Van Calster, B.; McLernon, D.J.; van Smeden, M.; Wynants, L.; Steyerberg, E.W. Calibration: The Achilles heel of predictive analytics. BMC Med. 2019, 17, 230. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Odesola, P.A.; Adegoke, A.A.; Babalola, I. Model uncertainty quantification: A post hoc calibration approach for heart disease prediction. J. Eng. Res. Sci. 2025, 4, 25–54. [Google Scholar] [CrossRef] [Scilit]
- Fisher, A.; Rudin, C.; Dominici, F. All models are wrong, but many are useful: Learning a variable’s importance by studying an entire class of prediction models simultaneously. J. Mach. Learn. Res. 2019, 20, 1–81. [Google Scholar]
- Lundberg, S.M.; Lee, S.-I. A unified approach to interpreting model predictions. Adv. Neural Inf. Process. Syst. 2017, 30, 4765–4774. [Google Scholar]
- Levina, N.A.; Rahardi, M. Analysis of stacking ensemble method in machine learning algorithms to predict student depression. J. Appl. Inform. Comput. 2025, 9, 3283–3294. [Google Scholar] [CrossRef] [Scilit]
- Tirado, H.; Alexander, S.; Vilchez, A.; Antoni, F.; Zúñiga, B.; Luis, J.; Aguirre, H.; Anthony, A. Implementation of an ensemble stacking model for early prediction of depression in university students. In Proceedings of the 5th LACCEI International Multiconference on Entrepreneurship, Innovation and Regional Development—LEIRD 2025, “Entrepreneurship with Purpose: Social and Technological Innovation in the Age of AI”, Virtual Edition, 1–3 December 2025. [Google Scholar] [CrossRef] [Scilit]
- Selvaraj, A.; Mohandoss, L. Enhancing depression detection: A stacked ensemble model with feature selection and RF feature importance analysis using NHANES data. Appl. Sci. 2024, 14, 7366. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.





