 Research
 Open access
 Published:
A particle swarm optimization improved BP neural network intelligent model for electrocardiogram classification
BMC Medical Informatics and Decision Making volumeÂ 21, ArticleÂ number:Â 99 (2021)
Abstract
Background
As proven to reflect the work state of heart and physiological situation objectively, electrocardiogram (ECG) is widely used in the assessment of human health, especially the diagnosis of heart disease. The accuracy and reliability of abnormal ECG (AECG) decision depend to a large extent on the feature extraction. However, it is often uneasy or even impossible to obtain accurate features, as the detection process of ECG is easily disturbed by the external environment. And AECG got many species and great variation. Whatâ€™s more, the ECG result obtained after a long time past, which can not reach the purpose of early warning or realtime disease diagnosis. Therefore, developing an intelligent classification model with an accurate feature extraction method to identify AECG is of quite significance. This study aimed to explore an accurate feature extraction method of ECG and establish a suitable model for identifying AECG and the diagnosis of heart disease.
Methods
In this research, the wavelet combined with four operations and adaptive threshold methods were applied to filter the ECG and extract its feature waves first. Then, a BP neural network (BPNN) intelligent model and a particle swarm optimization (PSO) improved BPNN (PSOBPNN) intelligent model based on MITBIH open database was established to identify ECG. To reduce the complexity of the model, the principal component analysis (PCA) was used to minimize the feature dimension.
Results
Wavelet transforms combined four operations and adaptive threshold methods were capable of ECG filtering and feature extraction. PCA can significantly deduce the modeling feature dimension to minimize the complexity and save classification time. The PSOBPNN intelligent model was suitable for identifying five types of ECG and showed better effects while comparing it with the BPNN model.
Conclusion
In summary, it was further concluded that the PSOBPNN intelligent model would be a suitable way to identify AECG and provide a tool for the diagnosis of heart disease.
Background
Electrocardiogram (ECG) is a bioelectricity signal with low frequency and weak amplitude, objectively reflect the work state of the heart and the physiological situation, provides important information in the assessment of human health, especially for heart disease [1]. ECG is proven as the most accurate method to analyze and diagnose all kinds of arrhythmia [2]. People with cardiovascular disease usually tend to have abnormal heart rhythms in the early stages [3, 4]. If detected in realtime and find the type of abnormal heart rhythm, proceeding early warning and targeted treatment have important implications for prevention [5]. Nowadays, ECG has become a basis detection index in the clinic. In reality, ECG is one of the leading tools to assess the extent of cardiac involvement in COVID19 patients [6]. It is of great significance to correctly identify ECG. The accuracy and reliability of ECG decision depend to a large extent on feature extraction. However, it is often uneasy or even impossible to obtained accurate features, for the ECG detection process is very easily disturbed by the external environment, and abnormal ECG (AECG) has many species and great variation. Even the same AECG of different patients also have differences. Therefore, it becomes the focus of ECG research to recognize ECG and reach the purpose of early warning or realtime disease diagnosis. Developing an intelligent classification model with an accurate feature extraction method is of quite significance to identify AECG. For ECG signal filtering, even though there is a corresponding filter bank in the system to filter out the noise in the acquisition process, the hardware denoising has certain limitations. Software denoising mainly include three kinds of method, i.e., designing a digital filter, wavelet filter, and neural network and mathematical morphology [7,8,9]. In general, digital filters is difficult to design, has relatively poor execution efficiency and larger calculation. The filtering effect of the neural network is easily affected by the characteristic waveform and operation longer. For feature extraction, the detection of other characteristic waves depends on the premise of accurate detection of QRS. The method for detecting the QRS wave mainly includes mathematical morphology, difference threshold method, template matching method [10,11,12]. The plate matching method is based on the amplitudefrequency characteristics of the signal. The differential threshold method is simple and fast, but the detection accuracy is relatively low. The accuracy of mathematical morphology pretreatment is very high, but with complicated calculation. Overall, wavelet presents good results in signal filtering and feature extraction [13].
After feature extraction, there is remaining a big challenge for researchers to develop an intelligent and reliable system to recognize the AECG. Researchers have studied the classification method and or with a feature deduce algorithm to build a model and reduce its complication. While most ECG diagnostic systems established can not get the diagnosis result but only plays an auxiliary diagnostic role due to the complexity of ECG and difference of similar ECG. In a dynamic ECG, the classification of arrhythmia types of ECG signals has not achieved the expected realtime recognition and accurate recognition to meet clinical requirements. The analysis and recognition of ECG still need further study. A pressing problem remains in the development of an accurate method to classify AECG. In recent years, deep learning has developed rapidly, has achieved considerable progress in the research fields such as image and speech processing [14, 15]. Many scholars have begun to explore the application of deep learning methods to the detection of atrial fibrillation (AF) or other arrhythmia classification, which shows superior performance [16,17,18,19,20,21,22,23,24]. By using convolutional neural network (CNN), the classification accuracy only up to 83%, there remains the problem that further handle the imbalance problems of CNN frameworks and accuracy further improve [25]. The ECG classification accuracy of the model based on adversarial domain adaptation reaches 92.3% [26]. Some scholars found that the classification effect of the support vector machine method is poor, the training of linear discriminant analysis is easy to overfit, and the training time of deep learning algorithms is too long [27,28,29]. Scholarsâ€™ study shows that building a backpropagation neural network (BPNN) model to classify AECG, the classification accuracy is only 72.27% [30], is not suitable for detecting cardiovascular disease as the CNN. However, BPNN has strong selflearning ability and high classification and recognition ability has been used in predicting the expected cases of acquired Â immune deficiency syndrome (AIDS) and shows good fitting and forecasting effects [31]. And improved BPNN also shows good effects in handmotion recognition and water temperature forecasting [32, 33]. In this way, BPNN improved can be suitable to establish a classification model for detection AECG and cardiovascular disease, but how to design the ECG classifier based on BPNN with superior performance is worth further study.
BPNN is a multilayer feedforward neural network, consists of an input layer, hidden layer, and output layer. It belongs to supervised learning with the main characteristics of signal forward propagation and the error backpropagation. In general, it utilizes the difference between a theoretical value and an experimental value as a supervised signal, with an error generated in response when the output differs from that expected [34]. BPNN has the ability of simplicity, robust learning capability, and good solutions for nonlinear problems. However, it has the disadvantage of sensitivity to the weight of the initial network, is prone to a local minimum with slow convergence. And also, its lack of theoretical guidance and the selection of training samples will affect the generalization performance of the classifier [35]. Therefore, a lot of improved algorithms emerged to cope with the practical application. It mainly includes two kinds of ways, that are heuristic learning algorithm and optimization algorithm. Among them, the first method is simple and easy to use, but the performance characteristics are not very easy to set up. The other has a lot to improve the convergence speed but increased the complexity of network computing. In this study, we choose the first method. particle swarm optimization (PSO) algorithm originated from the research on artificial intelligence and the hunting behavior of birds [36]. Based on the global search strategy of the population, PSO is optimized through cooperation and competition among particles of many populations. Nowadays, PSO has been widely used in many fields, for example, function optimization, image processing, and so on [37]. Raj Sandeep and Garcia Gabriel, et al. have researched cardiac arrhythmia beat classification using PSO tuned support vector machine (SVM) and got an accuracy of 89.10% for five classes [13, 38]. Liu Zhishuai has used twodimensionality reduction methods principal component analysis (PCA) and time window selection to get better performance in classify ECG [39]. In theory, the advantage of PSO can fill a gap of BPNN, and can be suitable to classify ECG. In this study, we mainly aimed to explore an accurate denoising and feature extraction method of ECG based on a wavelet and perform intelligent modeling to classify AECG based on PSO optimized BPNN with combining the advantage of BPNN and PSO. With the consideration of the training time of deep learning algorithms is too long [27,28,29], the feature dimension reduction are also under consideration to reduce the complexity of the model to save class time and up accuracy.
Methods
BPNN model
To a neural network (NN) model with only one hidden layer, the process of BPNN is mainly divided into two stages. The first stage is the forward propagation of the signal, which passes through the hidden layer from the input layer to the output layer. The second stage is the error backpropagation, from the output layer to the hidden layer, and finally to the input layer, in turn, adjust the weights and bias of the hidden layer to the output layer, weights, and bias of the input layer to the hidden layer. The BP learning algorithm adjusts the weight along the direction of the negative gradient, which refers to the direction in which the function goes down the fastest [40]. The learning process of BPNN is shown in Fig.Â 1. The weight value is revised by Eq.Â (1).
where \(x_{k}\) is weight and threshold matrix, \({\text{g}}_{{\text{k}}}\) is the gradient of the function, \(a_{k}\) is the learning rate.
The derivation analysis process is as follows [41]. Define \(x_{i}\) as input layer vector, \(y_{j}\) as hidden layer vector, \(z_{l}\) as output layer vector, \(\omega_{ji}\) as the weight vector between the input layer and hidden layer, \(\nu_{lj}\) as the weight vector between the hidden layer and output layer. When the prospect output vector is t_{1}, the output vector of the hidden layer and the output layer is given as Eqs. (2) and (3):
Then, the error between the expected output value and the actual output value is given as Eq.Â (4):
The derivative of the error function concerning the output vector is given as Eq.Â (5):
The derivative of the error function concerning the hidden vector is given as Eq.Â (6):
The weight correction function is given as Eqs. (7) and (8):
\(\sum\limits_{l} {(t_{l}  z_{l} ) \cdot f^{{\prime}} (net{}_{l})} \cdot \nu_{lj}\) in hidden layer node error is the error \((t_{l}  z_{l} ) \cdot f^{{\prime}} (net_{l} )\) in output node \(z_{l}\) backpropagation to hidden layer node \(y_{j}\) through weight \(\nu_{lj}\). The corresponding threshold correction formula is given as Eqs. (9) and (10):
where \(\eta\), \(\eta^{{\prime}}\) represents the learning rate of the hidden layer, the output layer, respectively.
When the transfer function is a binary type S function \(f(x) = \frac{1}{{1 + e^{  x} }}\), then its derivative is \(f^{{\prime}} (x) = f(x) \cdot (1  f(x))\). Therefore, \(f^{{\prime}} (net_{l} )\) and \(f^{{\prime}} (net_{j} )\) can be given as Eqs. (11) and (12):
Modeling process of BPNN
An artificial neural network (ANN) is a new crossdiscipline, which is a nonlinear information processing system developed to simulate the structure and function of the human brain. A BPNN is a multilevel NN with anticipation. The most common transfer function adopted by BPNN is nonlinear transformation function (sigmoid function) in layers before the output layer, while linear function in the output layer. In a BPNN, the signal is transmitted via forwarding propagation and error by backward propagation. The BPNN is part of a multilayered network. The most widely used ANN, the BPNN, comprises an input layer, a hidden layer, and an output layer. In this study, the structure of the BPNN model includes multihidden layers, as shown in Fig.Â 2. The process of modeling by BPNN is as follows:

