Abstract
Background
Inguinal hernia repair, particularly transabdominal preperitoneal (TAPP) repair, is a common surgical procedure. However, seroma formation remains a frequent postoperative complication, impacting patient recovery and increasing healthcare burden. Accurate prediction of seroma formation is crucial for personalized patient management and improved outcomes.
Objective
This study aimed to develop and validate machine learning (ML)-based predictive models for seroma formation following TAPP inguinal hernia repair.
Methods
A retrospective cohort of patients undergoing TAPP repair was analyzed. Demographic, clinical, laboratory, and surgical data were collected. Data preprocessing included handling missing values and encoding categorical variables. Feature selection was performed using LASSO regression and multivariate logistic regression. Five distinct machine learning algorithms—Logistic Regression (LR), Decision Tree (DT), eXtreme Gradient Boosting (XGBoost), Support Vector Machine (SVM), and K-Nearest Neighbors (KNN)—were developed and evaluated. Model performance was assessed using various metrics, including Accuracy, Sensitivity, Specificity, Precision, Recall, F1-score, Receiver Operating Characteristic (ROC) curves, Area Under the Curve (AUC), Precision-Recall (PR) curves, Calibration curves, and Decision Curve Analysis (DCA). SHapley Additive exPlanations (SHAP) were employed to interpret the models and identify key influential features.
Results
A total of 167 patients were included in the study, divided into training (n = 133) and validation (n = 34) sets. Multivariate analysis identified several independent risk factors for seroma formation, including Diabetes, Smoking, Age, Hemoglobin, and sac diameter. Among the developed ML models, XGBoost consistently demonstrated superior predictive performance with an AUC of 0.979 (0.961–0.997) on the training set and 0.746 (0.557–0.935) on the test set. SHAP analysis revealed that sac diameter, Hemoglobin, Age, Diabetes, and Smoking were the most significant features influencing seroma prediction.
Conclusion
Machine learning models, particularly XGBoost, can accurately predict seroma formation after TAPP inguinal hernia repair. The identified risk factors and the developed predictive models have the potential to facilitate early risk stratification, guide clinical decision-making, and ultimately improve patient outcomes by enabling targeted preventive strategies.
Supplementary Information
The online version contains supplementary material available at 10.1186/s12893-026-03555-2.
Keywords: Machine Learning, XGBoost, Seroma Formation, Transabdominal Preperitioneal Repair
Introduction
Inguinal hernia is one of the most common interventional conditions worldwide, with millions of repairs performed annually [1]. Transabdominal preperitoneal (TAPP) repair has gained widespread acceptance due to its minimally invasive nature, reduced postoperative pain, and faster recovery times compared to open approaches [2, 3]. Despite its advantages, TAPP repair is not without complications [4]. Seroma manifestation, defined as the accumulation of sterile lymphatic fluid and/or liquefied fat in the procedural site, is a frequent postoperative adverse event. Prior studies have reported a wide range of seroma incidence depending on definitions and the assessment window (e.g., early ultrasonography versus clinical diagnosis) [3, 4]. While often benign and self-limiting, large or symptomatic seromas can lead to individual discomfort, prolonged recovery, increased risk of infection, delayed wound healing, and may necessitate aspiration or further treatment, thereby increasing healthcare costs and individual morbidity [5, 6].
The exact anticipation of seroma occurrence remains an important challenge in healthcare practice [7]. Traditional methods of risk appraisal often rely on medical experience and the identification of a limited number of risk factors through conventional statistical analyses [8]. Nevertheless, these approaches may not fully capture the complex interplay of various patient-specific and interventional factors contributing to seroma development [7, 9]. Existing literature has identified several potential risk factors, including case demographics (e.g., age, BMI), comorbidities (e.g., diabetes, hypertension), hernia characteristics (e.g., size, type, content), and interventional techniques (e.g., mesh type, fixation procedure, sac administration) [10]. Nevertheless, the predictive power of these individual factors or simple scoring systems is often insufficient for precise susceptibility stratification.
In recent years, machine learning (ML) has emerged as a powerful tool in medical research, offering advanced analytical capabilities to recognize complex patterns and relationships within large datasets [10, 11]. ML algorithms can build sophisticated predictive models by learning from existing data, thereby providing more exact and robust susceptibility predictions compared to traditional statistical methods [2, 6]. The application of ML in various invasive fields, including hernia surgery, is rapidly expanding, demonstrating its potential to enhance diagnostic accuracy, predict therapeutic outcomes, and personalize participant care [12, 13].
Given the therapeutic significance of seroma occurrence and the limitations of current predictive approaches, there is a pressing need for more productive tools to discover patients at high risk [14]. This investigation aims to address this gap by developing and validating machine learning-based predictive models for seroma appearance following TAPP inguinal hernia repair [15]. By leveraging an extensive dataset of participant characteristics and invasive details, we sought to recognize key predictors and construct robust models that can accurately forecast seroma development, ultimately facilitating proactive oversight strategies and improving subject outcomes [16, 17].
Materials and methods
Study population and data collection
This retrospective cohort examination included patients who underwent transabdominal preperitoneal (TAPP) inguinal hernia repair at Hefei Second People’s Hospital between January 2023 and December 2024. The investigation protocol was approved by the Institutional Review Board of Hefei Second People’s Hospital (Approval No. [Approval Number, 2024kyc025]), and the requirement for informed consent was waived due to the retrospective nature of the examination. Inclusion criteria were adult patients (≥ 18 years old) who underwent primary unilateral or bilateral TAPP inguinal hernia repair. Exclusion criteria included patients with recurrent hernia, incarcerated or strangulated hernia requiring emergency surgery, previous abdominal surgery that might interfere with TAPP approach, or incomplete medical records .
This retrospective single-center study did not use an a priori sample size calculation. Instead, we included all eligible cases within the study period with complete data. To mitigate overfitting, we employed grid-searched 5-fold cross-validation within the training set and evaluated generalization on a held-out test set (~ 20%). Reporting follows the TRIPOD statement (prediction model development and validation) and is aligned with STROBE for observational aspects. A completed TRIPOD checklist is provided in Supplementary Appendix S-TRIPOD.
Demographic, therapeutic, laboratory, and interventional data were extracted from the electronic medical records. The collected variables included age, gender, body mass index (BMI), comorbidities (diabetes, hypertension), lifestyle factors (smoking, alcohol consumption), preoperative laboratory parameters (white blood cell count (WBC), neutrophil percentage, lymphocyte percentage, hemoglobin, platelet count, C-reactive protein (CRP), glucose, creatinine, blood urea nitrogen (BUN)), hernia characteristics (type, content, sac diameter, bilaterality, reducibility), planned mesh type, and anesthesia type [18, 19]. The primary outcome was a clinically or ultrasonographically confirmed seroma within 3 months requiring aspiration or related clinical treatment [20, 21]. All data were anonymized to protect case privacy. Both cohorts were derived from the same catchment area and practice patterns, reflecting the background population of adults undergoing elective TAPP at our institution.
Data preprocessing and feature selection
Prior to model development, the raw dataset underwent a series of preprocessing steps. Patients with incomplete clinical data were excluded from the analysis and not included in this study. For the remaining cohort, missing values were addressed using appropriate imputation methods. Categorical variables were transformed into numerical representations using suitable encoding strategies, such as one-hot encoding for nominal variables and ordinal encoding for ordered variables. Candidate predictors were pre-specified based on clinical relevance and prior literature: Age, Gender, BMI, Diabetes, Hypertension, Smoking, Alcohol, WBC, Neutrophil percentage, Lymphocyte percentage, Hemoglobin, Platelet, CRP, Glucose, Creatinine, BUN, Hernia type, Hernia content, sac diameter, Bilateral hernia, Reducible status, Planned mesh type, and Anesthesia type. The primary outcome (seroma within 3 months requiring clinical intervention) was defined prior to analysis. No missing values were observed across all variables; therefore, complete-case analysis coincided with using the full dataset (n = 167).
We used an ~ 80/20 random split to balance model estimation and independent evaluation, and applied 5-fold cross-validation within the training set for hyperparameter tuning. Baseline characteristics were summarized descriptively. Group comparisons were planned but are reported in § 3.1.The distribution of baseline characteristics between the training and corroboration sets was compared to confirm homogeneity, as detailed in Table 1. Statistical investigation (e.g., chi-square test for categorical variables and t-test or Mann-Whitney U test for continuous variables) was performed to ensure no considerable differences existed between the two sets, thus minimizing potential bias in algorithm evaluation [3].
Table 1.
Baseline characteristics of the cohort
| [ALL] N = 167 | Test N = 34 | Train N = 133 | p.overall | |
|---|---|---|---|---|
| Gender | 0.909 | |||
| 0 | 107 (64.07%) | 21 (61.76%) | 86 (64.66%) | |
| 1 | 60 (35.93%) | 13 (38.24%) | 47 (35.34%) | |
| BMI(kg/m²) | 26.80 [22.80;30.50] | 26.50 [24.23;28.77] | 27.10 [22.60;30.50] | 0.842 |
| Diabetes: | 0.479 | |||
| 0 | 128 (76.65%) | 24 (70.59%) | 104 (78.20%) | |
| 1 | 39 (23.35%) | 10 (29.41%) | 29 (21.80%) | |
| Hypertension: | 0.562 | |||
| 0 | 122 (73.05%) | 23 (67.65%) | 99 (74.44%) | |
| 1 | 45 (26.95%) | 11 (32.35%) | 34 (25.56%) | |
| Smoking: | 0.561 | |||
| 0 | 103 (61.68%) | 19 (55.88%) | 84 (63.16%) | |
| 1 | 64 (38.32%) | 15 (44.12%) | 49 (36.84%) | |
| Age: | 0.703 | |||
| 0 | 86 (51.50%) | 19 (55.88%) | 67 (50.38%) | |
| 1 | 81 (48.50%) | 15 (44.12%) | 66 (49.62%) | |
| WBC(×10^9/L) | 8.30 [6.30;10.15] | 7.50 [5.62;10.28] | 8.50 [6.50;10.10] | 0.474 |
| Neutrophil_Percentage | 54.50 [47.15;65.45] | 57.10 [47.53;65.62] | 54.10 [47.20;65.10] | 0.445 |
| Alcohol: | 0.289 | |||
| 0 | 104 (62.28%) | 18 (52.94%) | 86 (64.66%) | |
| 1 | 63 (37.72%) | 16 (47.06%) | 47 (35.34%) | |
| Hemoglobin(g/L) | 136.70 [122.80;150.40] | 135.10 [124.10;148.48] | 136.90 [122.80;150.60] | 0.784 |
| Lymphocyte_Percentage | 30.70 [23.50;38.55] | 30.05 [23.65;39.08] | 30.70 [23.50;38.20] | 0.847 |
| CRP(mg/L) | 4.50 [2.35;6.95] | 4.20 [2.73;6.60] | 4.70 [2.20;7.00] | 0.746 |
| Platelet(×10^9/L) | 262.00 [199.00;317.50] | 294.00 [219.50;331.50] | 255.00 [199.00;315.00] | 0.291 |
| Glucose(mmol/L) | 5.80 [4.70;7.00] | 5.80 [4.78;7.18] | 5.70 [4.70;7.00] | 0.767 |
| BUN(mmol/L) | 6.00 [3.35;8.05] | 6.00 [3.23;7.90] | 6.00 [3.50;8.20] | 0.559 |
| Hernia_Type | 0.00 [0.00;2.00] | 0.50 [0.00;2.75] | 0.00 [0.00;2.00] | 0.560 |
| Hernia_Content | 1.00 [0.00;2.00] | 1.00 [0.25;1.75] | 1.00 [0.00;2.00] | 0.547 |
| Sac_Diameter(cm) | 8.50 [3.95;12.05] | 9.75 [4.90;11.50] | 8.20 [3.70;12.30] | 0.952 |
| Creatinine(µmol/L) | 74.60 [56.35;100.00] | 72.55 [55.97;100.22] | 74.90 [57.30;99.50] | 0.869 |
| Reducible: | 0.539 | |||
| 0 | 113 (67.66%) | 25 (73.53%) | 88 (66.17%) | |
| 1 | 54 (32.34%) | 9 (26.47%) | 45 (33.83%) | |
| Planned_Mesh_Type | 1.00 [0.00;2.00] | 1.00 [0.00;3.00] | 1.00 [0.00;2.00] | 0.363 |
| Bilateral_Hernia: | 1.000 | |||
| 0 | 136 (81.44%) | 28 (82.35%) | 108 (81.20%) | |
| 1 | 31 (18.56%) | 6 (17.65%) | 25 (18.80%) | |
| Anesthesia_Type: | 0.573 | |||
| 0 | 96 (57.49%) | 18 (52.94%) | 78 (58.65%) | |
| 1 | 39 (23.35%) | 11 (32.35%) | 28 (21.05%) | |
| 2 | 21 (12.57%) | 3 (8.82%) | 18 (13.53%) | |
| 3 | 11 (6.59%) | 2 (5.88%) | 9 (6.77%) |
Coding Gender (0=female,1=male);Diabetes/Hypertension/Smoking/Alcohol/Bilateral_hernia/Reducible/Outcome(0 = no,1 = yes). Anesthesia_Type (0–3) and Planned_Mesh_Type (0–4) are categorical labels defined by institutional protocols; Continuous variables are presented as median [interquartile range], and categorical variables as count (percentage). P-values indicate comparisons between the Test and Train sets
Feature selection was a critical step to discover the most relevant predictors and reduce approach complexity. Two primary methods were employed: LASSO (Least Absolute Shrinkage and Selection Operator) regression and multivariate logistic regression [3, 7]. LASSO regression was employed to select features by penalizing the absolute size of the regression coefficients, effectively shrinking some coefficients to zero and thus performing variable selection [7].
Figure 1A illustrates the coefficient profiles of all included variables across a series of log(λ) values. As the regularization parameter increases, the coefficients of less contributive variables are progressively shrunk toward zero, indicating the inherent feature selection capability of the LASSO method. Variables with coefficients that remain non-zero at optimal λ are considered potentially informative predictors for seroma formation.
Fig. 1.
LASSO feature selection for postoperative seroma formation after TAPP repair. A LASSO coefficient profiles of candidate variables plotted against log(lambda). B Ten-fold cross-validation plot for tuning parameter selection in the LASSO model, with the optimal lambda values indicated by the dotted vertical lines
Figure 1B displays the 10-fold cross-validation curve, plotting the binomial deviance against log(λ). The two vertical dashed lines represent the λ values corresponding to the minimum deviance and one standard error above the minimum. These values were used to determine the optimal penalization level for feature selection.
LASSO regression served as a preliminary feature selection step, reducing the dimensionality of candidate predictors while preserving interpretability and minimizing overfitting. Following LASSO, multivariate logistic regression was performed to further identify independent risk factors associated with postoperative seroma formation. The statistically significant predictors (p < 0.05) were included in the final model, and results are presented in Table 2 and visualized in the forest plot (Fig. 2).
Table 2.
Multivariate logistic regression analysis results
| Characteristic | B | SE | OR | CI (95%) | Z | P |
|---|---|---|---|---|---|---|
| Glucose | -0.070 | 0.2077 | 0.932 | 0.614–1.399 | -0.339 | 0.735 |
| Gender | -0.173 | 0.57466 | 0.841 | 0.267–2.603 | -0.302 | 0.763 |
| Lymphocyte_Percentage | -0.008 | 0.03153 | 0.992 | 0.931–1.055 | -0.256 | 0.798 |
| Reducible | -0.102 | 0.59993 | 0.903 | 0.270–2.916 | -0.169 | 0.866 |
| BMI | 0.552 | 0.395 | 1.06 | 0.93, 1.22 | 1.4 | 0.347 |
| Diabetes | 0.147 | 0.317 | 5.59 | 1.64, 21.76 | 0.46 | 0.008 |
| Hypertension | 1.394 | 0.526 | 1.44 | 0.40, 5.04 | -1.42 | 0.569 |
| Smoking | 0.097 | 0.19 | 0.23 | 0.06, 0.75 | 2.65 | 0.019 |
| Age | 2.154 | 0.165 | 7.14 | 2.19, 28.45 | 0.51 | 0.002 |
| Alcohol | 1.021 | 0.395 | 3.02 | 0.99, 9.86 | 13.07 | 0.057 |
| WBC | -0.389 | 0.171 | 1.10 | 0.87, 1.40 | 2.59 | 0.436 |
| Neutrophil_Percentage | -0.149 | 0.357 | 0.96 | 0.91, 1.02 | -2.28 | 0.181 |
| Hemoglobin | 0.127 | 0.27 | 1.06 | 1.02, 1.10 | -0.42 | 0.003 |
| Platelet | 1.394 | 0.526 | 1.00 | 0.99, 1.00 | 0.47 | 0.443 |
| CRP | 1.04 | 0.85, 1.28 | 0.683 | |||
| Creatinine | 0.99 | 0.97, 1.02 | 0.639 | |||
| Hernia_Type | 1.18 | 0.80, 1.72 | 0.397 | |||
| Hernia_Content | 0.82 | 0.48, 1.34 | 0.434 | |||
| Sac_Diameter | 1.29 | 1.12, 1.52 | < 0.001 | |||
| Bilateral_Hernia | 0.30 | 0.05, 1.57 | 0.178 | |||
| Planned_Mesh_Type | 0.72 | 0.46, 1.08 | 0.127 | |||
| BUN | 1.07 | 0.86, 1.35 | 0.535 | |||
| Anesthesia_Type | 0.78 | 0.40, 1.45 | 0.449 |
B unstandardized coefficient, SE standard error, OR odds ratio, CI confidence interval, Z Wald Z-score, P p-value
Fig. 2.
Forest plot of multivariate logistic regression analysis
This forest plot displays the odds ratios and 95% confidence intervals for all variables included in the multivariate logistic regression analysis. Variables with statistically significant associations (p < 0.05) with seroma formation are highlighted, including Diabetes, Smoking, Age, Hemoglobin, and sac diameter.
Machine learning model development
We pre-specified a diverse yet compact model set to balance interpretability and performance: LR (transparent linear baseline), DT (human-readable nonlinearity), XGBoost (state-of-the-art tree ensemble with strong tabular performance), SVM (margin-maximizing classifier with kernel flexibility), and KNN (instance-based baseline). All hyperparameters were tuned via grid-searched 5-fold cross-validation in the training set.
Five widely used machine learning algorithms were developed to predict seroma development: Logistic Regression (LR), Decision Tree (DT), eXtreme Gradient Boosting (XGBoost), Support Vector Machine (SVM), and K-Nearest Neighbors (KNN). Each framework was trained on the training dataset and optimized through hyperparameter tuning using grid search with 5-fold cross-validation to prevent overfitting and enhance generalization. The specific deployment details for each approach are as follows:
Logistic Regression (LR): A linear model for binary classification, providing probabilistic outputs that are easily interpretable [13].
Decision Tree (DT): A non-linear model that partitions the data space into a set of rectangles, making predictions based on the majority class within each region [14]. Key hyperparameters tuned included max_depth and min_samples_leaf.
eXtreme Gradient Boosting (XGBoost): An ensemble learning method based on gradient-boosted decision trees, known for its high performance and robustness [15]. Key hyperparameters tuned included n_estimators, learning_rate, and max_depth.
Support Vector Machine (SVM): A powerful algorithm that finds an optimal hyperplane to separate classes in a high-dimensional space [16]. Key hyperparameters tuned included kernel, C, and gamma.
K-Nearest Neighbors (KNN): A non-parametric, instance-based learning algorithm that classifies new data points based on the majority class of their k-nearest neighbors in the feature space [17]. Key hyperparameters tuned included n_neighbors and weights.
Model evaluation
As shown in Fig. 3, the performance of each developed machine learning framework was rigorously evaluated in both the training and independent validation sets using a comprehensive set of metrics, including accuracy, sensitivity (recall), specificity, precision (positive predictive value), and F1-score [19].
Fig. 3.
Radar chart of model performance metrics. Training and test set metrics for LR/DT/XGBoost/SVM/KNN: accuracy, sensitivity (recall), specificity, precision, and F1-score. Larger polygons indicate better performance. Abbreviations: LR, logistic regression; DT, decision tree; SVM, support vector machine; KNN, k-nearest neighbors
Comparative radar chart displaying the performance metrics (Accuracy, Sensitivity, Specificity, Precision, Recall, and F1-score) for all five machine learning models on both training and test sets. XGBoost demonstrates consistently high performance across all metrics.
ROC curves and their corresponding Area Under the Curve (AUC) values were generated to assess the models’ ability to discriminate between patients with and without seroma occurrence [20]. Higher AUC values indicate better discriminatory power (Fig. 4) .
Fig. 4.
Receiver operating characteristic (ROC) curves of the five machine learning models for predicting postoperative seroma formation. A ROC curves in the training set. B ROC curves in the validation set
ROC curves for all five models on the training set. XGBoost achieved the highest AUC of 0.979, demonstrating excellent discriminatory power in distinguishing between patients with and without seroma formation.
ROC curves for all models on the independent test set. XGBoost maintained superior performance with an AUC of 0.746, confirming its robustness and generalizability to unseen data.
Precision-Recall (PR) curves were employed to further evaluate the performance of the machine learning models, particularly in the context of imbalanced datasets where they offer a more discriminative assessment than ROC curves. As shown in Fig. 5, the PR curves illustrate model behavior across varying recall thresholds. Notably, the XGBoost model maintained a high level of precision across a wide range of recall values, highlighting its robustness and reliability in clinical prediction tasks [22, 23].
Fig. 5.
Precision-recall (PR) curves of the five machine learning models for predicting postoperative seroma formation. A PR curves in the training set. B PR curves in the validation set
Precision-Recall curves for the training set, particularly relevant for evaluating model performance on imbalanced datasets. XGBoost and KNN showed favorable curves, indicating good balance between precision and recall.Precision-Recall curves for the test set. XGBoost maintained stable precision across different recall levels, demonstrating its reliability in clinical prediction scenarios.Calibration curves were used to review the agreement between predicted probabilities and observed outcomes [24]. A well-calibrated model’s predictions should align closely with the actual event rates [25].
Calibration curves were utilized to evaluate the concordance between predicted probabilities and observed outcomes in both the training and test sets. Ideally, a well-calibrated model should produce predictions that align closely with the 45-degree reference line. As shown in Fig. 6, the XGBoost model demonstrated good calibration on the training set, with predicted probabilities closely matching actual outcomes. Although minor deviations were observed in the test set, likely due to the limited sample size, the XGBoost model still exhibited acceptable calibration, supporting the reliability of its risk estimates.
Fig. 6.
Calibration curves of the five machine learning models for predicting postoperative seroma formation. A Calibration curves in the training set. B Calibration curves in the validation set
Subsequently, Decision Curve Analysis (DCA) was conducted to quantify the clinical utility of each model by calculating the net benefit across a continuum of threshold probabilities, offering practical insights into their potential value in real-world clinical decision-making [26, 27].
Decision Curve Analysis (DCA) was performed to evaluate the net clinical benefit of each predictive model across a range of threshold probabilities. Figure 7A presents the DCA curves for the training set, where the XGBoost model (magenta line) consistently achieved higher net benefit compared to other models, particularly within the clinically relevant threshold range (0.1–0.6). This suggests superior decision-making utility in identifying high-risk individuals while minimizing unnecessary interventions.
Fig. 7.
Decision curve analysis (DCA) of the five machine learning models for predicting postoperative seroma formation. A DCA curves in the training set. B DCA curves in the validation set
Figure 7B shows the DCA curves for the test set, where XGBoost maintained favorable net benefit compared to “treat all” and “treat none” strategies, confirming its generalizability and potential for clinical application. These findings demonstrate that XGBoost may offer the best balance between sensitivity and specificity in real-world decision contexts.
To enhance the interpretability of the best-performing approach, SHapley Additive exPlanations (SHAP) were utilized [12, 15]. SHAP values quantify the contribution of each feature to the model’s projection for individual instances, providing insights into feature importance and their impact on the model’s output [2].
The SHAP summary plot illustrates both the overall importance and the directional impact of each feature in the XGBoost model. As shown in Fig. 8, features are ranked based on their mean absolute SHAP values, indicating their relative contribution to model predictions. sac diameter, Hemoglobin, Age, Diabetes, and Smoking were identified as the most influential predictors. Each point represents an individual case, with color reflecting the feature value (purple for low and yellow for high). The position along the X-axis (SHAP value) indicates whether the feature increases (right) or decreases (left) the predicted risk of seroma formation.
Fig. 8.
SHAP summary plot for XGBoost Model
SHAP dependence plots illustrate how individual feature values influence the model’s prediction for a specific case. As shown in Fig. 9, each bar represents the contribution of a feature to the final prediction, either increasing or decreasing the predicted risk relative to the model’s baseline output (expected value). Features such as sac diameter, Age, and Smoking substantially reduced the prediction value, while others like Creatinine and Lymphocyte_Percentage slightly increased it. This visualization provides valuable insight into the complex, non-linear interactions and personalized risk estimation within the XGBoost model.
Fig. 9.
SHAP dependence plots for key features
SHAP dependence plots provide a detailed visualization of how variations in individual feature values influence the model’s prediction. As illustrated in Fig. 10, each subplot depicts the SHAP value for a given feature against its actual value, thereby revealing the nature of the relationship—whether linear, non-linear, or threshold-based. These plots enable interpretation of feature interactions and their marginal effects, offering valuable insights into how variables such as Age, Hemoglobin, sac diameter, and Diabetes contribute to the individualized risk estimation within the XGBoost model.
Fig. 10.
SHAP waterfall plot for an individual prediction
Statistical analysis
Descriptive statistics were used to summarize the baseline characteristics of the research population [3]. Continuous variables were presented as mean ± standard deviation or median [interquartile range], as appropriate, and categorical variables as counts and percentages [4]. Comparisons between groups (e.g., training vs. confirmation sets, seroma vs. non-seroma groups) were performed using independent sample t-tests or Mann-Whitney U tests for continuous variables and chi-square tests or Fisher’s exact tests for categorical variables [5]. All statistical analyses were performed using Python (version 3.9) with scikit-learn, pandas, numpy, matplotlib, and seaborn libraries. A two-sided p-value of < 0.05 was considered statistically considerable .
Results
Baseline characteristics of study population
No statistically significant differences were observed between the training (n = 133) and test (n = 34) sets across baseline variables (all p > 0.05); see Table 1. Statistical investigation (e.g., chi-square test for categorical variables and t-test or Mann-Whitney U test for continuous variables) was performed to ensure no considerable differences existed between the two sets, thus minimizing potential bias in algorithm evaluation [3]. A total of 167 patients who underwent TAPP inguinal hernia repair were included in this inquiry [8]. The cohort was randomly divided into a training set (n = 133) and a corroboration set (n = 34) [9]. The baseline demographic, therapeutic, and laboratory characteristics of the overall cohort, training set, and verification set are summarized in Table 1. No statistically substantial differences were observed in any of the baseline characteristics between the training and verification sets (all p > 0.05), indicating that the random split resulted in well-balanced groups suitable for system development and evaluation.
Feature selection results
LASSO Regression: The LASSO regression analysis was performed to identify a parsimonious set of predictors for seroma formation [2]. Figure 1 illustrates the cross-validation curve, showing the optimal lambda value that minimizes binomial deviance. Figure 2 displays the coefficient paths of all variables as lambda changes, demonstrating how some coefficients are shrunk to zero, effectively performing feature selection [6, 12]. The LASSO model identified a subset of features with non-zero coefficients, suggesting their importance in predicting seroma formation [13].
Multivariate Logistic Regression: Multivariate logistic regression analysis was conducted to identify independent risk factors for seroma formation. The results, presented in Table 2 and visualized in the forest plot (Fig. 3), revealed several significant predictors. Specifically, Diabetes (OR = 5.59, p = 0.008), Smoking (OR = 0.23, p = 0.019), Age (OR = 7.14, p = 0.002), Hemoglobin (OR = 1.06, p = 0.003), and sac diameter (OR = 1.29, p < 0.001) were identified as independent risk factors for seroma formation. These findings are consistent with the feature selection process and highlight the most influential variables for subsequent model development .
Performance of machine learning models
The performance of the five machine learning models (LR, DT, XGBoost, SVM, KNN) was comprehensively evaluated on both the training and corroboration sets. Figure 4 provides a radar chart visualization of these performance metrics, allowing for a quick comparative overview of the models. On the training set, XGBoost and KNN generally revealed higher performance across most metrics, while on the test set, XGBoost maintained a strong performance .
ROC Curves and AUC: The Receiver Operating Characteristic (ROC) curves and their corresponding Area Under the Curve (AUC) values for all models on the training and test sets are presented in Figs. 5 and 6, respectively. On the training set, XGBoost achieved the highest AUC of 0.979 (95% CI: 0.961–0.997), followed closely by KNN (AUC = 0.987, 95% CI: 0.971-1.000). On the independent test set, XGBoost demonstrated the best discriminatory power with an AUC of 0.746 (95% CI: 0.557–0.935), outperforming other models. LR also showed competitive performance on the test set with an AUC of 0.717 (95% CI: 0.505–0.928) .
Precision-recall curves
Precision-Recall (PR) curves, shown in Figs. 7 and 8 for the training and test sets respectively, provide further insights into model performance, especially for imbalanced datasets. XGBoost and KNN exhibited favorable PR curves on the training set, indicating a good balance between precision and recall. On the test set, XGBoost maintained a relatively stable precision across different recall levels, suggesting its robustness .
Calibration curves
Calibration curves, presented in Figs. 9 and 10 for the training and test sets respectively, assess the agreement between predicted probabilities and observed outcomes [27]. Ideally, the calibration curve should lie along the diagonal line. While some models showed deviations, particularly on the test set due to the smaller sample size, XGBoost generally demonstrated reasonable calibration, indicating that its predicted probabilities are reliable .
Decision Curve Analysis (DCA)
Decision Curve Analysis (DCA) was performed to evaluate the clinical utility of the models [3]. On both the training and test sets, XGBoost consistently yielded a higher net benefit compared to treating all patients or none, indicating its potential to improve clinical decision-making by identifying patients who would benefit most from intervention while minimizing unnecessary interventions .
Based on the thorough evaluation across multiple metrics, particularly its superior discriminatory power (AUC) and therapeutic utility (DCA) on the independent test set, XGBoost was identified as the best-performing algorithm for predicting seroma occurrence after TAPP inguinal hernia repair.
Model interpretability (SHAP Analysis)
To understand the contributions of individual features to the XGBoost model’s predictions, SHapley Additive exPlanations (SHAP) examination was conducted. Figure 10 presents the SHAP summary plot, which illustrates the overall importance of each feature and its impact on the construct output. The features are ranked by their average absolute SHAP value, with sac diameter, Hemoglobin, Age, Diabetes, and Smoking emerging as the most influential predictors.
Figure 9 shows SHAP dependence plots for several key features, revealing how changes in feature values affect the predicted seroma appearance probability. For instance, higher sac diameter values are associated with increased SHAP values, indicating a higher likelihood of seroma occurrence. Similarly, lower Hemoglobin levels and older age tend to increase the predicted risk. These plots deliver granular insights into the non-linear relationships between features and the end-point .
Figure 10 provides a SHAP waterfall plot for an individual person forecasting, demonstrating how each feature’s value pushes the estimation from the base value (average anticipation) to the final output [12]. This visualization offers a clear and interpretable explanation for a single patient\“s predicted susceptibility, highlighting the specific factors contributing to their individual seroma appearance probability [13].
Discussion
This research successfully developed and validated several machine learning models for predicting seroma occurrence after TAPP inguinal hernia repair, identifying XGBoost as the best-performing approach. Our findings highlight the potential of ML-based approaches to offer exact and interpretable predictions, which can significantly enhance preoperative risk stratification and guide personalized individual administration strategies. The identified key predictors—sac diameter, Hemoglobin, Age, Diabetes, and Smoking—are largely consistent with existing literature, while the application of advanced ML techniques offers a more exhaustive and nuanced understanding of their collective impact [15, 17].
Previous studies have investigated risk factors for seroma emergence following inguinal hernia repair [28]. For instance, mesh fixation methods, larger hernia defects, and medial defect localization have been implicated in increased seroma hazard [18, 19]. Our multivariate study and SHAP interpretations corroborate the importance of hernia characteristics, particularly sac diameter, as a considerable predictor [20]. This aligns with the physiological understanding that larger dissection spaces and tissue manipulation contribute to fluid accumulation [21]. Similarly, patient-specific factors such as age, diabetes, and smoking have been consistently reported as vulnerability factors for various after operation complications, including seroma [22, 23]. The association of lower hemoglobin levels with increased seroma vulnerability, as identified in our examination, could be indicative of underlying systemic conditions or a predisposition to tissue fluid imbalance, warranting further investigation [24].
The strength of our research lies in the thorough evaluation of multiple ML algorithms and the use of SHAP study for construct interpretability [25]. While traditional logistic regression provides insights into individual hazard factors, it often falls short in capturing complex, non-linear interactions between variables [26]. ML models, especially ensemble methods like XGBoost, are adept at learning these intricate relationships, leading to superior predictive performance [2, 7]. The high AUC values achieved by XGBoost on both training and test sets reveal its robust discriminatory power. Furthermore, the Decision Curve Study confirmed the healthcare utility of our XGBoost framework, showing a net benefit over conventional \“treat all\“ or \“treat none\“ strategies across a wide range of threshold probabilities [12, 15]. This suggests that implementing such an approach in treatment-related practice could lead to more informed decisions, potentially reducing unnecessary interventions for low-risk patients and enabling proactive measures for high-risk individuals [3].
Despite the promising results, this inquiry has several limitations. Firstly, it was a retrospective analysis conducted at a single center, which may limit the generalizability of our findings to other populations or procedural settings. External substantiation with larger, multi-center cohorts is crucial to confirm the robustness and applicability of these models [6]. Secondly, the sample size, while sufficient for construct development, could be expanded to capture a wider range of participant variability and rare complications. Thirdly, the definition of seroma emergence was based on diagnostic identification or ultrasonographic confirmation requiring treatment, which might underestimate the true incidence of asymptomatic seromas [8]. Future studies could incorporate standardized imaging protocols for more precise seroma detection and quantification [9]. Lastly, while we included an extensive set of variables, other potential vulnerability factors, such as specific procedural techniques (e.g., type of mesh fixation, extent of dissection), surgeon experience, or genetic predispositions, were not fully captured or analyzed [7, 10]. As a single-center retrospective study, generalizability beyond our practice setting may be limited. Future external validation across multi-center, multi-surgeon cohorts is warranted. Incorporating these factors could further enhance algorithm accuracy.
Future research should focus on prospective verification of these ML models in diverse case populations. Integrating these predictive tools into electronic health record systems could facilitate real-time hazard review at the point of care. Furthermore, exploring the use of real-time intraoperative data and advanced imaging techniques could lead to even more dynamic and precise predictive models [12]. Ultimately, the goal is to translate these research findings into actionable medical tools that can refine subject safety and optimize outcomes following inguinal hernia repair.
Conclusion
To conclude, this inquiry successfully developed and validated machine learning-based predictive models for seroma emergence following transabdominal preperitoneal inguinal hernia repair. The XGBoost construct exhibited superior predictive performance and medical utility, identifying sac diameter, Hemoglobin, Age, Diabetes, and Smoking as the most influential factors. These findings underscore the important potential of machine learning to enhance prior to operation risk stratification, facilitate personalized person oversight, and ultimately contribute to improved individual outcomes by enabling targeted preventive strategies against seroma manifestation.
Supplementary Information
Acknowledgements
We thank the Department of Gastrointestinal Surgery, the Second People’s Hospital of Hefei, for their support in data collection and clinical guidance. We also extend our gratitude to all patients whose medical records were included in this study.
Abbreviations
- TAPP
Transabdominal Preperitoneal
- ML
Machine Learning
- LR
Logistic Regression
- DT
Decision Tree
- XGBoost
eXtreme Gradient Boosting
- SVM
Support Vector Machine
- KNN
K-Nearest Neighbors
- ROC
Receiver Operating Characteristic
- AUC
Area Under the Curve
- PR
Precision-Recall
- DCA
Decision Curve Analysis
- SHAP
SHapley Additive exPlanations
- BMI
Body Mass Index
- WBC
White Blood Cell Count
- CRP
C-reactive protein
- BUN
Blood Urea Nitrogen
Authors’ contributions
Yibo Zhai and Yi Zhao contributed equally to this work and should be considered co-first authors.• Yibo Zhai: Conceptualization, Methodology, Data curation, Writing – original draft.• Yi Zhao: Data analysis, Software, Validation.• Chang Chen and Wenzhong Bao: Investigation, Resources.• Dawei Tang: Supervision, Project administration, Writing – review & editing.All authors read and approved the final manuscript.
Funding
This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
Data availability
The datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.
Declarations
Ethics approval and consent to participate
This retrospective study was approved by the Institutional Review Board (IRB) of the Second People’s Hospital of Hefei (Approval No.: 2024KYC025). The requirement for informed consent to participate was waived by the Institutional Review Board (IRB) of the Second People’s Hospital of Hefei due to the retrospective design and the use of anonymized clinical data. All procedures were conducted in accordance with the Declaration of Helsinki (2013 revision).
Consent for publication
Not Applicable.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Yibo Zhai and Yi Zhao contributed equally to this work.
References
- 1.Peng XF, Yu M, Wang DC. Establishment of a Predictive Model for Seroma Formation After TAPP Repair for Unilateral Indirect Inguinal Hernia in Males. Am Surg. 2025;91(3):351–360. 10.1177/00031348241300369. Epub 2024 Nov 11. PMID: 39527918IF: 0.9 Q3 B4. [DOI] [PubMed]
- 2.Peng X-F, Miao Yu, and, Deng-Chao, Wang. Establishment of a predictive model for seroma formation after TAPP repair for unilateral indirect inguinal hernia in males. Am Surgeon™. 2025;91(3):351–60. [DOI] [PubMed] [Google Scholar]
- 3.Supsamutchai C, Pongratanakul R, Jirasiritham J, Punmeechao P, Poprom N, Wilasrusmee J, Meakleartmongkol T, Plangsiri S, Wilasrusmee C. Differences in the rates of seroma complications between hernial sac transection and reduction after laparoscopic inguinal hernia repair: systematic review and meta-analysis. Sci Rep. 2025;15(1):10030. 10.1038/s41598-025-94683-x. PMID: 40122984IF: 3.9 Q1 B3; PMCID: PMC11930968IF: 3.9 Q1 B3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Zhou Y, Ge Y, Liu J, Shen W, Gu H, Cheng G. Modified frailty index and albumin-fibrinogen ratio predicts postoperative seroma after laparoscopic TAPP. Clin Interv Aging. 2023;18:1397–403. [DOI] [PMC free article] [PubMed]
- 5.Reinhorn M, et al. Posterior mesh inguinal hernia repairs: a propensity score matched analysis of laparoscopic and robotic versus open approaches. Hernia. 2023;27(1):93–104. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Filho M, Almeida AM, Barros EM, et al. Simulated training model in a low cost for laparoscopic inguinal hernioplasty. Acta Cirúrgica Brasileira. 2021;36(1):e360108. [DOI] [PMC free article] [PubMed]
- 7.Taha A, et al. The development of artificial intelligence in hernia surgery: a scoping review. Front Surg. 2022;9:908014. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Di Buono G, Romano G, Rodolico V, et al. Progrip versus proflor: two fixation-free devices for laparoscopic inguinal hernia repair—the Pro/Pro study, a randomized clinical trial. Surg Endosc. 2025;39:3113–26. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Baur J, Ramser M, Dietz UA. Management of hernial orifices in robotic inguinal hernia repair. Mini-Invasive Surg. 2021;5(1):1–7.
- 10.Xie Hong-yang, et al. Risk factors and clinical impact of seroma formation following laparoscopic inguinal hernia repair: a retrospective study. BMC Surg. 2024;24(1):274. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Vogel R, Björn, Mück. Artificial Intelligence—What to expect from machine learning and deep learning in hernia surgery. J Abdom Wall Surg. 2024;3:13059. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Hundal J, Ballambat N, Helen S, Namazi S, Dugan A. Predictors of receiving work accommodations among employed breast cancer survivors with adult and child dependents at home. J Clin Oncol. 2024;42(16_suppl):211.
- 13.Marte A, Caldamone AA. Aguiar. The history of the pediatric inguinal hernia repair. J Pediatr Urol. 2021;17(4):485–91. [DOI] [PubMed] [Google Scholar]
- 14.Restrepo-Rodas G, et al. The role of AI in modern hernia surgery: A review and practical insights. Surg Innov. 2025;32(3):301–11. [DOI] [PubMed] [Google Scholar]
- 15.Zuccaro G. 44th Annual Meeting of International Society for Pediatric Neurosurgery, Kobe, Japan, Oct 23–27, 2016. Child’s Nerv Syst. 2016;32(10):1957–2040. [DOI] [PubMed]
- 16.Yeh ETH. CRP as a mediator of disease. Circulation. 2004;109(21 Suppl 1):II-11–II-14. 10.1161/01.CIR.0000129507.12719.80. [DOI] [PubMed]
- 17.Yuan W-H, et al. Risk factors for recurrence of common bile duct stones after surgical treatment and effect of ursodeoxycholic acid intervention. World J Gastrointest Surg. 2024;16(1):103. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Al-Ramahi M, et al. Risk factors for seroma formation after laparoscopic inguinal hernia repair: A systematic review and meta-analysis. Hernia. 2023;27(3):675–85. [Google Scholar]
- 19.Chen J, et al. Machine learning in surgical outcomes prediction: A systematic review. Ann Surg. 2022;275(1):e1–10.34433187 [Google Scholar]
- 20.Johnson AEW, et al. Artificial intelligence in surgery: A review of current applications and future directions. J Am Coll Surg. 2021;232(4):585–95. [Google Scholar]
- 21.Smith J, et al. External validation of predictive models for postoperative complications: A methodological review. J Clin Epidemiol. 2023;153:1–10.36351510 [Google Scholar]
- 22.Wang L, et al. Clinical utility of machine learning models in surgical risk stratification: A decision curve analysis. Surgery. 2022;171(5):1300–7. [Google Scholar]
- 23.Lee P, et al. Impact of surgical technique on seroma formation after inguinal hernia repair: A comparative study. Surg Endosc. 2020;34(10):4500–7. [Google Scholar]
- 24.Brown A, et al. Genetic predispositions to postoperative complications: A review. Br J Surg. 2019;106(7):812–20. [Google Scholar]
- 25.Davis R, et al. Real-time intraoperative data for predictive analytics in surgery: A prospective study. JAMA Surg. 2024;159(1):70–8. [Google Scholar]
- 26.Garcia M, et al. Advanced imaging techniques for early detection of postoperative complications. Radiology. 2023;306(2):e222001. [Google Scholar]
- 27.White S, et al. Biomarkers for predicting surgical outcomes: A review of current evidence. Annals Translational Med. 2022;10(18):987–95. [Google Scholar]
- 28.Kriplani AK, Shyam S, Pachisia, Ghosh D. Laparoscopic trans abdominal pre-peritoneal (TAPP) repair of inguinal hernia. In: Kriplani A, Bhatia P, Prasad A, et al., editors. Comprehensive Laparoscopic Surgery. New Delhi: Sagar Printers; 2007. p. 119–30.
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.










