Diagnosing sleep disorders such as obstructive sleep apnea (OSA) typically requires full overnight polysomnography, which is time-consuming, resource-intensive, and difficult to scale. This study addresses the need for automated, interpretable tools that can use simpler EEG recordings to classify sleep stages and OSA severity.
We developed a sequential deep learning network that combines multi-kernel convolutional neural networks (CNNs), Transformer encoders, and a Conditional Random Field (CRF) layer to model both local EEG features and long-range temporal dependencies in sleep architecture. Using single-channel EEG signals, sleep stage labels, and Apnea–Hypopnea Index (AHI) values from SHHS-1, the model first performs sleep stage classification (W, N1, N2, N3, REM) and then uses learned representations of the predicted sleep stage sequences to predict OSA severity via regression models. This unified pipeline bridges sleep staging and apnea prediction within one framework, while attention mechanisms provide interpretability into which EEG segments drive the model’s decisions.
The study uses data from the Sleep Heart Health Study Visit 1 (SHHS-1), hosted on the National Sleep Research Resource (NSRR). Specifically:
• Single-channel EEG recordings
• Manual sleep stage labels (W, N1, N2, N3, REM)
• Apnea–Hypopnea Index (AHI) values to quantify OSA severity
The SHHS-1 cohort consists of community-based adult participants, enabling the model to be trained and evaluated on a large, population-level dataset
Using the SHHS-1 dataset, the model achieved 81.6% accuracy on subjects with low apnea indices and maintained strong performance (78.7% accuracy) on a more heterogeneous population spanning the full spectrum of OSA severity. Attention heatmaps highlighted EEG segments corresponding to canonical features such as spindles, K-complexes, and slow waves, demonstrating how the model focuses on physiologically meaningful patterns. The analysis also revealed marked differences in sleep stage distributions between OSA patients and controls, including reduced deep sleep (N3) and increased wakefulness among those with apnea.
This work shows that transformer-based modeling of single-channel EEG can reliably perform sleep staging and provide informative predictions of OSA severity in a unified framework. Reducing reliance on full polysomnography and manual scoring, this approach has the potential to make sleep diagnostics more scalable and accessible, including settings where only limited EEG channels are available. The interpretability offered by attention mechanisms and sequential modeling also supports clinical trust and may help illuminate how alterations in sleep architecture relate to respiratory disturbance.
Code available on request.
Sleep disorders, particularly Obstructive Sleep Apnea (OSA), have a considerable effect on an individual's health and quality of life. Accurate sleep stage classification and prediction of OSA are crucial for timely diagnosis and effective management of sleep disorders. In this study, we develop a sequential network that enhances sleep stage classification by incorporating self-attention mechanisms and Conditional Random Fields (CRF) into a deep learning model comprising multi-kernel Convolutional Neural Networks (CNNs) and Transformer-based encoders. The self-attention mechanism enables the model to focus on the most discriminative features extracted from single-channel electroencephalography (EEG) recordings, while the CRF module captures the temporal dependencies between sleep stages, improving the model's ability to learn more plausible sleep stage sequences. Moreover, we explore the relationship between sleep stages and OSA severity by utilizing the predicted sleep stage features to train various regression models for Apnea-Hypopnea Index (AHI) prediction. Our experiments demonstrate an improved sleep stage classification performance of 78.7%, particularly on datasets with diverse AHI values, and highlight the potential of leveraging sleep stage information for monitoring OSA. By employing advanced deep learning techniques, we thoroughly explore the intricate relationship between sleep stages and sleep apnea, laying the foundation for more precise and automated diagnostics of sleep disorders.
Wan, C., Nnamdi, M. C., Shi, W., Smith, B., Purnell, C., & Wang, M. D. (2024). Advancing sleep disorder diagnostics: A transformer-based EEG model for sleep stage classification and OSA prediction. IEEE Journal of Biomedical and Health Informatics. https://doi.org/10.1109/JBHI.2024.3512616
Blogpost Author: Dr. Micky C. Nnamdi