Table of Contents
Fetching ...

The Rlign Algorithm for Enhanced Electrocardiogram Analysis through R-Peak Alignment for Explainable Classification and Clustering

Lucas Plagwitz, Lucas Bickmann, Michael Fujarski, Alexander Brenner, Warnes Gobalakrishnan, Lars Eckardt, Antonius Büscher, Julian Varghese

TL;DR

The paper addresses variability in ECG signals caused by heart-rate differences and waveform misalignment, which complicates automated classification and clustering, especially for data-limited settings. It introduces Rlign, an open-source R-peak alignment and resampling pipeline that creates a uniform template, including a heart-rate-corrected variant, to enable effective use of shallow learners (e.g., LR, SVM) and clustering, while also enabling dataset-wide explainability through aggregated attribution maps. The study demonstrates that Rlign improves classification performance and calibration for shallow models, enhances unsupervised clustering and PCA separability, and provides richer interpretability via global IG maps and permutation importance, with competitive results against CNNs on PTB-XL data. The method is computationally efficient thanks to multiprocessing and is accompanied by publicly available code, facilitating reproducible research and potential clinical deployment where data and compute are constrained.

Abstract

Electrocardiogram (ECG) recordings have long been vital in diagnosing different cardiac conditions. Recently, research in the field of automatic ECG processing using machine learning methods has gained importance, mainly by utilizing deep learning methods on raw ECG signals. A major advantage of models like convolutional neural networks (CNNs) is their ability to effectively process biomedical imaging or signal data. However, this strength is tempered by challenges related to their lack of explainability, the need for a large amount of training data, and the complexities involved in adapting them for unsupervised clustering tasks. In addressing these tasks, we aim to reintroduce shallow learning techniques, including support vector machines and principal components analysis, into ECG signal processing by leveraging their semi-structured, cyclic form. To this end, we developed and evaluated a transformation that effectively restructures ECG signals into a fully structured format, facilitating their subsequent analysis using shallow learning algorithms. In this study, we present this adaptive transformative approach that aligns R-peaks across all signals in a dataset and resamples the segments between R-peaks, both with and without heart rate dependencies. We illustrate the substantial benefit of this transformation for traditional analysis techniques in the areas of classification, clustering, and explainability, outperforming commercial software for median beat transformation and CNN approaches. Our approach demonstrates a significant advantage for shallow machine learning methods over CNNs, especially when dealing with limited training data. Additionally, we release a fully tested and publicly accessible code framework, providing a robust alignment pipeline to support future research, available at https://github.com/imi-ms/rlign.

The Rlign Algorithm for Enhanced Electrocardiogram Analysis through R-Peak Alignment for Explainable Classification and Clustering

TL;DR

The paper addresses variability in ECG signals caused by heart-rate differences and waveform misalignment, which complicates automated classification and clustering, especially for data-limited settings. It introduces Rlign, an open-source R-peak alignment and resampling pipeline that creates a uniform template, including a heart-rate-corrected variant, to enable effective use of shallow learners (e.g., LR, SVM) and clustering, while also enabling dataset-wide explainability through aggregated attribution maps. The study demonstrates that Rlign improves classification performance and calibration for shallow models, enhances unsupervised clustering and PCA separability, and provides richer interpretability via global IG maps and permutation importance, with competitive results against CNNs on PTB-XL data. The method is computationally efficient thanks to multiprocessing and is accompanied by publicly available code, facilitating reproducible research and potential clinical deployment where data and compute are constrained.

Abstract

