Heartbeat Anomaly Detection using Adversarial Oversampling

Jefferson L. P. Lima, David Macêdo, Cleber Zanchettin

TL;DR

This paper tackles the challenge of imbalanced datasets in cardiovascular disease detection by proposing "Adversarial Oversampling," a novel method that uses an InfoGAN to generate synthetic ECG heartbeat samples for minority classes. This approach significantly improves classification performance for rare arrhythmias compared to traditional oversampling techniques.

What Problem Does This Paper Address?

Cardiovascular diseases are a major global health concern, and early detection through ECG analysis is crucial for effective prevention and treatment. However, a common hurdle in training machine learning models for this task is the severe class imbalance present in real-world ECG datasets. Specifically, abnormal heartbeats (arrhythmias) are much rarer than normal heartbeats, leading to models that perform well on common cases but poorly on critical, infrequent anomalies. This imbalance can lead to missed diagnoses and negatively impact patient outcomes. Traditional methods for addressing this imbalance, like random oversampling or SMOTE, often introduce noise or fail to capture the true underlying data distribution, limiting their effectiveness.

Methods

The core of this work is the "Adversarial Oversampling" technique, which leverages a Generative Adversarial Network (GAN), specifically an InfoGAN, to address class imbalance. The pipeline involves three main stages:

  1. Pre-processing: Raw ECG signals are converted into 2D images, with each image representing a single heartbeat centered around its peak. This transforms the 1D time-series data into a format suitable for Convolutional Neural Networks (CNNs).
  2. Adversarial Oversampling (InfoGAN): An InfoGAN is trained to generate synthetic heartbeat images for the minority classes (e.g., Ventricular Escape Beat - VEB, Atrial Premature Contraction - APC). The InfoGAN's architecture includes a Generator (G) to create synthetic images and a Discriminator (D) to distinguish real from fake images. An auxiliary Q Net is also used to provide labels for the generated synthetic images. The goal is to learn the data distribution of the minority classes and produce realistic, novel samples.
  3. Training and Classification: A 2D CNN is then trained on the augmented dataset, which now includes both original and synthetically generated samples, aiming for a more balanced distribution. The CNN architecture consists of convolutional layers, ReLU activation, dropout for regularization, batch normalization, and a softmax output layer for classification.

The authors compare their Adversarial Oversampling method against three established oversampling techniques: Random Oversampler, SMOTE (Synthetic Minority Over-sampling Technique), and ADASYN (Adaptive Synthetic Sampling Approach for Imbalanced Learning).

Datasets

The primary dataset used in this study is the MIT-BIH Arrhythmia Database. This dataset is a well-known benchmark for cardiac arrhythmia research, containing 48 half-hour, two-channel ambulatory ECG recordings from 47 subjects. The authors extracted samples from seven different heartbeat classes: Normal, APC, LBBB, PAB, PVC, RBB, and VEB. For training the InfoGAN, only the training set of the original dataset was used.

Key Insights and Ideas

  • GANs for Data Augmentation in Healthcare: The paper demonstrates the efficacy of using GANs, specifically InfoGAN, not just for general data augmentation but for targeted oversampling of minority classes in a critical medical domain like ECG analysis.
  • Beyond Simple Replication: Unlike traditional oversampling methods that might simply duplicate existing samples or create synthetic ones with limited variation, InfoGAN generates novel samples that better capture the underlying distribution of the minority classes. This is crucial for learning subtle variations in abnormal heartbeats.
  • Improved Minority Class Performance: The core insight is that Adversarial Oversampling significantly boosts the F1-score for minority classes (VEB and APC) without detrimentally affecting the performance on majority classes. This is a critical balance to strike in imbalanced classification.
  • 2D CNNs for ECG Analysis: The study reinforces the effectiveness of using 2D CNNs on image representations of heartbeats, showing excellent performance when combined with appropriate data balancing techniques.

Key Results

  • Improved F1-Scores: The proposed Adversarial Oversampling method achieved higher F1-scores for the minority classes VEB and APC compared to Random Oversampler, SMOTE, and ADASYN. For VEB, the F1-score increased from 0.43 (original) to 0.81, a substantial improvement. For APC, it rose from 0.68 to 0.80.
  • Balanced Performance: While significantly improving minority class performance, the Adversarial Oversampling method did not negatively impact the F1-scores of the majority classes, maintaining high performance across the board.
  • Optimal Sample Generation: The experiments showed that adding approximately 600 synthetic samples for both APC and VEB classes yielded the best overall CNN performance.
  • Qualitative Improvement: The generated synthetic samples were visually realistic and maintained the characteristics of the original minority class heartbeats, as illustrated in Figure 4.

Limitations and Future Work

  • Manual Sample Selection: The current method involves a manual selection of generated synthetic images based on visual inspection for realism, rather than an automated process driven by loss metrics.
  • Future Work Suggestions:
    • Develop a more automatic method for generating and selecting synthetic samples, potentially by incorporating loss-based criteria or reducing reliance on human interference.
  • Explore new GAN architectures or techniques for even more robust and efficient data augmentation.
  • Evaluate the performance of these approaches on larger and more diverse ECG datasets.
  • The authors have made their code publicly available for further research.

Summary updated

Abstract

Cardiovascular diseases are one of the most common causes of death in the world. Prevention, knowledge of previous cases in the family, and early detection is the best strategy to reduce this fact. Different machine learning approaches to automatic diagnostic are being proposed to this task. As in most health problems, the imbalance between examples and classes is predominant in this problem and affects the performance of the automated solution. In this paper, we address the classification of heartbeats images in different cardiovascular diseases. We propose a two-dimensional Convolutional Neural Network for classification after using a InfoGAN architecture for generating synthetic images to unbalanced classes. We call this proposal Adversarial Oversampling and compare it with the classical oversampling methods as SMOTE, ADASYN, and RandomOversampling. The results show that the proposed approach improves the classifier performance for the minority classes without harming the performance in the balanced classes.
BibTeX
@inproceedings{lima2019heartbeat,
  author = {Jefferson L. P. Lima and David Macêdo and Cleber Zanchettin},
  title = {{Heartbeat Anomaly Detection using Adversarial Oversampling}},
  booktitle = {IJCNN},
  year = {2019},
  url = {https://openreview.net/forum?id=w5K3m_eRQUe},
}
Figure