# Heartbeat Classification Based on Multifeature Combination and Stacking-DWKNN Algorithm

Authors: Shasha Ji; Runchuan Li; Shengya Shen; Bicao Li; Bing Zhou; Zongmin Wang
Journal: Journal of Healthcare Engineering
 (2021)

---

## Abstract

Arrhythmia is one of the most common abnormal symptoms that can threaten human life. In order to distinguish arrhythmia more accurately, the classification strategy of the multifeature combination and Stacking-DWKNN algorithm is proposed in this paper. The method consists of four modules. In the preprocessing module, the signal is denoised and segmented. Then, multiple different features are extracted based on single heartbeat morphology, P length, QRS length,T length, PR interval, ST segment, QT interval, RR interval, R amplitude, and T amplitude. Subsequently, the features are combined and normalized, and the effect of different feature combinations on heartbeat classification is analyzed to select the optimal feature combination. Finally, the four types of normal and abnormal heartbeats were identified using the Stacking-DWKNN algorithm. This method is performed on the MIT-BIH arrhythmia database. The result shows a sensitivity of 89.42% and a positive predictive value of 94.90% of S-type beats and a sensitivity of 97.21% and a positive predictive value of 97.07% of V-type beats. The obtained average accuracy is 99.01%. Compared to other models with the same features, this method can improve accuracy and has a higher positive predictive value and sensitivity, which is important for clinical decision-making.


---

## Body

## 1. Introduction

Cardiovascular disease is one of the main diseases that endanger human health [1]. Arrhythmia is a common cardiovascular syndrome, and accurate identification of arrhythmia is an essential part of the prevention of cardiovascular diseases. Most arrhythmias are harmless, but some may immediately threaten people’s lives. Early detection of arrhythmia can prolong life through proper treatment. The electrocardiogram (ECG) is a popular and mature diagnostic tool. It contains basic physiological information for analyzing cardiac function [2] and is the most basic method for the diagnosis of arrhythmia. Different classes of arrhythmias can be detected by analyzing the changes of ECG waveform, but it usually needs to be diagnosed at the onset of the disease. Some patients’ symptoms appear infrequently. Traditional electrocardiogram may not capture the electrocardiogram at the time of onset. It is necessary to use dynamic ECG to record long-term cardiac electrical activities [3].It may be time-consuming and impractical to rely on manual analysis of ECG signals. Moreover, due to the interference of noise and the diversity of ECG waveforms, arrhythmia is difficult to accurately diagnose and easy to be misdiagnosed. At the same time, relying on manual recognition of electrocardiograms often lacks real-time, which may delay the best time for patient treatment. The application of computer-aided intelligent diagnosis to the classification of arrhythmias can help doctors more accurately diagnose arrhythmias and reduce the workload of doctors. In the literature, numerous algorithms have been proposed to achieve an accurate result for the classification, mainly including deep learning-based approaches and feature extraction-based approaches.Deep neural networks usually work in an end-to-end way, do not require manual feature extraction, and are widely used for ECG classification [4]. However, although they are good at learning feature representations and have produced very competitive performance in a wide range of applications, they cannot analyze the impact of specific features on classification performance.The traditional feature extraction method has achieved good performance in ECG classification. Researchers usually fed the extracted features to the machine learning model to achieve heartbeat classification. The methods employing deep learning-based approaches have generated a competitive classification performance to the feature extraction-based methods. However, the classification performance of deep learning models can still be achieved by simple machine learning models. This means that there is still room for further performance improvements in this method.In this paper, a heartbeat classification method based on multifeature combination and Stacking-DWKNN models is proposed to address the shortcomings of deep learning methods and traditional machine learning methods. The distance weight KNN algorithm (DWKNN) is to improve the KNN model by setting the weight of distance. The method proposed further improves the performance of the classification. The main contributions of this paper are as follows:(1)
Different feature combinations are constructed. The suitability of every single feature is evaluated, and the results of different feature combinations on classification are analyzed to obtain the optimal feature combination.(2)
Different model fusion methods are used for heartbeat classification to obtain the optimal model fusion method.(3)
The Stacking-DWKNN model with the optimal feature combination is employed to distinguish normal beat (N), supraventricular ectopic beat (S), ventricular ectopic beat (V), and fusion normal (F), which is of great significance for clinical diagnosis.The other parts of this paper are structured as follows. Section2 introduces related work. The methods of heartbeat classification are introduced in Section 3. Experimental analysis and classification results are described in Section 4. Section 5 summarizes the full text.


## 2. Related Work

In the early days, the diagnosis of arrhythmias was based on the experience of the doctor. However, due to the diversity of arrhythmias and the corresponding complexity of the ECG waveform, manual analysis methods are no longer applicable. ECG intelligent analysis has become a research focus in recent years. Researchers have developed a diversity of classification methods for arrhythmias.


### 2.1. Arrhythmia Classification Based on Deep Learning

Deep learning does not require the manual design of feature extractors. It can automatically learn the features of ECG and extract the key features. It has very good robustness and makes the classification of heartbeat more efficient.Some researchers [5–8] employed convolutional neural networks (CNNs), which automatically extract the ECG features and significantly improve the final prediction. Some works [9, 10] proposed a deep learning architecture based on a convolutional recurrent neural network (GRNN) to detect arrhythmias. Li et al. [11] designed the architecture of the deep neural network, CraftNet, for accurately recognizing the features, and assembled multiple child classifiers to classify heartbeats. Li et al. [12] used long short-term memory (LSTM) model to distinguish different category heartbeats. Ebrahimzadeh et al. [13] extracted a balanced combination of the Hermit features and interval features. And then, a number of multilayer perceptron (MLP) neural networks were employed to classify heartbeats.The results of these researches were remarkable. Deep learning integrates feature learning into the process of modeling, and the classification of heartbeat is simple and effective. However, the requirement of deep learning for searching the optimal combination of features is challenging.


### 2.2. Arrhythmia Classification Based on Feature Extraction

Traditional machine learning (ML) involves direct feature engineering, making algorithms easy to interpret and understand. In addition, we have a comprehensive understanding of the algorithm and the structure of the data, making it easier to change the model. In recent years, researchers have developed numerous approaches for automatic classification. Among them, the two steps of feature extraction and classification are the most critical in the classification process, which are deeply studied by researchers. Furthermore, researches used numerous features to describe the ECG heartbeats, Hermite functions [13], morphological features [14, 15], wavelet features [16, 17], high-order statistical features [18, 19], QRS amplitude vector [20], QRS complex wave area [21], and heartbeat intervals [22–24]. Over the past few decades, numerous algorithms have been developed to distinguish different types of arrhythmias, including linear classifier [25–27], decision tree [28, 29], k-nearest neighbor [30–32], support vector machine [33, 34], random forest [35, 36], and ensemble classifier [37–41], etc.In [27], researchers have extracted ECG morphology, heartbeat intervals, and RR-intervals and then applied a linear classifier model to the classification tasks using the learned features. Sharma et al. [32] used stop-band energy (SBE) minimized dyadic orthogonal filter bank, and wavelet decomposition of the ECG signals was performed. And then fuzzy entropy, Renyi entropy, and fractal dimension features were extracted for accurate classification. The ensemble classifiers fuse the classification results of multiple different classifiers, to achieve better performance than a single classifier. Mondéjar-Guerra et al. [34] trained specific support vector machine models for each feature, and then the multiple SVMs are combined to classify heartbeats. Shi H. et al. [37] constructed a hierarchical classifier improved by threshold and extreme gradient boosting classifier. This method has better classification performance. Javadi et al. [38] integrated a multiple neural network model based on a stacking algorithm for ECG classification, which reduced the classification error rate. Pandey et al. [39] employed an ensemble of SVMs to classify heartbeats into four classes. Rajesh et al. [40] used intrinsic mode functions to get the final features, and the AdaBoost classifier was employed to classify heartbeats. Shi et al. [41] employed a regional feature extraction method and used an ensemble classifier to distinguish heartbeats.Although the aforementioned studies have achieved a good classification effect, the extracted medically meaningful features are less, part of the information hidden in the ECG is not easy to be revealed, the classification accuracy also needs to be improved, the classifier does not use a cross-validation method, and the robustness needs to be improved. The relevant literature in the related work is summarized in Table1.Table 1
Summary of related work.
MethodsClassifierLiteraturesDeep learningCNN[5–8]GRNN[9, 10]CraftNet[11]LSTM[12]MLP[13]Machine learningSVM[14, 16, 20, 22, 33, 34]HMM[15]KNN[18, 30–32]SVM&ICA-PCAnet[19]RF[21, 35, 36]LDC[23]Linear classifier[25–27]DT[28, 29]Ensemble[37–41]


## 2.1. Arrhythmia Classification Based on Deep Learning

Deep learning does not require the manual design of feature extractors. It can automatically learn the features of ECG and extract the key features. It has very good robustness and makes the classification of heartbeat more efficient.Some researchers [5–8] employed convolutional neural networks (CNNs), which automatically extract the ECG features and significantly improve the final prediction. Some works [9, 10] proposed a deep learning architecture based on a convolutional recurrent neural network (GRNN) to detect arrhythmias. Li et al. [11] designed the architecture of the deep neural network, CraftNet, for accurately recognizing the features, and assembled multiple child classifiers to classify heartbeats. Li et al. [12] used long short-term memory (LSTM) model to distinguish different category heartbeats. Ebrahimzadeh et al. [13] extracted a balanced combination of the Hermit features and interval features. And then, a number of multilayer perceptron (MLP) neural networks were employed to classify heartbeats.The results of these researches were remarkable. Deep learning integrates feature learning into the process of modeling, and the classification of heartbeat is simple and effective. However, the requirement of deep learning for searching the optimal combination of features is challenging.


