Source-linked AI summary

DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG

Akara Supratak, Hao Dong, Chao Wu, Yike Guo

arXiv:1703.04046v2stat.ML

TL;DR

Existing sleep-stage scoring methods often depend on hand-engineered features and only rarely encode temporal transition rules. DeepSleepNet learns features from raw single-channel EEG with CNNs and bidirectional-LSTMs, using two-step training; it achieved similar accuracy and macro F1-score to state-of-the-art hand-engineering methods across two datasets and multiple EEG channels.

  • Problem

    Existing methods rely on hand-engineered features, while only a few encode sleep-stage transition information into extracted features.

  • Method

    DeepSleepNet uses CNNs for time-invariant features, bidirectional-LSTMs for stage-transition information, and two-step training to address class imbalance and encode sequences.

  • Results

    The model achieved similar overall accuracy and macro F1-score to state-of-the-art hand-engineering methods across MASS and Sleep-EDF using different single-channel EEGs.

  • Takeaways & Limitations

    DeepSleepNet automatically learned scoring features from different raw single-channel EEGs and datasets without changing its architecture or training algorithm.

  • Takeaways & Limitations

    The model requires a sufficient amount of sleep data; performance began to drop below approximately 54,000 training epochs in the MASS experiments.

Abstract

from arXiv · show

The present study proposes a deep learning model, named DeepSleepNet, for automatic sleep stage scoring based on raw single-channel EEG. Most of the existing methods rely on hand-engineered features which require prior knowledge of sleep analysis. Only a few of them encode the temporal information such as transition rules, which is important for identifying the next sleep stages, into the extracted features. In the proposed model, we utilize Convolutional Neural Networks to extract time-invariant features, and bidirectional-Long Short-Term Memory to learn transition rules among sleep stages automatically from EEG epochs. We implement a two-step training algorithm to train our model efficiently. We evaluated our model using different single-channel EEGs (F4-EOG(Left), Fpz-Cz and Pz-Oz) from two public sleep datasets, that have different properties (e.g., sampling rate) and scoring standards (AASM and R&K). The results showed that our model achieved similar overall accuracy and macro F1-score (MASS: 86.2%-81.7, Sleep-EDF: 82.0%-76.9) compared to the state-of-the-art methods (MASS: 85.9%-80.5, Sleep-EDF: 78.9%-73.7) on both datasets. This demonstrated that, without changing the model architecture and the training algorithm, our model could automatically learn features for sleep stage scoring from different raw single-channel EEGs from different datasets without utilizing any hand-engineered features.

I. INTRODUCTION

DeepSleepNet addresses the limits of hand-engineered sleep-scoring features by learning representations and temporal transition information directly from raw single-channel EEG. Its two-step training algorithm targets class imbalance, and the model transfers across differing EEG datasets and scoring standards without changing its architecture.

  • Motivation: Sleep-stage scoring is typically performed on 30-s PSG epochs using expert-defined standards such as R&K and AASM.PSG recordings combine EEG, EOG, EMG, and ECG signals.
  • Prior work: Existing automated methods commonly extract time-, frequency-, and time-frequency-domain features before classifying each epoch.These approaches use either multiple signals or single-channel EEG.
  • Prior work: Recurrent models can learn temporal information, including sleep-stage transition rules, but relatively few studies had explored them for sleep scoring.Such rules help identify plausible next stages from sequences of PSG epochs.
  • Contributions: DeepSleepNet combines two CNNs with different initial filter sizes and bidirectional-LSTMs to learn time-invariant EEG features and temporal stage information.The model operates on raw single-channel EEG rather than relying on hand-engineered features.
  • Contributions: The two-step training algorithm trains the model end-to-end while preventing it from learning only the majority sleep stages in imbalanced datasets.The algorithm is designed to address class imbalance during training.
  • Contributions: Without changing its architecture or training algorithm, the model learned scoring features across raw single-channel EEGs from datasets with different properties and scoring standards.The evaluated datasets used AASM and R&K standards and differed in properties such as sampling rate.

