Self-supervised learning improves ECG heartbeat classification across datasets

TransECG-SSL: Hybrid Self-Supervised Representation Learning for ECG Arrhythmia Classification

Machine Learning

Summary

ECG machines record heartbeats and help detect irregular rhythms called arrhythmias. Models that identify arrhythmias often struggle when tested on new groups of people or data collected differently. The authors created a method named TransECG-SSL that teaches a computer to understand heartbeat signals from unlabeled data using a mix of techniques before checking its performance on new datasets. Their approach worked better than models trained only on labeled examples from one dataset, showing promise for more flexible heartbeat analysis tools. However, differences between datasets and rare arrhythmia types still make classification challenging.

What this means in practice

  • For medical device developers: Create ECG analysis tools that adapt better to data from different patient groups without needing extensive labeled samples.$Commercial implications: Enables more broadly usable heart monitoring devices that require less manual annotation, increasing product scalability and affordability.
  • For clinical ai teams: Improve arrhythmia detection algorithms by incorporating pretraining methods that transfer learning across diverse ECG datasets.

Authors

Ahtisham Ayyub, Fasih Haider, Muhammad Rehan Usman, Saturnino Luz, Christos Politis, Muhammad Arslan Usman

Abstract

Cross-dataset generalisation remains a major challenge for automated electrocardiogram (ECG) arrhythmia classification because of differences in patient populations, acquisition protocols, annotation practices, and class distributions. Learning representations that remain informative across independent datasets could reduce reliance on dataset-specific labelled data. We propose TransECG-SSL, a self-supervised framework for transferable heartbeat representation learning from unlabelled ECG data. A Transformer encoder is pretrained using a hybrid objective combining masked signal reconstruction and contrastive learning, then frozen and evaluated by linear probing under patient-disjoint evaluation. Experiments across three public ECG databases and seven source--target settings show that Hybrid SSL consistently outperforms randomly initialised Transformers and achieves higher balanced accuracy than architecture-matched source-supervised pretraining. Reconstruction-only SSL remains competitive with Hybrid SSL, whereas contrastive-only pretraining performs substantially worse, highlighting the importance of masked reconstruction for transferability. Cross-dataset transfer nevertheless reduces balanced accuracy relative to target-specific self-supervised pretraining, while minority arrhythmia classes remain challenging under severe class imbalance. These findings demonstrate the potential of label-efficient self-supervised learning for cross-dataset ECG representation transfer while highlighting persistent limitations from domain shift and class imbalance.