## 2.2. Arrhythmia Classification Based on Feature Extraction

Traditional machine learning (ML) involves direct feature engineering, making algorithms easy to interpret and understand. In addition, we have a comprehensive understanding of the algorithm and the structure of the data, making it easier to change the model. In recent years, researchers have developed numerous approaches for automatic classification. Among them, the two steps of feature extraction and classification are the most critical in the classification process, which are deeply studied by researchers. Furthermore, researches used numerous features to describe the ECG heartbeats, Hermite functions [13], morphological features [14, 15], wavelet features [16, 17], high-order statistical features [18, 19], QRS amplitude vector [20], QRS complex wave area [21], and heartbeat intervals [22–24]. Over the past few decades, numerous algorithms have been developed to distinguish different types of arrhythmias, including linear classifier [25–27], decision tree [28, 29], k-nearest neighbor [30–32], support vector machine [33, 34], random forest [35, 36], and ensemble classifier [37–41], etc.In [27], researchers have extracted ECG morphology, heartbeat intervals, and RR-intervals and then applied a linear classifier model to the classification tasks using the learned features. Sharma et al. [32] used stop-band energy (SBE) minimized dyadic orthogonal filter bank, and wavelet decomposition of the ECG signals was performed. And then fuzzy entropy, Renyi entropy, and fractal dimension features were extracted for accurate classification. The ensemble classifiers fuse the classification results of multiple different classifiers, to achieve better performance than a single classifier. Mondéjar-Guerra et al. [34] trained specific support vector machine models for each feature, and then the multiple SVMs are combined to classify heartbeats. Shi H. et al. [37] constructed a hierarchical classifier improved by threshold and extreme gradient boosting classifier. This method has better classification performance. Javadi et al. [38] integrated a multiple neural network model based on a stacking algorithm for ECG classification, which reduced the classification error rate. Pandey et al. [39] employed an ensemble of SVMs to classify heartbeats into four classes. Rajesh et al. [40] used intrinsic mode functions to get the final features, and the AdaBoost classifier was employed to classify heartbeats. Shi et al. [41] employed a regional feature extraction method and used an ensemble classifier to distinguish heartbeats.Although the aforementioned studies have achieved a good classification effect, the extracted medically meaningful features are less, part of the information hidden in the ECG is not easy to be revealed, the classification accuracy also needs to be improved, the classifier does not use a cross-validation method, and the robustness needs to be improved. The relevant literature in the related work is summarized in Table1.Table 1
Summary of related work.
MethodsClassifierLiteraturesDeep learningCNN[5–8]GRNN[9, 10]CraftNet[11]LSTM[12]MLP[13]Machine learningSVM[14, 16, 20, 22, 33, 34]HMM[15]KNN[18, 30–32]SVM&ICA-PCAnet[19]RF[21, 35, 36]LDC[23]Linear classifier[25–27]DT[28, 29]Ensemble[37–41]


## 3. Methods

A typical heartbeat classification method consists of four main modules. Figure1 shows the frame of the classification method. The preprocessing module mainly performs denoising and segmentation. Later, 235 points near R peak, P length, QRS length, T length, PR interval, ST segment, QT interval, RR interval, R amplitude, and T amplitude are extracted from the ECG signal. Furthermore, the features are combined and normalized. Finally, the optimal feature combination is fed to the Stacking-DWKNN algorithm, and then the final classification results are obtained. In this section, each module is introduced in detail.Figure 1
The frame of heartbeat classification.


### 3.1. ECG Signal Preprocessing

Noise mixed in ECG signal includes baseline drift and muscle artifacts, etc. They weaken the quality of the ECG signal, make the entire ECG waveform ambiguous, and seriously affect the analysis and diagnosis of ECG signals. In this paper, to classify heartbeat more accurately, the noise of raw ECG signal is removed by wavelet transform. Wavelet transform is a signal time-frequency analysis method [42], which can retain the features of ECG signal. Besides, it avoids important physiological details and has a simple calculation process [43, 44]. The wavelet transform and wavelet basis functions are as follows:(1)Wfm,τ=m−1/2∫−∞+∞ftψt−nmdt,(2)ψm,τt=m−1/2ψt−nm,m>0,τ∈R.In formula (1), m represents the scale factor and n represents the transforming parameter. They are mainly used to stretch the basic wavelet function ψt, τ reflects the displacement, and m and τ are continuous variables, so it is also called continue wavelet transform (CWT) [42].A complete heartbeat is composed of three basic waveforms: the P, QRS, and T. The most important step in segmentation is to obtain the positions of the QRS complex. The existing R peak detection methods have obtained sufficient accuracy [45, 46]. Each heartbeat contains a pre-R segment and a post-R segment. The pre-R segment before the R peak contains 90 sample points, and the post-R segment after the R peak contains 144 sample points [47]. R wave is the fiducial point for waveform positioning. In this paper, the “Pan-Tompkins” algorithm is used to locate the R waves, and the detected R wave is compared with the marked R wave in the MIT-BIH arrhythmia database. The result of R wave detection is shown in Figure 2. Table 2 shows some results of R wave detection in the MIT-BIH arrhythmia database.Figure 2
The result of R wave detection.Table 2
Statistics results ofR wave detection in MIT-BIH arrhythmia database.
RecordsFdr (%)Se (%)+p (%)Acc (%)1000.0499.96100.0099.961010.27100.0099.7399.731030100.00100.00100.001060.5999.5699.8599.411090.28100.0099.7299.721130.0699.94100.0099.941140.2799.9599.7999.731170.07100.0099.9399.931190100.00100.00100.001240.0699.94100.0099.942020.3899.62100.0099.622050.1199.89100.0099.892080.8299.5399.6699.182120100.00100.00100.002130.0399.97100.0099.972150.03100.0099.9799.972200100.00100.00100.002230.1299.9699.9299.882288.1999.9092.5191.812310.0699.94100.0099.942320.79100.0099.2299.212340.0799.93100.0099.93Total avg0.5699.9199.5699.44Note. The first column is the record name, the second column is the evaluation indicator “false detection rate,” the third column is the evaluation indicator “sensitivity,” the fourth column is the evaluation indicator “positive predictive value,” and the fifth column is the evaluation indicator “accuracy.” According to the AAMIEC38 standard, the difference between the detected QRS complex and the manual mark is within 150 ms, which means that the location detection is successful.


### 3.2. Heartbeat Feature Extraction

Feature extraction is a process of extracting representative samples from a large amount of data. These samples are used as features of the final classification. According to the literature [14, 15, 20, 22–24, 29], the wavelength, interval, and morphology of ECG signals have important medical significance and can reveal the hidden information in the heartbeat. Hence, based on the detected fiducial points, the 10 feature parameters are extracted for classification in this paper. Figure 3 is the annotation of each feature in the ECG signal. Table 3 summarizes the features extracted in this paper and detailed as follows:(1)
Single heartbeat morphology (Morph): 235 sampling points atR peaks from the prepared R peak annotation file are extracted as morphology features. Among them, the pre-R segment contains 90 sample points, and the pos-R segment contains 144 sample points [47]. Before the first or after last detected QRS complex reaches only 235 sampling points, then the corresponding heartbeat is used.(2)
P-QRS-T: A complete ECG waveform contains P, QRS, andT waves. P length (P_len), QRS length (QRS_len), and T length (T_len) are important parameters in electrocardiogram. P-QRS-T in this paper is used to represent P, QRS, and T length.(3)
Interval: It represents the time interval between different waveform points on the electrocardiogram. RR interval (RR_inter), QT interval (QT_inter), ST segment (ST_seg), and PR interval (PR_inter) are selected in this paper. These intervals are important for the diagnosis of arrhythmia.(4)
Amplitude:R amplitude (R_amp) and T amplitude (T_amp) are selected in this paper. The R amplitude is the wave with the largest amplitude among all waves. The R amplitude is the amplitude after removing noise in this paper. The T wave amplitude reflects the potential changes in the later period of ventricular repolarization.Figure 3
Annotation of heartbeat features.Table 3
Ten values of ECG signal features in this paper.
NumberECG signal featuresIntroduction of ECG signal feature parameters1Morph235 points of a single heartbeat2P_lenThe time between the start and end of the P wave3QRS_lenThe time between the start and end of the QRS complex4T_lenThe time between the start and end of theT wave5RR_interThe time between two adjacentR waves6PR_interThe time from the start of the P wave to the start of the QRS complex7ST_segThe time from the end of the QRS wave to the start of theT wave8QT_interThe time between the QRS wave and theT wave9R_ampThe maximal of theR wave10T_ampThe maximal of theT wave


### 3.3. Feature Combination

Feature combination is to combine individual features (multiplication, splicing, or Cartesian product) to get new features. In feature combination, the first-order discrete features are often combined to form high-order combination features, so as to resolve more complex problems [48]. The morphology, interval, and amplitude of ECG signal are of great medical significance, which is very important for diagnosing arrhythmias. Because a single feature cannot fully describe the ECG signal, these three types of features are combined in stitching ways, and the effects of different feature combinations on heartbeat classification are analyzed to select the optimal combination in this paper.


### 3.4. Stacking-DWKNN Model Description

