ECG Denoising Using Artificial Neural Networks and Complete Ensemble Empirical Mode Decomposition

Electrocardiogram (ECG) is a documentation of the electrical activities of the heart. It is used to identify a number of cardiac faults such as arrhythmias, AF etc. Quite often the ECG gets corrupted by various kinds of artifacts, thus in order to gain correct information from them, they must first be denoised. This paper presents a novel approach for the filtering of low frequency artifacts of ECG signals by using Complete Ensemble Empirical Mode Decomposition (CEED) and Neural Networks, which removes most of the constituent noise while assuring no loss of information in terms of the morphology of the ECG signal. The contribution of the method lies in the fact that it combines the advantages of both EEMD and ANN. The use of CEEMD ensures that the Neural Network does not get over fitted. It also significantly helps in building better predictors at individual frequency levels. The proposed method is compared with other state-of-the-art methods in terms of Mean Square Error (MSE), Signal to Noise Ratio (SNR) and Correlation Coefficient. The results show that the proposed method has better performance as compared to other state-of-the-art methods for low frequency artifacts removal from EEG.


Introduction
The electrocardiogram (ECG) is a quasi-periodic signal that measures the electrical activity of the heart. It is used to assess whether a patient has any type of cardiac disorder and provides information content mainly in the 0.5-120 Hz range. The P wave, QRS complex, and ST segment make up the majority of its morphology; any extra structures in the ECG indicate noise or cardiac defects. The diagnosis of these disorders is generally made by experts who examine the ECG signal for specific morphologies. As a consequence, an ECG signal's morphology is important, and it must be as noise-free as possible. In the other side, obtaining an ECG signal captures a vast range of different sounds, rendering accurate diagnosis impossible. As a consequence, correct diagnosis necessitates a filtration procedure that removes the bulk of constituent noise while preserving details about the ECG signal's morphology. Any of the noises that can be heard are power line interference (PLI), baseline wander, electrode touch noise, motion artefacts, and instrumentation noise [1]. Baseline wander artefact occurs mainly as a result of the patient's breathing, making it omnipresent in almost all ECG signals. As one of the most common kinds of noise in an ECG, it is recommended for denoising in this paper. This artefact is frequently seen during stress ECGs, especially as the patient's breathing rate rises. All of these morphological changes are normal and necessary for diagnosis, but most current denoising procedures tend to filter them out, resulting in information loss [37]. Another reason we chose baseline wander for denoising in our paper is that it hasn't gotten as much attention in the literature, so while there are fairly efficient methods for denoising PLI and other types of data, the same cannot be said for baseline wander.

