Skip to main content

An improved electrocardiogram arrhythmia classification performance with feature optimization

Abstract

Background

Automatic classification of arrhythmias based on electrocardiography (ECG) data faces several significant challenges, particularly due to the substantial volume of clinical data involved in ECG signal analysis. The volume of clinical data has increased considerably, especially with the emergence of new clinical symptoms and signs in various arrhythmia conditions. These symptoms and signs, which serve as distinguishing features, can number in the tens of thousands. However, the inclusion of irrelevant features can lead to inaccurate classification results.

Method

To identify the most relevant and optimal features for ECG arrhythmia classification, common feature extraction techniques have been applied to ECG signals, specifically shallow and deep feature extraction. Additionally, a feature selection technique based on a metaheuristic optimization algorithm is utilized following the ECG feature extraction process.

Results

Our findings indicate that shallow feature extraction based on the time-domain analysis, combined with feature selection using a metaheuristic optimization algorithm, outperformed other ECG feature extraction and selection techniques. Among eight features of time-domain anaylsis, the selected feature is one to three features from RR-interval assesment, achieving 100% accuracy, sensitivity, specificity, and precision for ECG arrhythmia classification.

Conclusion

The proposed end-to-end architecture for ECG arrhythmia classification demonstrates simplicity in parameters and low complexity, making it highly effective for practical applications.

Peer Review reports

Introduction

Arrhythmia is a condition characterized by an irregular or abnormal heart rhythm. Typically, a normal heartbeat follows a sinus rhythm pattern, with electrical signals being generated by the sinoatrial node located in the right atrium of the heart [1]. Abnormal electrical impulses are a key characteristic of arrhythmias and may initially go unnoticed in patients, potentially leading to cardiovascular disease. Early and precise diagnosis of arrhythmias is crucial for preventing cardiovascular disease [2].

Electrocardiography (ECG) remains the gold standard for identifying arrhythmia conditions [3]. However, in many instances for arrhythmia identification, the conventional rule-based diagnostic approach proves inefficient when faced with large volumes of diverse data [4]. The automatic ECG arrhythmia classification is extensively needed to improve the efficiency, nevertheless, it faces considerable challenges, primarily due to the vast amount of clinical data which heightens the risk of false diagnoses [4]. Several distinguishing features will provide important information about arrhythmia condition [5]. If the selected features are not pertinent, it will produce inaccurate classification performance [6].

Machine learning offers significant potential in optimizing features, allowing developers to determine which features have the most substantial impact on the performance of model. This insight can be used to refine the overall pipeline by creating relevant features from existing data, thereby enhancing predictive accuracy [7]. The feature extraction and feature selection from the ECG signal should faithfully capture specific patterns or behaviors observed within the ECG signal, a task that is inherently challenging [8]. Therefore, identifying the optimal features for ECG arrhythmia classification is highly desirable.

ECG feature extraction yields critical features such as amplitude and intervals (e.g., heart rate variability, QRS width, PQ/PR interval, and QRS amplitude), which are essential for subsequent automated analysis [8, 9]. ECG feature extraction has been leading to the development of numerous advanced techniques and transformations aimed at achieving accurate and rapid extraction of ECG features [9]. The objective of ECG feature extraction is to pinpoint the minimal number of features that facilitate effective abnormality detection and accurate prognosis [10]. Recently, several techniques have been proposed for ECG feature extraction, categorized into shallow and deep features [11,12,13,14,15,16,17,18,19]. Shallow features, typically handcrafted, are selected based on experience or through trial and error [20], while deep features involve automatic feature extraction and classification. Deep features technique does not rely on any hard-coded features due to its characteristic representation of the deep learning algorithm [20,21,22,23].

Shallow features encompass; (i) time-domain [11,12,13], (ii) frequency-domain [14,15,16], and (iii) time–frequency domain [17,18,19]. Time-domain feature extraction involves analyzing the ECG signal over time, enabling the measurement of signal variations [21]. Technique like linear predictive coding have demonstrated efficiency in time-domain analysis [24]. Frequency-domain features represent the energy distribution of an ECG signal as a function of its constituent frequencies, which is critical for analysis and often yields a better data representation [21]. The combination of time and frequency domain feature extraction is the time–frequency domain. The joint time–frequency domain offers greater insight into the frequency components along with their associated time instances. This enhanced representation of the ECG signals is expected to improve accuracy and, theoretically, yield better results [17,18,19].

Estimating the performance of a feature set from ECG feature extraction without training and testing the classification model is inherently challenging. Consequently, ECG feature selection becomes an iterative process, requiring the evaluation of multiple feature sets to achieve optimal classification performance [8, 9]. ECG feature selection is the process of reducing the number of features and enhancing the efficiency of the performance model [25]. In recent two years, several studies have explored the feature selection using metaheuristic algorithm in ECG processing. Patro et al. [26] experimented GA, particle swarm optimization (PSO), least absolute shrinkage selection operator and elastic net (EN). The features from the optimization phase are fed into popular machine learning techniques, such as SVM and random forest (RF) classifiers. As a result, the GA and EN methods combined with the RF classifier yield enhanced recognition rates of 95.30% and 94.90%, respectively. Hassaballah et al. [27] proposed marine predator algorithm (MPA), as metaheuristic optimization and combined machine learning classifiers for ECG arrhythmia classification. The obtained results demonstrated that the performance of all tested classifiers significantly improved after integrating the MPA, resulting in an average ECG arrhythmia classification accuracy of 99.92% and a sensitivity of 99.81%. Qaisar et al. [28] is presented for arrhythmia identification by processing the ECG signals with Butterfly Optimization Algorithm, MRFO, and Emperor Penguin Optimization algorithms. Among these, Butterfly Optimization Algorithm outperformed with the highest accuracy achieved 99.14%. Tunç et al. [29] compared three FS algorithms (minimum redundancy maximum relevance, Chi-square, and matched selection) for ECG arrhythmias classification. The experimental results indicate that the combination of the proposed feature selection method, referred to as "Matched Selection," with the SVM classifier outperforms other approaches, achieving an accuracy of 81.27%. Admass et al. [30] utilized attention-based deep learning techniques for arrhythmia classification. They combined the Adaptive Risk Rate-based Lemurs Optimization Algorithm (ARR-LO) with an adaptive attention-based hybrid deep learning model (HA-LSTM-DTCN). The results showed that the AR-LO-HA-LSTM-DTCN model significantly enhanced arrhythmia classification performance, making it valuable for the rapid diagnosis of arrhythmia.

