Classification of Arrhythmia using Wavelet Transform and Neural Network Model

,


Introduction
Cardiac arrhythmia is one the common disease that affects several millions people around the globe.People of all ages are affected by arrhythmia.Any deviation in normal functioning of the heart or improper heart beats will result in cardiac arrhythmia.There are many different types of arrhythmia.It is important to accurately determine the type of arrhythmia to perform specific medications that are suited for that specific type of disorder.We can effectively treat the patient if the specific type of arrhythmia is known.We suggest a method to perform better classification of arrhythmia with improved accuracy.The sample databases are taken from MIT-BIH databases for our analysis.We have classified Normal Sinus Rhythm and three types of arrhythmia including tachycardia, Bradycardia and first degree Atrio Ventricular block [1].
The signal is pre-processed to remove various noises that contaminate the signal using adaptive filter and prepare them for proper analysis.Recursive least square algorithm is used in adaptive filter as both AC and DC noises can be removed.Electrocardiogram is a complex signal and to extract the required parameters from the signal is not possible.Discrete wavelet transform is applied for extraction of the parameter like peak values and intervals in the ECG signal.These parameters are used for classification of arrhythmia.The extracted parameters are given as an input to the neural network.
Neural Networks are inspired from the human brain.Algorithms and data structures for classification and learning of data are found through NN.Human performed tasks are naturally fast.Recognition of a familiar face is easily performed by human rather by a computer using conventional programming.Neural Network techniques are applied to a program, from which it can learn and create an internal rule structure for classification [2].The extracted parameters are used for training the neural network from which the classification of the arrhythmia is performed.

Literature
The process for classifying arrhythmia includes importing samples from MIT-BIH databases, removing noise from the sample signal using adaptive filter trained with RLS algorithm.The components of the ECG signal used for classification are PR interval, QRS complex, RR interval.
Adaptive filter has the ability to change the parameters to make the error signal zero.The closed loop feedback system in the adaptive filter helps to refine its transfer function.ECG signals mixed with noises are tested for the performance comparison of algorithm.Results show that RLS can handle both DC and AC noises whereas LMS can handle only AC noise [3].The final error value for RLS is lesser tan LMS .After analyzing different algorithms like LMS and RLS, RLS algorithm gives better performance in noise removal.For power line noise and muscle contraction noise both the algorithms performs good.For motion artifact noise and base line drift noise the output of the LMS algorithm is very distorted since these type of noise involves DC signals RLS is best suited [4].Correlation coefficients for different filter lengths for noises like power line interference are better for RLS algorithm.Generally RLS algorithm performs better for any type of noise, although RLS algorithm convergence time is high when filter length is large.Hence RLS algorithm is chosen for adaptive filter.
The output of the wavelet transform provides information about both time and frequency.The output contains information similar to Fourier transform, but with additional information about resolution in time at higher frequencies.The difference in time resolution between Fourier transform and Wavelet transform is shows that Wavelet transform is good in time resolution of high frequencies [5].Frequency resolution is remarkable for slowly varying functions.Wavelet transform provides the frequency of the signal and the time associated with those frequencies.Therefore Fourier transform is just frequency analysis were as wavelet transform is both time and frequency analysis, so we use Wavelet transform for the parameter extraction of ECG signal.Discrete Wavelet Transform is the ideal choice in this case as all the downloaded physiological data that we handle is in samples and a wavelet decomposition implementation would be a right fit in terms of samples.Discrete Wavelet Transform is also the logical right choice as eventually we would need to embed this into a processor in order to reach the end application of a reliable monitoring system [3].
ECG signals are used to detect and classify different types of arrhythmia and also the normal sinus rhythm.ECG signals are generally stochastic in nature, thus they can't be classified using normal defined algorithms.Hence we in this project we propose the use of ANNs for classification.Artificial neural network are created using electronic networks based on neural brain structure.The records are processed one at a time.Learning of the network is done by comparing the classification of records that are got with the actual known classification.The error found through the comparison of initial classification of the 1st record is given as a feed back to the system.Through this network algorithm is modified for further iterations [4].
A neuron is combination of input values and the weights associated to the inputs.The results are mapped to a output through a function which sums up the weights.Basically neurons have 3 layers: input layer, hidden layer and output layer.Input layer consists of record values which are going to be given as the inputs to the next neuron layer.Hidden layers are the processing layers.The error back propagation is done here.One neural network can have several hidden layers.Each class has a node in output layer which is the final layer.Values to each output node are assigned through a single forward sweep.Highest value class node is assigned with the record [3].
Neural network performs better when it is trained with many samples, more the samples the better the performance.It has the ability to learn from experience.The number of hidden layers decides the performance of the classifier [4].Neural network can perform better than linear classifier in many cases.Even if any element of the neural network fails it can still perform.Neural network learns with training and hence it does not need reprogramming.Comparing with other classifiers like SVM, neural network has the ability to act as a nonlinear classifier.