Literature Survey
In the literature, several methods for ECG signal denoising have been proposed. For the removal of low frequency noise, digital window-based filters were first proposed [2] [3]. The trouble with these is that they cause ripples in the pass band when a strong cut-off is used. As a consequence of these ripples, the morphology of the ECG signal varies, which is inappropriate from a diagnostic perspective. Furthermore, the inability to successfully use Fourier Transforms on an ECG signal due to its non-stationary and non-linear properties illustrates the uncertainty of the exact frequency cut-offs needed for a window-based filter. In [4][5] [6], adaptive filters (LMS, NLMS, BLMS, and so on) were proposed as an upgrade over window-based filters. Active signal monitoring and noise prediction based on the discrepancy between predicted and observable signals are examples of these techniques. The issues that occur when using these for ECG filtering start with the need for pure input signals in order to approximate how the signal differs. The adaptive filter's minimum Mean Square Error [MSE] criterion, as well as the fact that the reference signals are not well matched with the primary data, result in additional problems. As a consequence, although this is better than mere window-based filtering, there is still space for development. As a consequence of recent developments in nonlinear signal processing utilizing wavelets, wavelets have been more commonly utilized in ECG denoising. The thesis suggested by Donoho et al. [7] was advanced into the area of ECG denoising, and several algorithms [8] [9] [10] have been built on top of it. The standard wavelet technique, as verified by Luong et al. [11], is unsuccessful for removing baseline wander noise. A fuzzy rule-based multi wavelet methodology was proposed to solve this problem [12], which aided in the optimization of pre and post filtering decisions for a given data collection. In his paper [13], Huang proposed Empirical Mode Decomposition as a modern method for studying non-linear non-stationary signals (EMD). This has been shown to be very effective in ECG filtration and is used in a variety of algorithms [14]. However, the majority of EMD work has been focused on the reduction of high-frequency sounds. When compared to direct denoising by EMD technique, denoising of ECG signals with the help of linear filtering (Butterworth Low pass filter) [15] yields better results. When EMD is combined with adaptive filters, the results are superior to when EMD is combined with linear filters. ECG denoising can also be accomplished using a combination of EMD and wavelets [16]. Zhang et al. [17] made even more changes to this. The energy of each IMF was analyzed in this study, and the noisy IMFs were identified as a result. The Wavelet Soft Thresholding Technique was used to denoise only the noisy IMFs. This reduces computation time and has proven to be the most efficient method to date. The problem with all of these techniques is that they are designed to deal with signals with lower IMFs or high frequency components, so they cannot be used to deal with Baseline Wander. EMD was first used for baseline wander denoising in a paper by Zhi-Dong Zhao et al. [18]. The residue signal was believed to be an approximation of baseline wander, and this residue was omitted to compensate for noise in the ECG signal. Na Pan et al. [19] made further progress in this field by decomposing the signal into 15 IMFs, with the assumption that the last three IMFs contained mostly noise components. The removal of the last three IMFs thus corrected the baseline wander. The limited nature of the signals they were tested on, as well as the lack of a suitable system to work on a varying number of IMFs, were issues with these works. Furthermore, it has been discovered that EMD's denoising property is insufficient on its own [34] [38]. As a result, it should be combined with another approach to achieve the best results. The EMD's main flaws are its noise sensitivity and the mode mixing property, which introduces error into the observed signal [35]. To address these issues, Huang suggested an Ensemble Empirical Mode Decomposition (EEMD) system [20], which was later improved [21], resulting in a numerically negligible error. Although EEMD has been used to denoise ECG [22], it has had some of the same issues with inadequate denoising strength on its own. With the help of averaging, this solves the problem of mode mixing and oscillations. However, this has a few drawbacks: it is computationally expensive, and the final amplitudes associated with the IMFs are greatly reduced due to the uneven number of modes across the ensemble [36].
Neural Networks are a type of data processing based on how the human brain works. Their use for filtering has been limited to PLI and electrode motion noise [24] and is based on signal reconstruction using existing biological signals, reducing their effectiveness. Further research, such as [25], used only the direct noisy values of the ECG signals as input, and found that networks trained on the direct values were overfit and had a diminished ability to filter novel ECG signals. For the prediction of non-linear non-stationary signals, EMD combined with Neural Networks has been widely used [26] [27]. For low frequency artefact removal from ECG signals, Mahipal Singh Choudhry et al. proposed using a cascade combination of EMD and Morphological function. Mahipal Singh Choudhry and Rajiv Kapoor suggested using CEEMD and Adaptive Morphological Function [33] for ECG denoising in a longer paper. The combination of CEEMD and Neural Network in our proposed algorithm is used to remove low frequency artefacts from ECG signals. The use of CEEMD eliminates the intrinsic flaws in EMD while also ensuring that the Neural Network is not overfit.

Background
A. Complete Ensemble Empirical Mode Decomposition Any data set can be decomposed using CEEMD into a set of true Intrinsic Mode Functions (IMFs). The various IMFs obtained thus far are representations of the signal's various frequency components. It's a combination of EMD and EEMD [13]. The following is how CEEMD breaks down a signal into its constituent IMFs.
• Using EMD, realizations of the base signal with added White Gaussian noise (( ) + ( )) are achieved to obtain their first modes and thereby to create an ensemble of first IMFs by taking average to obtain first true IMF, using the following formula Where, ( ) is the base signal (raw ECG signal for the first stage), ( ) is White Gaussian noise for ℎ realization, 1 ( )is first IMF of ℎ realization, is weight coefficient of added noise and = 1,2,3,4 … … … …K.
• At the first stage, residue is calculated by • • In the second stage of CEEMD, this residue signal is used as the base signal, and an ensemble of K residue realizations with White Gaussian noise is produced. The IMFs for each variable are first obtained, and then they are averaged to produce the second true IMF, which is provided as • Similar to (2), the second residue is calculated and used for third true IMF.
• The above-mentioned steps are continued until further decomposition is no longer possible and all the obtained true IMFs are subtracted from base signal to obtain the final residue, given as Artifical Neural Network Artificial Neural Networks (ANN) are a type of informative paradigm [28] that is based on how the human brain processes data. A neuron is the most basic component of such a system, and the processing power is determined by the number of these components and their interconnection. They necessitate initial training data, which must be carefully pre-processed to prevent overfitting. As a result, training must be done in such a way that the neural network's ability to respond to novel patterns is not harmed. The steps involved in setting up a network are • Collection of data.
• Pre-processing of data.
• Initialization of weights of neural network and learning rate.
• Division of data set into training, testing and validation.
• Training of data: The network trains itself in such a way as to minimize a particular function such as MSE, the function to be minimized depends on the training rule to be used.
• Testing: A portion of the data set is reserved for testing of the network that has been developed. Here the output of the network is compared against a pre-determined output and its performance is checked.
• Cross Validation: This involves testing to ensure that training of the network is not leading to a loss in generalization.