Electrocardiogram (ECG) recordings have long been vital in diagnosing different cardiac conditions. Recently, research in the field of automatic ECG processing using machine learning methods has gained importance, mainly by utilizing deep learning methods on raw ECG signals. A major advantage of models like convolutional neural networks (CNNs) is their ability to effectively process biomedical imaging or signal data. However, this strength is tempered by challenges related to their lack of explainability, the need for a large amount of training data, and the complexities involved in adapting them for unsupervised clustering tasks. In addressing these tasks, we aim to reintroduce shallow learning techniques, including support vector machines and principal components analysis, into ECG signal processing by leveraging their semi-structured, cyclic form. To this end, we developed and evaluated a transformation that effectively restructures ECG signals into a fully structured format, facilitating their subsequent analysis using shallow learning algorithms. In this study, we present this adaptive transformative approach that aligns R-peaks across all signals in a dataset and resamples the segments between R-peaks, both with and without heart rate dependencies. We illustrate the substantial benefit of this transformation for traditional analysis techniques in the areas of classification, clustering, and explainability, outperforming commercial software for median beat transformation and CNN approaches. Our approach demonstrates a significant advantage for shallow machine learning methods over CNNs, especially when dealing with limited training data. Additionally, we release a fully tested and publicly accessible code framework, providing a robust alignment pipeline to support future research, available at https://github.com/imi-ms/rlign.
Paper Structure (19 sections, 9 equations, 8 figures, 2 tables)

This paper contains 19 sections, 9 equations, 8 figures, 2 tables.

Figures (8)

  • Figure 1: Schematic representation of the ECG alignment process. The diagram illustrates data in angular boxes and algorithms in rounded boxes, with dashed lines illustrating configurable settings. Key steps involve R-peak identification, correcting for heart rate variations, and resampling according to a standardized template. The final outputs are ECGs aligned at the R-peak, available as either a single median beat or the full continuous signal.
  • Figure 2: Summary of various median beat techniques and their impact on heart rate categories. Each chart displays three groups: sinus rhythm ($60-100$ bpm), bradycardia ($< 60$ bpm), and tachycardia ($> 100$ bpm). Panel a displays the group-specific point-wise mean beat generated using the commercial Uni-G software. This software retains the original signal sampling and does not achieve complete R-peak alignment, which is evident from the low amplitude. Panel b represents linear resampling, centered around the R-peak. Panel c illustrates our approach to resampling adjusted for heart rate, maintaining R-peak centering.
  • Figure 3: Classification performance and model calibration relative to the training data volume. This figure compares the effectiveness of raw signals against the implementation of median beats synchronized for heart rate variability. The comparison is made using three distinct models: linear regression, support vector machine, and the CNN architecture XceptionTime. Left column: average performance and calibration of five binary classification of abnormal vs. normal ECG; right column: overall multi-class performance and calibration. In both scenarios, a single fold consists of 1640 ECGs (Norm: 898, MI: 262, STTC: 251, CD: 174, HYP: 55).
  • Figure 4: The realignment of ECGs enables principal component analysis (PCA) to project ECG data into a separable non-uniform two-dimensional space. The data set includes ECGs from the superclasses ‘normal ECGs’ (NORM), ‘ST-/T changes’ (STTC), and ‘Myocardial Infarction’ (MI, Stage $\ge$ II). The effect of various data transformation steps is depicted in a grid layout, with each column representing different alignment methods and each row showing different feature subsections. In panels a-d, the full time series of all 12 leads were analyzed, whereas panels e-g demonstrate the computations of two one-dimensional PCAs on the 12-lead QRS complex and T-wave separately.
  • Figure 5: Importance maps and correlation for binary classification in STTC vs. NORM and MI (Stage $\ge$ II) vs. NORM. Left subfigure: The upper row illustrates the use of a Grouped Permutation Importance (GPI) method, wherein 19 intervals undergo random permutation to assess their effect on SVM prediction in terms of AUC. The lower row displays feature attribution maps obtained from the absolute values of Integrated Gradients (IG) using an XceptionTime CNN architecture. This architecture underwent training and examination on the unprocessed signal (limited to lead II), with the attribution scores aligned during a subsequent processing phase. Intervals with highlighted colors are crucial for the overall prediction. Colormaps are depicted per row. Right subfigure: The correlation matrix visualizes the correlation across GPI and IG for NORM vs. STTC and NORM vs. MI (Stage $\ge$ II).
  • ...and 3 more figures