Background/Objectives: Obstructive sleep apnea (OSA) and related sleep disorders affect a substantial proportion of hospitalized patients, with an estimated 48% pooled prevalence of undiagnosed OSA in cardiac inpatients and up to 80% of moderate-to-severe community OSA cases carrying no formal diagnosis at the time of hospital admission. In parallel, frailty—a state of heightened physiological vulnerability arising from cumulative multi-system biological decline—is present in 40–80% of inpatients and shares deep, bidirectional neurobiological pathways with sleep-disordered breathing through circadian dysregulation, intermittent hypoxia, hypothalamic–pituitary–adrenal axis activation, and chronic low-grade inflammation. Despite this convergence, no prior study has integrated validated, administratively computable frailty phenotyping with a machine learning framework specifically designed to predict inpatient sleep disorder diagnosis—and OSA in particular—at the point of hospital admission. The present study addresses this gap by developing an admission-time, explainable machine learning framework for the prediction of inpatient sleep disorder diagnoses (ICD-10 G47.x, encompassing OSA G47.3, insomnia G47.0, hypersomnia, and circadian rhythm disorders) and of insomnia specifically (ICD-10 G47.00).
Methods: We developed and evaluated a suite of five binary classification models—XGBoost, Random Forest, LightGBM, CatBoost, and Decision Tree—using 9682 balanced hospitalization episodes from the MIMIC-IV (version 2.2) database. The predictor set comprised 23 admission-time structured features across three domains: (i) frailty and comorbidity burden, including the Hospital Frailty Risk Score (HFRS) derived from ICD-10 codes, the Elixhauser comorbidity index, prior admission history, and six binary disease flags (obesity, hypertension, type 2 diabetes, heart failure, COPD, and depression/anxiety); (ii) physiological and laboratory biomarkers from the first 24 h of care, including minimum SpO
2, heart rate variability, hemoglobin, creatinine, albumin, and arterial blood gas parameters; and (iii) sociodemographic and administrative variables encompassing age, sex, ethnicity, insurance type, and admission acuity. Model performance was assessed through five-fold stratified cross-validation and bootstrap confidence intervals (
n = 1000 iterations), with predictor importance quantified using SHapley Additive exPlanations (SHAP).
Results: XGBoost achieved the strongest aggregate performance across all evaluation metrics, attaining an area under the receiver operating characteristic curve (AUC) of 0.871 (95% CI: 0.856–0.887), accuracy of 79.6%, F1-score of 0.820, and sensitivity of 94.9%, correctly identifying 903 of 952 true positive cases in the held-out test set; all gradient boosting frameworks substantially outperformed the Decision Tree baseline (AUC 0.836). SHAP analysis identified the HFRS and Elixhauser index as the two dominant predictors, followed by depression/anxiety, obesity, hypertension, and minimum SpO
2—a hierarchy that recapitulates the canonical clinical phenotype of obstructive sleep apnea in frail inpatients rather than that of primary insomnia, indicating that the model is preferentially capturing the OSA–frailty axis within the broader G47.x outcome. The predicted probability outputs were well-calibrated across all risk deciles.
Conclusions: Frailty-derived features, in combination with admission-time clinical and physiological data, can predict inpatient sleep disorder diagnoses—predominantly OSA—with high sensitivity and well-calibrated risk estimates. The deployable, interpretable nature of the XGBoost model makes it directly suitable for integration into clinical decision support systems, offering a screening tool that requires no dedicated instrumentation beyond routine admission data. By flagging high-risk patients at the moment of admission, the framework provides a concrete mechanism for accelerating referral for definitive diagnostic confirmation (overnight oximetry, polysomnography) and earlier initiation of CPAP and related therapies, with direct implications for reducing the persistent diagnostic gap, perioperative risk, and preventable adverse outcomes in frail hospitalized populations.
Full article