Previous research has shown that the outstanding metaheuristic algorithm in ECG feature selection. In our previous study [31], we have proven that one of metaheuristic algorithm, namely teaching learning-based optimization (TLO) combined with support vector machines (SVM) as a wrapper method delivers outstanding performance in various medical structured datasets for feature selection. TLO has been successfully adapted and extensively applied to tackle a variety of real-world problems across various domains of science and technology, due to its straightforward concept, absence of algorithm-specific parameters, rapid convergence, ease of implementation, and overall effectiveness [32]. To our knowledge, no researchers have utilized the TLO approach to optimize ECG signal features. Hence, TLO is used for ECG feature selection following the feature extraction process.

Overall, ECG feature extraction and feature selection significantly optimize the features. These advantages are particularly valuable in machine learning-based ECG arrhythmia identification. Building on this foundation, an end-to-end methodology with feature optimization is proposed for ECG arrhythmia classification. The main contributions of this paper are as follows:

  • Proposing a robust end-to-end methodology for ECG arrhythmia classification.

  • Developing a feature selection with TLO and feature extraction model that uses time-domain analysis to identify key features in ECG signals.

  • Designing a machine learning approach utilizing optimized features for precise ECG arrhythmia classification.

  • Evaluating the proposed methodology from an ECG rhythm perspective through RR-interval assessment.

Material and method

The research methodology of this study is required to describe the experimental procedures in detail. The research methodology of this study can be presented in Fig. 1, which consisted of:

  1. (i)

    Data preparation: ECG raw data preparation from Lobachevsky University Electrocardiography Database (LUDB) and QT Database (QTDB),

  2. (ii)

    ECG Pre-processing: ECG pre-processing that consisted of ECG denoising, amplitude normalization, and segmentation,

  3. (iii)

    FE: several FE techniques have been explored and compared at a high level, such as shallow (time-domain, frequency-domain, time–frequency domain) and deep features (autoencoder and convolution layer),

  4. (iv)

    FS: the implementation of TLO based on metaheuristic optimization,

  5. (v)

    Supervised learning: the wrapper method interacts with any learning method (classifier) to evaluate the candidate's subset of features. Therefore, we have experimented with machine learning classifier (SVM), and

  6. (vi)

    Evaluation of fitness function: the performance evaluation of proposed end-to-end methodology (accuracy, sensitivity, specificity, and precision).

Fig. 1
figure 1

The research methodology

Data preparation

In this study, we have explored the LUDB [33] and QTDB [34]. Both databases have annotated ECG waveforms by certified cardiologists, with information on the start, peak, and end of P, T waves, and QRS complexes. The ECG signals are digitized at 500 and 250 samples per second, for LUDB and QTDB, respectively. The LUDB dataset contains 200 ten-second 12-lead ECG recordings, showcasing various ECG signal morphologies. Among them, we experimented with the 132 normal sinus rhythm (NSR) records, 15 atrial fibrillation (AF) records, and 24 sinus bradycardia (SBR) records in lead II only. The placement of the lead II electrode allows for clear visualization of key ECG elements like P waves, QRS complexes, and T waves, supporting accurate interpretation [35]. QTDB has also provided the information of P, T waves, and QRS complexes, which is consistsed of 105 fifteen-minute excerpts of two-channel ECG Holter recordings. For QTDB, we used 13 supraventricular arrhythmia (SAR) records. The sample and detailed description of each record are presented in Fig. 2 and Table 1.

Fig. 2
figure 2

The sample plot of ECG arrhythmia records

Table 1 The ECG records a detailed description

ECG pre-processing

In this study, before obtaining the optimized feature, we have proposed three steps for ECG preprocessing below:

  1. 1.

    ECG Denoising. Measuring and analyzing ECG signals can be complex due to the presence of noise from sources such as movement, muscle artifacts, powerline interference, and baseline drift. We utilized discrete wavelet transform (DWT) to tackle the challenge of canceling ECG noise. The effectiveness of the denoising process relies on factors like the wavelet function used, the level of decomposition, the choice of thresholds, and the reconstruction process. In this study, we proposed bior wavelet, specifically Bior6.8, chosen based on previous research that has established its effectiveness [36].

  2. 2.

    ECG Normalization. After canceling the ECG noise, we standardized the amplitude range for more efficient computation. We used the normalized bound method, part of a signal-processing toolkit (waveform-database, WFDB) for reading, writing, and processing ECG signals and annotations. This approach involved adjusting the signal data values to fall within a range of zero as the lower bound and one as the upper bound.

  3. 3.

    ECG Segmentation. This study used two databases of ECG signals from LUDB and QTDB, which have different length and frequency sampling. The LUDB signal has a length of 5000 nodes with a frequency sampling rate of 500 Hz, while the QTDB signal has a length of 225,000 nodes with a frequency sampling rate of 250 Hz. To determine a fixed length, the ECG signals are segmented every 5000 nodes, based on the smallest signal length from both databases.

Feature extraction

Feature extraction (FE) is an essential step of ECG signal pre-processing. ECG signals are non-stationary and non-linear, which have many features such as P, T waves and QRS complexes, ST-segment, PR-interval, RR-interval, etc. [37,38,39,40]. Several FE techniques have been explored at a high level, such as shallow and deep features [20, 21].

Shallow features