The idea of the stacking method is to use the basic classifier in the first layer to predict the training samples separately. Each DWKNN model is trained using a ten-cross-training process, which divides the training set into ten subsets. For each subset, the remaining dataset is used to train the model, and then the subsets predicted the result. This process is repeated ten times. The results are used as the training set of the secondary model and use the class label of the original data as the label of the training set of the metaclassifier. The weighted average of the ten prediction results of the test set is used for the final prediction [49]. Figure 4 presents the frame of the Stacking algorithm. And the Stacking algorithm is detailed in Table 4. The first layer of the stacking algorithm integrates four DWKNN algorithms with different parameters in this paper.Figure 4
Stacking algorithm structure.Table 4
The description of Stacking-DWKNN algorithm.
Algorithm 1: Stacking-DWKNN algorithmInput: dataset D=x1,y1,x2,y2,...,xt,ytOutput: ensemble classifier H (DWKNN model)1: learn the base classifiers2:fors = 1 to S do3: learnhs(DWKNN model) based on D4:end for5: Generate a new dataset for prediction6:fori = 1 to tdo7:Dh=xi′,yi,wherexi′=hixi,...,hsxi8:end for9: learn a metaclassifier10: learn H based onDs11: return HAs a highly flexible and general classification algorithm, the KNN model can classify various sample distributions and has good classification ability for small sample data [50]. However, when the samples are unbalanced, it may cause that when a new sample is input, the samples of the large capacity class of the K neighbors of the sample are the majority, so the weight method can be used for improvement.Distance-weighted k-nearest neighbor (DWKNN) is based on the KNN model. The idea of the DWKNN algorithm is to give weights tok-nearest neighbors according to the distances. The neighbors closer to the test sample have greater weight. A weight wi′ is assigned to the i-th nearest neighbor xiMM of the test sample x′ in this paper; the distance-weighted is given by [50]:(3)wi′=1distance+const.And then, the class y′ of the test sample x′ is labeled according to the majority weighted voting mechanism, and the voting formula is shown in (4) [51], where I is the indicating function, and the calculation formula of I is as follows (5) [50]:(4)y′=argmaxy∑xiMM,yiMM∈T′wi′×Iy=yiMM,(5)Iy,yiMM=0,y=yiMM,1,y≠yiMM.


## 3.1. ECG Signal Preprocessing

Noise mixed in ECG signal includes baseline drift and muscle artifacts, etc. They weaken the quality of the ECG signal, make the entire ECG waveform ambiguous, and seriously affect the analysis and diagnosis of ECG signals. In this paper, to classify heartbeat more accurately, the noise of raw ECG signal is removed by wavelet transform. Wavelet transform is a signal time-frequency analysis method [42], which can retain the features of ECG signal. Besides, it avoids important physiological details and has a simple calculation process [43, 44]. The wavelet transform and wavelet basis functions are as follows:(1)Wfm,τ=m−1/2∫−∞+∞ftψt−nmdt,(2)ψm,τt=m−1/2ψt−nm,m>0,τ∈R.In formula (1), m represents the scale factor and n represents the transforming parameter. They are mainly used to stretch the basic wavelet function ψt, τ reflects the displacement, and m and τ are continuous variables, so it is also called continue wavelet transform (CWT) [42].A complete heartbeat is composed of three basic waveforms: the P, QRS, and T. The most important step in segmentation is to obtain the positions of the QRS complex. The existing R peak detection methods have obtained sufficient accuracy [45, 46]. Each heartbeat contains a pre-R segment and a post-R segment. The pre-R segment before the R peak contains 90 sample points, and the post-R segment after the R peak contains 144 sample points [47]. R wave is the fiducial point for waveform positioning. In this paper, the “Pan-Tompkins” algorithm is used to locate the R waves, and the detected R wave is compared with the marked R wave in the MIT-BIH arrhythmia database. The result of R wave detection is shown in Figure 2. Table 2 shows some results of R wave detection in the MIT-BIH arrhythmia database.Figure 2
The result of R wave detection.Table 2
Statistics results ofR wave detection in MIT-BIH arrhythmia database.
RecordsFdr (%)Se (%)+p (%)Acc (%)1000.0499.96100.0099.961010.27100.0099.7399.731030100.00100.00100.001060.5999.5699.8599.411090.28100.0099.7299.721130.0699.94100.0099.941140.2799.9599.7999.731170.07100.0099.9399.931190100.00100.00100.001240.0699.94100.0099.942020.3899.62100.0099.622050.1199.89100.0099.892080.8299.5399.6699.182120100.00100.00100.002130.0399.97100.0099.972150.03100.0099.9799.972200100.00100.00100.002230.1299.9699.9299.882288.1999.9092.5191.812310.0699.94100.0099.942320.79100.0099.2299.212340.0799.93100.0099.93Total avg0.5699.9199.5699.44Note. The first column is the record name, the second column is the evaluation indicator “false detection rate,” the third column is the evaluation indicator “sensitivity,” the fourth column is the evaluation indicator “positive predictive value,” and the fifth column is the evaluation indicator “accuracy.” According to the AAMIEC38 standard, the difference between the detected QRS complex and the manual mark is within 150 ms, which means that the location detection is successful.


## 3.2. Heartbeat Feature Extraction

Feature extraction is a process of extracting representative samples from a large amount of data. These samples are used as features of the final classification. According to the literature [14, 15, 20, 22–24, 29], the wavelength, interval, and morphology of ECG signals have important medical significance and can reveal the hidden information in the heartbeat. Hence, based on the detected fiducial points, the 10 feature parameters are extracted for classification in this paper. Figure 3 is the annotation of each feature in the ECG signal. Table 3 summarizes the features extracted in this paper and detailed as follows:(1)
Single heartbeat morphology (Morph): 235 sampling points atR peaks from the prepared R peak annotation file are extracted as morphology features. Among them, the pre-R segment contains 90 sample points, and the pos-R segment contains 144 sample points [47]. Before the first or after last detected QRS complex reaches only 235 sampling points, then the corresponding heartbeat is used.(2)
P-QRS-T: A complete ECG waveform contains P, QRS, andT waves. P length (P_len), QRS length (QRS_len), and T length (T_len) are important parameters in electrocardiogram. P-QRS-T in this paper is used to represent P, QRS, and T length.(3)
Interval: It represents the time interval between different waveform points on the electrocardiogram. RR interval (RR_inter), QT interval (QT_inter), ST segment (ST_seg), and PR interval (PR_inter) are selected in this paper. These intervals are important for the diagnosis of arrhythmia.(4)
Amplitude:R amplitude (R_amp) and T amplitude (T_amp) are selected in this paper. The R amplitude is the wave with the largest amplitude among all waves. The R amplitude is the amplitude after removing noise in this paper. The T wave amplitude reflects the potential changes in the later period of ventricular repolarization.Figure 3
Annotation of heartbeat features.Table 3
Ten values of ECG signal features in this paper.
NumberECG signal featuresIntroduction of ECG signal feature parameters1Morph235 points of a single heartbeat2P_lenThe time between the start and end of the P wave3QRS_lenThe time between the start and end of the QRS complex4T_lenThe time between the start and end of theT wave5RR_interThe time between two adjacentR waves6PR_interThe time from the start of the P wave to the start of the QRS complex7ST_segThe time from the end of the QRS wave to the start of theT wave8QT_interThe time between the QRS wave and theT wave9R_ampThe maximal of theR wave10T_ampThe maximal of theT wave


## 3.3. Feature Combination

Feature combination is to combine individual features (multiplication, splicing, or Cartesian product) to get new features. In feature combination, the first-order discrete features are often combined to form high-order combination features, so as to resolve more complex problems [48]. The morphology, interval, and amplitude of ECG signal are of great medical significance, which is very important for diagnosing arrhythmias. Because a single feature cannot fully describe the ECG signal, these three types of features are combined in stitching ways, and the effects of different feature combinations on heartbeat classification are analyzed to select the optimal combination in this paper.


## 3.4. Stacking-DWKNN Model Description

The idea of the stacking method is to use the basic classifier in the first layer to predict the training samples separately. Each DWKNN model is trained using a ten-cross-training process, which divides the training set into ten subsets. For each subset, the remaining dataset is used to train the model, and then the subsets predicted the result. This process is repeated ten times. The results are used as the training set of the secondary model and use the class label of the original data as the label of the training set of the metaclassifier. The weighted average of the ten prediction results of the test set is used for the final prediction [49]. Figure 4 presents the frame of the Stacking algorithm. And the Stacking algorithm is detailed in Table 4. The first layer of the stacking algorithm integrates four DWKNN algorithms with different parameters in this paper.Figure 4
Stacking algorithm structure.Table 4
The description of Stacking-DWKNN algorithm.
Algorithm 1: Stacking-DWKNN algorithmInput: dataset D=x1,y1,x2,y2,...,xt,ytOutput: ensemble classifier H (DWKNN model)1: learn the base classifiers2:fors = 1 to S do3: learnhs(DWKNN model) based on D4:end for5: Generate a new dataset for prediction6:fori = 1 to tdo7:Dh=xi′,yi,wherexi′=hixi,...,hsxi8:end for9: learn a metaclassifier10: learn H based onDs11: return HAs a highly flexible and general classification algorithm, the KNN model can classify various sample distributions and has good classification ability for small sample data [50]. However, when the samples are unbalanced, it may cause that when a new sample is input, the samples of the large capacity class of the K neighbors of the sample are the majority, so the weight method can be used for improvement.Distance-weighted k-nearest neighbor (DWKNN) is based on the KNN model. The idea of the DWKNN algorithm is to give weights tok-nearest neighbors according to the distances. The neighbors closer to the test sample have greater weight. A weight wi′ is assigned to the i-th nearest neighbor xiMM of the test sample x′ in this paper; the distance-weighted is given by [50]:(3)wi′=1distance+const.And then, the class y′ of the test sample x′ is labeled according to the majority weighted voting mechanism, and the voting formula is shown in (4) [51], where I is the indicating function, and the calculation formula of I is as follows (5) [50]:(4)y′=argmaxy∑xiMM,yiMM∈T′wi′×Iy=yiMM,(5)Iy,yiMM=0,y=yiMM,1,y≠yiMM.


