Construction and validation of a machine learning-based model for predicting pneumonia risk in patients with hemorrhagic stroke
Darong Lu, Wanting Shi, Wenhua Li, Luo Yefangxin, Y X Li, Qiong Qin, Huang Runqin, Yan Xiong, Xuemei Chen, Y X Li, Wei Chen
Objective This study aimed to develop and validate a distinct, stable, and interpretable predictive model using machine learning techniques to identify individuals at high risk of pneumonia early after admission. The goal was to provide a potential quantitative reference for implementing preventive interventions in clinical practice. Methods A retrospective nested case–control design was adopted. A total of 822 patients with hemorrhagic stroke admitted between January 2019 and October 2024 were enrolled. Feature selection was performed using LASSO regression to eliminate multicollinearity and identify key predictors. Five machine learning algorithms—logistic regression (LRC), gradient boosting classifier (GBC), random forest classifier (RFC), multilayer perceptron classifier (MLPC), and support vector machine classifier (SVC)—were employed to construct predictive models. Hyperparameters were optimized through 10-fold cross-validation and grid search. Model performance was comprehensively evaluated on an independent test set using metrics including area under the curve (AUC), accuracy, sensitivity, precision, and F1-score. Finally, SHAP (SHapley Additive exPlanations) values were applied to interpret the optimal model and elucidate the contribution of each feature to the prediction. Results LASSO regression selected 14 key predictors from 57 initial variables. Among the five models, the logistic regression model achieved the best performance on the test set. SHAP-based interpretability analysis revealed that the most influential factors for pneumonia risk prediction were, in descending order: left lower limb muscle strength, total cholesterol (TC), right lower limb muscle strength, low-density lipoprotein cholesterol (LDL-C), white blood cell count (WBC), consciousness status, D-dimer, age, systolic blood pressure (SBP), and bleeding location. Conclusion This study successfully developed a logistic regression-based predictive model for pneumonia risk in patients with hemorrhagic stroke. The model demonstrated favorable discrimination and stability. It provides an objective, quantitative basis for early identification of high-risk patients, stratified management, and precise prevention and control, supporting a shift from reactive to proactive complication management.