Application of Artificial Neural Network and Empirical Mode Decomposition with Chaos Theory to Electrocardiography Diagnosis

We combined an artificial neural network (ANN) with empirical mode decomposition (EMD) and chaos theory for electrocardiography (ECG) signal recognition. The measuring circuit of the sensor and the LabVIEW human–machine interface developed in this study were used to measure and capture ECG signals. The stored ECG data were subjected to EMD into high and low frequencies. A chaotic error scatter map was generated by using master and slave chaotic systems, so as to obtain the chaotic eye coordinates of a specific ECG signal. A backpropagation neural network (BPNN) was applied for recognition. Fifty research subjects were enrolled for this study. The first half of the data was measured by a signal acquisition circuit, and the second half was provided by the Massachusetts Institute of Technology-Beth Israel Deaconess Medical Center (MIT-BIH). According to the analysis results, the proposed method has excellent accuracy in the classification of ECG signal recognition, with a recognition rate as high as 97%. Therefore, the ECG sensing system for automatic diagnosis designed in this study can effectively classify arrhythmia conditions and reduce manual identification costs and errors.


Introduction
Among the top 10 causes of death in the world listed by the World Health Organization (WHO) in 2018, heart disease ranked first. (1) Research in recent years has particularly paid attention to the prevention and diagnosis of heart disease. In diagnosis, medical equipment to capture human electrocardiography (ECG) signals is commonly used noninvasively, so as to know the voltage signal change of the heart rhythm and detect and diagnose different heart diseases.
In many studies, different eigenvalue extraction and diagnostic methods have proposed, with the ECG signal identification method gradually growing in prominence. The multilayer perceptron (MLP) and support vector machine (SVM) have been used to diagnose the heart according to five different types of features. (2) It is noteworthy that in the eigenvalue extraction methods, R−R intervals and other types of eigenvalues are mostly used. A discrete wavelet transform (DWT) has also been applied to extract the peak and QRS (ventricular depolarization and contraction) complex wave of an ECG signal to interpret the information in the signal. (3) The features were directly extracted from the time domain and frequency domain of the ECG signal. The classification methods include linear discrimination classification (4) and the use of SVM (5,6) and artificial neural networks (ANNs). (7) In Ref. 8, the Random Forests (RF) classifier was taken for ECG heartbeat signal identification with a combined model including multiscale principal component analysis (MSPCA) de-noising, DWT, and RF classifier to achieve better performance. In this study, we propose combining ANN with chaos theory and empirical mode decomposition (EMD) for ECG signal recognition. The ECG signals are measured and captured through a developed hardware measuring circuit and LabVIEW human-machine interface, and then the stored ECG signals are subjected to EMD into low and high frequencies.
The low-frequency signal is selected and the chaos error scatter map is formed by using master and slave chaotic systems to receive the chaos eye coordinates of a specific ECG signal, which are identified by ANN. Performances of the proposed method have been estimated on two different parts. One is the arrhythmia data provided by the Massachusetts Institute of Technology-Beth Israel Deaconess Medical Center (MIT-BIH) database, (9) which is one of the internationally recognized standard ECG databases providing data for testing in studies of arrhythmia. The other part is the actual subjects. The hardware circuit developed in this study is used to measure and capture ECG signals. As the feature extraction involves various categories and complex calculation, in order to effectively extract the eigenvalues of the original signal and to reduce the measured data volume, we employ a back-propagation neural network (BPNN), (10) EMD, (11,12) and chaos theory for ECG identification. In addition, for subsequent signal acquisition, analysis, and recognition, we use LabVIEW to develop a human-machine interface. The real-time signal is integrated with the proposed algorithm and displayed on a graphic control menu.

System flow
The ECG signal recognition sensing system proposed in this study is divided into three parts: (1) the measurement and acquisition of human ECG signals, (2) EMD signal analysis and chaotic eye eigenvalues of the chaos error scatter map, and (3) an ANN and a human-machine interface to display the results. The overall system architecture is shown in Fig. 1.

Part 1. Signal Measurement and Acquisition:
The ECG signals were derived from 50 subjects. The data of the first 25 subjects were transmitted to and stored in the server by the data acquisition (DAQ) card of LabVIEW after the subjects' ECG signals were measured by the hardware circuit. The second half of the data was provided by the MIT-BIH arrhythmia database.

Part 2. EMD and Chaos Theory:
The intrinsic mode function (IMF) of EMD was used for the measured original ECG signal and MIT-BIH data so as to obtain seven layers of signals from the high-frequency IMF1 to the low-frequency IMF7. Each layer was processed by master and slave chaotic systems to generate the chaotic error scatter map, and the extracted chaotic eye coordinates were taken as eigenvalues. There were 50 chaotic eye coordinate eigenvalues. The distance between two chaotic eyes was calculated as the largest root-mean-square deviation. The results showed that the low-frequency IMF7 has the largest distance. Thus, it is used as the main analysis signal in this paper.