Shallow features, typically handcrafted, are selected based on experience or through trial and error [20]. Shallow features consisted of; (i) time-domain [11,12,13], (ii) frequency-domain [14,15,16], and (iii) time–frequency domain [17,18,19]. The description of the shallow features can be described as:

  • Time-domain feature allows us to quantify how the ECG signal changes over time [21]. Time-domain features are segmented and extracted per window. Time-domain FE technique has low computational cost due to extracting statistical features from ECG signals is notably simpler compared to other methods of FE in the time-domain [41]. Hence, we have implemented the popular statistical features that can be extracted from the ECG. The time-domain features used in this study based on statistical features are listed in Table 2. Due to this study being concerned with arrhythmia cases, we are concerned with extracting RR-interval based on time-domain features. The ECG rhythm variability in RR-intervals is referred to as heart rate variability. The RR-interval is the duration of time between two consecutive R-waves in the QRS complex of an ECG.

    Table 2 The statistical time-domain features based on RR-interval [41]
  • Frequency domain is also frequently used for ECG signal FE [21]. In this study, we have used the fast Fourier transform (FFT) based on the frequency domain. FFT is a fast and efficient implementation of the discrete Fourier transform (DFT). Its algorithm can be used to detect anomalies in ECG signals [21, 42]. FFT can be analyzed to better understand the distribution of signal frequencies [21]. The extracted frequency-domain features based on FFT that were used in this study are listed in Table 3. There are two extracted features by frequency-domain features based on FFT; fft_max_amplitude and fft_frequency_of_max_amplitude. The sample visualization of frequency-domain FE on ECG signals can be presented in Fig. 3.

    Table 3 The results of frequency-domain features based on FFT
    Fig. 3
    figure 3

    The sample visualization of ECG signal based on frequency-domain

  • Time–frequency domain FE techniques are useful for considering the non-stationary nature of ECG signals [21, 43]. Since ECG signals are inherently non-stationary, it is beneficial to represent the signal in two dimensions, with time and frequency as coordinates [44]. In this study, we have used the short-time Fourier transform (STFT) based on the time–frequency domain. STFT can be used to calculate and analyze the energy distribution of ECG signals, which is essentially used to calculate the signal's frequency strength at the time \(t\) [21, 45]. STFT has a trade-off between time resolution and frequency resolution, so it constrains features by the accuracy of the frequency distribution. If the resolution in the frequency domain is increased, longer ECG data segments are required; however, the longer the ECG data, the higher the variation of frequency in the time domain. This means that if we want high time resolution, shorter ECG signal windowing is required [21, 46]. The extracted time–frequency domain features based on STFT that used in this study are listed in Table 4. Table 4 listed the results of time–frequency domain features based on STFT. There are ten extracted features, i.e., stft_max_amps, stft_min_amps, stft_freq_idx_of_max_amps, stft_freq_idx_of_min_amps, stft_time_idx_of_max_amps, stft_time_idx_of_min_amps, stft_freq_val_of_max_amps, stft_freq_val_of_min_amps, stft_time_val_of_max_amps, and stft_time_val_of_min_amps. The sample visualization of time–frequency domain FE on ECG signals can be presented in Fig. 4.

    Table 4 The results of time–frequency domain features based on STFT
Fig. 4
figure 4

The sample visualization of ECG signal based on time–frequency domain

Deep features

Different to shallow FEs (time-domain, frequency-domain, and time–frequency domain) that used human intervention, deep features with deep learning approach and its associated features can enable artificial intelligence to execute tasks autonomously without human intervention. The aim of automated FE with deep features in machine learning models by automatically generating numerous potential features from a dataset, from which the most effective ones can be identified and utilized for model training [47]. This process results in a vast array of options derived from all correlations within the dataset. The automation procedure operates similarly to shallow FE but broadens its scope to encompass as many connections as possible. Automated FE utilizes artificial intelligence to automatically extract the most optimal features (predictive values) necessary to address the queries posed by machine learning algorithms. This expedites the FE process and uncovers connections that may not be readily apparent to a human analyst. This study also compared deep features based on deep learning (AE and CNN). Previous studies have implemented AE and CNN for automated ECG FE [48, 49]. The structure of AE consisted of encode and decode layers (100 – 50 – 100 nodes). The input size shape is 5000 × 1 with the rectified linear unit (ReLU) function. For the structure of CNN, this study implemented a one convolution layer with a kernel size of 3 × 1 and one stride.

Feature selection

The primary distinction between them is that FE merges the original features and creates a set of new features, whereas feature selection (FS) involves choosing a subset of the original features [9]. In this study, we implemented TLO based on metehuristic optimization for FS that has proposed in our recent publication [31]. TLO is a feature selection method to obtain global solutions that work on the teaching and learning philosophy [50]. The foundation of the TLO approach is how the influence of a teacher effects the output of students in a classroom. In this case, output is measured in terms of grades or results. Most people view teachers as extremely intelligent individuals who impart their knowledge to students. The outcomes of students are impacted by their teacher. It goes without saying that a skilled educator prepares students to get higher scores or marks. Additionally, students obtain the knowledge from their own interactions with one other students, which it improves their performance [32]. The phases of teaching and learning can be explained below;

Teaching phase

The teaching phase represents the global search strategy of the TLO. A skilled teacher aims to improve the learners' performance by instructing them. The teachers seek to raise the average grade point of each subject for all learners to match their level. A skilled teacher elevates learners to their level of knowledge. However, in reality, this is not entirely achievable, and a teacher can only advance the class average to a certain degree based on the students' abilities.

For the \(i\)-th learner \({L}_{i}\) in the class, the updating mechanism is expressed as follows:

$$newL_i=L_i+r\;\left(T-T_FAverage\right)$$
(1)