Methodology
Physicians make a correct diagnosis with the help of certain physical signs present during arrhythmias but electrocardiography is the standard method that has been adopted by the medical institutes for recognizing cardiac arrhythmias.Therefore ECG has become the most common and powerful clinical diagnostic tool to detect the cardiac diseases.ECG gives invaluable information about the workload of the different chambers of the heart.The shape and size of the ECG signals provide information which helps us to determine the nature of the cardiac disease.The analysis of the ECG signals are computer assisted as the information from the signals are difficult to be analysed visually by the human eye.ECG samples are taken from MIT-BIH Arrhythmia database for computer aided detection and classification.Tachycardia, Atrio Ventricular Block, Normal Sinus Rhytmn and Bradycardia are the classes of ECG signals which are used for classification task.The samples in the MIT-BIH database have a sampling frequency of 360 Hz.Matlab software is used for detection process.It provides required information about the amplitude and interval between the peaks of the ECG signals [1].A total of 84 samples are used.For training 58 samples, validation 13 samples and testing 13 samples are used.The features from the ECG samples are extracted and multiple sets of PQRST waves are taken from different locations of the ECG sample so that the data obtained is accurate.The features are extracted by means of wavelet transform.The components of the ECG signal used for classification are PR interval, QRS complex, RR interval.After the parameters are extracted they are feeded into the neural network as input.The output provides us with the weights of each signal which helps to determine the disease accurately.Figure 1 shows the process flow.Adaptive filtering is used in Pre-processing stage and Wavelet transform is used in the processing stage.

Pre-processing -adaptive filtering
Noises from the ECG signal have to be removed for accurate analysis of the signal.We use adaptive filter since it removes the noise power spectrum which changes over time and it has a self-learning ability which is not present in normal digital filters.The filter coefficients are modified regularly to improve the performance of the system.The adaptive filter takes two input signal, the input signal mixed with noise and the desired signal.The filter setup has a feedback loop which varies the filter parameters to reduce the error.Error output is the difference between the desired signal and the filter output.This process is iterated few times until an optimum error rate is reached although reaching zero error is practically impossible.The samples from the MIT-BIH databases for several arrhythmia types are passed through this adaptive filter with the introduction of noise and the output of the filter gives the desired signal after removing the noise Adaptive filters have the capacity to adjust its parameters to make the error in the affected signal zero thus removing the noise in the signal.
There are several algorithms that can be implemented in adaptive filters; broadly they are classified into Least Mean Square algorithm and Recursive Least Square algorithm.The performance of different algorithm is measured by parameters like rate of convergence, computational complexity and cost.RLS algorithm has several advantages over other algorithms [2].It can handle any type of noise for example; DC noise such as abrupt change in signal cannot be handled by LMS.RLS have faster convergence rate, however there is trade-off between the faster convergence and complexity of the computations.The samples that are downloaded from the MIT-BIH database are imported to the mat lab.Relevant mat lab functions have been used to implement the adaptive filter algorithm.

Parameter extraction -wavelet transform
Wavelet transform allows changes only in time extension and not the signal shape.To perform this basic function must be choosed correctly.According to uncertainty principle, TW ≥ 0.5, where T represents change in time and W represents change in angular frequency.If the required resolution in time is higher, then the resolution in frequency must be lower.Discrete sampling of wavelets for any wavelet transform is Discrete Wavelet Transform.Both time and frequency information are captured with appreciable resolution in both domains.Multilevel one dimensional DWT is performed as to embed this into a processor to reach end application.Decomposition of signal is done in level-4 because all the information required will be within this level.The mother wavelet used is Daubechi4 (db4).Mother wavelet should be continuous in both time and frequency.This amplitude of frequency spectra of Daubechi4 (db4) mother has good resolution and the parameters extracted from the reconstructed signal will also be accurate.They are orthogonal wavelets and characterized by vanishing moments.Daubechi 4 (db4) signal has 2 vanishing moments for a given support width of 3. Hence Daubechi4 (db4) is used as mother wavelet.The signal is passed through a high pass filter and low pass filter.Then it is down sampled by 2 and for the down sampled low pass filter output this process is proceeded till level 4.This decomposed signal is reconstructed in each level so 4 reconstructed signals are available.All the 84 samples are decomposed and reconstructed.Observing the coefficients of the reconstructed signal, 1st level signal has 1/4th of the samples than actual signal, 2nd level signal have half the number of samples that of first level and the same continues to 3rd and 4th level.2nd level reconstructed signal is considered as the ideal ECG signal from which the parameters are extracted.The fact is that the parameters got in the signals are not the parameter of the original signal.With the parameters extracted from the 2nd level signal the actual parameters retrieved.To find the QRS, RR, PR interval all the position of the peaks such as P, Q, R, and S should be determined.First position of R peak is determined with the help of this all other peaks are determined [6].The values which are greater than 60% of the maxim value of the actual signal will be the R peak.There are many chances of having multiple points in the same peak as R-peak is not a single impulse peak.According to the analysis of ECG signal no two R-peak locations will be found below 360 samples for a 500HZ sampled signal.The value will be around 20 for our 4th level decomposition order.R-locations which are very close are removed.R-peaks which are 10 samples apart are only considered.The actual R-peak position is at least 1/4th of the reconstructed signal, with this actual R-peak is got.Traversing forth and back from R-peak location and searching for minima maxima other peaks like P, Q and S locations can be determined.