Part 3. ANN and Human-Machine Interface:
The BPNN, which is an ANN, was used to classify and identify the chaotic eye coordinates. The recognition result was then displayed on the developed human-machine interface. Figure 2 shows the physical circuit used for ECG signal measurement and acquisition, which included an electrode patch; an extraction circuit composed of a preamplifier, power amplifier, and filter; and a DAQ card for the analog/digital signal. Finally, the signal was exported to the human-machine interface designed by LabVIEW.

ECG signal measurement and acquisition sensor hardware circuit
Preamplifier: As the measured signal was very weak, the ECG signal must be amplified by a preamplifier circuit. Therefore, we used an AD620 instrument amplifier, which is a high-gain DC coupling amplifier characterized by its differential input, single-ended output, high input impedance, and high common-mode rejection ratio. Our circuitry is designed with the capability of providing low electromagnetic interference and high precision that allows the preamplifier to easily operate at a low voltage.

Filter:
The ECG signal was amplified by the AD620 preamplifier, and then the measurement range was designed to be in a frequency range by using a second-order Butterworth filter. (13,14) The cutoff frequencies of low-pass and high-pass filters were designed to be 100 and 0.05 Hz, respectively.
Power amplifier: After the signal was processed by the preamplifier and filter, the signal was amplified by a power amplifier circuit. We used an IC-LM324 non-inverting amplifier as the circuit Stage 2 gain.

EMD
We used the EMD (15) transform as ECG signal preprocessing in order to separate the different frequency components of a signal from the time curve in the form of an IMF, and we extracted the important information contained in the original signal in the course of decomposition. If the time series signal is x(t), then the first step is to determine all extreme point values on x(t). Next, all the extreme points are plotted to form a curve. The upper and lower envelope curves of signal x(t) are obtained and set as u o (t) and v o (t), respectively. The average curve of the upper and lower envelopes can be expressed as follows. When , and the function (h 1 (t)) is an IMF component. If the component does not satisfy the condition for the IMF, then x 1 (t) can be replaced by h 1 (t), and u o (t) and v o (t) are calculated. This process is repeated and expressed as follows.
In this decomposition process, when a certain standard is reached after multiple repetitions, h k (t) becomes the first IMF of the original signal set as y 1 (t). The other signals are set as r 1 (t), and then we obtain the following equation.
Here, y 1 (t) is the first component obtained by processing the original data, as well as the highestfrequency component in x(t) of the original signal, and r 1 (t) is the corresponding residual component. Moreover, r 1 (t) in the other equations is used as the new original signal. This process is repeated, EMD continues, and the second IMF y 2 (t) is calculated. The process is repeated n times until the remaining part obtained is a monotonic signal or its value is less than a predetermined value; thereby, the decomposition is completed. When the decomposition is completed, the nth IMF y n (t) and the residual component r n (t) are obtained as follows. The important information in the fault signal can be extracted by repeated EMD, whereas the noise interference can be eliminated.

Chaos theory
Chaos theory was proposed by the American meteorologist Edward Lorenz, who studied the unsteady behavior of a nonlinear dynamic system. The chaotic attractor results in an orderly but nonperiodic kinematic trajectory of the signal according to chaos theory. This trajectory can change enormously as a result of small changes. (16) Therefore, it is applicable to a large volume of data of the original signal and values changing in a small range. A chaotic system is divided into a master system and a slave system, expressed as Eqs. (5) and (6), respectively. The chaotic error resulting from the subtraction of the values of the two systems produces different operation trajectories of the master and slave systems. In the domain of engineering, if the master system is tracked by the slave system and the two system operation trajectories are equalized gradually by a controller, then such a system is known as a chaos synchronization system. (17) Here, f 1 is a nonlinear function, and Eq. (6) is subtracted from Eq. (5) to obtain the error equation, expressed as Eq. (7).
The Lorenz chaotic system used in this study is expressed as Eqs. (8) and (9).
Here, x is the master system, the initial value is set as 0, y is the slave system, and ECG is the signal value. The Lorenz primary coefficients are α = 10, β = 28, and γ = (−8/3).

ANN
An ANN is an information processing system imitating a biological neural network. Many connected artificial neurons are used to imitate biological neural networks capable of handling different information problems. (18,19) Most of the bottommost layer of an ANN consists of artificial neurons, also known as processing elements or nodes. (20) The transmission paths between processing elements are called connections. Each connection has a weight W ij representing the influence of the ith neuron on the jth neuron. ANNs comprise many artificial neurons and connections thereof, and different network models can be formed. The BPNN is the most commonly used ANN. As shown in Fig. 3, a BPNN generally has three layers: an input layer, a hidden layer, and an output layer. Each layer contains several processing elements, and each processing element works independently. The processing elements in the input layer import the signals of the external environment. The processing elements in the hidden layer of the ANN enable it to manifest the interaction between processing elements when the signals are processed. There are several hidden layers in general. The processing elements in the output layer export signals to the external environment, so as to manifest the output variables of the network. The number of neurons depends on the problem, and nonlinear and linear functions are generally used as the transfer functions.