## 4. Results

In this section, the experimental procedure is described in detail. Our focus is on feature extraction and classification. According to the medical significance of electrocardiogram, ten features are extracted, and then the effect of different feature combinations and Stacking-DWKNN algorithm on the classification results is analyzed. The MIT-BIH arrhythmia database (MIT-AD) is employed in this paper. The classification result is used as a preliminary diagnosis result of the computer to help the doctor make a further diagnosis.


### 4.1. Experimental Data

All the experiments in this paper are completed on the MIT-AD. The database consists of 48 two-lead records digitized at 360 HZ. Each of the ECG records includes one and a half hours of 2-lead dynamic ECG segments [52]. In this paper, the normal (N), supraventricular (S), ventricular (V), and fusion (F) heartbeats in MIT-AD are distinguished. The four types of heartbeats have a total of 101413 records. This paper randomly selected 90% of the heartbeat data for training and the remaining 10% for testing. The specific distribution of data is shown in Table 5.Table 5
Experimental data statistics.
Training setTesting setTotalN81,5609,03590,595S2,5282532,781V6,4507857,235F72379802


### 4.2. Evaluation Indicator

In this paper, the data is divided into a training set and a test set, and the label output of the model is compared with the real label to get the experimental results. The results of N category heartbeat classification are calculated by formulas (6)–(9) [42]. S, V, and F heartbeats are calculated in the same way. Description of a confusion matrix is shown in Table 6, where N, S, V, and F represent the real category of heartbeat and n, s, v, and f represent the predicted type of heartbeat.(6)TPN=Nn,(7)FNN=Ns+Nv+Nf,(8)TNN=Ss+Sv+Sf+Vs+Vv+Vf+Fs+Fv+Ff,(9)FPN=Sn+Vn+Fn.Table 6
Confusion matrix of classification results.
nsvfTotalNNnNsNvNf∑NSSnSsSvSf∑SVVnVsVvVf∑VFFnFsFvFf∑FFor the comprehensive evaluation of the performance, sensitivity (Se), specificity (Sp), positive predictive value (+p), and accuracy (Acc) are used as indicators in this paper. Higher values of these indicators indicate better classification performance. These four indicators are calculated by the following formula [42].(10)Se=TPTP+FN,Sp=TNTN+FP,+p=TPTP+FP,Acc=TP+TNTP+TN+FP+FN.


### 4.3. Experiment and Result Analysis

To distinguish arrhythmia more accurately, the classification strategy using the multifeature combination and Stacking-DWKNN algorithm is proposed, which is mainly reflected in the experimental part. This section first compares and analyzes the classification results of KNN models with different feature combinations to select the optimal feature combination (Section4.3.1); later, in order to achieve better classification results, the parameters K of the KNN model are adjusted (Section 4.3.2). Furthermore, different models are compared to verify that the KNN model is the best, and the classification results of the fusion of different models are compared to show that the framework proposed in this paper is better (Section 4.3.3), which are finally compared with other references (Section 4.3.4). Our focus is mainly on the selection of feature combinations and the influence of the model fusion method proposed in this paper on heartbeat classification.


#### 4.3.1. Analysis of Experimental Results of Different Feature Combinations

In order to select the optimal feature combination, the effects of the KNN model with different feature combinations on heartbeat classification are analyzed, and the above four indicators are used for evaluation.15 group experiments are performed in experiment I using the KNN model with interval features. The goal of this experiment is to get the optimal interval feature combination. The classification results of the KNN model with different interval combinations are shown in Table7. The best accuracy of 95.41% is obtained by P-QRS-T, PR_inter, QT_inter, ST_seg, and RR_inter. The optimal interval combination is represented by Inter, Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg}.Table 7
Classification results of the KNN model with interval features.
FeaturesEvaluation metrics (%)P-QRS-TRR_interPR_interST_segQT_interAcc••92.17••90.89••92.85••91.78•••92.72•••94.71•••94.68•••93.92•••93.10•••94.53••••95.39•••95.27••••94.76••••95.26•••••95.41Three groups of experiments are performed in experiment II using the KNN model with amplitude features. The goal of this experiment is to get the optimal amplitude of heartbeat classification. The classification results are represented in Table8. Compared with the KNN model with R_amp and T_amp, using only R_amp has the same classification effect. Besides, too many heartbeat features will reduce the efficiency of the classifier, so R_amp is selected as the optimal amplitude feature.Table 8
Classification results for the KNN model with amplitude features.
FeaturesEvaluation metrics (%)T_ampR_ampAcc•89.42•90.26••90.26Through the above two experiments, the best combination of interval and amplitude features is obtained. The optimal combination of the three types of features is represented by Morph, Inter, and Amp.Morph = {single heartbeat morphology};Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg};Amp = {R_amp}.In experiment III, in order to analyze the suitability of every single feature, each feature is fed into the KNN model for training. The resulting confusion matrices for the KNN model with a single feature are presented in Table9. It is obvious that the single heartbeat morphology feature (Morph) is the best descriptor, and the number of correctly classified heartbeats is the largest. Table 10 shows the classification results calculated from the confusion matrix. The average classification accuracy is 98.88%. From the perspective of the heartbeat, almost all the classification indicators of the KNN model with Morph features have obtained the best results, which are higher than Inter and Amp features.Table 9
Confusion matrix for the KNN model combining with single features.
MorphInterAmpnsvfnsvfnsvfN9009121228939265614896020532S402711013516980306600V23069031625544552731860F12185747072468091Table 10
Confusion matrix for the KNN model combining with single features.
MorphInterAmpSe(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)N99.7193.2299.1799.0098.9468.9096.2995.6699.1718.5490.8690.38S86.8699.8795.4299.4754.1799.6884.5098.2819.2099.7720.6996.76V96.3799.7897.0599.5475.9899.2588.4697.6025.9899.3475.0094.16F73.0899.9591.9499.7430.7799.8155.8199.2812.8099.9833.3399.22In experiment IV, to compare the effect of different feature combinations on heartbeat classification, different feature combinations are fed into the KNN model. Tables11 and 12 present confusion matrices and performance results calculated for each class. The larger the diagonal value in the confusion matrix, the better the classification effect of the classifier. It can be seen that the best results are almost based on the KNN model with Morph, Inter, and Amp features. The average classification accuracy is 98.88%. From these results, ECG information can be expressed more comprehensively by using interval, amplitude, and morphology features in heartbeat classification.Table 11
Confusion matrix for the KNN model combining with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpNsvfnsvfnsvfnsvfN9010121129010121128942275412900913112S42269104027110772241103727410V2226911230690385861942226911F150756121857280941150756Table 12
Classification performance for KNN model trained with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpSe%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%N99.7292.8699.1398.9799.7293.2299.1799.0198.9782.8297.9297.2199.7193.3199.1999.01S86.2299.8695.0599.4486.8699.8795.4299.4771.7999.6486.4998.7987.8299.8594.8199.48V96.5199.7997.3299.5796.3799.7997.1899.5586.4599.2189.3298.3196.5199.8097.3299.57F71.7999.9794.9299.7673.0899.9591.9499.7452.5699.8471.9399.4871.7999.9794.9299.75From the above experiments, it is obvious that the single heartbeat morphology is the optimal single feature for distinguishing the heartbeat. The optimal feature combination is single heartbeat morphology, Inter, and Amp features. The average classification accuracy is 98.91%. Figure5 shows the KNN model with optimal features combination of classification results.Figure 5
Classification results of KNN model with Morph, Inter, and Amp features.


#### 4.3.2. Analysis of Experimental Results with Different Parameters

To achieve better classification performance, the model parameters are adjusted. In the k-nearest-neighbor algorithm, the parameter K represents thek neighbors closest to the classified samples. Generally, the K value is too small, and the classification accuracy of the model is low. The K value is too large, and the model is easy to fit. To determine the appropriate K value, ten experiments are conducted with different parameters. Based on different parameter values, the classification results of the KNN model with the optimal feature combination are presented in Table 13.Table 13
Classification results of different K values.
Parameter K12345678910Acc (%)98.8498.8098.8598.9198.7998.8098.7298.7498.6598.65It is obvious from Table13 that when k = 4, the performance of the classifier is the best, with a classification accuracy of 98.91%. And the classification results of different parameters are different, indicating that the parameters have a certain influence on the classification results of the model. Afterward, the K-nearest neighbors are given different weights according to their distance from the classified samples. The accuracy of the DWKNN algorithm with the optimal feature combination is 98.96%.


#### 4.3.3. Analysis of Experimental Result Analysis of Different Classifiers