II. DEEPSLEEPNET

DeepSleepNet has representation-learning and sequence-residual-learning components. Its CNNs process raw 30-s single-channel EEG epochs using complementary filter sizes, then pass concatenated features to the temporal component.

  • Architecture: DeepSleepNet consists of representation learning and sequence residual learning, designed to score 30-s EEG epochs under AASM and R&K standards.Representation learning extracts epoch features, while sequence residual learning encodes stage-transition information.
  • Representation Learning: Two CNNs with small and large first-layer filters extract complementary time-invariant features from raw single-channel 30-s EEG epochs.The small filter targets temporal precision, whereas the larger filter targets frequency information.
  • Representation Learning: Each CNN contains four convolutional layers and two max-pooling layers, with convolution, batch normalization, and ReLU applied sequentially.Max-pooling downsamples inputs using the maximum operation.
  • Model Specification: The first convolutional-layer specifications depend on the EEG sampling rate Fs.This dependency is part of the architecture shown in Fig. 1.
  • Representation Learning: For epoch x_i, the two CNN outputs are transformed into feature vectors and concatenated into a combined feature a_i.The concatenated features are forwarded to sequence residual learning.

B. Sequence Residual Learning

Sequence residual learning combines bidirectional-LSTMs with a shortcut connection to incorporate temporal information from EEG-epoch sequences into CNN-derived features. Hidden and cell states are reset per patient so temporal information remains subject-specific.

  • Components: The sequence residual-learning component contains bidirectional-LSTMs and a shortcut connection.It uses a residual-learning formulation for sequence processing.
  • Temporal Modeling: Two bidirectional-LSTM layers learn temporal information such as stage-transition rules used to determine possible next sleep stages.The model can retain sequence context relevant to continuing or changing sleep stages.
  • Residual Connection: The shortcut connection adds transformed CNN features to the bidirectional-LSTM output, allowing learned temporal information to be combined with epoch representations.A fully connected layer transforms the CNN features before addition.
  • Formulation: At time t, the model processes the sequential CNN feature a_t with forward and backward LSTMs and combines their outputs with a transformed shortcut feature.The formulation uses forward and backward hidden and cell states together with a fully connected transformation.
  • Initialization: The forward and backward LSTM initial states are set to zero.The stated initialization applies to the sequence formulation.
  • Initialization: Hidden and cell states are re-initialized to zeros at each patient’s data boundary during training and testing.This ensures the model uses temporal information only from the current subject’s data.

C. Model Specification

Model specifications tune the first CNN filters to capture temporal or frequency information from EEG and constrain the sequence layers to select important features. These choices are intended to support representation quality while limiting overfitting.

  • Representation Learning: CNN-1 uses a first-layer filter size of Fs/2 and stride Fs/16 to detect when EEG patterns appear.The settings are selected according to signal-processing guidance for temporal information.
  • Representation Learning: The first-layer CNN specifications are selected to capture temporal and frequency information from EEG.The two CNNs use distinct filter configurations for these complementary objectives.
  • Sequence Residual Learning: Bidirectional-LSTM and fully connected layers are smaller than the 1024-dimensional representation-learning output.This restricts the model to selecting and combining important features to prevent overfitting.

III. TWO-STEP TRAINING ALGORITHM

DeepSleepNet uses two-step training to pre-train CNN representations on balanced data, then fine-tune the full sequential model to learn stage transitions while limiting majority-class overfitting.

  • Training objective: Cross-entropy with softmax trains the model to predict probabilities for mutually exclusive sleep-stage classes.The same loss is used in both training steps.
  • Pre-training: The algorithm first pre-trains the representation-learning CNNs with oversampled data so minority and majority sleep stages are equally represented.A temporary softmax layer is used during pre-training and discarded afterward.
  • Fine-tuning: The model then fine-tunes the complete network on sequential EEG epochs to encode sleep-stage transition rules.Pre-trained CNN parameters are transferred into the full model before sequential training.
  • Fine-tuning: Two learning rates protect the pre-trained CNNs while allowing stronger updates to the sequence residual-learning component.Using one learning rate caused excessive CNN adjustment to imbalanced sequential data and majority-stage overfitting.
  • Regularization: Dropout and L2 weight decay are added to reduce overfitting, with dropout removed during testing for deterministic outputs.Weight decay is applied only to the first CNN layers.

