基于机器学习算法的社区获得性肺炎患者住院时间延长风险预测模型构建与验证OA
Construction and Verification of Risk Prediction Model for Prolonged Length of Stay in Patients with Community-Acquired Pneumonia Based on Machine Learning Algorithm
目的 采用机器学习算法构建及验证社区获得性肺炎(CAP)患者住院时间延长的风险预测模型,同时筛选最佳模型.方法 回顾性选取2024年3月—2025年5月在北京市第一中西医结合医院呼吸科住院的CAP患者301例为研究对象.根据住院时间将患者分为住院时间延长组(≥8 d,164例)和非住院时间延长组(<8 d,137例).收集患者的临床资料.应用LASSO回归分析筛选特征变量.采用随机森林(RF)、支持向量机(SVM)和逻辑回归(LR)构建CAP患者住院时间延长的风险预测模型.评估各模型的性能、拟合程度、临床适用性,同时采用重复10次的10折交叉验证方法再次进行内部验证,筛选最佳模型,并采用Shapley加性解释(SHAP)方法可视化最佳模型.结果 LASSO回归分析结果显示,年龄、糖尿病史、高血压史、中医证型、中性粒细胞/淋巴细胞比值(NLR)、血清淀粉样蛋白A(SAA)可能是CAP患者住院时间延长的影响因素(P<0.05).基于上述影响因素,分别采用RF、SVM、LR构建CAP患者住院时间延长的风险预测模型.各模型的性能分析结果显示:在模型构建和10折交叉验证中,RF模型的AUC最大,准确度、F1分数最高;在模型构建中,RF模型的灵敏度最高,LR模型的特异度最高,SVM模型和LR模型的Brier分数高于RF模型;在10折交叉验证中,LR模型的灵敏度、Brier分数最高,SVM模型的特异度最高.Hosmer-Lemeshow拟合优度检验结果显示:RF、SVM模型在模型构建中的拟合程度较好(P值均>0.05),而在10折交叉验证中的拟合程度欠佳(P值均<0.05);LR模型在模型构建和10折交叉验证中的拟合程度均较好(P值均>0.05).决策曲线分析结果显示:在模型构建中,当阈值概率分别为0~0.92、0~0.93、0~0.92时,RF、SVM、LR模型的净获益率>0;在10折交叉验证中,当阈值概率分别为0~0.92、0~0.88、0~0.89时,RF、SVM、LR模型的净获益率>0.综上,RF模型为最佳模型.SHAP可视化结果显示,在RF模型中,平均|SHAP值|从高到低的特征变量分别为年龄(0.197)、NLR(0.092)、SAA(0.063)、中医证型(0.055)、高血压史(0.041)、糖尿病史(0.032),年龄、NLR、SAA、中医证型中的痰热壅肺证、高血压史、糖尿病史对CAP患者住院时间延长风险有正向贡献.结论 本研究基于年龄、糖尿病史、高血压史、中医证型、NLR、SAA,分别采用RF、SVM、LR构建了CAP患者住院时间延长的风险预测模型,其中RF模型为最佳模型.
Objective To construct and validate the risk prediction models for prolonged length of stay in patients with community-acquired pneumonia(CAP)using machine learning algorithm,and screen the best model.Methods A total of 301 patients with CAP who were hospitalized in the Department of Respiratory Medicine of Beijing First Hospital of Integrated Chinese and Western Medicine from March 2024 to May 2025 were retrospectively selected as the study subjects.The patients were divided into the prolonged length of stay group(≥8 d,164 cases)and the non-prolonged length of stay group(<8 d,137 cases)according to the length of stay.The clinical data of the patients were collected.LASSO regression analysis was used to screen characteristic variables.Random forest(RF),support vector machine(SVM)and Logistic regression(LR)were used to construct the risk prediction models for prolonged length of stay in patients with CAP.The performance,fitting degree and clinical applicability of each model were evaluated.At the same time,the 10-fold cross-validation method with 10 replicates was used for internal verification again,the best model was screened,and the SHapley Additive exPlanations(SHAP)method was used to visualize the best model.Results The results of LASSO regression analysis showed that age,history of diabetes,history of hypertension,TCM syndrome type,neutrophil/lymphocyte ratio(NLR)and serum amyloid A(SAA)might be the influencing factors of prolonged length of stay in CAP patients(P<0.05).Based on the above influencing factors,RF,SVM,and LR were used to construct the risk prediction models for prolonged length of stay in CAP patients.The performance analysis results of each model showed that in model construction and 10-fold cross-validation,the RF model had the highest AUC,accuracy and F1 score.In the model construction,the sensitivity of RF model was the highest,the specificity of LR model was the highest,and the Brier scores of SVM model and LR model were higher than those of RF model.In the 10-fold cross-validation,the LR model had the highest sensitivity and Brier score,and the SVM model had the highest specificity.The results of Hosmer-Lemeshow goodness-of-fit test showed that RF and SVM models had better fitting degree in model construction(both P values were>0.05),but poor fitting degree in 10-fold cross-validation(both P values were<0.05);the fitting degree of LR model in model construction and 10-fold cross validation was good(both P values were>0.05).The results of the decision curve analysis showed that in the model construction,when the threshold probabilities were 0-0.92,0-0.93,and 0-0.92,respectively,the net benefit rates of the RF,SVM,and LR models were>0;in the 10-fold cross-validation,when the threshold probabilities were 0-0.92,0-0.88,and 0-0.89,respectively,the net benefit rates of RF,SVM,and LR models were>0.In summary,the RF model was the best model.The results of SHAP visualization showed that in the RF model,the characteristic variables with average|SHAP value|from high to low were age(0.197),NLR(0.092),SAA(0.063),TCM syndrome type(0.055),history of hypertension(0.041),and history of diabetes(0.032);age,NLR,SAA,phlegm-heat obstructing lung syndrome in TCM syndrome type,history of hypertension,and history of diabetes had a positive contribution to the risk of prolonged length of stay in CAP patients.Conclusion Based on age,diabetes history,hypertension history,TCM syndrome type,NLR and SAA,this study uses RF,SVM and LR to construct the risk prediction models for prolonged length of stay in CAP patients,among which RF model is the best model.
刘杰;李慧;杨翠;杨涛;仝延萍
100101 北京市第一中西医结合医院呼吸科100101 北京市第一中西医结合医院呼吸科100101 北京市第一中西医结合医院呼吸科100070 北京市,首都医科大学附属北京天坛医院中医科100070 北京市,首都医科大学附属北京天坛医院中医科
医药卫生
社区获得性肺炎住院时间机器学习算法预测
Community-acquired pneumoniaLength of stayMachine learning algorithmsForecasting
《实用心脑肺血管病杂志》 2026 (9)
34-39,50,7
国家自然科学基金资助项目(81973599)北京市第一中西医结合医院传承与创新科研项目(ZDZK2024-07)第六批北京市级中医药专家学术经验继承工作项目(京中医科字[2021]169号)北京市属医院科研培育计划项目(PZ2021006)
评论