The performance of different classifiers is mainly compared in this section. From the above experiments, the optimal combination of features is Morph, Inter, and Amp. In this experiment, accuracy (Acc%) is employed as the evaluation indicator to compare the performance differences of support vector machine (SVM), random forest (RF), logistic regression (LR), linear discriminant classifier (LDA), decision tree (DT), gradient boosting decision tree (GBDT), K-nearest neighbor (KNN), and improved KNN (DWKNN) on different datasets. The classification results of the optimal feature combination based on different classifiers are presented in Table14.Table 14
Classification results of different classifiers trained with all possible feature combinations.
Feature combinationClassifierMorphInterAmpLDALRSVMDTGBDTRFKNNDW KNNStacking-DWKNN•91.7192.3998.6197.3597.6198.5598.8898.9598.94•89.0689.0193.6993.4794.4595.7395.4195.3695.59•90.4289.1490.5987.9890.5887.8190.2688.4790.43••93.0393.2598.6997.4397.7398.5798.8798.9798.97••91.7492.4098.6997.4797.5598.5898.8998.9498.95••90.1490.9495.7195.7496.0197.0896.8996.9397.09•••93.8294.2498.7497.8098.1598.8398.9198.9699.01As shown in Table14, it is obvious that the classification results of the KNN model are the best. The average classification accuracy is 98.91%. The k-nearest neighbors of the KNN model are given different weights (DWKNN), and the classification results are improved. The ensemble of multiple KNN models (Stacking-DWKNN) has a higher classification performance than a single model. The ensemble classifier fully utilized the correctly classified results of base learners and the difference between them. This demonstrates the outstanding performance of ensemble classifiers and does improve the results of heartbeat classification. The accuracy of the Stacking-DWKNN model with the optimal feature combination is 99.01%.The classification result by five ensemble structures with the optimal feature combination is shown in Table15. Table 15 lists the 16 metrics of classification results, including Se, Sp, and +p for each beat and the average accuracy. The Stacking-DWKNN structure has the best comprehensive classification ability: yielding the 8 highest scores on 13 metrics. It achieves the best average sensitivity and specificity of 94.26% and 98.63%. Among them, the N category and V category achieved better results. The Stacking-SVM, Stacking-DT, Stacking-GBDT, and Stacking-RF recognized the N category very well but at the cost of low detection rate of F beat. At the same time, the Stacking-DWKNN recognized the S category, and the F category is improved compared to them. This is because improving the KNN model through weights improves the impact of data imbalance. Figure 6 shows the Stacking-DWKNN model with different features of classification results.Table 15
Classification performance for stacking model combined with different classifier combinations.
NSVFAccSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)NumStacking-SVM99.8391.3298.9581.0999.9698.4496.5199.7897.0569.3299.9896.4398.79Stacking-DT98.9390.9698.8981.7399.5083.8893.9999.5193.6070.5199.7568.7597.83Stacking-GBDT99.6888.1698.5774.6899.9095.8894.4199.7196.1666.6799.9489.6698.28Stacking-RF99.8691.6898.9982.0599.9899.2296.5199.7897.0570.5199.9896.4998.85Stacking-DWKNN99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01Figure 6
Classification result based on Stacking-DWKNN model with different feature combinations.In order to understand the effect of different model fusion methods, based on the DWKNN (baseline1) model, different model fusion methods are used, and the optimal feature vectors are fed to different models, namely, Voting-DWKNN (baseline2), Bagging-DWKNN (baseline2), and Stacking-DWKNN (proposed) algorithm. Table16 shows the classification performance of different fusion methods with the optimal feature combination. The statistical measures include Se, Sp, and +p for each beat and the average accuracy. From these results, the Stacking-DWKNN model yields the 9 highest scores on 13 metrics; in particular, the three indicators of S-type heartbeat reached the highest, so this model is preferred for heartbeat classification.Table 16
Classification performance of fusion of different models.
NSVFAvgSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Acc (%)Baseline199.6094.8599.3788.7899.7992.9597.2099.8097.3580.7799.9288.7398.96Baseline299.5892.8699.1387.1899.7792.2095.9599.7696.7670.5199.9491.6797.83Baseline399.6794.3999.3289.1099.8193.6096.5199.8197.4678.2199.9389.7198.95Proposed99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01


#### 4.3.4. Comparison with Previous Studies

Table17 shows a comparison of the classification result between the proposed method and other studies, which also perform on MIT-AD. The results show that the Stacking-DWKNN model with multiple combinations of features has better classification accuracy than the other methods discussed in this paper. And the average classification accuracy is 99.01%. The method can accurately distinguish between four categories of heartbeats. As can be seen, a comparison of the classification results from the heartbeat perspective shows that the method outperforms [8, 11, 26, 32, 34] on all metrics. Compared with [14], the positive predictive value of S beats is slightly lower, but the proposed method has obvious advantages in other indicators. Regarding the sensitivity, the method proposed in this paper achieved higher values compared to previous methods for the majority classes, N and V. But compared with the literature [33, 37], the sensitivity of class S and class F is slightly lower. This is due to the lower number of these two types of heartbeats. It can be concluded from the above that the proposed method has better classification performance. The most important arrhythmias (S and V) have all achieved better results.Table 17
Comparison with other studies.
ReferenceFeaturesClassifierPerformanceMar et al. [26]Statistical features + SFFS; temporal features; morphological featuresWeighted LD, MLPAcc = 89.9%;Sen = 89.6%; +Pn = 99.1%:Ses = 83.2%; +Ps = 33.5%;Sev = 86.8%; +Pv = 75.9%;Sef = 61.1%; +Pf = 16.6%;Zhang et al. [33]ECG-intervals and segments; RR interval; morphological featuresCombined SVMAcc = 86.66%;Sen = 88.94%; +Pn = 98.98%:Ses = 79.06%; +Ps = 35.98%;Sev = 85.48%; +Pv = 92.75%;Sef = 93.81%; +Pf = 13.73%;Zhu et al. [14]ECG morphologySVMAcc = 97.80%;Sen = 99.27%; +Pn = 98.48%;Ses = 87.47%; +Ps = 95.25%;Sev = 94.71%; +Pv = 95.22%Sef = 73.88%; +Pf = 86.09%Mondéjar-Guerra [34]RR interval; HOS; ECG morphology; wavelet coefficientsEnsemble SVMAcc = 94.5%;Sen = 95.9%; +Pn = 98.2%;Ses = 78.1%; +Ps = 49.7%;Sev = 94.7%; +Pv = 93.9%Sef = 12.4%; +Pf = 23.6%Shi et al. [37]ECG morphologyHierarchical classifierSen = 92.1%; +Pn = 99.5%;Ses = 91.7%; +Ps = 46.2%;Sev = 95.1%; +Pv = 88.1%;Sef = 61.6%; +Pf = 15.2%;Sharma et al. [32]Fuzzy entropy; Renyi entropy; fractal dimensionKNNAcc = 94.5%;Sen = 99.59%; Spn = 91.92%; +Pn = 98.34;Ses = 73.64%; Sps = 99.84%; +Ps = 92.09;Sev = 92.11%; Spv = 99.75%; +Pv = 96.37;Sef = 64.46%; Spf = 99.94%; +Pf = 88.38;Singh et al. [8]Gabor; wave; intervalDCNNAcc = 93.19%;Se = 93.98%;Sp = 95%;Li et al. [11]R-R intervals; wavelet transform; Morph; higher-order statisticsCraftNetAcc = 89.24%;Sen = 88.16%; Spn = 94.34%Ses = 85.37%; Sps = 94.85%Sev = 94.53%; Spv = 99.70%Sef = 88.92%; Spf = 94.28%ProposedIntervals; P-QRS-T wave; amplitude; ECG morphologyStacking-DWKNNAcc = 99.01%;Sen = 99.65%; Spn = 94.94%; +Pn = 99.38;Ses = 89.42%; Sps = 99.85%; +Ps = 94.90;Sev = 97.21%; Spv = 99.78%; +Pv = 97.07;Sef = 80.77%; Spf = 99.94%; +Pf = 88.73;


## 4.1. Experimental Data

All the experiments in this paper are completed on the MIT-AD. The database consists of 48 two-lead records digitized at 360 HZ. Each of the ECG records includes one and a half hours of 2-lead dynamic ECG segments [52]. In this paper, the normal (N), supraventricular (S), ventricular (V), and fusion (F) heartbeats in MIT-AD are distinguished. The four types of heartbeats have a total of 101413 records. This paper randomly selected 90% of the heartbeat data for training and the remaining 10% for testing. The specific distribution of data is shown in Table 5.Table 5
Experimental data statistics.
Training setTesting setTotalN81,5609,03590,595S2,5282532,781V6,4507857,235F72379802


## 4.2. Evaluation Indicator

In this paper, the data is divided into a training set and a test set, and the label output of the model is compared with the real label to get the experimental results. The results of N category heartbeat classification are calculated by formulas (6)–(9) [42]. S, V, and F heartbeats are calculated in the same way. Description of a confusion matrix is shown in Table 6, where N, S, V, and F represent the real category of heartbeat and n, s, v, and f represent the predicted type of heartbeat.(6)TPN=Nn,(7)FNN=Ns+Nv+Nf,(8)TNN=Ss+Sv+Sf+Vs+Vv+Vf+Fs+Fv+Ff,(9)FPN=Sn+Vn+Fn.Table 6
Confusion matrix of classification results.
nsvfTotalNNnNsNvNf∑NSSnSsSvSf∑SVVnVsVvVf∑VFFnFsFvFf∑FFor the comprehensive evaluation of the performance, sensitivity (Se), specificity (Sp), positive predictive value (+p), and accuracy (Acc) are used as indicators in this paper. Higher values of these indicators indicate better classification performance. These four indicators are calculated by the following formula [42].(10)Se=TPTP+FN,Sp=TNTN+FP,+p=TPTP+FP,Acc=TP+TNTP+TN+FP+FN.


## 4.3. Experiment and Result Analysis

To distinguish arrhythmia more accurately, the classification strategy using the multifeature combination and Stacking-DWKNN algorithm is proposed, which is mainly reflected in the experimental part. This section first compares and analyzes the classification results of KNN models with different feature combinations to select the optimal feature combination (Section4.3.1); later, in order to achieve better classification results, the parameters K of the KNN model are adjusted (Section 4.3.2). Furthermore, different models are compared to verify that the KNN model is the best, and the classification results of the fusion of different models are compared to show that the framework proposed in this paper is better (Section 4.3.3), which are finally compared with other references (Section 4.3.4). Our focus is mainly on the selection of feature combinations and the influence of the model fusion method proposed in this paper on heartbeat classification.


