Detecting Apneas and Hypopneas During Sleep by Measuring Heart Rate Changes and Assessing Out-of-Sample Performance
Abstract
Sleep Apnea is a breathing condition characterized by episodes of reduced airflow during sleep, with the airway partially (hypopnea) or fully (apnea) obstructed. Conventional methods of diagnosis include overnight sleep studies, which are resource and time intensive. Previous studies have shown that heart rate and heart rate variability are associated with sleep apnea severity. However, the performance of these features in detecting respiratory events (apnea or hypopnea), and particularly in unknown datasets, was not examined. We trained a set of conventional machine learning models to label segments of electrocardiography data based on whether they contained apneas or hypopneas. Tuning hyperparameters using leave-one-subject-out cross-validation, logistic regression was found to have strong performance across area under the receiver-operating curve, accuracy, specificity, sensitivity and F1 score metrics, with scores of 0.736±0.102, 72.3±15.8%, 92.0±4.8%, 27.7±16.9%, and 31.7±17.4%, respectively. The application of this model to another dataset, the apnea-ECG dataset, showed an average accuracy of 60.7%. We have also assessed whether there were age- or sex-based differences in model performance. This study thus provides a workflow for comparing machine learning models for apnea detection and highlights how models may not perform as strongly on other datasets.