Clinical validation · Research feature

Machine learning prediction of postoperative pulmonary embolism: a multicenter external validation study highlighting inflammatory response and intraoperative hemodynamics

A multicenter study validates a machine learning model that predicts postoperative pulmonary embolism using factors like age, inflammation markers, and surgery duration.

Adapted from research by He S, Liu Y, Wu Y..

Journal publication · 2026-06-18 · Attribution & reuse
In this article
Editorial illustration of motion paths.

Editor’s introduction

The study developed and externally validated a machine learning model to predict postoperative pulmonary embolism in surgical patients. It compared five algorithms—KNN, SVM, Random Forest, MLP, and XGBoost—to assess performance across different modeling approaches. XGBoost showed the best balance of discrimination and stability, achieving an AUC of 0.925 in the external validation cohort. Key predictors identified included age, BMI, malignancy history, surgery duration, C-reactive protein, neutrophil-to-lymphocyte ratio, and intraoperative tachycardia. The model demonstrated strong performance in both internal and external datasets, with consistent results across cross-validation. SHAP analysis highlighted these variables as most influential in risk prediction.

Introduction

Venous thromboembolism (VTE) encompasses a continuous pathophysiological spectrum comprising deep vein thrombosis (DVT) and pulmonary embolism (PE). DVT typically originates in the valvular sinuses of the deep veins of the lower extremities or within the venous plexus of the gastrocnemius muscle, where fibrin–platelet thrombi progressively propagate under the synergistic influence of altered hemodynamic shear stress, endothelial injury, and systemic hypercoagulability. Subsequent dislodgement of the thrombus tail and its embolization via the systemic venous return into the right heart chambers culminates in impaction within the main pulmonary artery or its segmental branches, thereby manifesting as PE. Consequently, PE can be regarded as the terminal progression of venous thrombotic disease and constitutes the predominant clinical phenotype responsible for VTE-related mortality.

The detrimental effects of PE on hemodynamics and gas exchange are characterized by an insidious onset, rapid clinical deterioration, and a markedly elevated case-fatality rate. Acute massive PE precipitates a precipitous increase in right ventricular afterload, culminating in right ventricular failure, a profound reduction in cardiac output, and potentially obstructive shock or cardiac arrest. Even in patients with non-massive PE, recurrent micro-embolic events may engender chronic thromboembolic pulmonary hypertension (CTEPH), thereby severely compromising long-term quality of life. Accordingly, early identification and accurate risk stratification of PE remain a core imperative in perioperative critical care management.

Within the diverse etiological spectrum of PE, surgical trauma is unequivocally recognized as one of the most consequential acquired risk factors. Surgical intervention can concurrently activate all three dimensions of Virchow’s triad: intraoperative vascular transection and retraction directly compromise endothelial glycocalyx integrity; postoperative immobilization promotes venous stasis in the lower extremities; and the acute-phase response triggered by surgical stress induces a systemic hypercoagulable state. Global multicenter observational studies have demonstrated that the overall incidence of postoperative VTE among surgical patients not receiving prophylactic anticoagulation ranges from 15% to 40%, with notably heightened risk observed in patients undergoing major orthopedic procedures and abdominal oncologic surgery.

With respect to clinical probability scoring, although the Wells score and the revised Geneva score are widely endorsed by national and international guidelines, their discriminative validity is substantially attenuated in postoperative cohorts. Given the ubiquitous presence of non-specific findings such as lower-limb edema, immobilization, and hypoxemia in the postoperative setting, numerous scoring components within these instruments become indistinguishable in origin, thereby eroding diagnostic specificity.

Regarding biomarker detection, D-dimer serves as a first-line screening tool for PE exclusion in the emergency department owing to its high sensitivity. In the postoperative context, however, surgical wound healing per se provokes substantial release of fibrin degradation products, resulting in a precipitous escalation of the false-positive rate and a concomitant decline in specificity to below 30%. To circumvent unnecessary radiation exposure and mitigate the risk of contrast-induced nephropathy, there exists an urgent clinical imperative for superior combinatorial biomarker strategies capable of augmenting pretest probability.

Study design and population

