ECG ODE-GAN: Learning Ordinary Differential Equations of ECG Dynamics via Generative Adversarial Learning

Tomer Golany, Daniel Freedman, Kira Radinsky

Introduction

Electrocardiograms (ECGs) are fundamental tools for diagnosing cardiac conditions. However, the development of robust deep learning models for automated ECG interpretation is often hindered by the scarcity of high-quality labeled data, particularly for rare arrhythmias. While mathematical simulators based on Ordinary Differential Equations (ODEs) offer biological plausibility, they often lack the stochastic complexity of real-world signals. Conversely, standard Generative Adversarial Networks (GANs) can mimic data distributions but frequently produce physiologically nonsensical "hallucinations."

Presented at AAAI-21, ECG ODE-GAN addresses this gap by introducing a hybrid generative model. It teaches a GAN to learn the underlying differential equations of heartbeat dynamics, combining the structural constraints of physics with the expressive power of data-driven learning.

Methodology

The core innovation of this framework is the shift from generating raw signals to generating the dynamics (derivatives) of the system. In a standard GAN, the generator maps noise to a complete signal. In ECG ODE-GAN, the generator $G$ predicts the rate of change ($dh/dt$) at each time step.

Overview of the ECG ODE-GAN pipeline, showing the integration of physical parameters, the ODE-Generator, and the adversarial training loop.

The pipeline operates as follows:

  1. Parameter Extraction: Physical parameters (timing and voltage of P, Q, R, S, and T peaks) are extracted from real heartbeats to guide the generation process.
  2. ODE Generation: The generator predicts the derivative based on the current state and these physical parameters.
  3. Numerical Integration: A solver (e.g., Runge-Kutta) integrates these derivatives over $T$ steps to produce a synthetic heartbeat.
  4. Adversarial Training: A discriminator evaluates the realism of the generated signal against real patient data, providing feedback to the generator.

ODE-Generator Architecture

To capture the distinct phases of a cardiac cycle, the authors designed a modular generator consisting of six specialized sub-networks. Five of these networks model the dynamics of specific waves (P, Q, R, S, and T), while the sixth models "baseline wander"—the low-frequency noise typical in clinical recordings caused by patient movement or breathing.

The modular ODE-Generator architecture, featuring sub-networks for individual heartbeat components and the governing differential equation.

By decomposing the heartbeat into its physiological components, the model ensures that the generated signals adhere to the known structure of human heart activity. The final derivative is a summation of these components, as defined in the governing equation of the system.

Experimental Setup and Results

The model was evaluated using the MIT-BIH Arrhythmia Database, focusing on data augmentation for rare classes: Supraventricular ectopic beats (SVEB/S) and Fusion beats (F).

The synthetic data generated by ECG ODE-GAN was used to augment a 1D-ResNet classifier. The results demonstrated significant improvements over baseline models and standard GAN architectures:

  • Rare Class Performance: For the SVEB class, precision increased from a baseline of 0.02 to 0.83. For Fusion beats, precision rose from 0.04 to 0.45.
  • Qualitative Fidelity: Visual analysis confirmed that the model successfully captures subtle morphological features, such as the P and S waves, which are often lost in simpler generative models.

Conclusion

ECG ODE-GAN represents a significant step forward in physically-constrained generative modeling. By learning the "how" (the process) rather than just the "what" (the output), it produces synthetic ECGs that are both realistic and physiologically valid. While currently focused on single-lead ECGs and requiring pre-extracted physical parameters, the framework's modular approach to learning system dynamics holds promise for broader applications in biological and physical signal synthesis.

Summary updated

Abstract

Understanding the dynamics of complex biological and physiological systems has been explored for many years in the form of physically-based mathematical simulators. The behavior of a physical system is often described via ordinary differential equations (ODE), referred to as the dynamics. In the standard case, the dynamics are derived from purely physical considerations. By contrast, in this work we study how the dynamics can be learned by a generative adversarial network which combines both physical and data considerations. As a use case, we focus on the dynamics of the heart signal electrocardiogram (ECG). We begin by introducing a new GAN framework, dubbed ODE-GAN, in which the generator learns the dynamics of a physical system in the form of an ordinary differential equation. Specifically, the generator network receives as input a value at a specific time step, and produces the derivative of the system at that time step. Thus, the ODE-GAN learns purely data-driven dynamics. We then show how to incorporate physical considerations into ODE-GAN. We achieve this through the introduction of an additional input to the ODE-GAN generator: physical parameters, which partially characterize the signal of interest. As we focus on ECG signals, we refer to this new framework as ECG-ODE-GAN. We perform an empirical evaluation and show that generating ECG heartbeats from our learned dynamics improves ECG heartbeat classification.
BibTeX
@inproceedings{golany2021ecg,
  author = {Tomer Golany and Daniel Freedman and Kira Radinsky},
  title = {{ECG ODE-GAN: Learning Ordinary Differential Equations of ECG Dynamics via Generative Adversarial Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i1.16086},
}
Figure