Introduction
Clinical sleep staging—the process of categorizing sleep into stages such as REM, N1, N2, and N3 (Deep Sleep)—is a fundamental task in sleep medicine. Traditionally, this is a manual, labor-intensive process performed by experts. While deep learning has significantly automated this task, existing models often suffer from a "brittleness" problem known as domain shift. A model trained on data from one hospital using specific sensors often fails when applied to a different clinic with different hardware, sampling rates, or patient demographics.
To address this, researchers have proposed SleepDG, a novel framework designed for Domain Generalization (DG). Unlike Domain Adaptation, which requires access to data from the target site during training, SleepDG aims to learn universal sleep patterns from multiple source datasets so that it can generalize to completely unseen target domains out-of-the-box.
Methodology
Architecture
SleepDG utilizes a sequence-to-sequence autoencoder architecture designed to capture both local and global features:
- CNN Encoder: Extracts local morphological features from individual 30-second EEG/EOG epochs.
- Transformer Encoder: Captures the global temporal context, modeling how one sleep epoch relates to the next across a sequence.
Multi-Level Feature Alignment
The core innovation of SleepDG is its multi-level alignment strategy, which ensures that the features learned by the model are invariant across different datasets. This is achieved at two distinct levels:
- Epoch-level Alignment: The model aligns the first-order (mean) and second-order (covariance) statistics of individual epochs. This ensures that the representation of a single 30-second window of sleep is consistent, regardless of the specific sensor characteristics of the source domain.
- Sequence-level Alignment: Recognizing that sleep staging is inherently sequential, the authors use Pearson correlation coefficients to represent the relationships between different epochs in a sequence. By minimizing the discrepancy of these correlation matrices across domains, the model learns domain-invariant "sleep transition rules."
Training Objective
The framework is trained end-to-end using a multi-task loss function. This includes a classification loss for staging accuracy, a reconstruction loss (to ensure the autoencoder preserves meaningful data features), and the two alignment losses (epoch-level and sequence-level) to enforce domain invariance.
Experimental Design
Datasets
The study evaluated SleepDG using five diverse, publicly available sleep datasets:
- SleepEDFx: 197 recordings (100Hz)
- HMC (Haaglanden Medisch Centrum): 151 recordings (256Hz)
- ISRUC: 126 recordings (200Hz)
- SHHS (Sleep Heart Health Study): 150 recordings (125Hz)
- P2018 (PhysioNet 2018): 150 recordings (200Hz)
Evaluation Protocol
The authors employed a leave-one-dataset-out strategy. In each iteration, the model was trained on four datasets and tested on the fifth, completely unseen dataset. This rigorous protocol directly measures the model's ability to generalize to new clinical environments.
Results and Discussion
SleepDG achieved State-of-the-Art (SOTA) performance across all five test domains, outperforming both standard baseline models and existing DG methods like CORAL.
- Performance Metrics: The model achieved an average Accuracy (ACC) of 75.03% and a Macro-F1 Score (MF1) of 69.64%. This represents a significant improvement over the baseline model's 68.76% accuracy.
- The Importance of Transitions: A key insight from the study is that while raw EEG signals vary across machines, the biological logic of sleep transitions (e.g., the progression from Light Sleep to Deep Sleep) is universal. Aligning these transitions via sequence-level correlation proved more effective than simply aligning raw signal features.
- Statistical vs. Adversarial Alignment: The authors noted that matching statistical moments (mean and covariance) provided more stable training and better generalization than Domain Adversarial Neural Networks (DANN), which can be difficult to optimize in multi-domain scenarios.
Conclusion
SleepDG represents a significant step toward deployable, automated sleep staging systems. By aligning features at both the epoch and sequence levels, the framework successfully captures the universal biological signatures of sleep while ignoring domain-specific noise.
Future work may explore extending this framework to multi-channel fusion (integrating EEG, EOG, and EMG) and optimizing the computational overhead associated with calculating correlation matrices for very long sequences. Currently, the model uses a fixed sequence length of 20 epochs, and investigating the impact of different temporal windows could further refine the model's understanding of sleep architecture.
Summary updated