Graph Neural Networks for Topological Feature Extraction in ECG Classification

Kamyar Zeinalipour, Marco GoriSmart 2023 · DOI · arXiv · OpenAlex

Abstract

Automated classification of electrocardiogram (ECG) signals is critical for the early detection of cardiovascular diseases. While traditional deep learning models often treat ECG data as Euclidean sequences, this paper explores a topological approach. By transforming 1D ECG signals into complex networks using visibility and quantile-based methods, and subsequently processing them with Graph Isomorphism Networks (GIN), the researchers achieve state-of-the-art performance. The Natural Visibility Graph (NVG) approach, in particular, reaches an accuracy of 99.38% on the PTB Diagnostic dataset.

Introduction

The heartbeat is a complex time-series signal reflecting the underlying physiological state of the heart. Traditional automated analysis methods, such as Convolutional Neural Networks (CNNs), typically process these signals in their raw 1D form. However, these methods may fail to capture the intricate non-linear dynamics and structural relationships inherent in the signal's "shape." This study proposes a novel framework that maps ECG signals into the graph domain, allowing Graph Neural Networks (GNNs) to extract topological features that are highly discriminative for diagnostic purposes.

Methodology

The proposed pipeline involves two main stages: graph transformation and graph classification.

Graph Transformation

Three distinct techniques were evaluated to convert 1D ECG signals into graph structures:

  1. Natural Visibility Graph (NVG): Nodes represent time points, and edges are formed if two points have a direct "line of sight" over the intervening signal peaks.
  2. Horizontal Visibility Graph (HVG): A simplified visibility mapping where connections are restricted to horizontal lines of sight.
The Horizontal Visibility Graph (HVG) mapping process, illustrating the conversion of signal peaks into a network structure.
  1. Quantile Graph (QG): The signal amplitude is divided into $Q$ discrete quantiles. Each quantile is a node, and edges represent transition probabilities between these states over time. While the authors found $Q=24$ to be optimal, lower values are often used for visualization.
Quantile Graph (QG) construction: partitioning the ECG signal into discrete amplitude levels (Q=4 shown) to form a transition network.

Graph Isomorphism Network (GIN)

The transformed graphs are classified using a Graph Isomorphism Network (GIN). GINs are designed to be as powerful as the Weisfeiler-Lehman graph isomorphism test, making them exceptionally effective at distinguishing between different graph topologies. This capability is crucial for identifying the subtle structural differences between healthy and pathological heartbeats.

Experimental Results

The framework was tested on the PTB Diagnostic ECG database, which contains 290 subjects with various cardiac conditions. The data was preprocessed through resampling (125Hz), normalization, and R-peak detection. To address class imbalance, the minority class (normal samples) was oversampled.

The results demonstrate that the NVG-based approach significantly outperforms existing state-of-the-art methods.

Method Accuracy Rank
Proposed (NVG + GIN) 99.38% 1
Proposed (HVG + GIN) 98.76% 4
Proposed (QG-24 + GIN) 91.93% 13

Discussion

The high accuracy of the NVG method suggests that the "visibility" between different parts of the heartbeat captures essential diagnostic features that traditional filters might overlook. While HVG is more computationally efficient, NVG's richer connectivity provides a more detailed topological "fingerprint." The GIN architecture's ability to discriminate between these complex structures is a key factor in the model's success.

Conclusion and Future Work

Representing ECG signals as complex networks provides a powerful new lens for cardiac diagnostics. By leveraging the topological feature extraction capabilities of GNNs, this approach achieves superior accuracy compared to standard Euclidean methods. Future directions include extending this framework to multivariate signals (multi-lead ECG) and exploring its applicability to other time-series domains like electroencephalography (EEG) or speech recognition.

The authors have released their implementation as a Python library, ts2g, available on GitHub.

Summary updated

BibTeX
@inproceedings{zeinalipour2023graph,
  author = {Kamyar Zeinalipour and Marco Gori},
  title = {{Graph Neural Networks for Topological Feature Extraction in ECG Classification}},
  booktitle = {Smart},
  year = {2023},
  doi = {10.1007/978-981-99-3592-5\_2},
}
Figure