### 4.3.1. Analysis of Experimental Results of Different Feature Combinations

In order to select the optimal feature combination, the effects of the KNN model with different feature combinations on heartbeat classification are analyzed, and the above four indicators are used for evaluation.15 group experiments are performed in experiment I using the KNN model with interval features. The goal of this experiment is to get the optimal interval feature combination. The classification results of the KNN model with different interval combinations are shown in Table7. The best accuracy of 95.41% is obtained by P-QRS-T, PR_inter, QT_inter, ST_seg, and RR_inter. The optimal interval combination is represented by Inter, Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg}.Table 7
Classification results of the KNN model with interval features.
FeaturesEvaluation metrics (%)P-QRS-TRR_interPR_interST_segQT_interAcc••92.17••90.89••92.85••91.78•••92.72•••94.71•••94.68•••93.92•••93.10•••94.53••••95.39•••95.27••••94.76••••95.26•••••95.41Three groups of experiments are performed in experiment II using the KNN model with amplitude features. The goal of this experiment is to get the optimal amplitude of heartbeat classification. The classification results are represented in Table8. Compared with the KNN model with R_amp and T_amp, using only R_amp has the same classification effect. Besides, too many heartbeat features will reduce the efficiency of the classifier, so R_amp is selected as the optimal amplitude feature.Table 8
Classification results for the KNN model with amplitude features.
FeaturesEvaluation metrics (%)T_ampR_ampAcc•89.42•90.26••90.26Through the above two experiments, the best combination of interval and amplitude features is obtained. The optimal combination of the three types of features is represented by Morph, Inter, and Amp.Morph = {single heartbeat morphology};Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg};Amp = {R_amp}.In experiment III, in order to analyze the suitability of every single feature, each feature is fed into the KNN model for training. The resulting confusion matrices for the KNN model with a single feature are presented in Table9. It is obvious that the single heartbeat morphology feature (Morph) is the best descriptor, and the number of correctly classified heartbeats is the largest. Table 10 shows the classification results calculated from the confusion matrix. The average classification accuracy is 98.88%. From the perspective of the heartbeat, almost all the classification indicators of the KNN model with Morph features have obtained the best results, which are higher than Inter and Amp features.Table 9
Confusion matrix for the KNN model combining with single features.
MorphInterAmpnsvfnsvfnsvfN9009121228939265614896020532S402711013516980306600V23069031625544552731860F12185747072468091Table 10
Confusion matrix for the KNN model combining with single features.
MorphInterAmpSe(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)N99.7193.2299.1799.0098.9468.9096.2995.6699.1718.5490.8690.38S86.8699.8795.4299.4754.1799.6884.5098.2819.2099.7720.6996.76V96.3799.7897.0599.5475.9899.2588.4697.6025.9899.3475.0094.16F73.0899.9591.9499.7430.7799.8155.8199.2812.8099.9833.3399.22In experiment IV, to compare the effect of different feature combinations on heartbeat classification, different feature combinations are fed into the KNN model. Tables11 and 12 present confusion matrices and performance results calculated for each class. The larger the diagonal value in the confusion matrix, the better the classification effect of the classifier. It can be seen that the best results are almost based on the KNN model with Morph, Inter, and Amp features. The average classification accuracy is 98.88%. From these results, ECG information can be expressed more comprehensively by using interval, amplitude, and morphology features in heartbeat classification.Table 11
Confusion matrix for the KNN model combining with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpNsvfnsvfnsvfnsvfN9010121129010121128942275412900913112S42269104027110772241103727410V2226911230690385861942226911F150756121857280941150756Table 12
Classification performance for KNN model trained with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpSe%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%N99.7292.8699.1398.9799.7293.2299.1799.0198.9782.8297.9297.2199.7193.3199.1999.01S86.2299.8695.0599.4486.8699.8795.4299.4771.7999.6486.4998.7987.8299.8594.8199.48V96.5199.7997.3299.5796.3799.7997.1899.5586.4599.2189.3298.3196.5199.8097.3299.57F71.7999.9794.9299.7673.0899.9591.9499.7452.5699.8471.9399.4871.7999.9794.9299.75From the above experiments, it is obvious that the single heartbeat morphology is the optimal single feature for distinguishing the heartbeat. The optimal feature combination is single heartbeat morphology, Inter, and Amp features. The average classification accuracy is 98.91%. Figure5 shows the KNN model with optimal features combination of classification results.Figure 5
Classification results of KNN model with Morph, Inter, and Amp features.


### 4.3.2. Analysis of Experimental Results with Different Parameters

To achieve better classification performance, the model parameters are adjusted. In the k-nearest-neighbor algorithm, the parameter K represents thek neighbors closest to the classified samples. Generally, the K value is too small, and the classification accuracy of the model is low. The K value is too large, and the model is easy to fit. To determine the appropriate K value, ten experiments are conducted with different parameters. Based on different parameter values, the classification results of the KNN model with the optimal feature combination are presented in Table 13.Table 13
Classification results of different K values.
Parameter K12345678910Acc (%)98.8498.8098.8598.9198.7998.8098.7298.7498.6598.65It is obvious from Table13 that when k = 4, the performance of the classifier is the best, with a classification accuracy of 98.91%. And the classification results of different parameters are different, indicating that the parameters have a certain influence on the classification results of the model. Afterward, the K-nearest neighbors are given different weights according to their distance from the classified samples. The accuracy of the DWKNN algorithm with the optimal feature combination is 98.96%.


### 4.3.3. Analysis of Experimental Result Analysis of Different Classifiers

The performance of different classifiers is mainly compared in this section. From the above experiments, the optimal combination of features is Morph, Inter, and Amp. In this experiment, accuracy (Acc%) is employed as the evaluation indicator to compare the performance differences of support vector machine (SVM), random forest (RF), logistic regression (LR), linear discriminant classifier (LDA), decision tree (DT), gradient boosting decision tree (GBDT), K-nearest neighbor (KNN), and improved KNN (DWKNN) on different datasets. The classification results of the optimal feature combination based on different classifiers are presented in Table14.Table 14
Classification results of different classifiers trained with all possible feature combinations.
Feature combinationClassifierMorphInterAmpLDALRSVMDTGBDTRFKNNDW KNNStacking-DWKNN•91.7192.3998.6197.3597.6198.5598.8898.9598.94•89.0689.0193.6993.4794.4595.7395.4195.3695.59•90.4289.1490.5987.9890.5887.8190.2688.4790.43••93.0393.2598.6997.4397.7398.5798.8798.9798.97••91.7492.4098.6997.4797.5598.5898.8998.9498.95••90.1490.9495.7195.7496.0197.0896.8996.9397.09•••93.8294.2498.7497.8098.1598.8398.9198.9699.01As shown in Table14, it is obvious that the classification results of the KNN model are the best. The average classification accuracy is 98.91%. The k-nearest neighbors of the KNN model are given different weights (DWKNN), and the classification results are improved. The ensemble of multiple KNN models (Stacking-DWKNN) has a higher classification performance than a single model. The ensemble classifier fully utilized the correctly classified results of base learners and the difference between them. This demonstrates the outstanding performance of ensemble classifiers and does improve the results of heartbeat classification. The accuracy of the Stacking-DWKNN model with the optimal feature combination is 99.01%.The classification result by five ensemble structures with the optimal feature combination is shown in Table15. Table 15 lists the 16 metrics of classification results, including Se, Sp, and +p for each beat and the average accuracy. The Stacking-DWKNN structure has the best comprehensive classification ability: yielding the 8 highest scores on 13 metrics. It achieves the best average sensitivity and specificity of 94.26% and 98.63%. Among them, the N category and V category achieved better results. The Stacking-SVM, Stacking-DT, Stacking-GBDT, and Stacking-RF recognized the N category very well but at the cost of low detection rate of F beat. At the same time, the Stacking-DWKNN recognized the S category, and the F category is improved compared to them. This is because improving the KNN model through weights improves the impact of data imbalance. Figure 6 shows the Stacking-DWKNN model with different features of classification results.Table 15
Classification performance for stacking model combined with different classifier combinations.
NSVFAccSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)NumStacking-SVM99.8391.3298.9581.0999.9698.4496.5199.7897.0569.3299.9896.4398.79Stacking-DT98.9390.9698.8981.7399.5083.8893.9999.5193.6070.5199.7568.7597.83Stacking-GBDT99.6888.1698.5774.6899.9095.8894.4199.7196.1666.6799.9489.6698.28Stacking-RF99.8691.6898.9982.0599.9899.2296.5199.7897.0570.5199.9896.4998.85Stacking-DWKNN99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01Figure 6
Classification result based on Stacking-DWKNN model with different feature combinations.In order to understand the effect of different model fusion methods, based on the DWKNN (baseline1) model, different model fusion methods are used, and the optimal feature vectors are fed to different models, namely, Voting-DWKNN (baseline2), Bagging-DWKNN (baseline2), and Stacking-DWKNN (proposed) algorithm. Table16 shows the classification performance of different fusion methods with the optimal feature combination. The statistical measures include Se, Sp, and +p for each beat and the average accuracy. From these results, the Stacking-DWKNN model yields the 9 highest scores on 13 metrics; in particular, the three indicators of S-type heartbeat reached the highest, so this model is preferred for heartbeat classification.Table 16
Classification performance of fusion of different models.
NSVFAvgSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Acc (%)Baseline199.6094.8599.3788.7899.7992.9597.2099.8097.3580.7799.9288.7398.96Baseline299.5892.8699.1387.1899.7792.2095.9599.7696.7670.5199.9491.6797.83Baseline399.6794.3999.3289.1099.8193.6096.5199.8197.4678.2199.9389.7198.95Proposed99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01


