Using natural language processing and machine learning to identify social needs in patient medical notes: model training with balanced versus real-world datasets.
Christopher Kitchen, Thomas Richards, Luis M Ahumada, Geoffrey M Gray, Ayah Zirikly, Elham Hatef
Center for Population Health Information Technology, Johns Hopkins Bloomberg School of Public Health, Baltimore, MD, United States. · Center for Pediatric Data Science and Analytic Methodology, Johns Hopkins All Children's Hospital, St. Petersburg, FL, United States.
Key points
From the paper's 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).
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).
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Extracting Social Determinants of Health From Electronic Health Records: Development and Comparison of Rule-Based and Large Language Model MethodsJMIR Medical Informatics · 2026
- Enhancing Medicaid Social Risk Identification: Comparing Linear and Non-Linear Machine Learning Models with Expert Heuristics.IEEE International Conference on Digital Health. IEEE International Conference on Digital Health · 2026
- Social Status and Clinical Resource Allocation by a Large Language Model: An Evaluation of 30,618 Decisions.Journal of personalized medicine · 2026
- Detecting Sociodemographic Biases in the Content and Quality of Large Language Model–Generated Nursing Care: Cross-Sectional Simulation StudyJournal of Medical Internet Research · 2025
- Large language model-assisted machine learning for postpartum urinary incontinence prediction: Model development and validation study.Digital health · 2026
- Lexicon-Based and Machine Learning Approaches for Sentiment Classification of Telemedicine Reviews in IndonesiaJ-KOMA Jurnal Ilmu Komputer dan Aplikasi · 2026