Classification -neural network
The number of processing elements per layer and the number of layers are very important for NN classification.The number of the processing elements in the hidden layer should increase if there is an increase in complexity between the desired output and the input.The upper bound for the elements in the hidden layer is set by the amount of Training Set available.For new data sets additional network is useless if the processed model can be separated into multiple stages.Back-propagation network always has an input layer, at least one hidden layer and an output layer.In our project classification of the ECG signals is done using two layers feed forward back propagation neural network pattern recognizer The hidden layer contains 'sigmoid' activation function and output layer consists of softmax neurons.Scaled conjugate gradient back propagation is used for the training.For each record the correct class is found during the training phase.This is called as supervised training.A correct value -1 is assigned for the output nodes which correspond to the correct class and 0 is assigned for false classes.To get better results 0.9 and 0.1 can be used instead of 1 and 0. The error found is given back to the network so that weights in the hidden layer can be adjusted and during next iteration the output will be much closer to the correct value.We divide the available samples into 3 groups.Out of the total 84 samples, 70% of the samples is used for training i.e., 58 samples, 15% of the total samples are used for each validation and testing i.e., 13 samples.The learning process begins when all the input data and corresponding output classes are feed into the network.These records are given to the network one by one (rows).Each time the weights corresponding to the inputs are adjusted.All cases are presented and now this process is repeated.
Neural network has a very high tolerance to noisy data and can also classify patterns which are not well trained.Initial weights can be chosen randomly.Errors are back propagated to the system so that the weights can be adjusted and it can be applied for next record.Weights are tweaked so this process is repeatedly done.The error should be minimised so the connection weights should be continually refined during the training of the network.This can be achieved only when same set of data's are processed many times.Validation is a measure of the network generalization and the training will stop when generalization stops improving.With the test data the network performance during and after training is evaluated.Testing data is not connected with training.Figure 6 indicates the algorithm and the progress of the neural network.The performance index chosen is to get a goal of 0.01.The required criteria are met at an iteration of 34.As there is no improvement for the next six iterations, the training is stopped.The training and the validation data have reached the goal of 0.01. Figure 7 shows the cross entropy for the various sample data.Figure 8 shows the convergence of the gradient and its corresponding validation checks.

Results and Discussion
A two layered feed forwarded network consisting of hidden layer and output layer is incorporated.The performance of the classification is evaluated using the following measures: classifier efficiency, area under curve (AUC), receiver operating characteristics (ROC) and the confusion matrix.

Conclusion
An efficient ANN system is automated for classification of arrhythmia using a set of ECG signal data is done in this paper.The results show that parameter extraction using wavelet decomposition coupled with the feed forward neural network classifier outperforms other classifiers.The proposed system could aid cardiologists in improving the efficiency of detecting and classifying arrhythmia.The accuracy of the classification can be improved by selecting more parameters to train the neural network.A MLP model for classifying all arrhythmia classes using this approach can be made.This system can be further developed for practical application.

Figure 2 :
Figure 2: Pre-processing using adaptive filter (a) input signal (b) baseline corrected signal (c) filter output for tachycardia.

Figure 2
Figure2shows the filter coefficents, error signal, filter output, baseline corrected smooth signal.

Figure 4 :
Figure 4: Detection of all peaks for tachycardia signal.

Figures 3
Figures 3 and 4 explains the whole parameter extraction process.With this peaks detected the intervals are found and tabulated for all 84 samples.

Figure 5
below shows the architecture of the neural network pattern recognizer used for the training.10 neurons are used in the hidden layer.

Figure 5 :
Figure 5: Neural network architecture for the ECG classifier.

Figure 6 :
Figure 6: Algorithm and the progress of the NN.

Figure 7 :
Figure 7: Cross entropy for the sample data.

Citation:Figure 8 :
Figure 8: Convergence of the gradient and its corresponding validation checks.

Figure 9 :
Figure 9: Receiver operator characteristic for the training data, test data and validation data.

Figure 10 :
Figure 10: Confusion matrixes for the training, validation and testing data and the overall confusion matrix.

Table 1 :
Standard parameter intervals for classification.
The NN model is used for the classification of a normal and three types of arrhythmia affected abnormal ECG signals namely