1.
Preprocess data.

2.
Determine the number of network layers, training times, target errors, and learning speeds of the BPNN.

3.
Form the BPNN with training data.

4.
Use the test type data to test the NN model and finally obtain a predicted value.

5.
Compare and analyze the predicted and actual values obtained in the previous step.
Data collection and preprocess
In this study, there are five different types of MLII lead of ECG data collected to establish the classification model, from MITBIH open database, for MLII lead can express the changes of whole ECG well. The original ECG signal collected generally contains highfrequency noise and baseline drift. And the accuracy and reliability of AECG decision results depend to a large extent on the accuracy of ECG feature extraction.
We adopt a wavelet of common different wavelet basis functions to decompose the collected ECG signals to layer 8, to obtain the corresponding detail coefficient and approximate coefficient. From the wavelet principle, the detail coefficients of layer 1 and 2 include most of the highfrequency noise, and the approximate coefficients of layer 8 include baseline drift [42]. Therefore, we set the detail coefficient of layer 1â€“2 to 0 and the approximate coefficient of layer 8 to 0 to eliminate the noise. After corresponding wavelet reconstruction, we can obviously get the denoising signal with no highfrequency noise and baseline drift. To evaluate the effects of filtering, we adopt indexes include minimum mean square error (MSE, smaller is better), signaltonoise ratio (SNR, the closer to 1, the better), and waveform with no change to evaluate the filtering results. Based on the Matlab2019b and the first 10s wave of record 100 ECG from the MITBIH arrhythmia database, the filter effects result of a wavelet of common wavelet basis function, as shown in Table 1. From the results, we found the wavelet of the sym2 basis function is the best to get smooth and pure ECGÂ with keeping the original information, and the Dvalue of MSE is negligible than that of sym8.
Heartbeat segmentation and data integration
As recognition of ECG mainly depends on the time difference and amplitude of the feature waves and heart rate [43, 44]. In AECG, there is always an abnormal heartbeat arise, which contains effective information for the diagnosis of heart disease. In this way, we performed cardiac beat segmentation to the collected data after filtering, according to the label. Then, combining the same labeled beats to form the type of ECG data to further treatment. The heartbeat of fourÂ different types of AECG collected was shown in Fig.Â 3. The Fig.Â 3a is the heartbeat of the ventricular premature beat (Vpb), Fig.Â 3b is the heartbeat of right bundle branch block (Rbbb), Fig.Â 3c is the heartbeat of atrial premature beats (Apb), Fig.Â 3d is the heartbeat of left bundle branch block (Lbbb).
Through the heartbeat segmentation, the number of five different types of ECG we collected from 23 records (records 100â€“233, each 30minutes) are 4615 (Lbbb), 4347 (Rbbb), 1596 (Vpb), 3016 (Apb), and 23,826 (Nb, the heartbeat of normal ECG), respectively. To minimize the calculated amount and uniform the number of beats, we selected the first 30 heartbeats into two groups to further study.
Feature extraction
The time difference and amplitude of the characteristic waves and heart rate of ECG are the basis of diagnosis. ECG mainly includes P wave, QRS complex wave, T wave, and U wave. The normal heart rate is between 60 and 100Â bpm. The Pwave represents the potential change of atrial depolarization. The PR interval represents the time when the atrium begins to depolarize, is from the beginning of the Pwave to the beginning of the QRS group. The QRS group represents the potential change of ventricular depolarization. STsegment is the line segment from the end of the QRS group to the beginning of the Twave, represents the process of slow ventricular repolarization. Twave represents the potential change during rapid ventricular repolarization. QT interval represents the time required for the whole process of ventricular depolarization and repolarization,Â is from the beginning of the QRS wave group to the end of the Twave. Uwave is right after the Twave, represents the potential of ventricular followup. Specific changes in ECG always occur during the proceeding of disease. In clinical diagnosis and treatment, the index used to diagnosis whether the ECG is normal or not mainly includes heart rate, PR interval, QRS interval, and so on.
To obtain the diagnosis basis of ECG, accurate detection of QRS is the premise of feature extraction. To detection of QRS, the Rwave needs to be addressed first. In this study, we present a wavelet of type sym2 combined with four operations and adaptive threshold methods to perform feature extraction. We found that the energy of the Rwave is mainly contained in the detail coefficient of layer 3â€“5 while observing the ECG decomposed into 8 layers with wavelet sym2. Therefore, the decomposed signals at layers 3, 4, and 5 will be used for reconstruction. Rwave is oscillatory, it is still difficult to detect it after QRS composite wave is detected. Through further analysis, we found that the negative energy in the position of the Qwave of layer 5 nearly counteracts the positive energy in the same position of layers 3 and 4. And the energy of layers 3 and 5 together nearly has the same direction of energy in layer 4. Thus, we infer that if add layers 3â€“5 together, the positive energy in the Rwave position can be concentrated while canceled Qwave and Swave that are not currently considered. And if the addition results of layers 3 and 5 multiply layer 4, there will be only positive energy left concentrated in the position of Rwave. Through experiments, we found that it is useful for making four operations to the decomposed signals at layers 3â€“5 to enhance Rwave by Eqs. (13) and (14):
where \(d_{3}\) represents the decomposed signals in layer 3, \(d{}_{4}\) represents the decomposed signals in layer 4, \(d_{5}\) represents the decomposed signals in layer 5.
After the four operations, the energy of the Rwave enriched andÂ other characteristic waves eliminated. In this way, only the position value of the Rwave is retained. To avoid Rwave missing and false detection, an adaptive threshold to extract Rwave was used as follows: firstly, set a fixed window with width and step length of 215 Epochs. Then, obtain the maximum value within the window and use the 60% of the maximum value as the threshold value. Lastly, sliding the window to extract the Rwave. To evaluate the extraction effect of Rwave, we use sensitivity (Se) and precision (P) to perform, by using Eq. (15). The results tested by using the first group collected data of five different types of ECG were shown in Table 2. For the Se and P of the five types of ECG are all over 93%, we think wavelet of type sym2 combined with four operations and adaptive threshold method is suitable to extract Rwave. Same as the Rwave extraction, we located all other feature waves like Pwave, Qwave, Swave, and T wave. Then, the time difference and amplitude of the characteristic waves and heart rate can be extracted. The flow chart of the feature wave location is shown in Fig.Â 4.
where TP represents the number of correctly classified positive examples, i.e., it is actually a positive example and is marked positive, FP represents the number of falsely classified positive examples, i.e., it is actually a negative example but marked as positive, FN represents the number of falsely classified as negative, i.e., it is actually positive but marked as negative.
After all the character waves extracted, we get the feature vector consists of the time difference, amplitude, and heart rate extracted from ECG, show as Eq.Â (16).
where PQ represents the time difference (TTD) between the peak values (TPV) of Pwave and Qwave, PR represents TTD between TPV of Pwave and Rwave, PS represents TTD between TPV of Pwave and Swave, PT represents TTD between TPV of Pwave and Twave, QR represents TTD between TPV of Qwave and Rwave, QS represents TTD between TPV of Qwave and Swave, QT represents TTD between TPV of Qwave and Twave, RS represents TTD between TPV of Rwave and Swave, RT represents TTD between TPV of Rwave and Twave, ST represents TTD between TPV of Swave and Twave, ampP represents TPV of Pwave, ampQ represents TPV of Qwave, ampR represents TPV of Rwave, ampS represents TPV of Swave, ampT represents TPV of Twave, H represents the heartbeat of ECG.
Through the above procedure, the feature of 30 sets of each type of ECG was extracted. Set the feature data of each type of ECG into two groups, and then combine each group as BPNN modeling training data set and test data set. Before modeling, the data normalized. Then the BPNN model of classifying AECG was established through the process of modeling by BPNN.
PSOBPNN model
PSO algorithm
PSO algorithm originated from the research on artificial intelligence and the hunting behavior of birds [45]. Based on the global search strategy of the population, the PSO algorithm is optimized through cooperation and competition among particles of many populations [46]. Nowadays, PSO has been widely used in many fields such as function optimization, image processing, prediction, and so on, due to its simple operation, fast convergence, and global optimization capability [47, 48]. The particle swarm optimization algorithm described as follows [49]:
In an ndimensional search space, m particles are forming a population \(X = \left( {X_{1} ,X_{2} , \ldots ,X_{{\text{m}}} } \right)^{T}\),Â the position of theÂ ith particle isÂ \(X_{i} = \left( {X_{i1} ,X_{i2} , \ldots ,X_{in} } \right)^{T}\), theÂ speed isÂ \(V_{i} = \left( {V_{i1} ,V_{i2} , \ldots ,V_{in} } \right)^{T}\),Â the individual extreme value is \(P_{i} = \left( {P_{i1} ,P_{i2} , \ldots ,P_{in} } \right)^{T}\). The global extreme value of the population is \(P_{g} = \left( {P_{g1} ,P_{g2} , \ldots ,P_{gn} } \right)^{T}\). After finding the individual extreme value and the global extreme value, the particle updates its speed and position respectively according to Eqs. (17) and (18).
where c_{1} and c_{2Â }both are nonnegative constants, which are called learning factor, rand() is a random constant between (0,1), \(V_{id}^{k}\) and \(X_{id}^{k}\) are the velocity and position values of particle i in the d dimension in the kth iteration respectively, \(P_{id}^{k}\) is the position of the individual extremum of particle i in the ddimension, \(P_{gd}^{k}\) is the position of the global extreme value of the group in the d dimension.
Initial weights and thresholds optimization of BPNN
In this study, we use the PSO algorithm with an introduced speed adjustment factors to optimize the initial weight and threshold of BPNN and the conventional BPÂ neural network model. In this way, the optimized BPNN model will have both the global optimization ability of the PSO algorithm and the local search ability of the BP algorithm.
To accelerated convergence and balance the global velocity versus local velocity of the particle, introduce inertia weight w and shrinkage factor k into the above PSO algorithm. The particle updates its speed according to Eq.Â (19)
And we use the newff function to create network objects:
where \(PR\) is \(R \times 2\) matrix to define the minimum and maximum values of \(R\) input vectors, \(S_{i}\) express the number of layer \(i\) neurons, \(TF_{i}\) is the transfer function of layer \(i\), the default function is tansig, \(BTF\) is theÂ training function, the default function is trainlm function, while theÂ traingdx function is more applicable to pattern classification, \(BLF\) is theÂ weight/threshold learning function, default function is theÂ learngdm function, \(PF\) is theÂ performance function, theÂ default function is theÂ MSE function. The training net and parameters are shown as follows:

netâ€‰=â€‰newff(pr,[5, 16],{'tansig' 'purelin'},'traingdx','learngdm'),

pr(1:16,1)â€‰=â€‰âˆ’â€‰1,

pr(1:16,2)â€‰=â€‰1,

net.trainParam.epochsâ€‰=â€‰100,000,

net.trainParam.goalâ€‰=â€‰0.0002,

net.trainParam.lrâ€‰=â€‰0.0003,
The steps of the PSO algorithm optimizing the conventional BPNN is shown in Fig.Â 5. According to the modeling process of BPNN, we adopt the same data set for PSOBPNN modeling. The initial and training parameters that used in modeling as shown in Table 3. In this study, the fitness function of the PSO algorithm selected theÂ MSE of the test data set, as shown in Eq.Â (21):
where Ì„ \(\hat{y}_{i}\) is a predictive sequence and \({\text{y}}_{i}\) is a sequence of true values.
Feature dimension reduction and impact on modeling analysis
PCA is one of the most widely used data dimension reduction algorithms. Its main idea is to map the Ndimensional feature to the Kdimension, which is a new orthogonal feature, known as the principal component, and a reconstructed Kdimensional feature based on the original Ndimensional feature [50]. In this study, to reduce the computation and network complexity in classification, we used PCA to directly reduce the dimensions of each type of ECG heartbeat information to form the feature matrix. In theory, it is applicable to choose the dimension of accumulative contribution \(a > 85\%\) [51]. To keep as much information as possible, we choose the dimension of accumulative contribution aâ€‰>â€‰85% and aâ€‰>â€‰99%. Then, use the left dimension containing nearly all the information to establishÂ a model by using BPNN and PSOBPNN, andÂ to analyze the impact on modeling.
Results
BPNN model validation and performance analysis
National Engineering Research Center for Healthcare Devices and The Guangdong Key Lab of Medical Electronic Instruments and Polymer Material Products were selected for experiments. The experiment was performed on Matlab2019b in the workstation (model: DELL 210ANJK). To establish and evaluate a model, 30 heartbeats of feature data were collected for eachÂ of five different types of ECG collected from the MITBIH arrhythmia database. That is, there are 150 sets of extracted feature data. We use 75 sets of the extracted feature data to modeling, the last 75 for testing to validate the effects of the established model. When performing the experiments, we set different IDs to represent the five types of ECG, i.e., 1 represents Nb, 2 represents Lbbb, 3 represents Rbbb, 4 represents Vpb, 5 represents Apb. The results were shown in Fig.Â 6, in which the predicted value was round off.
To assess the accuracy of the BPNN model, we use Eq.Â (22) to evaluate.
where \(X^{{\prime}}\) represents the number of predicted value equal to the actual value, \(X\) represents the number of actual value.Â From the experiments, we can obtain the accuracy of the BPNN model is only 77.33%, lower than 81% of using the convolutional neural network (CNN) [52]. The time spent is 1334Â s. It is not meet the practical application demand.
PSOBPNN model validation and performance analysis
To evaluate the PSOBPNN modelÂ and make it a comparison to the BPNN model, we used the same data and platform. The results were shown in Fig.Â 7. The accuracy of the PSOBPNN model is up to 96%. The time has been reduced to 899Â s. Even the accuracy meets the practical application demand, but the time is still too long to realize a realtime diagnosis.
Dimension reduction and impact on modeling analysis
The results of dimension reduction was shown in Table 4. We can see the when \(a > 99\%\), the feature dimension reduces to half part of the original feature dimension.
Therefore, to analysis the impact on modeling time, seven feature dimensions were selected for modeling by BPNN and PSOBPNN, respectively. The results are shown in Figs.Â 8 and 9.
The accuracy of the BPNN model is up to 80% and the time spent to cut down to 91Â s. The accuracy of the PSOBPNN model is up to 97% and the time spent to cut down to 65Â s.
Discussion
In this study, through experiments on the same platform with the same data, the PSOBPNN model improves the accuracy and reduces the time cost, compared with the BPNN model. It indicates that the PSO algorithm has made up the defect of BPNN, which is sensitive to the weight of the initial network and prone to a local minimum. However, the classification time is still too slow to meet the actual application. The main reason could be what scholars have found, that is training time of deep learning algorithms is too long [13, 37, 38]. Except for the parameter adjustment and convergence rate of the BP neural network, the data for modeling always contained some information redundancy. In reality, too many inputs always complicate the model, which is also one reason to spend time more. To further study the reason and applicability of the PSOBPNN model in classifying the arrhythmia. PCA, one of the feature dimension reduction algorithm was used. The reduced time and improved accuracy mean that data redundancy increases the complexity of the model. The PSOBPNN model established in this study is suitable for ECG classification.
Several limitations still exist in this study. First of all, based on our results, future work will aim to establish data communication combined with more capable computer software to form a more complete, advanced, and simple operation. In the NN model, the study of the impact of the learning rate on the NNs has been insufficient. In general, if the learning rate is overly high, the learning process will be unstable. On the contrary, if the learning rate is too low, training will take an extended length of time. Secondly, the selection of the appropriate learning rate is the next step in optimizing the NN. The classification precision and time are analyzed qualitatively according to the given error. In future work, more test data will be added for model training to obtain a more perfect, more accurate, and more rapid soft measurement model of ECG classification.
Conclusions
Algorithm selection has a significant impact on the accuracy of classifying results. This study employs wavelet transform combined with four operations and adaptive threshold method to perform filtering and feature extraction of ECG. Then, employ a BPNN algorithm for analysis and classification of ECG, for BPNN can make use of several optimization methods. To make up for its defect, the PSO optimization algorithm employed is extensive and expected to enhance prediction result accuracy, reduce errors incurred during experimentation owing to flawed model design, and hinder the final determination of ECG. The experiments manifest that the PSO optimized BPNN intelligent model indicating greater accuracy and better classification results than that of the conventional BPNN model.
Above all, to analyze the reason for a long time, PCA was adopted to minimize the feature dimension to reevaluate the performance of the BPNN and PSOBPNN model. The results show that the PCA algorithm can effectively extract the key feature dimensions and minimize the complexity of modeling. The BPNN and PSOBPNN intelligent classification model spent less classification time but with higher accuracy. The PSOBPNN intelligent classification model shows better effects compared with the BPNN model when identifying the five types of ECG. In conclusion, the PSOBPNN intelligent classification model will be a suitable method to recognize ECG and provide a tool for the diagnosis of heart disease.
Availability of data and materials
The data used in this study are available from the MITBIH Arrhythmia Database (mitdb), which is one of the databases of PhysioBank ATM (https://archive.physionet.org/cgibin/atm/ATM). It consists of 48 halfhour ECG records from 47 subjects at Bostonâ€™s Beth Israel Hospital (now the Beth Israel Deaconess Medical Center). Each ECG data sequence has an 11 bit resolution over a 10Â mV range with a sampling frequency of 360Â Hz. This dataset is fully annotated with both beatlevel and rhythmlevel diagnoses.
Abbreviations
 ECG:

Electrocardiograph
 AECG:

Abnormal ECG
 BPNN:

Backpropagation neural networks
 PCA:

Principal component analysis
 PSO:

Particle swarm optimization
 NN:

Neural networks
 CNN:

Convolutional neural network
References
Herry Christophe L, Frasch M, Seely AJ, et al. Heart beat classification from singlelead ECG using the synchrosqueezing transform. Physiol Meas. 2017;38(2):171â€“87.
Tsvetelina N, Gisela L, David L, et al. Emergency department chest pain patients with or without ongoing pain: characteristics, outcome, and diagnostic value of the electrocardiogram. J Emerg Med. 2020;58(6):874â€“81.
Alina W, Andrzej R, Joanna W, et al. Heart rate variability and incidence of depression during the first six months following first myocardial infarction. Neuropsychiatr Dis Treat. 2019;15:1951â€“6.
Liu N, Guo D, Koh ZX, et al. Heart rate nvariability (HRnV) and its application to risk stratification of chest pain patients in the emergency department. BMC Cardiovasc Disord. 2020;20(1):168.
Yu LC, Lin IM, Fan SY, et al. Oneyear cardiovascular prognosis of the randomized, controlled, shortterm heart rate variability biofeedback among patients with coronary artery disease. Int J Behav Med. 2018;25(3):271â€“82.
Haseeb S, Gul EE, Inier G, et al. Value of electrocardiography in coronavirus disease 2019 (COVID19). J Electrocardiol. 2020;62:39â€“45.
Loring Z, Sen S, BlackMaier E, et al. Reducing ECG artifact from left ventricular assist device electromagnetic interference. J Am Heart Assoc. 2020. https://doi.org/10.1161/JAHA.120.017563.
Rajput JS, Sharma M, Tan RS, et al. Automated detection of severity of hypertension ECG signals using an optimal biorthogonal wavelet filter bank. Comput Biol Med. 2020;123:103924.
Xue Q, Hu YH, Tompkins WJ. Neuralnetworkbased adaptive matched filtering for QRS detection. IEEE Trans Biomed Eng. 1992;39(4):317â€“29.
Zhang F, Lian Y. QRS detection based on multiscale mathematical morphology for wearable ECG devices in body area networks. IEEE Trans Biomed Circuits Syst. 2009;3(4):220â€“8.
Diptangshu P, Li Z, Chengyu L, et al. A lightweight QRS detector for singlelead ECG signals using a maxâ€“min difference algorithm. Comput Methods Programs Biomed. 2017;144:61â€“75.
Krasteva V, Jekova I, Schmid R. Perspectives of human verification via binary QRS template matching of singlelead and 12lead electrocardiogram. PLoS ONE. 2018;13(5):e0197240.
Raj S, Ray KC, Shankar O. Cardiac arrhythmia beat classification using DOST and PSO tuned SVM. Comput Methods Programs Biomed. 2016;136:163â€“77.
Eun DI, Jang R, Ha WS, et al. Deeplearningbased image quality enhancement of compressed sensing magnetic resonance imaging of vessel wall: comparison of selfsupervised and unsupervised approaches. Sci Rep. 2020;10(1):13950.
Das N, Zegers J, Van HH, et al. Linear versus deep learning methods for noisy speech separation for EEGinformed attention decoding. J Neural Eng. 2020;17(4):046039.
Anwar SM, Gul M, Majid M, et al. Arrhythmia classification of ECG signals using hybrid features. Comput Math Methods Med. 2018;2018:1380348.
Mousavi S, Afghah F, Acharya UR. HANECG: an interpretable atrial fibrillation detection model using hierarchical attention networks. Comput Biol Med. 2020;127:104057.
Raj S, Ray KC. Automated recognition of cardiac arrhythmias using sparse decomposition over a composite dictionary. Comput Methods Programs Biomed. 2018;165:175â€“86.
Kruger GH, Latchamsetty R, Langhals NB, et al. Bimodal classification algorithm for atrial fibrillation detection from mhealth ECG recordings. Comput Biol Med. 2019;104:310â€“8.
Philipp S, Marcus V, Neetika N, et al. A convolutional neural network for ECG annotation as the basis for classification of cardiac rhythms. Physiol Meas. 2019;39(10):104005.
Hannun AY, Rajpurkar P, Haghpanahi M, et al. Cardiologistlevel arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nat Med. 2019;25(3):65â€“9.
Yao C, Xiao W, Yonghan J, et al. Classification of short singlelead electrocardiograms (ECGs) for atrial fibrillation detection using piecewise linear spline and XGBoost. Physiol Meas. 2018;39(10):104006.
Li Q, Rajagopalan C, Clifford GD. A machine learning approach to multilevel ecg signal quality classification. Comput Methods Prog Biomed. 2014;117(3):435â€“47.
Kaiyue He, Zhenning N, Gaoyan Z, et al. Localization of origins of premature ventricular contraction in the whole ventricle based on machine learning and automatic beat recognition from 12lead ECG. Physiol Meas. 2020;41(5):055007.
Shenda H, Yuxi Z, Junyuan S, et al. Opportunities and challenges of deep learning methods for electrocardiogram data: a systematic review. Comput Biol Med. 2020;122:103801.
Niu L, Chen C, Liu H, et al. A deeplearning approach to ECG classification based on adversarial domain adaptation. Healthcare (Basel). 2020. https://doi.org/10.3390/healthcare8040437.
Jinli He, Youqing W. Blood glucose concentration prediction based on kernel canonical correlation analysis with particle swarm optimization and error compensation. Comput Methods Programs Biomed. 2020;196:105574.
Hui J, Tong L, Peihuan He, et al. Rapid measurement of fatty acid content during flour storage using a colorsensitive gas sensor array: comparing the effects of swarm intelligence optimization algorithms on sensor features. Food Chem. 2020;338:127828.
Mar T, Zaunseder S, MartÃnez JP, et al. Optimization of ECG classification by means of feature selection. IEEE Trans Biomed Eng. 2011;58(8):2168â€“77.
Long HS, et al. Classification of cardiovascular disease via a new softmax model. Conf Proc IEEE Eng Med Biol Soc. 2018;2018:486â€“9.
Li Z, Li Y. A comparative study on the prediction of the BP artificial neural network model and the ARIMA model in the incidence of AIDS. BMC Med Inform Decis Mak. 2020;2020(20):143.
You B, Li Z, Huang L. Handmotion recognition based on improved BP neural network. CAAI Trans Intell Syst. 2018;13(5):848â€“54 ((in Chinese)).
Rujian Q, Yuankun W, Dong W, et al. Water temperature forecasting based on modified artificial neural network methods: two cases of the Yangtze River. Sci Total Environ. 2020;737:139729.
Lei W, Gastro O, Wang Y, et al. Intelligent modeling to predict heat transfer coefficient of vacuum glass insulation based on thinking evolutionary neural network. Artif Intell Rev. 2020;2020(7):1â€“22.
Zweiri YH, Seneviratne LD, Althoefer K. Stability analysis of a threeterm backpropagation algorithm. Neural Netw. 2005;18(10):1341â€“7.
Cai Q, Gong M, Shen B, et al. Discrete particle swarm optimization for identifying community structures in signed social networks. Neural Netw. 2014;58:4â€“13.
Saadat N, Hossein P. A novel realtime patientspecific seizure diagnosis algorithm based on analysis of EEG and ECG signals using spectral and spatial features and improved particle swarm optimization classifier. Comput Biol Med. 2012;42(8):848â€“56.
Gabriel G, Gladston M, David M, et al. Interpatient ECG heartbeat classification with temporal VCG optimized by PSO. Sci Rep. 2017;7(1):10543.
Zhishuai L, Guihua Y, Qing Z, et al. Wavelet scattering transform for ECG beat classification. Comput Math Methods Med. 2020;2020:3215681.
Amer Z, Nizar AB. Neural network principles and applications. Dig Syst. 2018. https://doi.org/10.5772/intechopen.80416.
Lin X. Research on the growth evaluation of listed retail enterprises based on BP neural network. Huaqiao University; 2009. ((in Chinese)).
Emina A, Abdulhamit S. Medical decision support system for diagnosis of heart arrhythmia using DWT and random forests classifier. J Med Syst. 2016;40(4):108.
Lindauer J, Gregg R, Helfenbein E, et al. Global QT measurements in the Philips 12lead algorithm. J Electrocardiol. 2005;38(Suppl 4):90â€“90.
Kora P, Kalva SR. Hybrid bacterial. Foraging and particle swarm optimization for detecting bundle branch block. Springerplus. 2015;4:481.
Chengtian S, Lizhi P, Yonghui J, et al. A highperformance transmitarray antenna with thin metasurface for 5G communication based on PSO (particle swarm optimization). Sensors (Basel). 2020. https://doi.org/10.3390/s20164460.
ShaSha G, JieSheng W, MengWei G. Zshaped transfer functions for binary particle swarm optimization algorithm. Comput Intell Neurosci. 2020;2020:6502807.
Qing Z, Nan W, Shuilin J, et al. ProbPFP: a multiple sequence alignment algorithm combining hidden Markov model optimized by particle swarm optimization with partition function. BMC Bioinformatics. 2019;20:573.
Moavenian M, Khorrami H. A qualitative comparison of artificial neural networks and support vector machines in ECG arrhythmias classification. Expert Syst Appl. 2010;37(4):3088â€“93.
Yong X, Naren W, Kuanquan W, et al. Detecting atrial fibrillation by deep convolutional neural networks. Comput Biol Med. 2018;93:84â€“92.
Xiaoqing W, Xinyuan S, Hongtu Z. Bayesian latent factor on image regression with nonignorable missing data. Stat Med. 2020. https://doi.org/10.1002/sim.8810.
Feng B. Research on classification of arrhythmia based on wavelet transform and neural network. University of Electronic Science and Technology of China; 2019. ((in Chinese)).
Hong S, Zhou Y, Shang J, et al. Opportunities and challenges of deep learning methods for electrocardiogram data: A systematic review. Comput Biol Med. 2020;122:103801.
Acknowledgements
Not applicable.
About this supplement
This article has been published as part of BMC Medical Informatics and Decision Making Volume 21, Supplement 2 2021: Health Big Data and Artificial Intelligence. The full contents of the supplement are available at https://bmcmedinformdecismak.biomedcentral.com/articles/supplements/volume21supplement2.
Funding
The Science and Technology Program of Guangdong Academy of Sciences (2019GDASYL0105007, 2017GDASCX0103, 2019GDASYL0402002, 2018GDASCX0103, 2019GDASYL0502002), the National Key Research and Development Program of China (2020YFC2004300, 2020YFC2004301, 2019YFC0118800, 2019YFC0118802, 2019YFC0118804, 2019YFC0118805), the National Natural Science Foundation of China (31771074, 81802230), the Science and Technology Program of Guangdong (2019A050510026, 2017A070701019, 2017B030314174), the Key Research and Development Program of Guangdong (2018B030335001, 2020B0101130020, 2020B0404010002), and the Science and Technology Program of Guangzhou (201704020168, 201704020113, 201807010064, 201803010100, 201903010032).
Author information
Authors and Affiliations
Contributions
GXL contributed significantly to establish an intelligent model and perform the analysis and manuscript preparation. ZWT and WKX contributed to the data collection and preprocessing. FX participated in the manuscript modification. LW contributed to the design of the paper. JC and KW contributed to the conception of the study and helped perform the analysis with constructive discussions. All authors read and approved the final manuscript.
Corresponding authors
Ethics declarations
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
The authors declare that they have 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 4.0 International License, which permits use, sharing, adaptation, 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 changes were made. 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/4.0/. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.
About this article
Cite this article
Li, G., Tan, Z., Xu, W. et al. A particle swarm optimization improved BP neural network intelligent model for electrocardiogram classification. BMC Med Inform Decis Mak 21 (Suppl 2), 99 (2021). https://doi.org/10.1186/s12911021014536
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s12911021014536