This multicenter retrospective study enrolled surgical patients from six tertiary hospitals in China, including Wuxi People’s Hospital Affiliated to Nanjing Medical University, Wuxi Second People’s Hospital, Yixing People’s Hospital, Tengzhou Central People’s Hospital, Gaomi People’s Hospital, and Tengzhou Hospital of Traditional Chinese Medicine. The study period spanned from January 2020 to January 2025. Based on data provenance, patients from Wuxi People’s Hospital Affiliated to Nanjing Medical University, Wuxi Second People’s Hospital, and Yixing People’s Hospital were assigned to the internal dataset, whereas patients from Tengzhou Central People’s Hospital, Gaomi People’s Hospital, and Tengzhou Hospital of Traditional Chinese Medicine were reserved as the external validation cohort.

The study enrolled patients aged 18–65 years who underwent surgical procedures and were subsequently diagnosed with postoperative pulmonary embolism confirmed by CTPA or pulmonary angiography. The surgical procedures encompassed multiple subspecialty disciplines, including gastrointestinal surgery (e.g., radical gastrectomy for gastric cancer, radical resection of colorectal cancer, cholecystectomy, appendectomy), urologic surgery (e.g., radical nephrectomy for renal cancer, transurethral resection of the prostate, ureteroscopic lithotripsy), gynecologic surgery (e.g., radical oophorectomy for ovarian cancer, myomectomy, ovarian cystectomy, total hysterectomy), thyroid and breast surgery (e.g., total thyroidectomy, breast lumpectomy), orthopedic surgery (e.g., total hip/knee arthroplasty, internal fixation of hip fractures, spinal fusion), thoracic and cardiovascular surgery (e.g., pulmonary lobectomy, cardiac valve replacement), neurosurgical procedures (e.g., intracranial tumor resection, evacuation of intracranial hematoma), and other superficial procedures (e.g., ophthalmologic, otorhinolaryngologic, and superficial mass excisions). All surgical interventions were performed by senior surgical teams possessing independent operative competency.

Exclusion criteria were as follows: presence of hemorrhagic diathesis (e.g., hemophilia, idiopathic thrombocytopenic purpura), hematologic disorders characterized by abnormalities of the vascular wall or coagulation function; severe cardiac, cerebral, hepatic, or renal insufficiency, psychiatric disorders, or markedly poor compliance; preoperative confirmation of lower extremity deep vein thrombosis or pulmonary embolism; chronic preoperative use of anticoagulant or antiplatelet agents without adequate washout; occurrence of pregnancy, severe infection/sepsis, major hemorrhage, or transfusion of ≥4 units of blood products within 30 days postoperatively; missing data for key predictive variables (including D-dimer, fibrinogen, bedridden status, and surgical type); and patients who underwent a secondary surgical intervention during the same hospital admission.

This retrospective study was approved by the Ethics Committees of all participating institutions, including Wuxi People’s Hospital Affiliated to Nanjing Medical University, Wuxi Second People’s Hospital, Tengzhou Central People’s Hospital, Gaomi People’s Hospital, and Tengzhou Hospital of Traditional Chinese Medicine (Approval Nos. KY22086 and IEC-AF/17-1.1). Written informed consent was obtained from all participants, and all personal data were anonymized to safeguard confidentiality.

Stratified K-fold cross-validation procedure

To comprehensively evaluate model robustness and generalizability while explicitly addressing the challenges posed by a low-incidence (rare-event) outcome such as postoperative pulmonary embolism, a rigorous stratified k-fold cross-validation procedure was implemented across all five machine learning algorithms. Rather than serving as a purely technical validation step, this resampling strategy was adopted as an essential safeguard against overfitting and optimistic performance estimation, which are particularly common in datasets with highly imbalanced outcome distributions.

Given the relatively low event rate in the present study, a stratified k-fold cross-validation approach was employed to ensure that the proportion of positive and negative cases was preserved within each fold, thereby maintaining consistency with the original dataset distribution. This is critical in rare-event settings, as random partitioning without stratification may lead to unstable training processes and unreliable performance estimates due to insufficient representation of outcome events in certain folds.

Specifically, the original dataset was randomly and stratifiedly divided into k mutually exclusive subsets of approximately equal size (with k = 10 in this study). In each iteration, one fold was retained as the validation set, while the remaining k − 1 folds were used for model training. This process was repeated k times so that each sample served exactly once as a validation instance. This repeated resampling framework provides a more reliable approximation of model performance than a single train–test split, particularly in the context of limited event numbers, where performance estimates are highly sensitive to data partitioning.

The overall predictive performance of each model was obtained by averaging the evaluation metrics across all k iterations. This averaging process reduces variance introduced by random sampling variability and yields a more stable and approximately unbiased estimate of model generalization performance. Importantly, in the context of rare-event modeling, such cross-validation is not merely a technical optimization step but a critical methodological safeguard to ensure that observed performance is not driven by idiosyncratic characteristics of a single data split.