IV. RESULTS

The experiments used EEG recordings from MASS and Sleep-EDF, with differing acquisition conditions, sleep-stage labels, and dataset preprocessing choices.

  • Datasets: The evaluation used EEG channels from two public datasets: Montreal Archive of Sleep Studies and Sleep-EDF.The datasets provided the experimental recordings for model evaluation.
  • MASS: MASS recordings used 256-Hz EEG and five AASM-scored stages from 62 healthy subjects.The MASS data came from cohort 1, subset SS3.
  • Sleep-EDF: Sleep-EDF recordings used 100-Hz EEG and eight manually scored classes from 20 healthy subjects in the SC study.The recordings included Fpz-Cz and Pz-Cz EEG channels alongside other PSG signals.
  • Preprocessing: MOVEMENT and UNKNOWN epochs were excluded because they were outside the five target sleep stages.These stages occurred at the beginnings or ends of recordings.

B. Experimental Design

Performance was assessed with subject-level k-fold cross-validation and multiple classwise and aggregate classification metrics.

  • Cross-validation: The study used 31-fold cross-validation for MASS and 20-fold cross-validation for Sleep-EDF.Each fold trained on most subjects and tested on the remaining subjects, with all recordings tested across folds.
  • Cross-validation: Each fold assigned recordings from held-out subjects to testing and the remaining subjects to training.Predictions from all folds were combined before computing performance metrics.
  • Metrics: Reported metrics included per-class precision, recall, F1-score, macro F1-score, overall accuracy, and Cohen’s Kappa.Per-class measures treat one class as positive and all others as negative.
  • Metrics: Macro F1-score averages the per-class F1-scores, while overall accuracy divides correctly classified epochs by all test epochs.The supplied equations define these aggregate metrics using C sleep stages and N test epochs.

D. Training Parameters

Training used separate pre-training and fine-tuning settings, numerical-stability controls, and high-performance computing resources, with architecture and hyperparameters selected through initial experiments.

  • Training setup: Representation learning was pre-trained with mini-batches of 100 and Adam learning rate 10^-4, beta1 0.9, and beta2 0.999.Fine-tuning used subject sequences divided into 10 sub-sequences of 25 epochs.
  • Numerical stability: Batch normalization added 10^-5 to mini-batch variance for numerical stability.Moving averages with decay 0.999 supplied fixed training-set statistics during testing.
  • Implementation: The implementation used TensorLayer extended from TensorFlow and ran cross-validation on NVIDIA GeForce GTX 980 nodes.Each validation fold took approximately 3 hours to train, while prediction for 25 epochs took approximately 50 milliseconds per batch.
  • Parameter selection: Architecture and training parameters were selected through initial experiments on the first MASS cross-validation fold.The search varied convolutional structure, filter and stride settings, hidden sizes, weight decay, learning rates, batch sizes, and sequence lengths.

G. Sleep Stage Scoring Performance