### 4.3.4. Comparison with Previous Studies

Table17 shows a comparison of the classification result between the proposed method and other studies, which also perform on MIT-AD. The results show that the Stacking-DWKNN model with multiple combinations of features has better classification accuracy than the other methods discussed in this paper. And the average classification accuracy is 99.01%. The method can accurately distinguish between four categories of heartbeats. As can be seen, a comparison of the classification results from the heartbeat perspective shows that the method outperforms [8, 11, 26, 32, 34] on all metrics. Compared with [14], the positive predictive value of S beats is slightly lower, but the proposed method has obvious advantages in other indicators. Regarding the sensitivity, the method proposed in this paper achieved higher values compared to previous methods for the majority classes, N and V. But compared with the literature [33, 37], the sensitivity of class S and class F is slightly lower. This is due to the lower number of these two types of heartbeats. It can be concluded from the above that the proposed method has better classification performance. The most important arrhythmias (S and V) have all achieved better results.Table 17
Comparison with other studies.
ReferenceFeaturesClassifierPerformanceMar et al. [26]Statistical features + SFFS; temporal features; morphological featuresWeighted LD, MLPAcc = 89.9%;Sen = 89.6%; +Pn = 99.1%:Ses = 83.2%; +Ps = 33.5%;Sev = 86.8%; +Pv = 75.9%;Sef = 61.1%; +Pf = 16.6%;Zhang et al. [33]ECG-intervals and segments; RR interval; morphological featuresCombined SVMAcc = 86.66%;Sen = 88.94%; +Pn = 98.98%:Ses = 79.06%; +Ps = 35.98%;Sev = 85.48%; +Pv = 92.75%;Sef = 93.81%; +Pf = 13.73%;Zhu et al. [14]ECG morphologySVMAcc = 97.80%;Sen = 99.27%; +Pn = 98.48%;Ses = 87.47%; +Ps = 95.25%;Sev = 94.71%; +Pv = 95.22%Sef = 73.88%; +Pf = 86.09%Mondéjar-Guerra [34]RR interval; HOS; ECG morphology; wavelet coefficientsEnsemble SVMAcc = 94.5%;Sen = 95.9%; +Pn = 98.2%;Ses = 78.1%; +Ps = 49.7%;Sev = 94.7%; +Pv = 93.9%Sef = 12.4%; +Pf = 23.6%Shi et al. [37]ECG morphologyHierarchical classifierSen = 92.1%; +Pn = 99.5%;Ses = 91.7%; +Ps = 46.2%;Sev = 95.1%; +Pv = 88.1%;Sef = 61.6%; +Pf = 15.2%;Sharma et al. [32]Fuzzy entropy; Renyi entropy; fractal dimensionKNNAcc = 94.5%;Sen = 99.59%; Spn = 91.92%; +Pn = 98.34;Ses = 73.64%; Sps = 99.84%; +Ps = 92.09;Sev = 92.11%; Spv = 99.75%; +Pv = 96.37;Sef = 64.46%; Spf = 99.94%; +Pf = 88.38;Singh et al. [8]Gabor; wave; intervalDCNNAcc = 93.19%;Se = 93.98%;Sp = 95%;Li et al. [11]R-R intervals; wavelet transform; Morph; higher-order statisticsCraftNetAcc = 89.24%;Sen = 88.16%; Spn = 94.34%Ses = 85.37%; Sps = 94.85%Sev = 94.53%; Spv = 99.70%Sef = 88.92%; Spf = 94.28%ProposedIntervals; P-QRS-T wave; amplitude; ECG morphologyStacking-DWKNNAcc = 99.01%;Sen = 99.65%; Spn = 94.94%; +Pn = 99.38;Ses = 89.42%; Sps = 99.85%; +Ps = 94.90;Sev = 97.21%; Spv = 99.78%; +Pv = 97.07;Sef = 80.77%; Spf = 99.94%; +Pf = 88.73;


## 4.3.1. Analysis of Experimental Results of Different Feature Combinations

In order to select the optimal feature combination, the effects of the KNN model with different feature combinations on heartbeat classification are analyzed, and the above four indicators are used for evaluation.15 group experiments are performed in experiment I using the KNN model with interval features. The goal of this experiment is to get the optimal interval feature combination. The classification results of the KNN model with different interval combinations are shown in Table7. The best accuracy of 95.41% is obtained by P-QRS-T, PR_inter, QT_inter, ST_seg, and RR_inter. The optimal interval combination is represented by Inter, Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg}.Table 7
Classification results of the KNN model with interval features.
FeaturesEvaluation metrics (%)P-QRS-TRR_interPR_interST_segQT_interAcc••92.17••90.89••92.85••91.78•••92.72•••94.71•••94.68•••93.92•••93.10•••94.53••••95.39•••95.27••••94.76••••95.26•••••95.41Three groups of experiments are performed in experiment II using the KNN model with amplitude features. The goal of this experiment is to get the optimal amplitude of heartbeat classification. The classification results are represented in Table8. Compared with the KNN model with R_amp and T_amp, using only R_amp has the same classification effect. Besides, too many heartbeat features will reduce the efficiency of the classifier, so R_amp is selected as the optimal amplitude feature.Table 8
Classification results for the KNN model with amplitude features.
FeaturesEvaluation metrics (%)T_ampR_ampAcc•89.42•90.26••90.26Through the above two experiments, the best combination of interval and amplitude features is obtained. The optimal combination of the three types of features is represented by Morph, Inter, and Amp.Morph = {single heartbeat morphology};Inter = {P-QRS-T, QT_inter, RR_inter, PR_inter, ST_seg};Amp = {R_amp}.In experiment III, in order to analyze the suitability of every single feature, each feature is fed into the KNN model for training. The resulting confusion matrices for the KNN model with a single feature are presented in Table9. It is obvious that the single heartbeat morphology feature (Morph) is the best descriptor, and the number of correctly classified heartbeats is the largest. Table 10 shows the classification results calculated from the confusion matrix. The average classification accuracy is 98.88%. From the perspective of the heartbeat, almost all the classification indicators of the KNN model with Morph features have obtained the best results, which are higher than Inter and Amp features.Table 9
Confusion matrix for the KNN model combining with single features.
MorphInterAmpnsvfnsvfnsvfN9009121228939265614896020532S402711013516980306600V23069031625544552731860F12185747072468091Table 10
Confusion matrix for the KNN model combining with single features.
MorphInterAmpSe(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)Se(%)Sp(%)+p(%)Acc(%)N99.7193.2299.1799.0098.9468.9096.2995.6699.1718.5490.8690.38S86.8699.8795.4299.4754.1799.6884.5098.2819.2099.7720.6996.76V96.3799.7897.0599.5475.9899.2588.4697.6025.9899.3475.0094.16F73.0899.9591.9499.7430.7799.8155.8199.2812.8099.9833.3399.22In experiment IV, to compare the effect of different feature combinations on heartbeat classification, different feature combinations are fed into the KNN model. Tables11 and 12 present confusion matrices and performance results calculated for each class. The larger the diagonal value in the confusion matrix, the better the classification effect of the classifier. It can be seen that the best results are almost based on the KNN model with Morph, Inter, and Amp features. The average classification accuracy is 98.88%. From these results, ECG information can be expressed more comprehensively by using interval, amplitude, and morphology features in heartbeat classification.Table 11
Confusion matrix for the KNN model combining with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpNsvfnsvfnsvfnsvfN9010121129010121128942275412900913112S42269104027110772241103727410V2226911230690385861942226911F150756121857280941150756Table 12
Classification performance for KNN model trained with different feature combinations.
Morph + InterMorph + AmpInter + AmpMorph + Inter + AmpSe%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%Se%Sp%+p%Acc%N99.7292.8699.1398.9799.7293.2299.1799.0198.9782.8297.9297.2199.7193.3199.1999.01S86.2299.8695.0599.4486.8699.8795.4299.4771.7999.6486.4998.7987.8299.8594.8199.48V96.5199.7997.3299.5796.3799.7997.1899.5586.4599.2189.3298.3196.5199.8097.3299.57F71.7999.9794.9299.7673.0899.9591.9499.7452.5699.8471.9399.4871.7999.9794.9299.75From the above experiments, it is obvious that the single heartbeat morphology is the optimal single feature for distinguishing the heartbeat. The optimal feature combination is single heartbeat morphology, Inter, and Amp features. The average classification accuracy is 98.91%. Figure5 shows the KNN model with optimal features combination of classification results.Figure 5
Classification results of KNN model with Morph, Inter, and Amp features.


## 4.3.2. Analysis of Experimental Results with Different Parameters

To achieve better classification performance, the model parameters are adjusted. In the k-nearest-neighbor algorithm, the parameter K represents thek neighbors closest to the classified samples. Generally, the K value is too small, and the classification accuracy of the model is low. The K value is too large, and the model is easy to fit. To determine the appropriate K value, ten experiments are conducted with different parameters. Based on different parameter values, the classification results of the KNN model with the optimal feature combination are presented in Table 13.Table 13
Classification results of different K values.
Parameter K12345678910Acc (%)98.8498.8098.8598.9198.7998.8098.7298.7498.6598.65It is obvious from Table13 that when k = 4, the performance of the classifier is the best, with a classification accuracy of 98.91%. And the classification results of different parameters are different, indicating that the parameters have a certain influence on the classification results of the model. Afterward, the K-nearest neighbors are given different weights according to their distance from the classified samples. The accuracy of the DWKNN algorithm with the optimal feature combination is 98.96%.


## 4.3.3. Analysis of Experimental Result Analysis of Different Classifiers