where \(new{L}_{i}\) is the new state of the learner \({L}_{i}\), \(T\) is the learner with the best fitness and \({\text{Average}}\) is the mean state of the class (\(\frac{1}{NP}\sum_{i=1}^{NP}{L}_{i})\), where \(NP\) is the learner numbers in the population, \({T}_{F}\) is a teaching factor that decides the value of the mean to be changed (\(round[1+round\left(\text{0,1}\right)]\), and \(r\) is a random number in the range [0, 1]. Following the teaching phase, the superior learner—either the existing learner or the newly generated one—is chosen to proceed into the learning phase.

Learning phase

Students expand their knowledge through two primary methods: one is receiving instruction from the teacher, and the other is engaging in peer-to-peer interaction (discussion, presentation, collaborative learning, and so on). For the 𝑖-th learner 𝐿𝑖 in the class, the updating mechanism is presented below;

$$newL_{\mathrm i}=\left\{\begin{array}{l}L_{\mathrm i}+\;r\left(L_{\mathrm i}-L_k\right)\;\mathrm{if}\;f\left(L_i\right)<\;f\left(L_k\right)\\L_{\mathrm i}+\;r\left(L_k-\;L_{\mathrm i}\right)\;\mathrm{otherwise}\end{array}\right.$$
(2)

where \(new{L}_{i}\) is the new positions of the \(i\)-th learner \({L}_{i}\), \({L}_{k}\) is a randomly selected learner from the class, \(f({L}_{i})\) and \(f({L}_{k})\) are the fitness values of the \({L}_{i}\) and \({L}_{k}\) respectively. Similar to the teaching phase, the more proficient learner—whether the existing learner or the newly created one—will be selected to advance to the next teaching phase after the learning phase. This study experimented the existing default parameters of TLO, with epochs and population size values of 100. The feature significance threshold value used as feature input is > 0.5. Ibrahim, et al. [51] utilized a threshold value of 0.5 on a medical dataset. If the threshold value > 0.5, then all values of feature significance from TLO are used as input features for the classifier. Therefore, if the component value is equal to or more than 0.5, it will be replaced with 1 so that the feature is selected, otherwise the value is close to 0 and the feature is not selected.

Supervised learning

Supervised learning is a popular machine learning type that involves training a predictive model that includes the target outputs. One of the supervised methods is classification, which means to group the output inside a class. In this study, we have a wrapper approach (TLO) as a FS method. The wrapper method interacts with any learning method (classifier) to evaluate the candidate's subset of features. Therefore, we have experimented with SVM. We have used the default parameter of SVM. SVM is a supervised learning algorithm to find a hyperplane in an \(d\)-dimensional space, which \(d\) is the number of features and separates its perfectly into two classes [49]. We are given \(t\) training examples \({\{x}_{i},{y}_{i}\}\), which \(i=1,\dots .,t,\) where each example has \(d\) inputs \(\left({x}_{i}\epsilon {{\varvec{R}}}^{d}\right)\), and a class label with one of two values \({y}_{i}\epsilon \{-\text{1,1}\})\). All hyperplanes in \({{\varvec{R}}}^{d}\) are parameterized by a vector \(({\varvec{w}})\), and a constant \((b)\), expressed as follows:

$${\varvec{w}}\cdot x+b=0$$
(3)

Given such a hyperplane \((w,b)\) that separates the data, so this gives the function:

$$f\left(x\right)=\text{sign}({\varvec{w}}\cdot x+b)$$
(4)

which correctly classifies the training or testing data.

The detailed parameters of SVM classifier can be listed in Table 5.

Table 5 The parameters of SVM classifier

To evaluate feature optimization, we have experimented nine case studies (refer to Tables 6 and 7). We explored the binary NSR and AF classification, and multiclass NSR, AF, SBR, and SAR classification. We compared time-domain, frequency-domain, time–frequency-domain, and deep features with TLO for ECG arrhythmia classification.

Table 6 The case studies of shallow FE and TLO
Table 7 The case studies of deep FE and TLO

Evaluation of fitness function

The objective function (fitness function) or suitability function is used to evaluate and determine how well the combination of features being considered in the feature optimization process performs [52]. FS is a process of selecting a subset of features from a set of available features to improve model performance, reduce overfitting, and accelerate computation time. The aim FS in this study is to enhance model performance by using a minimal subset of features. Therefore, improving accuracy, sensitivity, specificity, and precision is required. Accuracy, sensitivity, specificity, and precision values are generated from the evaluation of the confusion matrix (CM). CM is used to measure the performance of a classification model, which consists of four main components, i.e., true positive (TP), true negative (TN), false positive (FP), and false negative (FN). The detailed equation can be followed as;

$$\mathrm{Accuracy}=\frac{\sum_{i=1}^l{TP}_i+\sum_{i=1}^l{TN}_i}{\sum_{i=1}^l{TP}_i+\sum_{i=1}^l{TN}_i+\sum_{i=1}^l{FP}_i+\sum_{i=1}^l{FN}_i}$$
(5)
$$\mathrm{Sensitivity}=\frac{\sum_{i=1}^l{TP}_i}{\sum_{i=1}^l{TP}_i+\sum_{i=1}^l{FN}_i}$$
(6)
$$\mathrm{Specificity}=\frac{\sum_{i=1}^l{TN}_i}{\sum_{i=1}^l{TN}_i+\sum_{i=1}^l{FP}_i}$$
(7)
$$\mathrm{Precision}=\frac{\sum_{i=1}^l{TP}_i}{\sum_{i=1}^l{TP}_i+\sum_{i=1}^l{FP}_i}$$
(8)

where \(l\) is the number of classes in class-\(i\)

Results

In this study, total of 185 ECG record numbers were divided into 80% for the training set, 10% for validation, and the remaining for the testing set (unseen). This study was implemented on a workstation with one Intel(R) Core(TM) I9-9900 K CPU @ 3.60 GHz (16 CPUs) ~ 3.6 GHz, 32 GB RAM, and one NVIDIA GeForce RTX 2080 Ti 27 GB GPU (11 GB Dedicated, 16 GB Shared) is conducted. All experiments were run on Windows 10 Pro 64 Bit. Python codes in Spyder 4.1.5 with libraries, i.e., VS Code, TensorFlow, NumPy, pandas, scikit-learn, SciPy, matplotlib, seaborn, and the native Python waveform-database (WFDB) package were used.

The performance results of these experiments to binary and multiclass arrhythmia classification based on shallow and deep FE analysis can be presented as follows;

Shallow features

NSR and AF classification

Based on the study cases of FE and FS that are represented above in Table 6, there are four models of machine learning for NSR and AF classification. In the first model, NSR and AF classification involved time-domain FE, TLO, and SVM. Different from the first model, the second model did not use TLO as an FS technique. The technique of frequency-domain FE, TLO, and SVM and time–frequency-domain FE, TLO, and SVM were conducted in the third and fourth models, respectively. In the first model, among the eight time-domain features, only one feature was selected: the pnn50 feature (Table 8).

Table 8 The selected features of shallow FE

The first model using time-domain FE, TLO, and SVM outperformed the other models, achieving 100% accuracy, sensitivity, specificity, and precision (refer to Fig. 5). In the second model, time-domain FE technique with SVM (without TLO) also showed good results, although the sensitivity and specificity only reached 75%. In conclusion, out of the six proposed models, the time-domain FE technique excelled compared to frequency-domain, time–frequency-domain, and deep features extraction techniques for binary classification of NSR and AF.

Fig. 5
figure 5

The performance results of NSR and AF classification in testing set

Figure 6 presented the heatmap CM based on the performance of the four models. The CM is used to assess the performance of classification algorithms. It visualizes and summarizes the actual and predicted values of the classification algorithm. In the first model, both FP and FN are zero, meaning there were no errors in the prediction results. In contrast, in the second model, there is an FN value of 1, indicating that one AF class was predicted as NSR. The third – sixth models also have an FN value of 2, meaning that two AF records were also predicted as NSR. This may be due to the greater variation in features in each NSR ECG signal recording.

Fig. 6
figure 6

The heatmap CM of NSR and AF classification

NSR, AF, SBR and SAR classification

Based on the results of the binary classification experiment of NSR and AF, the proposed FE technique is time-domain. To validate the robustness of the time-domain FE technique, this study explored the multiclass classification by adding two arrhythmia classes, SBR and SAR. The heatmap CM for the classification of NSR, AF, SBR, and SAR can be seen in Fig. 7 (model 5). The model has no FP and FN, it demonstrates that by using the time-domain FE technique, accuracy, sensitivity, specificity, and precision still outperformed, reaching 100%. Out of the eight features extracted from the time-domain, three features were selected by TLO and SVM: pnn50, cvr_RR, and min_R (Table 8).

Fig. 7
figure 7

The heatmap CM of NSR, AF, SBR and SAR classification in time-domain analysis (model 5)

Deep features

We experimented AE and CNN as part of deep learning algorithms for automated FE. The extracted features by ECG FE techniques are selected by TLO. The selected features by TLO are being an input of AE and CNN. The results of FE are selected by TLO to find optimal features (Table 9). The structure of AE consisted of encode and decode layers (100 – 50 – 100 nodes). The input size shape is 5000 × 1 with the ReLU function. It means the total of extracted feature is 5000 nodes. For the structure of CNN, this study implemented a one convolution layer with a kernel size of 3 × 1, one stride, and 8 filter number. The feature map is a series of features are extracted from input via different filters (5000 nodes × 8 filter number). The feature map is being selected by TLO.

Table 9 The selected features of deep features

The performance results of the four models (models 6 – 9) can be presented in Figs. 8 and 9. Figure 8 presented the poor performance results for NSR and arrhythmia classification. With the basic parameters, we did not hyperparameter tunning for deep features. As the result, it was revealed that shallow FE, coupled with time-domain analysis, surpassed deep features in classifying both NSR and arrhythmia. Through shallow FE with simple parameter and low complexity, this study identified and prioritized features significantly enhancing model performance. Employing time-domain analysis in FE aligns with the specific problem addressed and is suitable for the model, thereby enhancing model accuracy.

Fig. 8
figure 8

The performance results of NSR, AF, SBR, and SAR classification with deep features

Fig. 9
figure 9

The heatmap CM of deep features (automated FE) for binary and multiclass ECG arrhythmia classification

Discussion

In shallow FE, there are eight, two, and ten extracted features by time-domain, frequency-domain, and time–frequency domain. Based on the results of the four models in binary classification (NSR and AF records), the first model using time-domain FE, TLO, and SVM outperformed the other models, achieving 100% accuracy, sensitivity, specificity, and precision (refer to Fig. 5). Among the eight time-domain features, only one feature was selected: the pnn50 feature. The pnn50 feature represents the percentage of NN50, which is the number of adjacent RR-intervals. This feature is the most important because it relates to RR-interval assessment. For arrhythmia classification based on medical rules, RR-intervals are essential for determining heart rate. Normal heart rate varies from person to person, but the normal range for adults is 60 to 100 beats per minute (bpm). However, normal heart rate depends on factors such as the individual's age, body size, heart condition, activity level, certain medications, and even air temperature. Changes in RR-intervals can indicate an abnormal heart rate, whether it is too fast or too slow. In multiclass classification (NSR, AF, SBR and SAR records), out of the eight features extracted from the time-domain, three features were selected by TLO and SVM: pnn50, cvr_RR, and min_RR (minimum RR-interval). The cvr_RR feature is coefficient of variation of RR-interval. The cvr_RR of the time interval between two consecutive R-waves, known as the RR-interval (\({RR}_{i}\)), has been suggested as an alternative measurement of heart rate variability approach. The cvr_RR is computed by dividing the standard deviation of the RR interval (\(\text{std}\_\text{RR}\)) by the mean of the RR interval (\(\text{mean}\_\text{RR})\). The cvr_RR shares similarities with heart rate variability and allows for individual normalization in patients with cardiovascular conditions. Additionally, the coefficient of variation of \({RR}_{i}\), demonstrates less variability over time and among different individuals compared to heart rate variability, making it a potential marker of cardiovascular autoregulation. Hence, the cvr_RR feature can serve as a key metric for assessing cardiovascular function and its relationship with age and stroke.

Different to shallow FE, deep features automatically generates an extensive array of options by exploring every correlation identified by the system. This automated process parallels manual FE but broadens the scope to encompass as many connections as feasible. FE with deep features is automatically carried out from the input data. Subsequently, a fully connected, multi-layer perceptron operates to categorize the information acquired in the initial phase. Utilizing neural networks, which mimic the human brain and consist of multiple layers, this approach enables the extraction of various distinctive features from data.

In this study, we benchmark recent research that addresses the challenges of FE of ECG in shallow and deep approaches (refer to Table 10). Cai et al. [11] proposed a real-time arrhythmia classification algorithm using time-domain analysis for FE and CNN for classification. They achieved an overall classification accuracy of 91.5% for a 5-class category and 75.6% for a 13-class category. Zhang et al. [53] also proposed a CNN model for NSR and seven types of cardiac arrhythmias. In time-domain modeling, the average accuracy rate is 99.1%, while in frequency-domain modeling, the classification accuracy of atrial premature contraction (APC) is 96.3%. Wang et al. [54] combined time and frequency-domain analysis for normal heartbeat (N), atrial premature beats (A), premature ventricular beats (V), left bundle branch block (L), and right bundle branch block (R). Using a CNN, they achieved an accuracy of 99.43%. Kumar M et al. [55] used frequency-domain FE for N, right bundle branch block (RBBB), premature atrial contraction (PAC), and premature ventricular contraction (PVC). With an AlexNet classifier, they achieved an accuracy of 99.7%, a sensitivity of 98.3%, a specificity of 99.2%, and a precision of 96.1%.

Table 10 Benchmarking studies for recent year's publications related to ECG FE

As illustrated in Table 10, recent publications [11, 53,54,55] have concentrated on beat segmentation for ECG arrhythmia classification using the MIT-BIH Arrhythmia Database. However, ECG arrhythmia identification involves not only beats but also rhythm, where irregular rhythm is evident in ECG morphology. A cardiac arrhythmia is simply defined as a deviation from the normal heart rate and/or rhythm without a physiological justification. Therefore, we proposed approaching arrhythmia identification from the ECG rhythm perspective. This study focuses on RR-interval assessment for ECG arrhythmia analysis, with the RR-interval serving as the primary feature for identifying irregular or regular heart rates. Heart rate can be expressed as an actual rate in beats per minute or as the RR-interval measured in milliseconds.

In contrast to previous studies utilizing the MIT-BIH Arrhythmia [11, 53,54,55], we combined LUDB and QTDB, which have different frequency sampling and record lengths. Since this study is concerned with ECG rhythm, we explored only LUDB and QTDB records related to rhythm, such as NSR, AF, SBR, and SAR. NSR originates from the sinus node and represents the typical rhythm of a healthy human heart. AF is a heart disorder characterized by an irregular rhythm and often an excessively rapid heart rate. SBR is a heart rhythm marked by proper cardiac muscle depolarization originating from the sinus node and a heart rate of fewer than 60 beats per minute. SBR is an irregular heart rate that originates above the ventricles, or the heart's lower chambers.

Furthermore, previous studies [11, 53,54,55] have employed deep learning algorithms (CNN) for classification tasks without human intervention on FE and FS, yielding good performance results. However, the significant computational demands of deep learning models lead to considerable energy consumption due to their power-hungry nature. Our proposed end-to-end methodology with machine learning (time-domain and TLO) outperforms existing methods in ECG arrhythmia classification, with low computational time. This approach enables faster and more accurate decision-making, efficient data management, and the discovery of insights and patterns that may be overlooked using traditional methods. This study presents a state-of-the-art methodology achieving 100% accuracy, sensitivity, specificity, and precision in ECG arrhythmia classification. We believe our proposed time-domain and TLO model advances computer-aided diagnosis with simple parameters for arrhythmia interpretation and diagnosis.

The performance results of this experiment study look promising, however, there are limitations of this study:

  • For time-domain FE analysis, we are only concerned with RR-interval features for ECG arrhythmia classification. Other ECG morphology, such as P-wave features, can be considered for further research.

  • The experimented classes for ECG arrhythmia classification are NSR, AF, SBR, and SAR.

Conclusion

The large amount of clinical data in ECG signal analysis can lead to a higher chance of misdiagnosing arrhythmia. Additionally, the increase in clinical data, especially medical information, is due to the emergence of new clinical symptoms and signs in arrhythmia. These symptoms and clinical signs act as identifying features that can be numerous, sometimes reaching tens of thousands, which can hinder the efficiency and accuracy of the analysis process. Multiple distinguishing features can offer key insights into a clinical condition, but if the chosen features are irrelevant, it could lead to incorrect clinical data. Therefore, this study focuses on FE and FS for classifying arrhythmias, as this is a vital part of data preparation in machine learning.

The main objective of machine learning is to discover patterns that convert data into actionable knowledge for decision-making purposes. Thus, before implementing any machine learning algorithm, it is crucial to transform raw data into useful and meaningful features that capture specific aspects of the observations. The effectiveness of machine learning frequently relies heavily on the quality of features. This study proposes an architecture for feature optimization in ECG arrhythmia classification, which combines time-domain as FE and TLO as FS. Among eight features of time-domain analysis, the selected feature is one to three features from RR-interval assessment, achieving 100% accuracy, sensitivity, specificity, and precision for NSR, AF, SBR, and SAR classification. With simple parameters and low complexity (shallow features), shallow features (time-domain and TLO) outperformed deep features analysis with deep learning for ECG NSR and arrhythmia classification. The results presented the shallow features (time-domain and TLO) that can be proposed for obtaining the optimum features for ECG arrhythmia classification. In time-domain FE analysis, our focus is primarily on RR-interval characteristics for ECG arrhythmia classification. Other aspects of ECG morphology may be explored in future research to provide deeper insights into specific arrhythmias.

Data availability

The datasets generated and/or analysed during the current study are available in the PhysioNet:Lobachevsky University Electrocardiography Database repository (https://physionet.org/content/ludb/1.0.1/) and PhysioNet: QT Database (https://physionet.org/content/qtdb/1.0.0/).

References

  1. Ansari Y, Mourad O, Qaraqe K, Serpedin E. Deep learning for ECG Arrhythmia detection and classification: an overview of progress for period 2017–2023. Front Physiol. 2023;14:1246746.

    Article  PubMed  PubMed Central  Google Scholar 

  2. Wang Y, Yang G, Li S, Li Y, He L, Liu D. Arrhythmia classification algorithm based on multi-head self-attention mechanism. Biomed Signal Process Control. 2023;79:104206.

    Article  Google Scholar 

  3. Koppad D. Arrhythmia classification using deep learning: a review. WSEAS Trans Biol Biomed. 2021;18:96–105.

    Article  Google Scholar 

  4. Ebrahimi Z, Loni M, Daneshtalab M, Gharehbaghi A. A review on deep learning methods for ECG arrhythmia classification. Expert Systems with Applications: X. 2020;7:100033.

  5. B Remeseiro, V Bolon-Canedo. A review of feature selection methods in medical applications. Comput Biol Med. 2019;112. https://doiorg.publicaciones.saludcastillayleon.es/10.1016/j.compbiomed.2019.103375.

  6. M Alirezanejad, R Enayatifar, H Motameni, H Nematzadeh. Heuristic filter feature selection methods for medical datasets. Genomics. 2020;112(2). https://doiorg.publicaciones.saludcastillayleon.es/10.1016/j.ygeno.2019.07.002.

  7. Nargesian F, Samulowitz H, Khurana U, Khalil EB,  Turaga DS. Learning Feature Engineering for Classification. In Ijcai. 2017;17:2529-35.

  8. Dewangan NK, Shukla SP. A survey on ECG signal feature extraction and analysis techniques. Int J Innov Res Electr Electron Instrum Control Eng. 2015;3(6):12–9.

    Google Scholar 

  9. Karpagachelvi S, Arthanari M, Sivakumar M. ECG feature extraction techniques-a survey approach. Int J Comput Sci Inf Secur. 2010;8(1).

  10. Gupta V, Mittal M, Mittal V, Saxena NK. A critical review of feature extraction techniques for ECG signal analysis. J Inst Eng Ser B. 2021;102:1049–60.

    Article  Google Scholar 

  11. Cai J, Zhou G, Dong M, Hu X, Liu G, Ni W. Real-time arrhythmia classification algorithm using time-domain ECG feature based on FFNN and CNN. Math Probl Eng. 2021;2021:1–17.

    Google Scholar 

  12. Xu Y, Zhang S, Cao Z, Chen Q, Xiao W. Extreme Learning Machine for Heartbeat Classification with Hybrid Time‐Domain and Wavelet Time‐Frequency Features. J Healthc Eng. 2021;(1):6674695.

  13. Vijayakumar T, Vinothkanna R, Duraipandian M. Fusion based feature extraction analysis of ECG signal interpretation–a systematic approach. J Artif Intell. 2021;3(01):1–16.

    Google Scholar 

  14. Hu Y, Zhao Y, Liu J, Pang J, Zhang C, Li P. An effective frequency-domain feature of atrial fibrillation based on time–frequency analysis. BMC Med Inform Decis Mak. 2020;20:1–11.

    Article  Google Scholar 

  15. Lekhal R, Zidelmal Z, Ould-Abdesslam D. Optimized time–frequency features and semi-supervised SVM to heartbeat classification. Signal, Image Video Process. 2020;14(7):1471–8.

    Article  Google Scholar 

  16. Kuila S, Dhanda N, Joardar S. Feature extraction of electrocardiogram signal using machine learning classification. Int J Electr Comput Eng. 2020;10(6):6598–605.

    Google Scholar 

  17. Kayikcioglu I, Akdeniz F, Köse C, Kayikcioglu T. Time-frequency approach to ECG classification of myocardial infarction. Comput Electr Eng. 2020;84:106621.

    Article  Google Scholar 

  18. Krupa AJD, Dhanalakshmi S, Kumar R. Joint time-frequency analysis and non-linear estimation for fetal ECG extraction. Biomed Signal Process Control. 2022;75:103569.

    Article  Google Scholar 

  19. Zhang J, Tian J, Cao Y, Yang Y, Xu X. Deep time–frequency representation and progressive decision fusion for ECG classification. Knowledge-based Syst. 2020;190:105402.

    Article  Google Scholar 

  20. Murat F, et al. Exploring deep features and ECG attributes to detect cardiac rhythm classes. Knowledge-Based Syst. 2021;232:107473.

    Article  Google Scholar 

  21. Singh AK, Krishnan S. ECG signal feature extraction trends in methods and applications. Biomed Eng Online. 2023;22(1):22.

    Article  PubMed  PubMed Central  Google Scholar 

  22. Diker A, Engin AVCI. Feature extraction of ECG signal by using deep feature. In 2019 7th International Symposium on Digital Forensics and Security (ISDFS). Ieee; 2019. pp. 1-6.

  23. Wu X, Zheng Y, Chu CH, He Z. Extracting deep features from short ECG signals for early atrial fibrillation detection. Artif Intell Med. 2020;109:101896.

    Article  PubMed  Google Scholar 

  24. Bannajak K, Theera-Umpon N, Auephanwiriyakul S. Signal Acquisition-Independent Lossless Electrocardiogram Compression Using Adaptive Linear Prediction. Int J Environ Res Public Health. 2023;20(3):2753.

    Article  PubMed  PubMed Central  Google Scholar 

  25. Hossain MM, et al. Analysis of the performance of feature optimization techniques for the diagnosis of machine learning-based chronic kidney disease. Mach Learn with Appl. 2022;9:100330.

    Article  Google Scholar 

  26. Patro KK, Jaya Prakash A, Jayamanmadha Rao M, Rajesh Kumar P. An efficient optimized feature selection with machine learning approach for ECG biometric recognition. IETE J Res. 2022;68(4):2743–54.

    Article  Google Scholar 

  27. Hassaballah M, Wazery YM, Ibrahim IE, Farag A. Ecg heartbeat classification using machine learning and metaheuristic optimization for smart healthcare systems. Bioengineering. 2023;10(4):429.

    Article  PubMed  PubMed Central  Google Scholar 

  28. Qaisar SM, Khan SI, Srinivasan K, Krichen M. Arrhythmia classification using multirate processing metaheuristic optimization and variational mode decomposition. J King Saud Univ Inf Sci. 2023;35(1):26–37.

    Google Scholar 

  29. Tunç M, Cangöz GB. Classification of the cardiac arrhythmia using combined feature selection algorithms. Turkish J Sci Technol. 2024;19(1):147–59.

    Article  Google Scholar 

  30. Admass WS, Bogale GA. Arrhythmia classification using ECG signal: a meta-heuristic improvement of optimal weighted feature integration and attention-based hybrid deep learning model. Biomed Signal Process Control. 2024;87:105565.

    Article  Google Scholar 

  31. Darmawahyuni A et al. Health-related data analysis using metaheuristic optimization and machine learning. IEEE Access. 2024. https://doiorg.publicaciones.saludcastillayleon.es/10.1109/ACCESS.2024.3390008.

  32. Zou F, Chen D, Xu Q. A survey of teaching–learning-based optimization. Neurocomputing. 2019;335:366–83.

    Article  Google Scholar 

  33. Kalyakulina AI, et al. Ludb: a new open-access validation tool for electrocardiogram delineation algorithms. IEEE Access. 2020;8:186181–90.

    Article  Google Scholar 

  34. Laguna P, Mark RG, Goldberg A, Moody GB. A database for evaluation of algorithms for measurement of QT and other waveform intervals in the ECG. Comput Cardiol. 1997;1997:673–6.

    Google Scholar 

  35. Issa MF, Yousry A, Tuboly G, Juhasz Z, AbuEl-Atta AH, Selim MM. Heartbeat classification based on single lead-II ECG using deep learning. Heliyon. 2023;9(7):e17974.

    Article  PubMed  PubMed Central  Google Scholar 

  36. Nurmaini S, et al. Beat-to-Beat electrocardiogram waveform classification based on a stacked convolutional and bidirectional long short-term memory. IEEE Access. 2021;9:92600–13. https://doiorg.publicaciones.saludcastillayleon.es/10.1109/ACCESS.2021.3092631.

    Article  Google Scholar 

  37. A Subasi, SM Qaisar. Heartbeat classification using parametric and time–frequency methods, in Modelling and Analysis of Active Biopotential Signals in Healthcare, Volume 2, in 2053–2563. , IOP Publishing, 2020:11–29. https://doiorg.publicaciones.saludcastillayleon.es/10.1088/978-0-7503-3411-2ch11.

  38. Whitaker BM, Rizwan M, Aydemir VB, Rehg JM, Anderson DV. “AF classification from ECG recording using feature ensemble and sparse coding”, in Computing in Cardiology (CinC). 2017;2017:1–4.

  39. S. Kutscher. Algorithms for ECG feature extraction: an overview. 2013.

  40. Chandra S, Sharma A, Singh GK. Feature extraction of ECG signal. J Med Eng Technol. 2018;42(4):306–16.

    Article  PubMed  Google Scholar 

  41. Parsi A, Byrne D, Glavin M, Jones E. Heart rate variability feature selection method for automated prediction of sudden cardiac death. Biomed Signal Process Control. 2021;65:102310.

    Article  Google Scholar 

  42. Tripathi PM, Kumar A, Komaragiri R, Kumar M. Watermarking of ECG signals compressed using Fourier decomposition method. Multimed Tools Appl. 2022;81(14):19543–57.

    Article  Google Scholar 

  43. RM Rangayyan, S Krishnan. Biomedical signal analysis. Hoboken: Wiley; 2024.

  44. R Abeysekera, B Boashash. Time-frequency domain features of ECG signals: their application in P wave detection using the cross Wigner-Ville distribution, in International Conference on Acoustics, Speech, and Signal Processing, 1989:1524–1527.

  45. Mateo C, Talavera JA. Short-time Fourier transform with the window size fixed in the frequency domain. Digit Signal Process. 2018;77:13–21.

    Article  Google Scholar 

  46. Afonso VX, Tompkins WJ. Detecting ventricular fibrillation. IEEE Eng Med Biol Mag. 1995;14(2):152–9.

    Article  Google Scholar 

  47. A Mumuni, F Mumuni. Automated data processing and feature engineering for deep learning and big data applications: a survey. J Inf Intell. 2024;1-41.

  48. Nurmaini S, et al. Deep learning-based stacked denoising and autoencoder for ECG heartbeat classification. Electronics. 2020;9(1):135. https://doiorg.publicaciones.saludcastillayleon.es/10.3390/electronics9010135.

    Article  Google Scholar 

  49. Tutuko B, et al. AFibNet: an implementation of atrial fibrillation detection with convolutional neural network. BMC Med Inform Decis Mak. 2021;1:1–17. https://doiorg.publicaciones.saludcastillayleon.es/10.1186/s12911-021-01571-1.

    Article  Google Scholar 

  50. Rao RV, Savsani VJ, Vakharia DP. Teaching–learning-based optimization: an optimization method for continuous non-linear large scale problems. Inf Sci (Ny). 2012;183(1):1–15.

    Article  Google Scholar 

  51. HT Ibrahim, WJ Mazher, ON Uçan, O Bayat. Feature selection using salp swarm algorithm for real biomedical datasets. 2017.

  52. Cinar AC. A comprehensive comparison of accuracy-based fitness functions of metaheuristics for feature selection. Soft Comput. 2023;27(13):8931–58. https://doiorg.publicaciones.saludcastillayleon.es/10.1007/s00500-023-08414-3.

    Article  Google Scholar 

  53. Zhang Y, Yi J, Chen A, Cheng L. Cardiac arrhythmia classification by time–frequency features inputted to the designed convolutional neural networks. Biomed Signal Process Control. 2023;79:104224.

    Article  Google Scholar 

  54. Wang B, et al. Arrhythmia disease diagnosis based on ECG time–frequency domain fusion and convolutional neural network. IEEE J Transl Eng Heal Med. 2022;11:116–25.

    Article  Google Scholar 

  55. Kumar MA, Chakrapani A. Classification of ECG signal using FFT based improved Alexnet classifier. PLoS One. 2022;17(9):e0274225.

    Article  Google Scholar 

Download references

Acknowledgements

We thank the Intelligent System Research Group, Faculty of Computer Science, Universitas Sriwijaya, Indonesia, for supporting this study in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Funding

This research was funded by Intelligent System Research Group, Faculty of Computer Science, Universitas Sriwijaya, Indonesia. The funding body has played role in the design of the study and collection, analysis, interpretation of data, and in writing the manuscript.

Author information

Authors and Affiliations

Authors

Contributions

AD: Conceptualization, wrote the manuscript, performed the analysis, and methodology. SN: formal analysis, wrote-edited the manuscript and funding acquisition. BT: contributed data or analysis tools and formal analysis. MNR: Designing computer programs, formal Analysis, methodology. FF: contributed data or analysis tools and formal analysis. AIS and AI: Resources.. JM, RI and MIP: Designing computer programs, data curation, contributed data or analysis tools, and visualization preparation. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Siti Nurmaini.

Ethics declarations

Ethics approval and consent to participate

Not applicable.

Consent for publication

Not applicable.

Competing interests

The authors declare no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Darmawahyuni, A., Nurmaini, S., Tutuko, B. et al. An improved electrocardiogram arrhythmia classification performance with feature optimization. BMC Med Inform Decis Mak 24, 412 (2024). https://doiorg.publicaciones.saludcastillayleon.es/10.1186/s12911-024-02822-7

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doiorg.publicaciones.saludcastillayleon.es/10.1186/s12911-024-02822-7

Keywords