Basic structure of ANN
The basic structure of an ANN (18) is divided into layers, artificial neurons, and network levels.
(a) Layers: Each layer is made up of several neurons, as shown in Fig. 3. There is typically only one input layer and one output layer, but there can be several hidden layers or even no hidden layers.

(b) Artificial neurons:
The artificial neuron is the basic unit of an ANN (as shown in Fig. 4), and it imitates the operation mode of a biological neuron. The relationship between the output value and the input value is generally represented as a function of the weighted product sum, expressed as Eq. (11).
x i : input variable of the ith neuron. W ij : link weight of the ith neuron to the jth neuron. b j : bias of the jth neuron, also known as the threshold, which imitates the weight of the biological neuron model. n j : net input of the transfer function of the jth neuron. f: transfer function, which imitates the nonlinear processing function of a biological neuron model, to convert the weighted product sum of the input values from other neurons to the output of the neuron. y i : output value of the ith neuron, which imitates the output signal of a biological neuron.

BPNN algorithm
The BPNN algorithm is also known as the generalized delta (δ) rule. It is a supervised learning algorithm. A schematic diagram is shown in Fig. 5. The δ rule can be generalized to a multilayer network with a nonlinear differentiable transfer function. Its fundamental purpose is to minimize the error between the target output value and the deduced output value of an output neuron. The network error function is usually minimized by using the steepest descent method, Fig. 4. Artificial neuron model. and the error in the output layer is fed back to the input layer through the weight by the chain rate of calculus, so as to correct the weight in the network connection.
Error function: Adjusted weight:

Chaotic error scatter map
To validate the performance and accuracy of the method of disease identification proposed in this study, 25 subjects and 25 cases from the MIT-BIH arrhythmia database were used as disease identification data. The 50 experimental subjects were 20-50-year-old males and females. The MIT-BIH database contains four common heartbeat classes: normal beat (NB), left bundle branch block beat (LBBBB), right bundle branch block beat (RBBBB), and atrial premature contractions beat (APCB). (21) The measured and collected ECG data were analyzed using the IMF of EMD to obtain the functions of IMF1-IMF7, as shown in Fig. 6. Next, IMF7 was calculated using the Lorenz chaotic system of chaos theory to obtain the chaotic error scatter map. Figure 7 shows the chaos error scatter map of a heartbeat class (LBBBB). Each scatter diagram has two chaotic eyes and four coordinate values C1-C4. We used the y values (C1 and C3) of the left and right chaotic eye coordinates as new eigenvalues, and we obtained 50 chaotic eye coordinate eigenvalues. Figure 8 presents the distribution of the chaotic eye coordinates of the four heartbeat classes. (22)

ANN recognition result
The 50 chaotic eye coordinate values obtained were identified by the proposed ANN. When the number of hidden layer neurons is 16, the recognition accuracy is as high as 97%, as shown in Fig. 9. According to the result, when the numbers of hidden-layer neurons are 6, 8, 10, and 16, the recognition rates are 89, 92, 85, and 97%, as shown in Figs. 9(a)-9(d), respectively.   Figure 10 shows the display of the human-machine interface developed after the algorithm was written using LabVIEW graphic control software and MATLAB. It shows the ECG measurement signal, the error scatter diagram calculated by chaos theory after EMD, the chaotic eye coordinate value display, and the ANN recognition result ( Table 1). The developed   human-machine interface can display the measured signal instantly (red frame) and set the storage path (green frame) for consulting with recorded signals in the future.

Conclusion
We developed software and hardware for an ECG signal recognition sensing system, which features a simple ECG signal measurement and extraction circuit architecture. The LabVIEW human-machine interface can provide information on the subject's heart condition after analysis. In addition, the signal is measured and captured by an ECG sensor hardware circuit, and the stored data are processed by EMD to form an error scatter diagram using the master and slave chaotic systems of chaos theory. The chaotic eye is taken as an eigenvalue, and the  result is identified by an ANN, so as to diagnose the subjects' heart conditions. The recognition accuracy is as high as 97%. According to the experimental results, the chaos error scatter map and chaotic eyes derived from the master and slave chaotic systems are feasible for feature extraction. The left and right chaotic eye coordinates can be used as eigenvalues. Moreover, the number of features extracted in the time domain of a traditional ECG is reduced significantly, so as to decrease the computing time and the complexity of the recognition system. Overall, the proposed system is efficient in its diagnosis.