Source-linked AI summary
Uncovering the structure of clinical EEG signals with self-supervised learning
Hubert Banville, Omar Chehab, Aapo Hyvärinen, Denis-Alexander Engemann, Alexandre Gramfort
TL;DR
EEG research is constrained by scarce, costly, and noisy annotations despite abundant unlabeled data. This paper evaluates EEG self-supervised learning through temporal-context and contrastive predictive tasks on sleep staging and pathology detection, finding that SSL features outperform purely supervised deep networks in low-labeled regimes and remain competitive with all labels.
Problem
EEG annotation requires substantial expertise and time, while supervised learning is limited by the availability and quality of labeled data.
Method
The study learns EEG representations with relative positioning, temporal shuffling, and contrastive predictive coding, then evaluates them on two clinical classification tasks.
Results
SSL-learned features consistently outperformed purely supervised deep neural networks in low-labeled regimes and reached competitive performance when all labels were available.
Takeaways & Limitations
SSL features captured clinically relevant EEG structure, including sleep micro- and macrostructure and pathology, from unlabeled data.
Takeaways & Limitations
The study did not focus on matching state-of-the-art performance, and its supervised models used fixed hyperparameters across data regimes.
Abstract
from arXiv · showhide
Objective. Supervised learning paradigms are often limited by the amount of labeled data that is available. This phenomenon is particularly problematic in clinically-relevant data, such as electroencephalography (EEG), where labeling can be costly in terms of specialized expertise and human processing time. Consequently, deep learning architectures designed to learn on EEG data have yielded relatively shallow models and performances at best similar to those of traditional feature-based approaches. However, in most situations, unlabeled data is available in abundance. By extracting information from this unlabeled data, it might be possible to reach competitive performance with deep neural networks despite limited access to labels. Approach. We investigated self-supervised learning (SSL), a promising technique for discovering structure in unlabeled data, to learn representations of EEG signals. Specifically, we explored two tasks based on temporal context prediction as well as contrastive predictive coding on two clinically-relevant problems: EEG-based sleep staging and pathology detection. We conducted experiments on two large public datasets with thousands of recordings and performed baseline comparisons with purely supervised and hand-engineered approaches. Main results. Linear classifiers trained on SSL-learned features consistently outperformed purely supervised deep neural networks in low-labeled data regimes while reaching competitive performance when all labels were available. Additionally, the embeddings learned with each method revealed clear latent structures related to physiological and clinical phenomena, such as age effects. Significance. We demonstrate the benefit of self-supervised learning approaches on EEG data. Our results suggest that SSL may pave the way to a wider use of deep learning models on EEG data.
1 Introduction
EEG analysis often relies on costly, noisy annotations, while self-supervised learning offers a way to learn representations from abundant unlabeled signals. This paper evaluates whether SSL tasks can produce useful EEG features and reduce dependence on labels across downstream classification problems.
- EEG applications generate increasing data volumes that require models to classify and interpret physiological signals.
- Accurate EEG annotations can be expensive, time-consuming, difficult to obtain, and variable across human raters.Sleep scoring requires technicians to label 30-s windows, while clinical recordings require neurologist review.
- Self-supervised learning learns representations from unlabeled data by using data structure to provide supervision through pretext tasks.A pretext task must be related to the downstream task and generate its own annotations from unlabeled data.
- SSL may be especially valuable for EEG because low-labeled regimes are common and supervised deep learning effectiveness is limited.Prior biosignal studies were few, used limited datasets or tasks, and often did not benchmark against supervised deep learning or expert features.
- The study asks which SSL tasks capture EEG structure, how SSL features compare with supervised and unsupervised methods, and whether they encode physiological or clinical information.
2 Methods
The methods are situated within prior self-supervised learning research spanning vision, language, and biosignals. The paper motivates EEG-specific SSL by adapting temporal and contrastive ideas that can learn reusable representations from unlabeled data.
- Computer-vision SSL tasks exploit spatial or temporal structure, including patch-position prediction, jigsaw reconstruction, and frame-order prediction.
- Natural-language methods such as word2vec and BERT learn reusable representations through self-supervised prediction tasks.
- Contrastive predictive coding predicts future encoded windows from a context, while improved sampling and augmentation can strengthen SSL representations.
- Biosignal SSL studies had demonstrated potential but remained limited in EEG coverage, datasets, downstream tasks, and supervised comparisons.
2.2 Self-supervised learning pretext tasks for EEG
The paper uses three EEG SSL pretext tasks: relative positioning, temporal shuffling, and contrastive predictive coding. Each trains a feature extractor from automatically constructed temporal examples, with task-specific comparisons or predictions.
- Relative positioning: Relative positioning samples pairs of EEG windows and labels them according to whether they are close or far apart in time.Positive and negative contexts are controlled by τpos and τneg, which can use signal knowledge or hyperparameter search.
- Figure 1 separates example sampling from end-to-end feature-extractor training for the three pretext tasks.
- Relative positioning: The RP model extracts each window with hΘ and classifies the pair using the elementwise absolute difference between their representations.
- Temporal shuffling: Temporal shuffling classifies triplets as ordered or shuffled after sampling two anchor windows and a third intermediate or negative-context window.
- Contrastive predictive coding: CPC summarizes a sequence of context windows into a vector and predicts multiple immediately following windows against sampled negatives.Negatives can be drawn within the same recording or across recordings.
- Contrastive predictive coding: CPC uses bilinear predictors and trains the full model with InfoNCE to select the true continuation among Nb + 1 candidates.
2.3 Downstream tasks
The study evaluates EEG SSL on two clinically relevant classification problems with different targets and data-generating mechanisms: sleep staging and pathology detection. These tasks represent event-level and subject-level clinical analysis.
- The benchmarks cover sleep monitoring and pathology screening, two EEG classification problems with distinct numbers of classes and data-generating mechanisms.Sleep monitoring concerns biological events, whereas pathology screening compares individual patients with the population.
- Sleep staging: Sleep staging predicts one of five stages—W, N1, N2, N3, or R—for each 30-s EEG window.It supports sleep monitoring and is relevant to disorders including apnea and narcolepsy.
- Sleep staging: Automated sleep staging addresses limited human-rater agreement and a largely manual, time-consuming annotation process.
- Pathology detection: Pathology detection targets neurological conditions such as epilepsy and dementia using EEG screening data.Performance depends on specialized medical expertise and expert training and experience.
2.4 Deep learning architectures
The study uses two convolutional EEG embedders tailored to sleep staging and pathology detection, with a shared focus on spatial and temporal filtering. StagerNet and ShallowNet provide the primary architectures for representation learning.
- Both embedders are convolutional neural networks that learn spatial and temporal filtering operations typical of EEG processing pipelines.
- StagerNet is a three-layer convolutional network adapted for window-wise classification of 30-s multichannel EEG sleep recordings.
- StagerNet was modified with doubled convolutional channels, batch normalization, unpadded temporal convolutions, and a 100-dimensional output.
- ShallowNet was taken from prior TUH Abnormal EEG work and parametrizes a filter-bank common spatial patterns pipeline.
- The CPC task used a GRU autoregressive model with hidden size D_AR = 100 on both datasets.
2.5 Baselines
The SSL representations were compared with random, autoencoding, supervised, and handcrafted-feature baselines. Downstream learned features were evaluated with linear logistic regression, while handcrafted features used a random forest.
- Four baselines were evaluated: random weights, convolutional autoencoders, purely supervised learning, and handcrafted features.
- The random-weights model froze a randomly initialized embedder, while the autoencoder learned an input-to-output identity mapping through an encoder and decoder.
- Sleep-staging handcrafted features comprised 37 statistics, spectral quantities, ratios, and complexity measures per EEG channel.
- Features learned with RP, TS, CPC, and AE were classified using L2-regularized linear logistic regression with C = 1.
- Handcrafted features were classified with a random forest, and balanced accuracy measured downstream performance.
2.6 Data
Experiments used two public EEG datasets: PC18 for sleep staging and TUHab for pathology detection. Recordings were split by recording, then filtered, windowed, and normalized before pretext-task sampling.
- The experiments used two publicly available EEG datasets, PC18 and TUHab.
- PC18 sleep staging: PC18 contained overnight recordings from 1,983 individuals with suspected sleep apnea and six EEG channels sampled at 200 Hz.
- TUHab pathology detection: TUHab contained 2,993 clinical recordings from 2,329 patients, labeled normal or abnormal, with most recordings sampled at 250 Hz.
- Data splits: Examples from each recording were assigned to only one of the training, validation, or testing sets.
- Data splits: PC18 used a 60-20-20% recording split, whereas TUHab used 2,171, 543, and 276 recordings for training, validation, and testing.
- Preprocessing: PC18 preprocessing applied a 30 Hz lowpass filter, downsampling to 100 Hz, selection of two channels, and non-overlapping 30-s windows of size (3000 x 2).
- Preprocessing: Low-amplitude windows were rejected, and remaining windows were normalized channel-wise to zero mean and unit standard deviation.
3 Results
Across sleep staging and pathology detection, SSL learned useful EEG representations that outperformed or matched baselines in low-to-medium labeled-data regimes and remained competitive with abundant labels. The learned embeddings also captured clinically and physiologically relevant structure, while hyperparameter choices influenced downstream performance.
- 3.1 SSL models learn representations of EEG and facilitate downstream tasks with limited annotated data: SSL features reached 72.3% balanced accuracy on PC18 sleep staging and 79.4% on TUHab pathology detection, both above chance across data regimes.PC18 used a 5-class task with 20% chance performance; TUHab used a 2-class task with 50% chance performance.
- 3.1 SSL models learn representations of EEG and facilitate downstream tasks with limited annotated data: On PC18, all three SSL pretext tasks usually outperformed supervised and handcrafted baselines, with a 22.8-point advantage over full supervision at one example per class.Full supervision exceeded SSL only around 10,000 examples per class, by a 1.6-3.5% margin.
- 3.1 SSL models learn representations of EEG and facilitate downstream tasks with limited annotated data: On TUHab, CPC outperformed full supervision below 10,000 labeled examples per class, while its advantage was about 1% when all examples were available.RP, TS and CPC also consistently outperformed handcrafted features; AE performance never exceeded 53.0%.
- 3.2 SSL models capture physiologically and clinically meaningful features: UMAP embeddings from TS and CPC formed clear, sequential sleep-stage structure without labels, with W, N1, N2 and N3 arranged along a trajectory and R overlapping mainly with N1.The arrangement aligns with prior observations of a sleep-wakefulness continuum.
- 3.2 SSL models capture physiologically and clinically meaningful features: SSL embeddings also exposed gradients related to pathology, age, apnea and gender, including age-linked variation within N2-N3 regions and across TUHab clusters.The results indicate that SSL captured continuous rather than purely discrete structure in the EEG feature space.
- 3.3 SSL pretext task hyperparameters strongly influence downstream task performance: High pretext-task performance did not necessarily predict high downstream performance, and negative-sampling effects differed by task: 71.6 vs. 72.2% for sleep and 74.1 vs. 80.4% for pathology.The authors therefore emphasize appropriate hyperparameter selection; negative-sampling distributions determine the invariance the network is encouraged to learn.
4 Discussion
The paper shows that self-supervised learning can extract clinically relevant EEG representations and improve downstream classification, especially when labels are scarce. It also identifies data, architecture, benchmarking, and task-selection boundaries for interpreting these results.
- SSL learned generic EEG features capturing sleep microstructure, macrostructure, pathology, age, and gender across two large clinical datasets.
- Using SSL to improve performance in semi-supervised scenarios: SSL improved downstream classification most clearly in low-labeled regimes, including about 20% over supervised learning with one labeled example per sleep class and close to 15% with 10 pathology examples per class.
- Sleep-wakefulness continuum and inter-rater reliability: The learned embeddings formed continuous physiological and clinical gradients rather than discrete clusters, including smooth sleep-wakefulness and normal-abnormal EEG structure.
- Finding the right pretext task for EEG: Pretext-task selection should combine EEG-specific temporal knowledge, assumptions about feature structure, hyperparameter search, and computational considerations.
- Finding the right pretext task for EEG: Negative-sampling strategy was especially important: sleep staging benefited from same-recording sampling, whereas pathology detection used a different configuration.
- Limitations: The study’s principal limitations were fixed training hyperparameters across data regimes, restricted architecture search, and differences from state-of-the-art evaluation settings.
5 Conclusion
The work shows that self-supervised learning can produce EEG representations competitive with, and sometimes better than, traditional supervised approaches across two large clinical tasks. These features also encode multiple physiological quantities jointly, although broader validation and better pretext-task design remain future needs.
- SSL representations competed with and sometimes outperformed traditional supervised approaches on two large clinical EEG tasks.
- SSL-learned features displayed clear structure jointly encoding different physiological quantities.
- Future work must test SSL on other EEG recordings and tasks, including regression.
- Designing pretext tasks for specific EEG structures is identified as critical for wider adoption in EEG analysis pipelines.
A UMAP on RP-learned features
The RP pretext-task experiment is illustrated with UMAP visualizations of learned features and figures describing the structure learned by the embedders.
- Figures 8 and 9 report results from the RP pretext-task experiment.
- Figure 8 visualizes RP-learned features with UMAP across the entire PC18 dataset.
- Figure 9 presents the structure learned by embedders trained on the RP task.
B Hyperparameter search procedure
The hyperparameter search independently trains embedders for three pretext tasks, freezes them, extracts 100-dimensional features, and uses those features for downstream classification.
- Embedders h_Θ were independently trained on RP, TS, and CPC pretext tasks before downstream evaluation.
- After training, the parameters of each embedder were frozen and used to extract 100-dimensional feature vectors from the original input data.
- Linear logistic regression classifiers were then trained for the downstream tasks using the extracted features.
PC18 TUHab
Experiment 2 considered SSL pretext-task hyperparameter values, focusing on context-window durations for RP and TS and evaluating downstream validation performance with balanced accuracy.
- Table 4 lists the SSL pretext-task hyperparameter values considered in Experiment 2.
- For RP and TS, the search focused on τ_pos and τ_neg, which control positive and negative context sizes when sampling pairs or triplets of windows.
- The experiments compared balanced accuracy on the validation set for pretext and downstream task performance.