Video-assisted thoracoscopic surgery has transformed lung cancer treatment. VATS has become the standard surgical approach for early-stage non-small cell lung cancer due to its minimally invasive nature, reduced blood loss, and faster recovery compared to open thoracotomy. However, moderate-to-severe postoperative pain remains a significant complication, affecting patient recovery, respiratory function, and quality of life.
Postoperative pain after VATS is driven by multiple mechanisms including intercostal nerve injury, pleural irritation, and port-site trauma. Uncontrolled pain impairs deep breathing and coughing, increasing the risk of pneumonia and atelectasis in the vulnerable post-lung-surgery period.
Existing pain prediction tools for thoracic surgery are limited in number and accuracy. Most rely on a narrow set of subjective or postoperative variables rather than preoperative objective biomarkers, reducing their utility for prospective surgical planning and personalized analgesia.
Machine learning offers a data-driven approach capable of identifying complex non-linear relationships among multiple preoperative variables simultaneously. Developing an ML-based preoperative pain risk model could enable earlier, more targeted pain management interventions for high-risk NSCLC patients undergoing VATS.
A single-center retrospective cohort of 100 NSCLC patients. This study included 100 patients with confirmed NSCLC who underwent VATS at Changshu Affiliated Hospital of Soochow University between July 2023 and July 2024. Patients were divided into a training set (70 patients) and a test set (30 patients) using a 7:3 random split stratified by pain outcome.
The primary outcome was moderate-to-severe postoperative pain, defined as a Numeric Rating Scale score of 4 or above within 48 hours after surgery. Of the 100 patients, 33 (33%) met this threshold and were classified as the high-pain group, while 67 (67%) had mild or no pain.
A comprehensive set of preoperative and perioperative variables was collected, including demographic characteristics, comorbidities, laboratory values, and anesthetic agents. Laboratory markers included ProGRP, LDH, RDW, WBC, hemoglobin, APTT, and others. Comorbidities documented included cardiovascular disease and dyslipidemia.
LASSO logistic regression with 10-fold cross-validation was applied to reduce the initial variable set to the most informative predictors. Using a regularization parameter lambda of 0.057, LASSO identified 11 variables with non-zero coefficients: ProGRP, dexmedetomidine use, APTT, tumor size, LDH, RDW, WBC, hemoglobin, ASA classification, cardiovascular disease, and dyslipidemia.
Seven ML algorithms were evaluated in parallel. The models tested included logistic regression, K-nearest neighbors, support vector machine, naive Bayes, decision tree, gradient boosting, and random forest. All were trained on the 70-patient training set using the 11 LASSO-selected predictors, with performance evaluated on the held-out 30-patient test set.
Model performance was assessed using multiple metrics: area under the receiver operating characteristic curve (AUC), accuracy, sensitivity, specificity, positive predictive value, negative predictive value, and F1 score. Cross-validation AUC in the training set and test set AUC were both reported to detect overfitting.
Random forest achieved the best overall performance with a training cross-validation AUC of 0.927 and a test set AUC of 0.893. In the test set, the model achieved accuracy of 0.900, sensitivity of 0.933, specificity of 0.882, and F1 score of 0.875 -- outperforming all six competing algorithms.
SHAP (Shapley Additive Explanations) analysis was applied to the random forest model to quantify each predictor's contribution to individual predictions. The five most important features by SHAP value were ProGRP, tumor size, RDW, LDH, and WBC -- all positively associated with pain risk -- while dexmedetomidine use and higher hemoglobin were identified as protective factors reducing pain probability.
A streamlined model matched full-model performance. To improve clinical practicality, a simplified random forest model was developed using only the five most important SHAP-identified predictors: ProGRP, tumor size, RDW, LDH, and WBC. This model achieved a test set AUC of 0.880, compared to 0.893 for the full 11-predictor model.
DeLong's test confirmed that the performance difference between the simplified and full models was not statistically significant (p = 0.4846), validating the simplified model as clinically equivalent while requiring fewer inputs. Decision curve analysis demonstrated that the simplified model provided net clinical benefit across a wide range of risk thresholds.
Events-per-variable analysis revealed that the full 11-predictor model was underpowered for the study sample size of 100 patients, requiring 158 patients for adequate power (EPV ratio below the recommended minimum). In contrast, the simplified 5-predictor model met the EPV threshold with the current sample, requiring only 72 patients.
The nomogram derived from the simplified model provided a clinician-interpretable visualization of predicted pain risk, enabling point-of-care probability estimation without requiring software. Calibration plots showed good alignment between predicted probabilities and observed pain outcomes in both training and test sets.
Each top predictor connects to distinct pain and inflammation biology. ProGRP (pro-gastrin-releasing peptide) is a neuroendocrine marker elevated in NSCLC that activates inflammatory cascades and may sensitize peripheral pain receptors through neuropeptide signaling, directly amplifying postoperative pain perception.
RDW (red cell distribution width) reflects variability in red blood cell size and is an established marker of chronic inflammation and anemia. Higher RDW may indicate tissue hypoxia and impaired oxygen delivery, conditions that lower pain thresholds and reduce tissue tolerance to surgical trauma. LDH (lactate dehydrogenase) elevation signals cellular damage and ischemia, reflecting greater tumor burden or surgical tissue injury.
Elevated WBC counts indicate systemic inflammation and immune activation, which can amplify the neuroinflammatory response to surgical trauma and intensify pain signaling. Tumor size directly correlates with surgical complexity, extent of tissue dissection, and degree of intercostal nerve involvement during VATS port placement.
Dexmedetomidine, an alpha-2 adrenergic receptor agonist used for intraoperative sedation, exerts analgesic effects through central and peripheral mechanisms including reduced sympathetic tone and suppression of inflammatory cytokine release. Its identification as a protective factor in this model supports its established perioperative analgesic benefit and suggests a role in personalized anesthetic planning for high-risk patients.
A practical preoperative tool for personalizing VATS pain management. The simplified 5-predictor random forest model and its associated nomogram provide surgeons and anesthesiologists with a preoperative, objective tool to identify NSCLC patients at high risk for moderate-to-severe pain after VATS. Early identification enables tailored analgesia planning, potentially including preemptive multimodal analgesia protocols and targeted dexmedetomidine dosing.
Key limitations include the single-center retrospective design and small sample size of 100 patients, which restricts generalizability and statistical power for the full model. The retrospective nature introduces selection and measurement biases that can only be addressed through prospective validation studies.
The study's reliance on a single institution's case mix and clinical practices may limit external validity. Variations in VATS technique, anesthetic protocols, and postoperative care across institutions could affect model performance, making multicenter validation a critical next step.
Future research directions include prospective multicenter validation with larger cohorts, integration of intraoperative variables such as chest tube size and operative duration, and exploration of whether model-guided preemptive analgesia interventions reduce pain severity in high-risk patients. Incorporating patient-reported outcome measures alongside NRS scores would provide a more comprehensive pain assessment framework.