Detection of preceding sleep apnea using ECG spectrogram during CPAP titration night: A novel machine-learning and bag-of-features framework

J Sleep Res. 2023 Jul 4. doi: 10.1111/jsr.13991. Online ahead of print.

Abstract

Obstructive sleep apnea (OSA) has a heavy health-related burden on patients and the healthcare system. Continuous positive airway pressure (CPAP) is effective in treating OSA, but adherence to it is often inadequate. A promising solution is to detect sleep apnea events in advance, and to adjust the pressure accordingly, which could improve the long-term use of CPAP treatment. The use of CPAP titration data may reflect a similar response of patients to therapy at home. Our study aimed to develop a machine-learning algorithm using retrospective electrocardiogram (ECG) data and CPAP titration to forecast sleep apnea events before they happen. We employed a support vector machine (SVM), k-nearest neighbour (KNN), decision tree (DT), and linear discriminative analysis (LDA) to detect sleep apnea events 30-90 s in advance. Preprocessed 30 s segments were time-frequency transformed to spectrograms using continuous wavelet transform, followed by feature generation using the bag-of-features technique. Specific frequency bands of 0.5-50 Hz, 0.8-10 Hz, and 8-50 Hz were also extracted to detect the most detected band. Our results indicated that SVM outperformed KNN, LDA, and DT across frequency bands and leading time segments. The 8-50 Hz frequency band gave the best accuracy of 98.2%, and a F1-score of 0.93. Segments 60 s before sleep events seemed to exhibit better performance than other pre-OSA segments. Our findings demonstrate the feasibility of detecting sleep apnea events in advance using only a single-lead ECG signal at CPAP titration, making our proposed framework a novel and promising approach to managing obstructive sleep apnea at home.

Keywords: adherence; bag-of-features; machine learning; sleep apnea; spectrogram; time-frequency transforms.