DeepSleepNet achieved performance comparable to state-of-the-art sleep-stage scoring methods under independent evaluation across MASS and Sleep-EDF. Its errors were concentrated in N1 and N2–N3 confusions, while performance remained comparatively strong for other stages.

  • Per-Stage Performance: N1 was the poorest-performing stage, with F1 below 60, whereas other stages ranged from 81.5 to 90.3.Most misclassifications occurred between N2 and N3.
  • Error Patterns: The nearly symmetric confusion matrix, apart from N2–N3, suggested that errors were less likely to result from class imbalance.This assessment was based on the MASS evaluation results.
  • Comparison with State-of-the-Art Approaches: DeepSleepNet achieved similar performance to state-of-the-art methods using the same EEG channel and dataset.The comparison covered overall accuracy, macro-F1, Cohen’s kappa, and per-class F1.
  • Class-Balance Robustness: The model preserved N1 performance without favoring majority sleep stages over minority stages.The authors interpreted this as evidence that the model was not biased toward majority classes.
  • Channel Comparison: DeepSleepNet performed better on Fpz-Cz than on Pz-Oz, consistent with an earlier method’s channel comparison.The cited comparison concerns Sleep-EDF EEG channels.

I. Sequence Residual Learning

Sequence residual learning improved classification after the pretrained representation and sequence components were stacked and jointly fine-tuned. Model analyses linked learned filters and recurrent memory cells to sleep-stage patterns and temporal information.

  • Sequence Residual Learning: Removing sequence residual learning lowered F1 for every sleep stage except N3.The ablation increased confusions among N1–N2, N2–N3, and N1–REM, and encouraged more N1 and N3 predictions.
  • Sequence Residual Learning: Stacking pretrained representation learning with sequence residual learning and jointly fine-tuning improved classification performance.The authors used sequential training after balancing the training samples.
  • Learned Filter Activations: The first CNN layers contained filters mostly active for individual stages and filters active across multiple stages, including N2 and N3.The activation analysis used 5 sleep-stage rows and 64 filters for both small and large filters.
  • Model Analysis: The learned filters captured patterns consistent with AASM scoring, including patterns shared by N2–N3 and W–N1–REM.The authors suggested that some filters might detect sleep spindles appearing in both N2 and N3.
  • Recurrent Memory: Bidirectional-LSTM memory cells tracked temporal patterns such as wakefulness and sleep onset.The analysis identified interpretable forward-LSTM cells that reset their values during these patterns.

V. DISCUSSION

DeepSleepNet learned features from raw single-channel EEG across different channels and datasets, while its temporal components captured sleep-stage transition information. The authors also identified data-volume, domain-shift, and sequence-length constraints.

  • Cross-dataset performance: DeepSleepNet achieved similar performance across different EEG channels and datasets without changing its architecture or training algorithm.The evaluated datasets differed in properties such as sampling rate and scoring standards.
  • Learned representations: The model learned features consistent with the AASM manual, including patterns associated with N2-N3 and W-N1-REM stages.The authors suggest some filters may detect sleep spindles or eye-movement features relevant to these stages.
  • Temporal modeling: Bidirectional-LSTM memory cells tracked wakefulness, sleep onset, stage-value changes, and trains of N3 or REM stages.These cells were combined to formulate transition rules, such as likely transitions from wakefulness to W or N1.
  • Limitations: The model requires sufficient training data, with performance dropping below approximately 54,000 training epochs in the MASS experiments.Performance also dropped when fewer than 12 cross-validation folds were used.
  • Limitations: Applying the trained model to data with different properties, such as different EEG channels, may require retraining or fine-tuning.

VI. CONCLUSION AND FUTURE WORK

The conclusion presents DeepSleepNet as a raw single-channel EEG model that combines CNN feature extraction with bidirectional-LSTM transition modeling. The authors report applicability across varied EEG data and identify wearable-device EEG as future work.

  • Conclusion: DeepSleepNet uses CNNs to extract time-invariant features and bidirectional-LSTMs to learn sleep-stage transition rules from raw single-channel EEG.The model also uses two-step training to address class imbalance and encode temporal information.
  • Conclusion: The model automatically learned sleep-scoring features from different raw single-channel EEGs across datasets with different properties and scoring standards.
  • Conclusion: The authors relate automatic raw-EEG feature learning to remote sleep monitoring compared with hand-engineered approaches.
  • Future work: Future work will extend DeepSleepNet to single-channel EEG collected from wearable devices, including F4-EOG (Left) and Fp2-EOG (Left).
Loading 1703.04046v2…