Development and validation of a clinical prediction model for postoperative atrial fibrillation after lung cancer
1Department of Thoracic Surgery, Nanxishan Hospital of Guangxi Zhuang Autonomous Region (The Second People's Hospital of Guangxi Zhuang Autonomous Region), Guilin, China.
Background:
Postoperative atrial fibrillation (POAF) is a common complication after lung cancer surgery, associated with increased morbidity and prolonged hospitalisation. Accurate preoperative or early postoperative risk stratification remains challenging due to the multifactorial nature of POAF. This study aimed to develop and validate machine learning-based prediction models for POAF and to construct a clinically applicable nomogram for individualised risk estimation.
Methods:
A total of 540 patients undergoing lung cancer surgery were retrospectively included, among whom 107 (19.8%) developed POAF. Patients were randomly divided into a training cohort (n = 379) and an independent test cohort (n = 161). Least absolute shrinkage and selection operator (LASSO) regression with 10-fold cross-validation was applied in the training cohort to select the most informative predictors. Seven machine-learning models-logistic regression (LR), k-nearest neighbours (KNN), decision tree (DT), random forest (RF), extreme gradient boosting (XGBoost), support vector machine (SVM), and neural network (NN)-were developed using the selected features. Model performance was evaluated in both cohorts in terms of discrimination, calibration, and decision curve analysis. A nomogram was constructed based on the optimal model.
Results:
LASSO regression identified six predictors of POAF: age, education level, hypertension, marital status, postoperative pain score, and surgical approach. In the training cohort, all models demonstrated good discrimination with area under the receiver operating characteristic curve (AUC) values ranging from 0.827 to 0.995. However, performance declined to varying degrees in the test cohort. LR exhibited the most stable performance, achieving the highest AUC (0.855) and accuracy (0.857), with acceptable precision (0.667), recall (0.563), and F1 score (0.610). Calibration curves indicated good agreement between predicted and observed POAF risks for the LR model, while decision curve analysis demonstrated a consistently favourable net benefit across clinically relevant threshold probabilities. Based on these findings, an LR-based nomogram incorporating the six selected predictors was developed to facilitate individualised POAF risk prediction.
Conclusions:
We developed and internally validated a machine learning-assisted risk prediction framework for POAF after lung cancer surgery. Compared with more complex models, LR demonstrated superior stability, calibration, and clinical utility. The resulting nomogram provides a practical and interpretable tool for early postoperative POAF risk assessment and may support perioperative monitoring and personalised management of patients undergoing lung cancer surgery.