The performance of different classifiers is mainly compared in this section. From the above experiments, the optimal combination of features is Morph, Inter, and Amp. In this experiment, accuracy (Acc%) is employed as the evaluation indicator to compare the performance differences of support vector machine (SVM), random forest (RF), logistic regression (LR), linear discriminant classifier (LDA), decision tree (DT), gradient boosting decision tree (GBDT), K-nearest neighbor (KNN), and improved KNN (DWKNN) on different datasets. The classification results of the optimal feature combination based on different classifiers are presented in Table14.Table 14
Classification results of different classifiers trained with all possible feature combinations.
Feature combinationClassifierMorphInterAmpLDALRSVMDTGBDTRFKNNDW KNNStacking-DWKNN•91.7192.3998.6197.3597.6198.5598.8898.9598.94•89.0689.0193.6993.4794.4595.7395.4195.3695.59•90.4289.1490.5987.9890.5887.8190.2688.4790.43••93.0393.2598.6997.4397.7398.5798.8798.9798.97••91.7492.4098.6997.4797.5598.5898.8998.9498.95••90.1490.9495.7195.7496.0197.0896.8996.9397.09•••93.8294.2498.7497.8098.1598.8398.9198.9699.01As shown in Table14, it is obvious that the classification results of the KNN model are the best. The average classification accuracy is 98.91%. The k-nearest neighbors of the KNN model are given different weights (DWKNN), and the classification results are improved. The ensemble of multiple KNN models (Stacking-DWKNN) has a higher classification performance than a single model. The ensemble classifier fully utilized the correctly classified results of base learners and the difference between them. This demonstrates the outstanding performance of ensemble classifiers and does improve the results of heartbeat classification. The accuracy of the Stacking-DWKNN model with the optimal feature combination is 99.01%.The classification result by five ensemble structures with the optimal feature combination is shown in Table15. Table 15 lists the 16 metrics of classification results, including Se, Sp, and +p for each beat and the average accuracy. The Stacking-DWKNN structure has the best comprehensive classification ability: yielding the 8 highest scores on 13 metrics. It achieves the best average sensitivity and specificity of 94.26% and 98.63%. Among them, the N category and V category achieved better results. The Stacking-SVM, Stacking-DT, Stacking-GBDT, and Stacking-RF recognized the N category very well but at the cost of low detection rate of F beat. At the same time, the Stacking-DWKNN recognized the S category, and the F category is improved compared to them. This is because improving the KNN model through weights improves the impact of data imbalance. Figure 6 shows the Stacking-DWKNN model with different features of classification results.Table 15
Classification performance for stacking model combined with different classifier combinations.
NSVFAccSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)NumStacking-SVM99.8391.3298.9581.0999.9698.4496.5199.7897.0569.3299.9896.4398.79Stacking-DT98.9390.9698.8981.7399.5083.8893.9999.5193.6070.5199.7568.7597.83Stacking-GBDT99.6888.1698.5774.6899.9095.8894.4199.7196.1666.6799.9489.6698.28Stacking-RF99.8691.6898.9982.0599.9899.2296.5199.7897.0570.5199.9896.4998.85Stacking-DWKNN99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01Figure 6
Classification result based on Stacking-DWKNN model with different feature combinations.In order to understand the effect of different model fusion methods, based on the DWKNN (baseline1) model, different model fusion methods are used, and the optimal feature vectors are fed to different models, namely, Voting-DWKNN (baseline2), Bagging-DWKNN (baseline2), and Stacking-DWKNN (proposed) algorithm. Table16 shows the classification performance of different fusion methods with the optimal feature combination. The statistical measures include Se, Sp, and +p for each beat and the average accuracy. From these results, the Stacking-DWKNN model yields the 9 highest scores on 13 metrics; in particular, the three indicators of S-type heartbeat reached the highest, so this model is preferred for heartbeat classification.Table 16
Classification performance of fusion of different models.
NSVFAvgSe(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Se(%)Sp(%)+p(%)Acc (%)Baseline199.6094.8599.3788.7899.7992.9597.2099.8097.3580.7799.9288.7398.96Baseline299.5892.8699.1387.1899.7792.2095.9599.7696.7670.5199.9491.6797.83Baseline399.6794.3999.3289.1099.8193.6096.5199.8197.4678.2199.9389.7198.95Proposed99.6594.9499.3889.4299.8594.9097.2199.7897.0780.7799.9488.7399.01


## 4.3.4. Comparison with Previous Studies

Table17 shows a comparison of the classification result between the proposed method and other studies, which also perform on MIT-AD. The results show that the Stacking-DWKNN model with multiple combinations of features has better classification accuracy than the other methods discussed in this paper. And the average classification accuracy is 99.01%. The method can accurately distinguish between four categories of heartbeats. As can be seen, a comparison of the classification results from the heartbeat perspective shows that the method outperforms [8, 11, 26, 32, 34] on all metrics. Compared with [14], the positive predictive value of S beats is slightly lower, but the proposed method has obvious advantages in other indicators. Regarding the sensitivity, the method proposed in this paper achieved higher values compared to previous methods for the majority classes, N and V. But compared with the literature [33, 37], the sensitivity of class S and class F is slightly lower. This is due to the lower number of these two types of heartbeats. It can be concluded from the above that the proposed method has better classification performance. The most important arrhythmias (S and V) have all achieved better results.Table 17
Comparison with other studies.
ReferenceFeaturesClassifierPerformanceMar et al. [26]Statistical features + SFFS; temporal features; morphological featuresWeighted LD, MLPAcc = 89.9%;Sen = 89.6%; +Pn = 99.1%:Ses = 83.2%; +Ps = 33.5%;Sev = 86.8%; +Pv = 75.9%;Sef = 61.1%; +Pf = 16.6%;Zhang et al. [33]ECG-intervals and segments; RR interval; morphological featuresCombined SVMAcc = 86.66%;Sen = 88.94%; +Pn = 98.98%:Ses = 79.06%; +Ps = 35.98%;Sev = 85.48%; +Pv = 92.75%;Sef = 93.81%; +Pf = 13.73%;Zhu et al. [14]ECG morphologySVMAcc = 97.80%;Sen = 99.27%; +Pn = 98.48%;Ses = 87.47%; +Ps = 95.25%;Sev = 94.71%; +Pv = 95.22%Sef = 73.88%; +Pf = 86.09%Mondéjar-Guerra [34]RR interval; HOS; ECG morphology; wavelet coefficientsEnsemble SVMAcc = 94.5%;Sen = 95.9%; +Pn = 98.2%;Ses = 78.1%; +Ps = 49.7%;Sev = 94.7%; +Pv = 93.9%Sef = 12.4%; +Pf = 23.6%Shi et al. [37]ECG morphologyHierarchical classifierSen = 92.1%; +Pn = 99.5%;Ses = 91.7%; +Ps = 46.2%;Sev = 95.1%; +Pv = 88.1%;Sef = 61.6%; +Pf = 15.2%;Sharma et al. [32]Fuzzy entropy; Renyi entropy; fractal dimensionKNNAcc = 94.5%;Sen = 99.59%; Spn = 91.92%; +Pn = 98.34;Ses = 73.64%; Sps = 99.84%; +Ps = 92.09;Sev = 92.11%; Spv = 99.75%; +Pv = 96.37;Sef = 64.46%; Spf = 99.94%; +Pf = 88.38;Singh et al. [8]Gabor; wave; intervalDCNNAcc = 93.19%;Se = 93.98%;Sp = 95%;Li et al. [11]R-R intervals; wavelet transform; Morph; higher-order statisticsCraftNetAcc = 89.24%;Sen = 88.16%; Spn = 94.34%Ses = 85.37%; Sps = 94.85%Sev = 94.53%; Spv = 99.70%Sef = 88.92%; Spf = 94.28%ProposedIntervals; P-QRS-T wave; amplitude; ECG morphologyStacking-DWKNNAcc = 99.01%;Sen = 99.65%; Spn = 94.94%; +Pn = 99.38;Ses = 89.42%; Sps = 99.85%; +Ps = 94.90;Sev = 97.21%; Spv = 99.78%; +Pv = 97.07;Sef = 80.77%; Spf = 99.94%; +Pf = 88.73;


## 5. Conclusions

Accurate classification of arrhythmias is essential for treating patients. Therefore, an intelligent classification method based on multifeature combination and Stacking-DWKNN algorithm is presented in this paper, which can realize the selection of ECG features and heartbeat classification. The results show that the proposed method has a good recognition rate for four heartbeats. The key points of this study are as follows:(1)
Different feature combinations are constructed, and the effect of different combinations of features on heartbeat classification is evaluated to select the optimal feature combination, which provides a good application for ECG feature selection(2)
The classification effects of several different classifiers are compared to select the optimal classifier, and then different model fusion methods are used for heartbeat classification based on this classifier to obtain the optimal model fusion method(3)
The experimental results show that the Stacking-DWKNN model with optimal feature combination can distinguish four different types of the heartbeatThe Stacking-DWKNN model first uses DWKNN models to predict samples separately. The training process of each DWKNN model adopts a cross-training method, the prediction results are used as the input of the secondary model to make the final prediction, and then the final classification is determined by combining the classification results of multiple classifiers to achieve better performance than a single classifier. The cross-validation method effectively alleviates the overfitting problem encountered by a single classification algorithm and has strong robustness. The average classification accuracy is 99.01%.However, the results of F-type are worse than other types because a few F-types have difficulty in analyzing the features of this type of heartbeat in detail. In the future, we need to include the use of multiple leads and add more complex feature fusion methodologies, and also more attention should be paid to improve the performance of F-type.



---

*Source: 8811837-2021-01-28.xml*