This uniform stratified cross-validation framework was consistently applied to XGBoost, Random Forest, SVM, KNN, and MLP models, ensuring that comparisons among different algorithmic architectures were performed on a standardized and fair basis. The primary objective of implementing k-fold cross-validation in this study was twofold: to mitigate overfitting to noise, outliers, and dataset-specific patterns that are more pronounced in small-event scenarios; and (2) to evaluate model stability under repeated perturbations of the training distribution, thereby providing a more reliable assessment of robustness in real-world clinical settings.

XGBoost as the primary machine learning model demonstrating the best overall performance

All selected variables were incorporated into five machine learning models, including KNN, XGBoost, RF, SVM, and MLP, and their predictive performances were compared. Receiver operating characteristic (ROC) curve analysis demonstrated that the XGBoost model achieved the best discriminative performance among all models. Among the five evaluated machine learning models, performance comparison across multiple metrics, including AUC, sensitivity, specificity, F1 score, and Cohen’s Kappa, demonstrated that XGBoost achieved the most balanced and robust predictive performance in both the training and validation cohorts.

To further evaluate model generalizability, a k-fold cross-validation strategy was applied. The entire dataset was randomly divided into a training set and a testing set, with 602 patients (30.02%) allocated to the testing set and the remaining samples used for 10-fold cross-validation. Among the five models, the XGBoost model demonstrated the best overall performance and stability, achieving a mean AUC of 0.8821 ± 0.1226 in cross-validation. In the independent testing set, XGBoost maintained robust predictive performance with an AUC of 0.8232 and an accuracy of 0.9419 (Figures 4A–C). The RF model showed moderate performance, with a cross-validation AUC of 0.7834 ± 0.1775 and a testing AUC of 0.7266 (accuracy: 0.9102). The SVM and KNN models demonstrated relatively high variability across folds (AUC: 0.8381 ± 0.1927 and 0.8328 ± 0.1586, respectively), suggesting limited stability despite acceptable performance in the testing set (AUC: 0.7464 and 0.8135, respectively). The MLP model exhibited relatively stable but lower performance, with a cross-validation AUC of 0.7502 ± 0.0518 and a testing AUC of 0.7575 (accuracy: 0.8150).

Therefore, based on comprehensive evaluation, XGBoost was selected as the final model. Further evaluation using the Kolmogorov–Smirnov curve demonstrated good discriminative ability of the model, with a KS statistic of 0.569 at a threshold of 0.010. Learning curve analysis indicated that model performance gradually stabilized as the training sample size increased, with no evident signs of overfitting or underfitting. Importantly, confusion matrix analysis was carefully re-examined to ensure correct interpretation in the context of class imbalance. In the training cohort, the model correctly identified 1,341 true negatives (non-PE cases) and 20 true positives (PE cases). In the testing cohort, 565 true negatives and 2 true positives were correctly classified, reflecting the inherently low incidence of postoperative pulmonary embolism in the dataset (1.38%) and the corresponding rarity of positive events. These results indicate that the high overall classification accuracy observed in both cohorts is primarily driven by correct identification of the majority (non-PE) class. Therefore, performance interpretation was further complemented by class-specific metrics, particularly sensitivity for PE detection, to provide a more clinically meaningful assessment of model performance under imbalanced outcome conditions (Figures 5A–D).

Discussion

In the present study, five machine learning algorithms—namely KNN, SVM, RF, MLP, and XGBoost—were selected to construct and comparatively evaluate predictive models for postoperative pulmonary embolism. The rationale for selecting this ensemble of algorithms was to encompass a broad spectrum of modeling paradigms, including distance-based learning (KNN), kernel-based classification (SVM), ensemble tree-based methods (RF and XGBoost), and neural network-based architectures (MLP). This multi-algorithm strategy enables a comprehensive appraisal of model performance under divergent assumptions regarding data structure, feature interactions, and non-linearity, thereby enhancing the robustness of model selection. Among the evaluated models, XGBoost demonstrated superior overall performance with respect to discrimination, calibration, and clinical utility. The preeminence of XGBoost may be attributable to its gradient boosting architecture, which sequentially optimizes weak learners to minimize residual error, thereby effectively capturing complex non-linear relationships and high-order feature interactions inherent in perioperative clinical data. Furthermore, its built-in regularization mechanisms mitigate the risk of overfitting, a consideration of particular salience in clinical datasets characterized by class imbalance and heterogeneous feature distributions. Compared with alternative algorithms, XGBoost afforded a more favorable balance between predictive accuracy and generalizability, rendering it especially suitable for clinical risk prediction tasks.

