ECG-based machine-learning algorithms for heartbeat classification

Saira Aziz, Sajid Ahmed, Mohamed‐Slim AlouiniScientific 2021 · DOI

Abstract

Electrocardiogram (ECG) signals represent the electrical activity of the human hearts and consist of several waveforms (P, QRS, and T). The duration and shape of each waveform and the distances between different peaks are used to diagnose heart diseases. In this work, to better analyze ECG signals, a new algorithm that exploits two-event related moving-averages (TERMA) and fractional-Fourier-transform (FrFT) algorithms is proposed. The TERMA algorithm specifies certain areas of interest to locate desired peak, while the FrFT rotates ECG signals in the time-frequency plane to manifest the locations of various peaks. The proposed algorithm's performance outperforms state-of-the-art algorithms. Moreover, to automatically classify heart disease, estimated peaks, durations between different peaks, and other ECG signal features were used to train a machine-learning model. Most of the available studies uses the MIT-BIH database (only 48 patients). However, in this work, the recently reported Shaoxing People's Hospital (SPH) database, which consists of more than 10,000 patients, was used to train the proposed machine-learning model, which is more realistic for classification. The cross-database training and testing with promising results is the uniqueness of our proposed machine-learning model.

Introduction

Cardiovascular diseases (CVDs) remain the leading cause of death globally. The Electrocardiogram (ECG) is the gold standard for diagnosis, capturing the heart's electrical activity through specific waveforms: the P wave, the QRS complex, and the T wave. While automated systems exist, manual interpretation remains common because existing algorithms often struggle to accurately locate smaller P and T waves or fail to generalize across diverse patient populations found in real-world clinical settings.

Standard ECG waveform showing P, QRS, and T components

Methodology

The researchers proposed a robust framework designed to overcome the limitations of dataset bias and subtle feature detection. The process follows a structured pipeline from raw signal acquisition to final disease classification.

  1. Signal Filtering: Using Discrete Wavelet Transform (DWT), specifically the Daubechies-4 wavelet, the system removes baseline drift and high-frequency muscle noise.
  2. Peak Detection (Fusion Algorithm): This core innovation combines Two-Event Related Moving Averages (TERMA) with the Fractional Fourier Transform (FrFT). The FrFT "rotates" the signal in the time-frequency plane to sharpen peaks, while TERMA establishes "Blocks of Interest" (BOIs) to isolate where peaks are likely to occur.
  3. Classification: Extracted features, such as PR and RT intervals, are combined with patient metadata (age and sex) to train Support Vector Machine (SVM) and Multi-layer Perceptron (MLP) models.
Workflow of the proposed automated heartbeat classification system

Datasets and Results

A key differentiator of this study is the use of the Shaoxing People’s Hospital (SPH) database, which includes data from 10,646 patients, providing a much more realistic training set than the traditional 48-patient MIT-BIH database.

  • Peak Detection: The fusion algorithm achieved a sensitivity of 99.83% for R-peak detection.
  • Classification Accuracy: The MLP classifier reached 99.8% accuracy on the MIT-BIH set. More importantly, it maintained a high stability of 90.7% on the massive SPH database using only four key features.
  • Cross-Database Validation: When trained on MIT-BIH and tested on the independent INCART database, the model achieved 99.85% accuracy, demonstrating exceptional generalizability.

Conclusion

By fusing advanced signal processing with machine learning and validating against large-scale clinical data, this research provides a stable framework for automated cardiac monitoring. While challenges remain regarding complex T-wave morphologies, the high cross-database performance suggests the model is well-suited for real-world deployment, including potential integration into mobile health monitoring systems.

Summary updated

Abstract

Electrocardiogram (ECG) signals represent the electrical activity of the human hearts and consist of several waveforms (P, QRS, and T). The duration and shape of each waveform and the distances between different peaks are used to diagnose heart diseases. In this work, to better analyze ECG signals, a new algorithm that exploits two-event related moving-averages (TERMA) and fractional-Fourier-transform (FrFT) algorithms is proposed. The TERMA algorithm specifies certain areas of interest to locate desired peak, while the FrFT rotates ECG signals in the time-frequency plane to manifest the locations of various peaks. The proposed algorithm's performance outperforms state-of-the-art algorithms. Moreover, to automatically classify heart disease, estimated peaks, durations between different peaks, and other ECG signal features were used to train a machine-learning model. Most of the available studies uses the MIT-BIH database (only 48 patients). However, in this work, the recently reported Shaoxing People's Hospital (SPH) database, which consists of more than 10,000 patients, was used to train the proposed machine-learning model, which is more realistic for classification. The cross-database training and testing with promising results is the uniqueness of our proposed machine-learning model.
BibTeX
@inproceedings{aziz2021ecg,
  author = {Saira Aziz and Sajid Ahmed and Mohamed‐Slim Alouini},
  title = {{ECG-based machine-learning algorithms for heartbeat classification}},
  booktitle = {Scientific},
  year = {2021},
  doi = {10.1038/s41598-021-97118-5},
}
Figure