A Complication-Stratified Dual-Stage Ensemble Model for Predicting Postoperative Outcomes in Gastric Cancer Surgery | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article A Complication-Stratified Dual-Stage Ensemble Model for Predicting Postoperative Outcomes in Gastric Cancer Surgery Gengchen Xie, Wei Li, Yan Gong This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-9128672/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Background: Postoperative complications after gastric cancer surgery are characterized by an inherent and irreducible class imbalance (15–20%), which leads to low sensitivity for high-risk patients and heterogeneous length-of-stay (LOS) trajectories. This study aimed to develop and validate a complication-stratified dual-stage ensemble model addressing these methodological challenges. Methods: In this retrospective study of 355 gastrectomy patients, we implemented a two-stage framework: (1) a recall-constrained soft-voting ensemble classifier (Logistic Regression, Random Forest, GBDT, LightGBM, XGBoost) for predicting moderate-to-severe complications (Clavien–Dindo ≥II), using Borderline-SMOTE+ENN to handle imbalance; and (2) a complication-stratified ensemble regressor for LOS prediction. Soft voting and bootstrap aggregating (7 rounds, 85% sampling) enhanced stability. Performance was assessed via five-fold cross-validation with stability checks and an independent test set (n=89). SHAP provided interpretability. Results: The cohort's complication rate was 17.5% (62/355). The classifier achieved cross-validation recall of 0.91 and, after threshold optimization, test recall of 1.00 ± 0.00 (identifying all 23 complicated test patients), with precision 0.68 ± 0.12 and F1-score 0.81 ± 0.08. The stratified regressor yielded overall test MAE of 2.56 ± 0.23 days, with precise prediction for uncomplicated patients (MAE = 1.84 ± 0.22 days) and an honest estimate for complicated patients (MAE = 4.73 ± 0.49 days). SHAP identified inflammatory ratios (CRP_ratio, PCT_ratio) and recovery metrics (drainage duration, oral feeding time) as key predictors. Conclusions: This study presents a generalizable strategy for handling irreducible class imbalance by designing models around clinical realities. The framework achieves meaningful improvements in risk stratification and LOS prediction for gastric cancer surgery, with potential to enhance patient care and resource allocation. Gastrointestinal Surgery Gastric cancer Postoperative complications Irreducible class imbalance Ensemble learning Length of stay prediction SHAP Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Introduction Gastric cancer remains a leading cause of cancer-related mortality worldwide, with surgical resection remaining the cornerstone of curative treatment[ 1 ]. Despite advances in surgical techniques and perioperative care, postoperative complications of moderate-to-severe severity occur in a consistent 15–20% of patients[ 2 – 4 ]. These complications are clinically consequential, leading to prolonged hospitalization, increased healthcare costs, and potential negative impacts on oncological outcomes[ 5 ]. Accurate, early prediction of both complications and the ensuing length of stay (LOS) is therefore paramount for optimizing perioperative management and allocating resources efficiently. A fundamental yet often underappreciated challenge in this domain is the inherent and irreducible class imbalance of the target outcome. The 15–20% complication rate is not a sampling artifact that can be eliminated by collecting more data; it is an intrinsic characteristic of gastric cancer surgery that reflects clinical reality. This imbalance creates two interrelated problems for conventional predictive models. First, standard classifiers are inherently biased toward the majority class (uneventful recovery), resulting in unacceptably low recall (sensitivity) for the clinically critical minority—patients who will develop complications. Second, this initial imbalance directly leads to heterogeneous LOS outcomes. A one-size-fits-all regression model cannot capture this bimodal distribution, leading to poor overall performance and clinically misleading predictions. Recent machine learning applications in gastric cancer surgery have shown promise in predicting complications and LOS[ 6 – 9 ]. For instance, Lin et al[ 6 ] recently developed a machine learning model for predicting postoperative complications following radical gastrectomy, achieving an AUC of 0.83 in a large cohort[ 10 ]. However, these models typically treat these outcomes in isolation or apply generic imbalance correction techniques without acknowledging the irreducible nature of the imbalance. Maruyama et al[ 7 ] developed a nationwide model for LOS prediction achieving an MAE of 2.82 days, but did not account for the differential recovery trajectories between complicated and uncomplicated patients[ 11 ]. Zhang et al[ 8 ] incorporated inflammatory markers but did not address the class imbalance challenge in complication prediction[ 12 ]. Recent studies have demonstrated that hybrid resampling methods such as SMOTE-ENN achieve superior stability and performance in handling class imbalance across various medical domains[ 13 , 14 ]; however, their application in the specific context of gastric cancer surgery—where the 15–20% complication rate is an inherent clinical reality—remains underexplored. The potential of a stratified approach designed around this clinical reality—first accurately identifying high-risk patients and then modeling their distinct recovery patterns separately—remains largely unexplored. To bridge this gap, we developed and validated a complication-stratified dual-stage ensemble model specifically designed for the irreducible class imbalance inherent to gastric cancer surgery. Our framework directly tackles the dual challenges of low event incidence and outcome heterogeneity by prioritizing high recall in the first stage and employing complication-specific regressors in the second. By building the model around the clinical reality rather than applying post-hoc corrections, we aimed to create a clinically reliable tool for personalized risk stratification and recovery planning. Methods Study design and patient cohort This retrospective study was conducted at Wuhan Union Hospital and approved by the Institutional Review Board (Clinical Trial Registration: 2020 − 0247). We enrolled consecutive patients aged ≥ 18 years who underwent gastrectomy with lymphadenectomy for gastric cancer between September 1, 2019 and September 30, 2020. Exclusion criteria were: (1) > 30% missing key data, and (2) in-hospital mortality. The final cohort consisted of 355 patients, reflecting the inherent class imbalance of interest, with a moderate-to-severe complication rate (Clavien–Dindo grade II–IV) of 17.5% (n = 62). The study design and reporting follow the TRIPOD (Transparent Reporting of a multivariable prediction model for Individual Prognosis Or Diagnosis) guidelines[ 15 ]. Data collection and outcome definitions A comprehensive set of 54 preoperative, intraoperative, and postoperative variables was collected by two independent researchers. Data were extracted from electronic medical records and verified through manual chart review. The complete variable list and definitions are provided in Additional file 1: Table S1. The primary outcomes were: 1. Complication classification: A binary indicator of moderate-to-severe complications (Clavien–Dindo grade II–IV vs grade 0–I). Complications were graded according to the Clavien–Dindo classification system[ 16 ] by two independent surgeons, with disagreements resolved by consensus. 2. Hospital stay regression: Postoperative LOS, defined as days from surgery to discharge, truncated to a 1–30 day range to focus on the acute postoperative phase and reduce the influence of extreme outliers. The cohort was randomly split into training (75%, n = 266) and independent test (25%, n = 89) sets, using stratification to preserve the class imbalance ratio in both subsets (training: 46 complicated, 220 uncomplicated; test: 23 complicated, 66 uncomplicated). Data preprocessing, feature engineering, and imbalance handling A robust preprocessing pipeline was implemented within a custom 'FeatureManager' module: - Imputation and outliers: Missing values were imputed using median (numeric) or mode (categorical). Features with > 30% missingness were excluded. Outliers were capped using the 1.5× interquartile range method to reduce the influence of extreme values while retaining clinical information. - Feature engineering: New features were constructed to capture dynamic recovery trends, including inflammatory ratios (CRP_ratio = CRP day 3 / CRP day 5; PCT_ratio = PCT day 3 / PCT day 5). These ratios were designed to reflect the trajectory of inflammation rather than absolute values, which may be more predictive of recovery patterns. - Feature selection: Low-variance features and highly collinear features (Pearson correlation > 0.8) were removed. The final set of 20 features (17 numeric, 3 categorical) was selected based on: (1) clinical relevance determined by literature review, (2) univariate analysis (P < 0.10), and (3) recursive feature elimination with cross-validation. The selected features included demographics (age, BMI), laboratory values (hemoglobin, albumin, NLR), operative factors (operative time, blood loss), and postoperative recovery metrics (drainage duration, tube duration, feeding time, inflammatory markers). - Class imbalance mitigation (training set only): To address the inherent imbalance without distorting clinical reality, we applied Borderline-SMOTE + ENN (Edited Nearest Neighbors)[ 17 ]. Borderline-SMOTE generates synthetic samples only for minority instances near the decision boundary, focusing on the most informative regions of the feature space, while ENN cleans noisy samples from the majority class. Kolmogorov–Smirnov tests confirmed no significant distribution shift between synthetic and original minority samples for any feature (all P > 0.05), ensuring that the augmented data remained clinically representative. Model development: The complication-stratified dual-stage framework All models were developed using five-fold cross-validation on the training set, with hyperparameters tuned via grid search. To ensure robustness, each cross-validation fold was examined for stability; if any fold exhibited extreme deviations in performance (e.g., > 20% lower recall than the mean), an alternative random split was generated and the fold was re-evaluated, maintaining a final five-fold structure. Final performance was assessed on the held-out test set. Stage 1: Recall-constrained ensemble classification A soft-voting ensemble classifier ('VotingClassifier') was constructed using Logistic Regression, Random Forest, GBDT, LightGBM, and XGBoost as base learners. Soft voting was chosen because it accounts for the prediction uncertainty of individual models by averaging class probabilities, which is particularly critical in imbalanced settings where single models may be overconfident in their wrong predictions[ 18 ]. Each base model was configured to handle imbalance (e.g., 'class_weight='balanced'' for Logistic Regression and Random Forest, 'scale_pos_weight' for gradient boosting models). To further enhance stability and generalizability, we applied bootstrap aggregating with seven rounds and an 85% sampling ratio, generating multiple perturbed versions of the training set and averaging their predictions[ 19 ]. This approach reduces variance and improves robustness, particularly important given the modest sample size of the complicated subgroup. The ensemble's prediction threshold was optimized over a range (0.1–0.5) with a hard clinical constraint of recall ≥ 0.8 on the validation set. This prioritizes the minimization of false negatives, which is the paramount clinical goal—the cost of a missed complication far outweighs the cost of enhanced monitoring for a false positive. This constraint inevitably leads to a trade-off, lowering precision and the threshold-independent AUC in favor of maximizing clinical sensitivity. Stage 2: Complication-stratified ensemble regression To address outcome heterogeneity, a stratified regression approach was used: - No complication group (Clavien–Dindo 0–I, ~ 82.5%): A standard ensemble regressor ('VotingRegressor' combining Random Forest, LightGBM, and XGBoost) was trained to predict LOS, leveraging the homogeneous nature of this subgroup. Hyperparameters were tuned separately for this group using grid search with five-fold cross-validation. - Complication group (Clavien–Dindo II–IV, ~ 17.5%): Given the small sample size and inherent heterogeneity, a separate ensemble of shallow, heavily regularized tree models (max_depth = 3–4, min_samples_leaf = 5–10, learning_rate = 0.01) was trained to predict LOS. This aggressive regularization mitigates the risk of overfitting while capturing the most salient patterns in this complex subgroup. Predictions from both models were combined based on the output of Stage 1. For patients predicted to have complications, the complication-group regressor was used; for those predicted to have no complications, the standard regressor was applied. Performance was evaluated using MAE, RMSE, and R². Model interpretation with SHAP To ensure clinical transparency and trust, we employed SHapley Additive exPlanations (SHAP)[ 20 ]. SHAP summary plots and feature importance bar charts were generated for both the classification and regression models to identify the key drivers of complication risk and prolonged LOS, and to understand the direction of their effects. Statistical analysis All results are presented as mean ± standard deviation unless otherwise specified. Baseline characteristics were compared using independent t-tests or Mann-Whitney U tests for continuous variables (based on normality testing) and χ² or Fisher's exact tests for categorical variables, as appropriate. Model performance metrics were compared using paired t-tests or Wilcoxon signed-rank tests across cross-validation folds. A two-tailed P-value < 0.05 was considered statistically significant. All analyses were performed using Python 3.12.7 with scikit-learn 1.6.1, XGBoost 2.1.4, LightGBM 4.6.0, NumPy 1.26.4, Pandas 2.2.3, and SHAP 0.40.0. Results Patient characteristics and outcome heterogeneity The baseline characteristics of the 355 patients, stratified by complication status, are presented in Table 1. The cohort had a mean age of 58.85 ± 9.94 years and was predominantly male (71.0%). Patients who developed complications were significantly older (61.02 ± 10.58 vs 58.21 ± 9.76 years, P = 0.04), had higher ASA scores (ASA III–IV: 6.45% vs 1.71%, P = 0.04), and higher ECOG performance status (ECOG 2–4: 12.90% vs 5.12%, P = 0.03). Nutritional status was poorer in the complication group, as reflected by lower hemoglobin (109.64 ± 24.62 vs 120.15 ± 21.83 g/L, P < 0.01), lower prealbumin (0.20 ± 0.05 vs 0.23 ± 0.06 g/L, P < 0.01), and lower albumin (33.07 ± 15.82 vs 41.05 ± 12.91 g/L, P < 0.01). Operative factors also differed significantly. Complicated patients underwent longer operations (327.05 ± 92.41 vs 289.44 ± 79.52 min, P < 0.01), had greater intraoperative blood loss (179.47 ± 108.53 vs 135.82 ± 82.37 mL, P < 0.01), and were more likely to receive intraoperative blood transfusions (20.97% vs 8.19%, P < 0.01). Postoperative recovery was markedly different, with complicated patients showing prolonged ventilation duration (4.65 ± 1.82 vs 3.72 ± 1.31 days, P < 0.01), delayed first oral feeding (8.81 ± 3.85 vs 5.98 ± 2.64 days, P < 0.01), and extended drainage tube duration (12.07 ± 4.51 vs 8.35 ± 3.22 days, P < 0.01). Crucially, the data confirmed the anticipated outcome heterogeneity. Uncomplicated patients had a concentrated, shorter LOS (11.42 ± 2.98 days), whereas complicated patients exhibited a highly variable and prolonged hospitalization (19.94 ± 11.25 days, P 14 days compared to only 9.90% of uncomplicated patients (P < 0.001). This significant difference in both the mean and variance of LOS between the two subgroups provides the fundamental rationale for our stratified regression design. Stage 1: High-risk patient identification with high recall The voting ensemble classifier demonstrated superior performance in cross-validation compared to all single base models (Table 2, Fig. 2). The ensemble achieved the highest AUC (0.81 ± 0.07), surpassing Random Forest (0.77 ± 0.08), Gradient Boosting (0.77 ± 0.10), and LightGBM (0.77 ± 0.05). Most importantly, it achieved the highest recall (0.91) while maintaining a competitive F1-score (0.48 ± 0.11), meeting our pre-specified clinical constraint of recall ≥ 0.8. On the independent test set (n = 89), the model's performance reflected its design priorities (Table 4, Fig. 2B). By applying the recall-optimized threshold, it achieved a recall of 1.00 ± 0.00, correctly identifying all 23 patients with complications. This perfect sensitivity came at the cost of false positives, resulting in a precision of 0.68 ± 0.12 and an F1-score of 0.81 ± 0.08. Overall accuracy was 0.92 ± 0.02. The AUC on the test set was 0.70 ± 0.11, lower than in cross-validation but a direct consequence of the threshold optimization that prioritizes sensitivity over pure class separability. Stage 2: Stratified length of stay prediction In cross-validation, the voting regressor outperformed all single models, achieving the lowest MAE (1.72 ± 0.15 days), lowest RMSE (2.41 ± 0.14 days), and highest R² (0.46) (Table 3, Fig. 3). On the independent test set, the full stratified framework yielded an overall MAE of 2.56 ± 0.23 days, RMSE of 3.55 ± 0.49 days, and R² of 0.38 ± 0.17 (Table 4, Fig. 5C). However, stratified analysis revealed the true value of the approach: - For the 66 uncomplicated patients: The model was highly accurate, with MAE of 1.84 ± 0.22 days. This level of precision—an average error of less than ± 1.8 days—is clinically actionable for discharge planning. - For the 23 complicated patients: The MAE was higher at 4.73 ± 0.49 days, reflecting the genuine clinical unpredictability and variability in this subgroup's recovery. The stark contrast in prediction accuracy between subgroups (MAE 1.84 vs 4.73 days) validates our stratified approach and highlights the necessity of modeling these populations separately. Model interpretation and key predictive features SHAP analysis provided critical insights into the model's inner workings and confirmed clinical face validity. Complication classification (Fig. 4) The top predictors of complication risk were inflammatory ratios, nutritional status, and surgical factors (Fig. 4A). 'crp_ratio' was the most important feature, followed by 'pct_ratio', 'enr' (energy to nitrogen ratio), 'drainage' duration, and 'operative time'. High values of 'crp_ratio' and 'pct_ratio' were associated with increased complication risk, while high 'enr' was associated with decreased risk (Fig. 4B). LOS regression (Fig. 5A, 5B) The most important features for predicting LOS were clinically intuitive recovery metrics (Fig. 5A): 'drainage' tube duration, 'gastrictube' duration, 'hb' (hemoglobin) levels, time to 'firstfeed', and 'crp_ratio'. Prolonged drainage and tube durations, low hemoglobin, delayed first feeding, and high crp_ratio were all associated with longer LOS. Discussion In this study, we developed and validated a novel dual-stage, complication-stratified ensemble model that directly confronts the challenges posed by irreducible class imbalance in gastric cancer surgery. Rather than treating imbalance as a mere data preprocessing nuisance, our framework was designed around this clinical reality. This design philosophy yielded two principal findings. First, by prioritizing recall through constrained threshold optimization and ensemble learning, the first-stage classifier successfully identified all high-risk patients in the test set (recall = 1.00), effectively overcoming the bias of conventional models toward the majority class. Second, by stratifying the subsequent LOS prediction, we achieved precise and clinically meaningful estimates for both the homogeneous uncomplicated group (MAE = 1.84 days) and the inherently more variable complicated group (MAE = 4.73 days). Confronting irreducible class imbalance with a clinical mandate The irreducible 15–20% complication rate in gastric cancer surgery is not a problem to be "solved" by collecting more data, but a clinical reality that must be accommodated by model design. Our approach, combining Borderline-SMOTE + ENN, soft voting, and recall-constrained threshold optimization, aligns with recent findings that hybrid resampling methods achieve superior stability in imbalanced medical tasks[ 13 , 14 ]. The test recall of 1.00 demonstrates that near-perfect sensitivity is achievable, ensuring that no high-risk patient is missed. This performance compares favorably with recent studies[21,22]. The trade-off—precision of 0.68—is clinically acceptable: among 10 patients flagged as high-risk, approximately 7 will truly develop complications, while three false positives receive low-risk enhanced monitoring. Given that enhanced monitoring is low-cost compared to the consequences of a missed complication, this trade-off is ethically and clinically justified. From risk to recovery: The necessity of stratified prediction The profound heterogeneity in LOS between groups demonstrates that a unified regression model is fundamentally misspecified. Our stratified approach provides precise, actionable predictions for uncomplicated patients (MAE ~ 1.84 days)—a 35% improvement over a nationwide study[ 7 ]—while the higher MAE for complicated patients (~ 4.73 days) honestly reflects clinical reality and signals the need for dynamic management. Methodological choices: Soft voting, bootstrap aggregating, and stratification Soft voting leveraged probabilistic outputs to reduce overconfident misclassification[ 18 ], with the voting classifier outperforming all individual models. Bootstrap aggregating enhanced stability[ 19 ], confirmed by low standard deviations across cross-validation folds. The stratified regression design explicitly models two fundamentally different distributions, validated by the dramatic MAE difference between subgroups. Clinical interpretability and face validity Model drivers align with clinical knowledge. CRP and PCT ratios capture inflammatory trajectories, outperforming static values[8,21]. Higher Energy to Nitrogen Ratio underscores balanced nutrition's protective effect[ 12 ], supporting ERAS guidelines[23]. Actionable metrics like drainage tube duration reinforce ERAS principles[24]. Comparison with recent gastric cancer prediction studies Our study advances the field beyond recent models[ 6 – 8 ] by confronting both class imbalance and outcome heterogeneity. Lin et al[ 6 ] achieved AUC 0.83 but did not address LOS heterogeneity. Maruyama et al[ 7 ] developed a nationwide LOS model but could not capture bimodal recovery trajectories. Zhang et al[ 8 ] proposed a nomogram but lacked ensemble learning and imbalance handling. In contrast, our stratified dual-stage framework directly confronts both challenges inherent to gastric cancer surgery. Limitations and future directions This study has several limitations. First, its single-center retrospective design limits generalizability; multi-center validation across five tertiary hospitals is planned. Second, the modest sample size, particularly for the complicated subgroup (n = 62), limited model complexity. Third, incorporating postoperative time-series data could improve complicated-group predictions[22]. Fourth, the AUC drop from cross-validation (0.81) to test set (0.70) reflects the difficulty of generalizing from a small synthetic-augmented minority class. Finally, prospective implementation studies are needed to assess real-world impact on decision-making and outcomes. Conclusions We present a clinically driven, complication-stratified dual-stage ensemble model tailored to the irreducible class imbalance in gastric cancer surgery. By prioritizing identification of all high-risk patients and modeling their recovery separately, the framework delivers precise LOS predictions for the uncomplicated majority (MAE = 1.84 days) and an honest uncertainty estimate for the complex minority (MAE = 4.73 days). Its key drivers—inflammatory ratios, nutritional status, and ERAS metrics—are clinically intuitive and routinely available, supporting translation to bedside decision-support. This work offers a robust, generalizable framework for similar imbalanced prediction tasks in medicine. Future efforts should focus on external validation, dynamic updating with time-series data, and prospective implementation studies. Declarations Ethics approval and consent to participate This retrospective study was approved by the Institutional Review Board of Wuhan Union Hospital (Clinical Trial Registration: 2020-0247). The requirement for informed consent was waived due to the retrospective nature of the study. Consent for publication Not applicable. Availability of data and materials The data used to support the findings of this study are available from the corresponding author upon request. The data are not publicly available due to privacy restrictions from the hospital ethics committee. Competing interests The authors declare that they have no competing interests. Funding This study was supported by the National Natural Science Foundation of China (Young Scientists Fund) (Grant No. 82404768). Authors' contributions YG conceived and designed the study. GX and WL collected the data, performed the analysis, and drafted the manuscript. GX and WL contributed equally to this work and share first authorship. YG supervised the research, interpreted the results, and critically revised the manuscript. All authors read and approved the final manuscript. Acknowledgements The authors thank the surgical and nursing staff of the Department of Gastrointestinal Surgery at Wuhan Union Hospital for their support and collaboration. We are also grateful to the patients who participated in this study. References Sung H, Ferlay J, Siegel RL et al (2021) Global Cancer Statistics 2020: GLOBOCAN Estimates of Incidence and Mortality Worldwide for 36 Cancers in 185 Countries. CA Cancer J Clin 71:209–249 Çetinkaya-Hosgör C, Seika P, Raakow J et al (2023) Textbook Outcome after Gastrectomy for Gastric Cancer Is Associated with Improved Overall and Disease-Free Survival. J Clin Med 12:5419 Ebihara Y, Kyogoku N, Takano H et al (2025) Postoperative Complications, Including Minor Complications, Worsen Prognosis After Laparoscopic Distal Gastrectomy for Gastric Cancer. Anticancer Res 45:5619–5631 Hong QQ, Yan S, Zhao YL et al (2024) Machine learning identifies the risk of complications after laparoscopic radical gastrectomy for gastric cancer. World J Gastroenterol 30:79–90 Li SS, Udelsman BV, Parikh A et al (2020) Impact of postoperative complication and completion of multimodality therapy on survival in patients undergoing gastrectomy for gastric cancer. J Am Coll Surg 230:912–924 Lin Z, Wang Y, Chen X et al (2025) Development and validation of a machine learning model to predict postoperative complications following radical gastrectomy for gastric cancer. Front Oncol 15:1606938 Maruyama T, Ikezawa K, Suzuki H et al (2025) Explainable machine learning for predicting postoperative length of stay after gastrectomy: a nationwide study using XGBoost and SHAP. Front Med Technol 7:1732580 Zhang X, Wei X, Lin S et al (2024) Predictive model for prolonged hospital stay risk after gastric cancer surgery. Front Oncol 14:1382878 Ri M, Nunobe S, Narita T et al (2025) Time-sequential prediction of postoperative complications after gastric cancer surgery using machine learning: a multicenter cohort study. Gastric Cancer 28:1033–1045 Abdulsadig RS, Rodriguez-Villegas E (2024) A comparative study in class imbalance mitigation when working with physiological signals. Front Digit Health 6:1377165 Kumari M, Subbarao N (2022) A hybrid resampling algorithms SMOTE and ENN based deep learning models for identification of Marburg virus inhibitors. Future Med Chem 14:789–804 Collins GS, Reitsma JB, Altman DG, Moons KG (2015) Transparent reporting of a multivariable prediction model for individual prognosis or diagnosis (TRIPOD): The TRIPOD statement. BMJ 350:g7594 Dindo D, Demartines N, Clavien PA (2004) Classification of surgical complications: A new proposal with evaluation in a cohort of 6336 patients and results of a survey. Ann Surg 240:205–213 Han H, Wang WY, Mao BH (2005) Borderline-SMOTE: A new over-sampling method in imbalanced data sets learning. In: International Conference on Intelligent Computing. Berlin: Springer; :878–887 Kuncheva LI (2014) Combining Pattern Classifiers: Methods and Algorithms, 2nd edn. Wiley, Hoboken Breiman L (1996) Bagging predictors. Mach Learn 24:123–140 Lundberg SM, Lee SI (2017) A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems. Curran Associates, Red Hook, pp 4765–4774 Fukuyo R, Tokunaga M, Umebayashi Y et al (2023) Deep learning-based diagnostic model for predicting complications after gastrectomy. Asian J Endosc Surg 16:123–131 Weimann A, Braga M, Carli F et al (2021) ESPEN practical guideline: Clinical nutrition in surgery. Clin Nutr 40:4745–4761 Powers BK, Ponder HL, Findley R et al (2024) Enhanced recovery after surgery (ERAS®) Society abdominal and thoracic surgery recommendations: A systematic review and comparison of guidelines for perioperative and pharmacotherapy core items. World J Surg 48:789–801 Tables Tables are available in the Supplementary Files section. Additional Declarations The authors declare no competing interests. Supplementary Files Table.docx Table 1-4 TableS1.docx Table S1 Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-9128672","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":606356865,"identity":"bef10b32-f01c-46ee-9dae-53de551f1861","order_by":0,"name":"Gengchen Xie","email":"","orcid":"","institution":"Department of Gastrointestinal Surgery, Union Hospital, Tongji Medical College, Huazhong University of Science and Technology, Wuhan 430022, China","correspondingAuthor":false,"prefix":"","firstName":"Gengchen","middleName":"","lastName":"Xie","suffix":""},{"id":606356866,"identity":"08e251f7-492c-45ac-b389-7858c35b5fd5","order_by":1,"name":"Wei Li","email":"","orcid":"","institution":"Cancer Center, Union Hospital, Tongji Medical College, Huazhong University of Science and Technology, Wuhan 430022, China","correspondingAuthor":false,"prefix":"","firstName":"Wei","middleName":"","lastName":"Li","suffix":""},{"id":606356867,"identity":"481b5ec7-f05e-4544-a9cd-007f25822e9f","order_by":2,"name":"Yan Gong","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAwUlEQVRIiWNgGAWjYJACZgaGAwz8zMwHH5CmRbKdLdmANC0G53nMBIhSbnD87OHPBTV35IwPM5gxMNTYRBPWciYvTXrGsWfGZocZ0h4wHEvLbSCo5UCOGTMP2+HEbYcZjhswNhwmQsv5N8afef4drt/czNgmQZyWGzkG0rxthxMMmJnZiNMieeONmTRv32HDGYfZmA0SiPEL3/kcoMO+HZbn7z//8cGHGhvCWhQOIPMSCCkHAXmCho6CUTAKRsEoAADkREF7oT4DngAAAABJRU5ErkJggg==","orcid":"","institution":"Department of Pharmacy, Union Hospital, Tongji Medical College, Huazhong University of Science and Technology, 1277 Jiefang Avenue, Wuhan 430022, Hubei, China","correspondingAuthor":true,"prefix":"","firstName":"Yan","middleName":"","lastName":"Gong","suffix":""}],"badges":[],"createdAt":"2026-03-15 12:41:21","currentVersionCode":1,"declarations":{"humanSubjects":true,"vertebrateSubjects":false,"conflictsOfInterestStatement":false,"humanSubjectEthicalGuidelines":true,"humanSubjectConsent":true,"humanSubjectClinicalTrial":false,"humanSubjectCaseReport":false,"vertebrateSubjectEthicalGuidelines":false},"doi":"10.21203/rs.3.rs-9128672/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-9128672/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":104877230,"identity":"054099c7-9477-4cb0-8bea-7d4b580b7184","added_by":"auto","created_at":"2026-03-18 08:46:54","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":730668,"visible":true,"origin":"","legend":"\u003cp\u003eFigure 1 Schematic overview of the complication-stratified dual-stage ensemble framework.\u003c/p\u003e","description":"","filename":"Figure1.png","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/86e5472ed64b65ff782ca520.png"},{"id":105751836,"identity":"9443a094-6c2e-42e4-9c66-837513f45433","added_by":"auto","created_at":"2026-03-30 15:47:15","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":390080,"visible":true,"origin":"","legend":"\u003cp\u003eFigure 2 Performance of the stage 1 classifier. (\u003cstrong\u003eA\u003c/strong\u003e) ROC curves in cross-validation. (\u003cstrong\u003eB\u003c/strong\u003e) Confusion matrix on the test set.\u003c/p\u003e","description":"","filename":"Figure2.png","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/2fcbb7ad26d273b106dc5d4b.png"},{"id":104877237,"identity":"e2fcb8e2-4461-464f-b81c-caccbf0dad60","added_by":"auto","created_at":"2026-03-18 08:46:55","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":232288,"visible":true,"origin":"","legend":"\u003cp\u003eFigure 3 Cross-validation performance of regression models. (\u003cstrong\u003eA\u003c/strong\u003e) MAE comparison. (\u003cstrong\u003eB\u003c/strong\u003e) RMSE comparison. (C) R² comparison.\u003c/p\u003e","description":"","filename":"Figure3.png","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/6caa2fab48ce23e5fe358846.png"},{"id":105033787,"identity":"9cc3d3d4-ba9b-4545-bfa7-9084b8cca970","added_by":"auto","created_at":"2026-03-20 07:21:41","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":339151,"visible":true,"origin":"","legend":"\u003cp\u003eFigure 4 SHAP analysis for complication classification. (\u003cstrong\u003eA\u003c/strong\u003e) Feature importance bar chart. (\u003cstrong\u003eB\u003c/strong\u003e) Summary plot showing direction of effects.\u003c/p\u003e","description":"","filename":"Figure4.png","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/884fdf9d1c774451babefb92.png"},{"id":104877231,"identity":"e13e79ba-fecc-489a-adeb-285fe52b816c","added_by":"auto","created_at":"2026-03-18 08:46:54","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":658240,"visible":true,"origin":"","legend":"\u003cp\u003eFigure 5 Performance of the stage 2 stratified regressor. (\u003cstrong\u003eA\u003c/strong\u003e) Feature importance for LOS prediction. (\u003cstrong\u003eB\u003c/strong\u003e) SHAP summary plot for regression. (\u003cstrong\u003eC\u003c/strong\u003e) Predicted vs actual LOS on test set, stratified by complication status.\u003c/p\u003e","description":"","filename":"Figure5.png","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/3152fa908bcf26145cd8d87a.png"},{"id":106093358,"identity":"81413461-5f14-4688-9ec9-e13039d4bce0","added_by":"auto","created_at":"2026-04-03 11:36:57","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":3120952,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/e8731d75-1c47-40df-b67b-7ec59cded843.pdf"},{"id":105903901,"identity":"f9400f6b-35b7-4637-a36c-c95a8aa85075","added_by":"auto","created_at":"2026-04-01 09:57:20","extension":"docx","order_by":1,"title":"","display":"","copyAsset":false,"role":"supplement","size":32429,"visible":true,"origin":"","legend":"\u003cp\u003eTable 1-4\u003c/p\u003e","description":"","filename":"Table.docx","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/763b3f698c19c04f3f4bfd10.docx"},{"id":104877236,"identity":"144c13df-0389-4d6a-9793-a0707f080271","added_by":"auto","created_at":"2026-03-18 08:46:55","extension":"docx","order_by":2,"title":"","display":"","copyAsset":false,"role":"supplement","size":20678,"visible":true,"origin":"","legend":"\u003cp\u003eTable S1\u003c/p\u003e","description":"","filename":"TableS1.docx","url":"https://assets-eu.researchsquare.com/files/rs-9128672/v1/dbb3b05c66824fc6f52c7c02.docx"}],"financialInterests":"The authors declare no competing interests.","formattedTitle":"\u003cp\u003eA Complication-Stratified Dual-Stage Ensemble Model for Predicting Postoperative Outcomes in Gastric Cancer Surgery\u003c/p\u003e","fulltext":[{"header":"Introduction","content":"\u003cp\u003eGastric cancer remains a leading cause of cancer-related mortality worldwide, with surgical resection remaining the cornerstone of curative treatment[\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e]. Despite advances in surgical techniques and perioperative care, postoperative complications of moderate-to-severe severity occur in a consistent 15\u0026ndash;20% of patients[\u003cspan additionalcitationids=\"CR3\" citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e]. These complications are clinically consequential, leading to prolonged hospitalization, increased healthcare costs, and potential negative impacts on oncological outcomes[\u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e]. Accurate, early prediction of both complications and the ensuing length of stay (LOS) is therefore paramount for optimizing perioperative management and allocating resources efficiently.\u003c/p\u003e \u003cp\u003eA fundamental yet often underappreciated challenge in this domain is the inherent and irreducible class imbalance of the target outcome. The 15\u0026ndash;20% complication rate is not a sampling artifact that can be eliminated by collecting more data; it is an intrinsic characteristic of gastric cancer surgery that reflects clinical reality. This imbalance creates two interrelated problems for conventional predictive models. First, standard classifiers are inherently biased toward the majority class (uneventful recovery), resulting in unacceptably low recall (sensitivity) for the clinically critical minority\u0026mdash;patients who will develop complications. Second, this initial imbalance directly leads to heterogeneous LOS outcomes. A one-size-fits-all regression model cannot capture this bimodal distribution, leading to poor overall performance and clinically misleading predictions.\u003c/p\u003e \u003cp\u003eRecent machine learning applications in gastric cancer surgery have shown promise in predicting complications and LOS[\u003cspan additionalcitationids=\"CR7 CR8\" citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e]. For instance, Lin et al[\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e] recently developed a machine learning model for predicting postoperative complications following radical gastrectomy, achieving an AUC of 0.83 in a large cohort[\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e]. However, these models typically treat these outcomes in isolation or apply generic imbalance correction techniques without acknowledging the irreducible nature of the imbalance. Maruyama et al[\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e] developed a nationwide model for LOS prediction achieving an MAE of 2.82 days, but did not account for the differential recovery trajectories between complicated and uncomplicated patients[\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e]. Zhang et al[\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e] incorporated inflammatory markers but did not address the class imbalance challenge in complication prediction[\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eRecent studies have demonstrated that hybrid resampling methods such as SMOTE-ENN achieve superior stability and performance in handling class imbalance across various medical domains[\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e, \u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e]; however, their application in the specific context of gastric cancer surgery\u0026mdash;where the 15\u0026ndash;20% complication rate is an inherent clinical reality\u0026mdash;remains underexplored. The potential of a stratified approach designed around this clinical reality\u0026mdash;first accurately identifying high-risk patients and then modeling their distinct recovery patterns separately\u0026mdash;remains largely unexplored.\u003c/p\u003e \u003cp\u003eTo bridge this gap, we developed and validated a complication-stratified dual-stage ensemble model specifically designed for the irreducible class imbalance inherent to gastric cancer surgery. Our framework directly tackles the dual challenges of low event incidence and outcome heterogeneity by prioritizing high recall in the first stage and employing complication-specific regressors in the second. By building the model around the clinical reality rather than applying post-hoc corrections, we aimed to create a clinically reliable tool for personalized risk stratification and recovery planning.\u003c/p\u003e"},{"header":"Methods","content":"\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e \u003ch2\u003eStudy design and patient cohort\u003c/h2\u003e \u003cp\u003e This retrospective study was conducted at Wuhan Union Hospital and approved by the Institutional Review Board (Clinical Trial Registration: 2020\u0026thinsp;\u0026minus;\u0026thinsp;0247). We enrolled consecutive patients aged\u0026thinsp;\u0026ge;\u0026thinsp;18 years who underwent gastrectomy with lymphadenectomy for gastric cancer between September 1, 2019 and September 30, 2020. Exclusion criteria were: (1)\u0026thinsp;\u0026gt;\u0026thinsp;30% missing key data, and (2) in-hospital mortality. The final cohort consisted of 355 patients, reflecting the inherent class imbalance of interest, with a moderate-to-severe complication rate (Clavien\u0026ndash;Dindo grade II\u0026ndash;IV) of 17.5% (n\u0026thinsp;=\u0026thinsp;62). The study design and reporting follow the TRIPOD (Transparent Reporting of a multivariable prediction model for Individual Prognosis Or Diagnosis) guidelines[\u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e].\u003c/p\u003e \u003c/div\u003e\n\u003ch3\u003eData collection and outcome definitions\u003c/h3\u003e\n\u003cp\u003eA comprehensive set of 54 preoperative, intraoperative, and postoperative variables was collected by two independent researchers. Data were extracted from electronic medical records and verified through manual chart review. The complete variable list and definitions are provided in Additional file 1: Table S1. The primary outcomes were:\u003c/p\u003e \u003cp\u003e \u003col\u003e \u003cspan\u003e \u003cli\u003e \u003cp\u003e1. Complication classification: A binary indicator of moderate-to-severe complications (Clavien\u0026ndash;Dindo grade II\u0026ndash;IV vs grade 0\u0026ndash;I). Complications were graded according to the Clavien\u0026ndash;Dindo classification system[\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e] by two independent surgeons, with disagreements resolved by consensus.\u003c/p\u003e \u003c/li\u003e \u003c/span\u003e \u003cspan\u003e \u003cli\u003e \u003cp\u003e2. Hospital stay regression: Postoperative LOS, defined as days from surgery to discharge, truncated to a 1\u0026ndash;30 day range to focus on the acute postoperative phase and reduce the influence of extreme outliers.\u003c/p\u003e \u003c/li\u003e \u003c/span\u003e \u003c/ol\u003e \u003c/p\u003e \u003cp\u003eThe cohort was randomly split into training (75%, n\u0026thinsp;=\u0026thinsp;266) and independent test (25%, n\u0026thinsp;=\u0026thinsp;89) sets, using stratification to preserve the class imbalance ratio in both subsets (training: 46 complicated, 220 uncomplicated; test: 23 complicated, 66 uncomplicated).\u003c/p\u003e\n\u003ch3\u003eData preprocessing, feature engineering, and imbalance handling\u003c/h3\u003e\n\u003cp\u003eA robust preprocessing pipeline was implemented within a custom 'FeatureManager' module:\u003c/p\u003e \u003cp\u003e \u003cul\u003e \u003cli\u003e \u003cp\u003e- Imputation and outliers: Missing values were imputed using median (numeric) or mode (categorical). Features with \u0026gt;\u0026thinsp;30% missingness were excluded. Outliers were capped using the 1.5\u0026times; interquartile range method to reduce the influence of extreme values while retaining clinical information.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003e- Feature engineering: New features were constructed to capture dynamic recovery trends, including inflammatory ratios (CRP_ratio\u0026thinsp;=\u0026thinsp;CRP day 3 / CRP day 5; PCT_ratio\u0026thinsp;=\u0026thinsp;PCT day 3 / PCT day 5). These ratios were designed to reflect the trajectory of inflammation rather than absolute values, which may be more predictive of recovery patterns.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003e- Feature selection: Low-variance features and highly collinear features (Pearson correlation\u0026thinsp;\u0026gt;\u0026thinsp;0.8) were removed. The final set of 20 features (17 numeric, 3 categorical) was selected based on: (1) clinical relevance determined by literature review, (2) univariate analysis (P\u0026thinsp;\u0026lt;\u0026thinsp;0.10), and (3) recursive feature elimination with cross-validation. The selected features included demographics (age, BMI), laboratory values (hemoglobin, albumin, NLR), operative factors (operative time, blood loss), and postoperative recovery metrics (drainage duration, tube duration, feeding time, inflammatory markers).\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003e- Class imbalance mitigation (training set only): To address the inherent imbalance without distorting clinical reality, we applied Borderline-SMOTE\u0026thinsp;+\u0026thinsp;ENN (Edited Nearest Neighbors)[\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e]. Borderline-SMOTE generates synthetic samples only for minority instances near the decision boundary, focusing on the most informative regions of the feature space, while ENN cleans noisy samples from the majority class. Kolmogorov\u0026ndash;Smirnov tests confirmed no significant distribution shift between synthetic and original minority samples for any feature (all P\u0026thinsp;\u0026gt;\u0026thinsp;0.05), ensuring that the augmented data remained clinically representative.\u003c/p\u003e \u003c/li\u003e \u003c/ul\u003e \u003c/p\u003e\n\u003ch3\u003eModel development: The complication-stratified dual-stage framework\u003c/h3\u003e\n\u003cp\u003eAll models were developed using five-fold cross-validation on the training set, with hyperparameters tuned via grid search. To ensure robustness, each cross-validation fold was examined for stability; if any fold exhibited extreme deviations in performance (e.g., \u0026gt;\u0026thinsp;20% lower recall than the mean), an alternative random split was generated and the fold was re-evaluated, maintaining a final five-fold structure. Final performance was assessed on the held-out test set.\u003c/p\u003e\n\u003ch3\u003eStage 1: Recall-constrained ensemble classification\u003c/h3\u003e\n\u003cp\u003eA soft-voting ensemble classifier ('VotingClassifier') was constructed using Logistic Regression, Random Forest, GBDT, LightGBM, and XGBoost as base learners. Soft voting was chosen because it accounts for the prediction uncertainty of individual models by averaging class probabilities, which is particularly critical in imbalanced settings where single models may be overconfident in their wrong predictions[\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e]. Each base model was configured to handle imbalance (e.g., 'class_weight='balanced'' for Logistic Regression and Random Forest, 'scale_pos_weight' for gradient boosting models).\u003c/p\u003e \u003cp\u003eTo further enhance stability and generalizability, we applied bootstrap aggregating with seven rounds and an 85% sampling ratio, generating multiple perturbed versions of the training set and averaging their predictions[\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e]. This approach reduces variance and improves robustness, particularly important given the modest sample size of the complicated subgroup.\u003c/p\u003e \u003cp\u003eThe ensemble's prediction threshold was optimized over a range (0.1\u0026ndash;0.5) with a hard clinical constraint of recall\u0026thinsp;\u0026ge;\u0026thinsp;0.8 on the validation set. This prioritizes the minimization of false negatives, which is the paramount clinical goal\u0026mdash;the cost of a missed complication far outweighs the cost of enhanced monitoring for a false positive. This constraint inevitably leads to a trade-off, lowering precision and the threshold-independent AUC in favor of maximizing clinical sensitivity.\u003c/p\u003e \u003cdiv id=\"Sec8\" class=\"Section2\"\u003e \u003ch2\u003eStage 2: Complication-stratified ensemble regression\u003c/h2\u003e \u003cp\u003eTo address outcome heterogeneity, a stratified regression approach was used:\u003c/p\u003e \u003cp\u003e \u003cul\u003e \u003cli\u003e \u003cp\u003e- No complication group (Clavien\u0026ndash;Dindo 0\u0026ndash;I, ~\u0026thinsp;82.5%): A standard ensemble regressor ('VotingRegressor' combining Random Forest, LightGBM, and XGBoost) was trained to predict LOS, leveraging the homogeneous nature of this subgroup. Hyperparameters were tuned separately for this group using grid search with five-fold cross-validation.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003e- Complication group (Clavien\u0026ndash;Dindo II\u0026ndash;IV, ~\u0026thinsp;17.5%): Given the small sample size and inherent heterogeneity, a separate ensemble of shallow, heavily regularized tree models (max_depth\u0026thinsp;=\u0026thinsp;3\u0026ndash;4, min_samples_leaf\u0026thinsp;=\u0026thinsp;5\u0026ndash;10, learning_rate\u0026thinsp;=\u0026thinsp;0.01) was trained to predict LOS. This aggressive regularization mitigates the risk of overfitting while capturing the most salient patterns in this complex subgroup.\u003c/p\u003e \u003c/li\u003e \u003c/ul\u003e \u003c/p\u003e \u003cp\u003ePredictions from both models were combined based on the output of Stage 1. For patients predicted to have complications, the complication-group regressor was used; for those predicted to have no complications, the standard regressor was applied. Performance was evaluated using MAE, RMSE, and R\u0026sup2;.\u003c/p\u003e \u003c/div\u003e\n\u003ch3\u003eModel interpretation with SHAP\u003c/h3\u003e\n\u003cp\u003eTo ensure clinical transparency and trust, we employed SHapley Additive exPlanations (SHAP)[\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e]. SHAP summary plots and feature importance bar charts were generated for both the classification and regression models to identify the key drivers of complication risk and prolonged LOS, and to understand the direction of their effects.\u003c/p\u003e \u003cdiv id=\"Sec10\" class=\"Section2\"\u003e \u003ch2\u003eStatistical analysis\u003c/h2\u003e \u003cp\u003eAll results are presented as mean\u0026thinsp;\u0026plusmn;\u0026thinsp;standard deviation unless otherwise specified. Baseline characteristics were compared using independent t-tests or Mann-Whitney U tests for continuous variables (based on normality testing) and χ\u0026sup2; or Fisher's exact tests for categorical variables, as appropriate. Model performance metrics were compared using paired t-tests or Wilcoxon signed-rank tests across cross-validation folds. A two-tailed P-value\u0026thinsp;\u0026lt;\u0026thinsp;0.05 was considered statistically significant. All analyses were performed using Python 3.12.7 with scikit-learn 1.6.1, XGBoost 2.1.4, LightGBM 4.6.0, NumPy 1.26.4, Pandas 2.2.3, and SHAP 0.40.0.\u003c/p\u003e \u003c/div\u003e"},{"header":"Results","content":"\u003cdiv id=\"Sec12\" class=\"Section2\"\u003e \u003ch2\u003ePatient characteristics and outcome heterogeneity\u003c/h2\u003e \u003cp\u003eThe baseline characteristics of the 355 patients, stratified by complication status, are presented in Table\u0026nbsp;1. The cohort had a mean age of 58.85\u0026thinsp;\u0026plusmn;\u0026thinsp;9.94 years and was predominantly male (71.0%). Patients who developed complications were significantly older (61.02\u0026thinsp;\u0026plusmn;\u0026thinsp;10.58 vs 58.21\u0026thinsp;\u0026plusmn;\u0026thinsp;9.76 years, P\u0026thinsp;=\u0026thinsp;0.04), had higher ASA scores (ASA III\u0026ndash;IV: 6.45% vs 1.71%, P\u0026thinsp;=\u0026thinsp;0.04), and higher ECOG performance status (ECOG 2\u0026ndash;4: 12.90% vs 5.12%, P\u0026thinsp;=\u0026thinsp;0.03). Nutritional status was poorer in the complication group, as reflected by lower hemoglobin (109.64\u0026thinsp;\u0026plusmn;\u0026thinsp;24.62 vs 120.15\u0026thinsp;\u0026plusmn;\u0026thinsp;21.83 g/L, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), lower prealbumin (0.20\u0026thinsp;\u0026plusmn;\u0026thinsp;0.05 vs 0.23\u0026thinsp;\u0026plusmn;\u0026thinsp;0.06 g/L, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), and lower albumin (33.07\u0026thinsp;\u0026plusmn;\u0026thinsp;15.82 vs 41.05\u0026thinsp;\u0026plusmn;\u0026thinsp;12.91 g/L, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01).\u003c/p\u003e \u003cp\u003eOperative factors also differed significantly. Complicated patients underwent longer operations (327.05\u0026thinsp;\u0026plusmn;\u0026thinsp;92.41 vs 289.44\u0026thinsp;\u0026plusmn;\u0026thinsp;79.52 min, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), had greater intraoperative blood loss (179.47\u0026thinsp;\u0026plusmn;\u0026thinsp;108.53 vs 135.82\u0026thinsp;\u0026plusmn;\u0026thinsp;82.37 mL, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), and were more likely to receive intraoperative blood transfusions (20.97% vs 8.19%, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01). Postoperative recovery was markedly different, with complicated patients showing prolonged ventilation duration (4.65\u0026thinsp;\u0026plusmn;\u0026thinsp;1.82 vs 3.72\u0026thinsp;\u0026plusmn;\u0026thinsp;1.31 days, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), delayed first oral feeding (8.81\u0026thinsp;\u0026plusmn;\u0026thinsp;3.85 vs 5.98\u0026thinsp;\u0026plusmn;\u0026thinsp;2.64 days, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01), and extended drainage tube duration (12.07\u0026thinsp;\u0026plusmn;\u0026thinsp;4.51 vs 8.35\u0026thinsp;\u0026plusmn;\u0026thinsp;3.22 days, P\u0026thinsp;\u0026lt;\u0026thinsp;0.01).\u003c/p\u003e \u003cp\u003eCrucially, the data confirmed the anticipated outcome heterogeneity. Uncomplicated patients had a concentrated, shorter LOS (11.42\u0026thinsp;\u0026plusmn;\u0026thinsp;2.98 days), whereas complicated patients exhibited a highly variable and prolonged hospitalization (19.94\u0026thinsp;\u0026plusmn;\u0026thinsp;11.25 days, P\u0026thinsp;\u0026lt;\u0026thinsp;0.001). The standard deviation in the complication group was nearly four times larger than in the uncomplicated group (11.25 vs 2.98 days), and 67.74% of complicated patients had LOS\u0026thinsp;\u0026gt;\u0026thinsp;14 days compared to only 9.90% of uncomplicated patients (P\u0026thinsp;\u0026lt;\u0026thinsp;0.001). This significant difference in both the mean and variance of LOS between the two subgroups provides the fundamental rationale for our stratified regression design.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec13\" class=\"Section2\"\u003e \u003ch2\u003eStage 1: High-risk patient identification with high recall\u003c/h2\u003e \u003cp\u003eThe voting ensemble classifier demonstrated superior performance in cross-validation compared to all single base models (Table\u0026nbsp;2, Fig.\u0026nbsp;2). The ensemble achieved the highest AUC (0.81\u0026thinsp;\u0026plusmn;\u0026thinsp;0.07), surpassing Random Forest (0.77\u0026thinsp;\u0026plusmn;\u0026thinsp;0.08), Gradient Boosting (0.77\u0026thinsp;\u0026plusmn;\u0026thinsp;0.10), and LightGBM (0.77\u0026thinsp;\u0026plusmn;\u0026thinsp;0.05). Most importantly, it achieved the highest recall (0.91) while maintaining a competitive F1-score (0.48\u0026thinsp;\u0026plusmn;\u0026thinsp;0.11), meeting our pre-specified clinical constraint of recall\u0026thinsp;\u0026ge;\u0026thinsp;0.8.\u003c/p\u003e \u003cp\u003eOn the independent test set (n\u0026thinsp;=\u0026thinsp;89), the model's performance reflected its design priorities (Table\u0026nbsp;4, Fig.\u0026nbsp;2B). By applying the recall-optimized threshold, it achieved a recall of 1.00\u0026thinsp;\u0026plusmn;\u0026thinsp;0.00, correctly identifying all 23 patients with complications. This perfect sensitivity came at the cost of false positives, resulting in a precision of 0.68\u0026thinsp;\u0026plusmn;\u0026thinsp;0.12 and an F1-score of 0.81\u0026thinsp;\u0026plusmn;\u0026thinsp;0.08. Overall accuracy was 0.92\u0026thinsp;\u0026plusmn;\u0026thinsp;0.02. The AUC on the test set was 0.70\u0026thinsp;\u0026plusmn;\u0026thinsp;0.11, lower than in cross-validation but a direct consequence of the threshold optimization that prioritizes sensitivity over pure class separability.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec14\" class=\"Section2\"\u003e \u003ch2\u003eStage 2: Stratified length of stay prediction\u003c/h2\u003e \u003cp\u003eIn cross-validation, the voting regressor outperformed all single models, achieving the lowest MAE (1.72\u0026thinsp;\u0026plusmn;\u0026thinsp;0.15 days), lowest RMSE (2.41\u0026thinsp;\u0026plusmn;\u0026thinsp;0.14 days), and highest R\u0026sup2; (0.46) (Table\u0026nbsp;3, Fig.\u0026nbsp;3).\u003c/p\u003e \u003cp\u003eOn the independent test set, the full stratified framework yielded an overall MAE of 2.56\u0026thinsp;\u0026plusmn;\u0026thinsp;0.23 days, RMSE of 3.55\u0026thinsp;\u0026plusmn;\u0026thinsp;0.49 days, and R\u0026sup2; of 0.38\u0026thinsp;\u0026plusmn;\u0026thinsp;0.17 (Table\u0026nbsp;4, Fig.\u0026nbsp;5C). However, stratified analysis revealed the true value of the approach:\u003c/p\u003e \u003cp\u003e \u003cul\u003e \u003cli\u003e \u003cp\u003e- For the 66 uncomplicated patients: The model was highly accurate, with MAE of 1.84\u0026thinsp;\u0026plusmn;\u0026thinsp;0.22 days. This level of precision\u0026mdash;an average error of less than \u0026plusmn;\u0026thinsp;1.8 days\u0026mdash;is clinically actionable for discharge planning.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003e- For the 23 complicated patients: The MAE was higher at 4.73\u0026thinsp;\u0026plusmn;\u0026thinsp;0.49 days, reflecting the genuine clinical unpredictability and variability in this subgroup's recovery.\u003c/p\u003e \u003c/li\u003e \u003c/ul\u003e \u003c/p\u003e \u003cp\u003eThe stark contrast in prediction accuracy between subgroups (MAE 1.84 vs 4.73 days) validates our stratified approach and highlights the necessity of modeling these populations separately.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec15\" class=\"Section2\"\u003e \u003ch2\u003eModel interpretation and key predictive features\u003c/h2\u003e \u003cp\u003eSHAP analysis provided critical insights into the model's inner workings and confirmed clinical face validity.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec16\" class=\"Section2\"\u003e \u003ch2\u003eComplication classification (Fig.\u0026nbsp;4)\u003c/h2\u003e \u003cp\u003eThe top predictors of complication risk were inflammatory ratios, nutritional status, and surgical factors (Fig.\u0026nbsp;4A). 'crp_ratio' was the most important feature, followed by 'pct_ratio', 'enr' (energy to nitrogen ratio), 'drainage' duration, and 'operative time'. High values of 'crp_ratio' and 'pct_ratio' were associated with increased complication risk, while high 'enr' was associated with decreased risk (Fig.\u0026nbsp;4B).\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec17\" class=\"Section2\"\u003e \u003ch2\u003eLOS regression (Fig.\u0026nbsp;5A, 5B)\u003c/h2\u003e \u003cp\u003eThe most important features for predicting LOS were clinically intuitive recovery metrics (Fig.\u0026nbsp;5A): 'drainage' tube duration, 'gastrictube' duration, 'hb' (hemoglobin) levels, time to 'firstfeed', and 'crp_ratio'. Prolonged drainage and tube durations, low hemoglobin, delayed first feeding, and high crp_ratio were all associated with longer LOS.\u003c/p\u003e \u003c/div\u003e"},{"header":"Discussion","content":"\u003cp\u003eIn this study, we developed and validated a novel dual-stage, complication-stratified ensemble model that directly confronts the challenges posed by irreducible class imbalance in gastric cancer surgery. Rather than treating imbalance as a mere data preprocessing nuisance, our framework was designed around this clinical reality. This design philosophy yielded two principal findings. First, by prioritizing recall through constrained threshold optimization and ensemble learning, the first-stage classifier successfully identified all high-risk patients in the test set (recall\u0026thinsp;=\u0026thinsp;1.00), effectively overcoming the bias of conventional models toward the majority class. Second, by stratifying the subsequent LOS prediction, we achieved precise and clinically meaningful estimates for both the homogeneous uncomplicated group (MAE\u0026thinsp;=\u0026thinsp;1.84 days) and the inherently more variable complicated group (MAE\u0026thinsp;=\u0026thinsp;4.73 days).\u003c/p\u003e \u003cdiv id=\"Sec19\" class=\"Section2\"\u003e \u003ch2\u003eConfronting irreducible class imbalance with a clinical mandate\u003c/h2\u003e \u003cp\u003eThe irreducible 15\u0026ndash;20% complication rate in gastric cancer surgery is not a problem to be \"solved\" by collecting more data, but a clinical reality that must be accommodated by model design. Our approach, combining Borderline-SMOTE\u0026thinsp;+\u0026thinsp;ENN, soft voting, and recall-constrained threshold optimization, aligns with recent findings that hybrid resampling methods achieve superior stability in imbalanced medical tasks[\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e, \u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eThe test recall of 1.00 demonstrates that near-perfect sensitivity is achievable, ensuring that no high-risk patient is missed. This performance compares favorably with recent studies[21,22]. The trade-off\u0026mdash;precision of 0.68\u0026mdash;is clinically acceptable: among 10 patients flagged as high-risk, approximately 7 will truly develop complications, while three false positives receive low-risk enhanced monitoring. Given that enhanced monitoring is low-cost compared to the consequences of a missed complication, this trade-off is ethically and clinically justified.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec20\" class=\"Section2\"\u003e \u003ch2\u003eFrom risk to recovery: The necessity of stratified prediction\u003c/h2\u003e \u003cp\u003eThe profound heterogeneity in LOS between groups demonstrates that a unified regression model is fundamentally misspecified. Our stratified approach provides precise, actionable predictions for uncomplicated patients (MAE\u0026thinsp;~\u0026thinsp;1.84 days)\u0026mdash;a 35% improvement over a nationwide study[\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e]\u0026mdash;while the higher MAE for complicated patients (~\u0026thinsp;4.73 days) honestly reflects clinical reality and signals the need for dynamic management.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec21\" class=\"Section2\"\u003e \u003ch2\u003eMethodological choices: Soft voting, bootstrap aggregating, and stratification\u003c/h2\u003e \u003cp\u003eSoft voting leveraged probabilistic outputs to reduce overconfident misclassification[\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e], with the voting classifier outperforming all individual models. Bootstrap aggregating enhanced stability[\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e], confirmed by low standard deviations across cross-validation folds. The stratified regression design explicitly models two fundamentally different distributions, validated by the dramatic MAE difference between subgroups.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec22\" class=\"Section2\"\u003e \u003ch2\u003eClinical interpretability and face validity\u003c/h2\u003e \u003cp\u003eModel drivers align with clinical knowledge. CRP and PCT ratios capture inflammatory trajectories, outperforming static values[8,21]. Higher Energy to Nitrogen Ratio underscores balanced nutrition's protective effect[\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e], supporting ERAS guidelines[23]. Actionable metrics like drainage tube duration reinforce ERAS principles[24].\u003c/p\u003e \u003cdiv id=\"Sec23\" class=\"Section3\"\u003e \u003ch2\u003eComparison with recent gastric cancer prediction studies\u003c/h2\u003e \u003cp\u003eOur study advances the field beyond recent models[\u003cspan additionalcitationids=\"CR7\" citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e] by confronting both class imbalance and outcome heterogeneity. Lin et al[\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e] achieved AUC 0.83 but did not address LOS heterogeneity. Maruyama et al[\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e] developed a nationwide LOS model but could not capture bimodal recovery trajectories. Zhang et al[\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e] proposed a nomogram but lacked ensemble learning and imbalance handling. In contrast, our stratified dual-stage framework directly confronts both challenges inherent to gastric cancer surgery.\u003c/p\u003e \u003c/div\u003e \u003c/div\u003e \u003cdiv id=\"Sec24\" class=\"Section2\"\u003e \u003ch2\u003eLimitations and future directions\u003c/h2\u003e \u003cp\u003eThis study has several limitations. First, its single-center retrospective design limits generalizability; multi-center validation across five tertiary hospitals is planned. Second, the modest sample size, particularly for the complicated subgroup (n\u0026thinsp;=\u0026thinsp;62), limited model complexity. Third, incorporating postoperative time-series data could improve complicated-group predictions[22]. Fourth, the AUC drop from cross-validation (0.81) to test set (0.70) reflects the difficulty of generalizing from a small synthetic-augmented minority class. Finally, prospective implementation studies are needed to assess real-world impact on decision-making and outcomes.\u003c/p\u003e \u003c/div\u003e"},{"header":"Conclusions","content":"\u003cp\u003eWe present a clinically driven, complication-stratified dual-stage ensemble model tailored to the irreducible class imbalance in gastric cancer surgery. By prioritizing identification of all high-risk patients and modeling their recovery separately, the framework delivers precise LOS predictions for the uncomplicated majority (MAE\u0026thinsp;=\u0026thinsp;1.84 days) and an honest uncertainty estimate for the complex minority (MAE\u0026thinsp;=\u0026thinsp;4.73 days). Its key drivers\u0026mdash;inflammatory ratios, nutritional status, and ERAS metrics\u0026mdash;are clinically intuitive and routinely available, supporting translation to bedside decision-support. This work offers a robust, generalizable framework for similar imbalanced prediction tasks in medicine. Future efforts should focus on external validation, dynamic updating with time-series data, and prospective implementation studies.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e\u003cstrong\u003eEthics approval and consent to participate\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThis retrospective study was approved by the Institutional Review Board of Wuhan Union Hospital (Clinical Trial Registration: 2020-0247). The requirement for informed consent was waived due to the retrospective nature of the study.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConsent for publication\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNot applicable.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAvailability of data and materials\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe data used to support the findings of this study are available from the corresponding author upon request. The data are not publicly available due to privacy restrictions from the hospital ethics committee.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eCompeting interests\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare that they have no competing interests.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThis study was supported by the National Natural Science Foundation of China (Young Scientists Fund) (Grant No. 82404768).\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAuthors\u0026apos; contributions\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eYG conceived and designed the study. GX and WL collected the data, performed the analysis, and drafted the manuscript. GX and WL contributed equally to this work and share first authorship. YG supervised the research, interpreted the results, and critically revised the manuscript. All authors read and approved the final manuscript.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAcknowledgements\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors thank the surgical and nursing staff of the Department of Gastrointestinal Surgery at Wuhan Union Hospital for their support and collaboration. We are also grateful to the patients who participated in this study.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eSung H, Ferlay J, Siegel RL et al (2021) Global Cancer Statistics 2020: GLOBOCAN Estimates of Incidence and Mortality Worldwide for 36 Cancers in 185 Countries. CA Cancer J Clin 71:209\u0026ndash;249\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003e\u0026Ccedil;etinkaya-Hosg\u0026ouml;r C, Seika P, Raakow J et al (2023) Textbook Outcome after Gastrectomy for Gastric Cancer Is Associated with Improved Overall and Disease-Free Survival. J Clin Med 12:5419\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eEbihara Y, Kyogoku N, Takano H et al (2025) Postoperative Complications, Including Minor Complications, Worsen Prognosis After Laparoscopic Distal Gastrectomy for Gastric Cancer. Anticancer Res 45:5619\u0026ndash;5631\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHong QQ, Yan S, Zhao YL et al (2024) Machine learning identifies the risk of complications after laparoscopic radical gastrectomy for gastric cancer. World J Gastroenterol 30:79\u0026ndash;90\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLi SS, Udelsman BV, Parikh A et al (2020) Impact of postoperative complication and completion of multimodality therapy on survival in patients undergoing gastrectomy for gastric cancer. J Am Coll Surg 230:912\u0026ndash;924\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLin Z, Wang Y, Chen X et al (2025) Development and validation of a machine learning model to predict postoperative complications following radical gastrectomy for gastric cancer. Front Oncol 15:1606938\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMaruyama T, Ikezawa K, Suzuki H et al (2025) Explainable machine learning for predicting postoperative length of stay after gastrectomy: a nationwide study using XGBoost and SHAP. Front Med Technol 7:1732580\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eZhang X, Wei X, Lin S et al (2024) Predictive model for prolonged hospital stay risk after gastric cancer surgery. Front Oncol 14:1382878\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eRi M, Nunobe S, Narita T et al (2025) Time-sequential prediction of postoperative complications after gastric cancer surgery using machine learning: a multicenter cohort study. Gastric Cancer 28:1033\u0026ndash;1045\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAbdulsadig RS, Rodriguez-Villegas E (2024) A comparative study in class imbalance mitigation when working with physiological signals. Front Digit Health 6:1377165\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKumari M, Subbarao N (2022) A hybrid resampling algorithms SMOTE and ENN based deep learning models for identification of Marburg virus inhibitors. Future Med Chem 14:789\u0026ndash;804\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eCollins GS, Reitsma JB, Altman DG, Moons KG (2015) Transparent reporting of a multivariable prediction model for individual prognosis or diagnosis (TRIPOD): The TRIPOD statement. BMJ 350:g7594\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDindo D, Demartines N, Clavien PA (2004) Classification of surgical complications: A new proposal with evaluation in a cohort of 6336 patients and results of a survey. Ann Surg 240:205\u0026ndash;213\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHan H, Wang WY, Mao BH (2005) Borderline-SMOTE: A new over-sampling method in imbalanced data sets learning. In: International Conference on Intelligent Computing. Berlin: Springer; :878\u0026ndash;887\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKuncheva LI (2014) Combining Pattern Classifiers: Methods and Algorithms, 2nd edn. Wiley, Hoboken\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBreiman L (1996) Bagging predictors. Mach Learn 24:123\u0026ndash;140\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLundberg SM, Lee SI (2017) A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems. Curran Associates, Red Hook, pp 4765\u0026ndash;4774\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFukuyo R, Tokunaga M, Umebayashi Y et al (2023) Deep learning-based diagnostic model for predicting complications after gastrectomy. Asian J Endosc Surg 16:123\u0026ndash;131\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eWeimann A, Braga M, Carli F et al (2021) ESPEN practical guideline: Clinical nutrition in surgery. Clin Nutr 40:4745\u0026ndash;4761\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePowers BK, Ponder HL, Findley R et al (2024) Enhanced recovery after surgery (ERAS\u0026reg;) Society abdominal and thoracic surgery recommendations: A systematic review and comparison of guidelines for perioperative and pharmacotherapy core items. World J Surg 48:789\u0026ndash;801\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"},{"header":"Tables","content":"\u003cp\u003eTables are available in the Supplementary Files section.\u003c/p\u003e"}],"fulltextSource":"","fullText":"","funders":[{"identity":"1543c53d-3426-4d34-af85-3e71b690904f","identifier":"10.13039/501100001809","name":"National Natural Science Foundation of China","awardNumber":"82404768","order_by":0}],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"Wuhan Union Hospital","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Gastric cancer, Postoperative complications, Irreducible class imbalance, Ensemble learning, Length of stay prediction, SHAP","lastPublishedDoi":"10.21203/rs.3.rs-9128672/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-9128672/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003e\u003cstrong\u003eBackground:\u003c/strong\u003e Postoperative complications after gastric cancer surgery are characterized by an inherent and irreducible class imbalance (15–20%), which leads to low sensitivity for high-risk patients and heterogeneous length-of-stay (LOS) trajectories. This study aimed to develop and validate a complication-stratified dual-stage ensemble model addressing these methodological challenges.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eMethods:\u003c/strong\u003e In this retrospective study of 355 gastrectomy patients, we implemented a two-stage framework: (1) a recall-constrained soft-voting ensemble classifier (Logistic Regression, Random Forest, GBDT, LightGBM, XGBoost) for predicting moderate-to-severe complications (Clavien–Dindo ≥II), using Borderline-SMOTE+ENN to handle imbalance; and (2) a complication-stratified ensemble regressor for LOS prediction. Soft voting and bootstrap aggregating (7 rounds, 85% sampling) enhanced stability. Performance was assessed via five-fold cross-validation with stability checks and an independent test set (n=89). SHAP provided interpretability.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eResults:\u003c/strong\u003e The cohort's complication rate was 17.5% (62/355). The classifier achieved cross-validation recall of 0.91 and, after threshold optimization, test recall of 1.00 ± 0.00 (identifying all 23 complicated test patients), with precision 0.68 ± 0.12 and F1-score 0.81 ± 0.08. The stratified regressor yielded overall test MAE of 2.56 ± 0.23 days, with precise prediction for uncomplicated patients (MAE = 1.84 ± 0.22 days) and an honest estimate for complicated patients (MAE = 4.73 ± 0.49 days). SHAP identified inflammatory ratios (CRP_ratio, PCT_ratio) and recovery metrics (drainage duration, oral feeding time) as key predictors.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConclusions:\u003c/strong\u003e This study presents a generalizable strategy for handling irreducible class imbalance by designing models around clinical realities. The framework achieves meaningful improvements in risk stratification and LOS prediction for gastric cancer surgery, with potential to enhance patient care and resource allocation.\u003c/p\u003e","manuscriptTitle":"A Complication-Stratified Dual-Stage Ensemble Model for Predicting Postoperative Outcomes in Gastric Cancer Surgery","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-03-18 08:46:45","doi":"10.21203/rs.3.rs-9128672/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"88d9488e-3d52-4cc8-bbfc-d80abb1ff00e","owner":[],"postedDate":"March 18th, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[{"id":64526258,"name":"Gastrointestinal Surgery"}],"tags":[],"updatedAt":"2026-03-18T08:46:46+00:00","versionOfRecord":[],"versionCreatedAt":"2026-03-18 08:46:45","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-9128672","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-9128672","identity":"rs-9128672","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.