To further enhance the clinical interpretability of the model, SHAP analysis was conducted to quantify the contribution of individual variables to model predictions. The analysis revealed that operative duration, postoperative inflammatory markers (including CRP and NLR), history of malignancy, advanced age, elevated BMI, elevated postoperative D-dimer concentration, and intraoperative tachycardia constituted the most influential predictors of postoperative pulmonary embolism. The predictive salience of the key variables identified by the model can be systematically mechanistically explicated within the conceptual framework of Virchow’s triad, wherein each clinical parameter maps onto distinct dimensions of the core pathophysiological pathways governing the initiation and progression of pulmonary embolism, reflecting the synergistic interplay among endothelial injury, hemodynamic alterations, and hypercoagulability.

Within the Virchow triad framework, prolonged operative duration can be conceptualized as a cumulative index of endothelial injury. Its impact extends beyond direct macroscopic vascular trauma to encompass microvascular endothelial dysfunction induced by sustained intraoperative retraction, thermal diffusion from electrocautery, and ischemia–reperfusion processes. Emerging evidence (–) indicates that the endothelial glycocalyx layer plays a pivotal role in this cascade. The glycocalyx, a dynamic barrier structure composed of proteoglycans and glycosaminoglycans, serves a critical function in maintaining hemodynamic shear stress sensing and anticoagulant homeostasis. Surgical trauma and the attendant inflammatory response can precipitate glycocalyx degradation, accompanied by elevated circulating levels of its constituent components, such as syndecan-1 and heparan sulfate, a phenomenon that has been empirically associated with the extent of surgical insult and clinical prognosis. Following glycocalyx disruption, the subendothelial matrix becomes exposed, enabling direct contact between type I and type III collagen and circulating blood elements. This exposure facilitates initial platelet adhesion via the interaction between the glycoprotein Ib-IX-V complex and von Willebrand factor (vWF). Concurrently, subendothelial cells and activated fibroblasts express tissue factor, which forms a complex with coagulation factor VIIa, thereby initiating the extrinsic coagulation cascade and triggering thrombin generation. Accordingly, operative duration functions within the model not merely as a temporal variable but as an indirect quantitative proxy for the cumulative burden of endothelial injury and the extent of tissue factor exposure.

Conversely, prolonged postoperative immobilization promotes venous stasis through inhibition of the calf muscle pump function. At the molecular and biomechanical level, however, the core mechanism is localized to the venous valvular sinus region. Under conditions of physiological laminar shear stress, endothelial cells maintain an anti-inflammatory and anticoagulant phenotype through activation of Krüppel-like factor 2 (KLF2). Postoperative immobilization engenders a low-shear or oscillatory flow state, thereby suppressing the MEK5/ERK5-KLF2 signaling axis and inducing a phenotypic shift of endothelial cells toward a prothrombotic state. The consequences of this shift include downregulation of thrombomodulin expression, increased release of vWF, and upregulation of plasminogen activator inhibitor-1 (PAI-1), collectively establishing a localized microenvironment characterized by hypercoagulability and hypofibrinolysis.

Our findings further corroborated that a history of malignancy confers a markedly elevated risk of postoperative pulmonary embolism, a phenomenon reflective of tumor-associated systemic hypercoagulability. One salient mechanism underlying cancer-associated thrombosis involves the release of circulating tumor-derived microparticles. These microparticles frequently express tissue factor and expose phosphatidylserine on their surface, thereby serving as a scaffold for the assembly of coagulation complexes and promoting the coagulation cascade at vascular sites remote from the primary tumor. Additionally, certain adenocarcinomas, particularly mucinous subtypes, secrete mucins rich in glycosylated structures. Through interactions with P-selectin and L-selectin, these molecules facilitate platelet–leukocyte aggregation, thereby potentiating thrombotic propensity. It warrants clarification that while mucins substantially amplify the coagulation response, they do not directly cleave prothrombin; rather, they indirectly augment thrombin generation by promoting the assembly of coagulation complexes and enhancing cellular interactions. Consequently, patients with malignant neoplasms frequently exist in a state of persistent subclinical hypercoagulability, with surgical trauma acting as the critical precipitating trigger for overt clinical thrombotic events.