Using natural language processing and machine learning to identify social needs in patient medical notes: model training with balanced versus real-world datasets.

IF 4.7 Q2 HEALTH CARE SCIENCES & SERVICES
JAMIA Open Pub Date : 2026-08-17 eCollection Date: 2026-08-01 DOI:10.1093/jamiaopen/ooag170
Christopher Kitchen, Thomas Richards, Luis M Ahumada, Geoffrey M Gray, Ayah Zirikly, Elham Hatef
{"title":"Using natural language processing and machine learning to identify social needs in patient medical notes: model training with balanced versus real-world datasets.","authors":"Christopher Kitchen, Thomas Richards, Luis M Ahumada, Geoffrey M Gray, Ayah Zirikly, Elham Hatef","doi":"10.1093/jamiaopen/ooag170","DOIUrl":null,"url":null,"abstract":"<p><strong>Objective: </strong>To evaluate natural language processing (NLP) and machine learning (ML) approaches for identifying social needs in electronic health record (EHR) notes, using balanced versus real-world imbalanced datasets.</p><p><strong>Materials and methods: </strong>A rule-based NLP framework using definite, non-negated keywords flagged social needs domains and \"Any Social Need\" in unstructured notes. Logistic regression, random forest, and XGBoost models were trained under balanced and imbalanced prevalence and evaluated using area under the receiver operating characteristic curve (AUROC), area under the precision-recall curve (AUPRC), F1, precision, recall, and specificity, with threshold sensitivity analyses.</p><p><strong>Results: </strong>On the imbalanced test set for any social need, the rule-based model achieved F1 0.373 (precision 0.484; recall 0.303; and specificity 0.978). On the balanced test set for any social need, XGBoost and logistic models achieved AUPRC 0.719 and 0.718, F1 0.438, and precision 0.944; random forest had AUPRC 0.714, F1 0.423, and precision 0.945. Under imbalanced evaluation, XGBoost led (AUPRC 0.319, F1 0.312, precision 0.839, recall 0.191, and specificity 0.998), followed by logistic (AUPRC 0.312 and F1 0.289) and random forest (AUPRC 0.305 and F1 0.282).</p><p><strong>Discussion: </strong>Balanced training inflated apparent performance, while under realistic class imbalance the ML models traded recall for very high precision, with XGBoost performing best but still lagging in sensitivity.</p><p><strong>Conclusion: </strong>These findings underscore the need to train and tune under real-world prevalence and to set thresholds based on use-case priorities (eg, maximizing precision for referrals versus improving recall for screening).</p>","PeriodicalId":36278,"journal":{"name":"JAMIA Open","volume":"9 4","pages":"ooag170"},"PeriodicalIF":4.7000,"publicationDate":"2026-08-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13480434/pdf/","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"JAMIA Open","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1093/jamiaopen/ooag170","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/8/1 0:00:00","PubModel":"eCollection","JCR":"Q2","JCRName":"HEALTH CARE SCIENCES & SERVICES","Score":null,"Total":0}
引用次数: 0

Abstract

Objective: To evaluate natural language processing (NLP) and machine learning (ML) approaches for identifying social needs in electronic health record (EHR) notes, using balanced versus real-world imbalanced datasets.

Materials and methods: A rule-based NLP framework using definite, non-negated keywords flagged social needs domains and "Any Social Need" in unstructured notes. Logistic regression, random forest, and XGBoost models were trained under balanced and imbalanced prevalence and evaluated using area under the receiver operating characteristic curve (AUROC), area under the precision-recall curve (AUPRC), F1, precision, recall, and specificity, with threshold sensitivity analyses.

Results: On the imbalanced test set for any social need, the rule-based model achieved F1 0.373 (precision 0.484; recall 0.303; and specificity 0.978). On the balanced test set for any social need, XGBoost and logistic models achieved AUPRC 0.719 and 0.718, F1 0.438, and precision 0.944; random forest had AUPRC 0.714, F1 0.423, and precision 0.945. Under imbalanced evaluation, XGBoost led (AUPRC 0.319, F1 0.312, precision 0.839, recall 0.191, and specificity 0.998), followed by logistic (AUPRC 0.312 and F1 0.289) and random forest (AUPRC 0.305 and F1 0.282).

Discussion: Balanced training inflated apparent performance, while under realistic class imbalance the ML models traded recall for very high precision, with XGBoost performing best but still lagging in sensitivity.

Conclusion: These findings underscore the need to train and tune under real-world prevalence and to set thresholds based on use-case priorities (eg, maximizing precision for referrals versus improving recall for screening).

使用自然语言处理和机器学习识别患者医疗记录中的社会需求:使用平衡数据集与真实数据集进行模型训练。
目的:评估自然语言处理(NLP)和机器学习(ML)方法在电子健康记录(EHR)笔记中识别社会需求的作用,使用平衡与现实世界的不平衡数据集。材料和方法:一个基于规则的NLP框架,在非结构化笔记中使用明确的、非否定的关键词标记社会需求域和“任何社会需求”。在平衡和不平衡患病率下训练Logistic回归、随机森林和XGBoost模型,并使用受试者工作特征曲线下面积(AUROC)、精确召回曲线下面积(AUPRC)、F1、精度、召回率和特异性进行评估,并进行阈值敏感性分析。结果:在任意社会需求的不平衡测试集上,基于规则的模型达到F1 0.373(精度0.484,召回率0.303,特异性0.978)。在任意社会需求的平衡测试集上,XGBoost和logistic模型的AUPRC分别为0.719和0.718,F1为0.438,precision为0.944;随机森林的AUPRC为0.714,F1为0.423,精度为0.945。在不平衡评价下,XGBoost领先(AUPRC 0.319, F1 0.312,精密度0.839,召回率0.191,特异性0.998),其次是logistic (AUPRC 0.312, F1 0.289)和随机森林(AUPRC 0.305, F1 0.282)。讨论:平衡训练夸大了明显的性能,而在现实的类别不平衡下,ML模型用召回率换取了非常高的精度,XGBoost表现最好,但灵敏度仍然落后。结论:这些发现强调了在现实世界的流行情况下进行培训和调整的必要性,以及基于用例优先级设置阈值的必要性(例如,最大限度地提高转诊的准确性,而不是提高筛查的召回率)。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
JAMIA Open
JAMIA Open Medicine-Health Informatics
CiteScore
4.10
自引率
4.80%
发文量
102
审稿时长
16 weeks
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书