Proposed Methodology
Flowchart of proposed method is given as Fig.1 The various steps of proposed method are • Apply CEEMD to noisy ECG signal. • IMFs are break down into two halves, those affected by baseline wander and those relatively free of it. • A neural network is created and trained to filter each baseline affected IMF. • The entire network is tested and cross validated. • Results are obtained based on three output parameters on different types of noises and test subjects The CEEMD operation is used to decompose a noisy signal into N true IMFs. These IMFs have now been grouped into two categories: (i) There are two types of IMFs: I noisy IMFs and (ii) clean IMFs. The Spectral Flatness (SF) of each individual IMF is used to calculate the number of noisy IMFs. The relationship between the Geometric mean (GM) and the Arithmetic mean (AM) is known as spectral flatness (AM). It is defined as the ratio of the power spectrum's geometric mean to its arithmetic mean. Spectral Flatness (SF) =GM / AM (5) Spectral Flatness measure is fuzzied to detect whether the IMFs are noisy or clean. Linguistic variable used are low, and high membership functions for Spectral Flatness. The rules for spectral flatness are: Rule 1: IF SF is in high range THEN IMF is clean Rule 2: IF SF is in low range THEN IMF is noisy.
Individually, the noisy IMFs are applied to a separate Neural Network. Because each of these IMFs has a higher periodic nature than the combined full ECG signal, this performs filtering at the IMF level, making the Neural Network more efficient at filtration. This also eliminates the possibility of overfitting.
In the proposed method for Network with 10 hidden layers and 2 delays, the Levenberg-Marquardt algorithm [29] is used for the training process. A comparative analysis is used to determine the number of layers, and the number with the lowest error is chosen.
The steepest descent procedure and the Gauss-Newton algorithm are combined in the Levenberg-Marquardt algorithm. The algorithm's general concept is as follows: In areas where the curve is complex, it executes a combined training process, using the steepest descent algorithm. It switches to the Gauss-Newton algorithm when the curve can be safely estimated as quadratic, which saves a lot of time. The following is how the Levenberg-Marquardt algorithm is used to train: 1) With the randomly generated initial weights and evaluate the total error (SSE).
2) Do an update as directed by the following equation to adjust weights +1 = − ( + µ ) −1 (6) 3) With the updated weights, evaluate the total error. 4) If the current total error is increased as a result of the update, then retract the step (reset the weight vector to the previous value), increase combination coefficient μ by a factor of 10 or by some other factor and then go to step 2 and try another update. 5) If the current total error is decreased as a result of the update, then accept the step (keep the weight vector as the current one), decrease the combination coefficient μ by a factor of 10 or by the same factor as step 4. 6) Go to step 2 with the new weights until the current total error is smaller than the required value.

Results
The MIT-BIH ST change database [30] is used to receive ECG signals for training and testing. This database contains 28 ECG recordings of varying lengths, sampled at 360 Hz, the majority of which were captured during exercise stress tests and show transient ST depression. The last five records (323 through 327) are ST elevation extracts from long-term ECG recordings. The pure ECG signal is augmented with a baseline wander noise estimation derived from the MIT BIH noise stress test database [31].
The above-mentioned data sets are then fed into a Levenberg-Marquardt algorithm with 10 hidden layers and 2 delays, which is used to train a neural network. For training, 70% of the total available data set is used. Input data from varying noisy ECG records is used to train the networks. When network generalization stops improving, cross validation is used to measure it and to stop training. Cross validation is carried out on 15% of the data set. In order to test proposed method, Mean Square Error (MSE), Signal to Noise Ratio (SNR) and Correlation Coefficient ( ) are used as testing parameters. These parameters are defined as Where, is pure ECG signal, is denoised ECG signal, is convolution function and σ is variance. Fig. 2 -4 show the plots of denoised signals using combinations of Neural Network with EMD, EEMD and CEEMD for three different ECG signals recordings.     The CEEMD-based approach outperforms both EMD and EEMD in terms of results. For ECG signal recording-1, Fig.5 presents plots of denoising techniques using CEEMD and Morphological Operator, Neural Network, and a proposed combination of CEEMD and Neural Network. Table IV shows the results of the denoising technique for ECG signal recording-1 using CEEMD and Morphological Operator, Neural Network, and a proposed combination of CEEMD and Neural Network. In terms of all three parameters, the proposed technique outperforms the combination of CEEMD with Morphological Operator and Neural Network. Other ECG signal recordings yielded the same results.

Conclusion
When examining the results, it is clear that simple Neural Networks can produce excellent results at times, but their performance is inconsistent. The addition of CEEMD ensures that the system runs smoothly. The results show that the proposed method is clearly superior to other methods in the literature. The use of CEEMD has increased the filtration properties of Neural Networks while also preventing overfitting. Furthermore, since the filtration will be conducted mainly at lower frequencies, any high frequency cardiac defects will not be filtered, which is an important consideration.