The proposed project aims in developing an automated system for the classification of various cardiac abnormalities using Neural Network classifiers. Any variability in the ECG signal pattern (Arrhythmia) is an indicator of a fatal cardiac disease. Manual study is tedious and time consuming owing to the large volume of data. This calls for the need to have automated Neural Network classification of cardiac diseases which provides efficient and speedy diagnosis. The original ECG Signals may be distorted due to baseline drift and added noise from various sources. So, preprocessing of the signal plays a vital role which involves smoothening and Wavelet decomposition. Wavelet decomposition also separates the signal components (the QRS specifically). Useful features are extracted from the separated signal components. These features are then given as inputs to ANN and SVM which classify the ECG signals into 6 specific classes otherwise called targets of the network. The classification results of each classifier are obtained. The performance and accuracy of both the classifiers are compared.
Get your grade
or your money back
using our Essay Writing Service!
Key words: Electrocardiograph (ECG), Artificial Neural Network (ANN), Support Vector Machine (SVM)
Physiology of ECG signal
Types of Cardiac Arrhythmias and their comparison
Different Electrodes for ECG
The Human Heart is a pump that performs the function of pushing and circulating the blood throughout the body. The pumping action of the heart is accomplished by the rhythmic contraction and relaxation of the muscle fibers of the heart. These muscle fibers make up the conduction system of the heart. The SA node, located in the Right Atrium is the 'natural pacemaker' of the heart. The rhythmic cardiac impulse originates in the SA Node. The impulse passes from the SA node through specialized conducting tracts in the Atria to activate the Right and Left Atrium (Atrial depolarization). It then goes to the AV node (the electrical connection between the atria and ventricle) where it is delayed and it continues into the Bundle of His and the Purkinje Fibre network.. This part of the conduction system spreads the impulse throughout the ventricles (ventricular depolarization).
Fig 1.1: Heart Conduction System
The above synchronous electrical activity in many Myocardial cells of the heart produces large currents that can be detected using electrodes placed on the skin. The characteristic recording of the electrical activity of the heart during the cardiac cycle is called the Electrocardiogram or ECG. The components of the ECG can be correlated with the electrical activity of the atrial and ventricle fibers such that:
The P-wave is produced by atrial depolarization
The QRS complex is produced by atrial repolarization and ventricular depolarization
The T-wave is produced by ventricular repolarization.
The PR interval represents the time taken by the electrical impulse to travel from the sinus node through the AV node and entering the ventricles
A prolonged QT interval is a risk factor for ventricular tachyarrhythmia and sudden death.
The PR segment coincides with the electrical conduction from the AV node to the bundle of His and then to the Purkinje Fibers
The ST segment represents the ventricular depolarization period. It is isoelectric.
Fig 1.2: Components of ECG Signal
Table 1.1: Waves and Intervals of ECG Signal
Rapid depolarisation of the right and left ventricles
25 % of QRS Amplitude
Beginning of P Wave to Beginning of QRS Complex
Interval between successive two R Waves
Beginning of the QRS Complex to end of T wave
Connects the P wave and the QRS Complex
Connects QRS Complex and T wave
Any disturbance in the heart's normal rhythmic contraction is called an Arrhythmia. Each beat of normal human heart originates in the SA Node. The normal heart rate is 70 beats per minute. The rate is slowed down during sleep, the condition of Bradycardia and is accelerated during conditions of increased heart activity like exercise, fever etc, the condition of Tachycardia. when the heart beat goes below 50 beats per minute the bradycardia condition becomes symptomatic. The person may go into a cardiac arrest when his heart is not pumping enough oxygen. Similarly the condition of Tachycardia may become dangerous depending on the speed and the type of Rhythm. When the heart beats excessively rapidly, it pumps less effectively leading to a reduced oxygen supply to the different organs as well as back to the heart itself leading to the condition of Ischemia. The threshold of Beat level that causes the danger varies and can be anywhere between >100 bpm to around 200 bpm.
Always on Time
Marked to Standard
The Bundle of His may be partially or completely interrupted. In the latter case, the Ventricles of the heart beat at a slow and incoherent rate whereas the atria continue to beat at the normal sinus rate. This condition is called Idio Ventricular Rhythm (30-45 beats per minute). This is the condition of a complete, third degree heart block. The case where the Bundle of His is not completely interrupted, an incomplete heart block is said to occur which may be a first degree heart block or Second degree heart block. In the first degree heart block, all the impulses from the atria reach the ventricles but the P-R interval is prolonged because of a delay in transmission through the affected region. In case of a second degree heart block, not all the atrial impulses get conducted to the ventricles. It can be a 2:1 or a 3:1 block and so on. i.e. one ventricular beat for every second atrial beat and likewise.
Sometimes a portion of Myocardium (Ectopic Focus) becomes irritable and discharges independently. The cardiac rhythm is said to be transiently interrupted when the focus discharges only once and the abnormal beat occurs before the next expected normal beat. This beat may be an atrial or a ventricular ectopic beat.
Fig 1.3: Ectopic beat
On the other hand, if a group of foci discharge repetitively and irregularly either in the atria or ventricles, this might lead to Atrial or Ventricular Fibrillation. During atrial fibrillation, the atria stop their regular beat and begin a feeble uncoordinated twitching. Low amplitude irregular waves appear in the ECG. In ventricular fibrillation, the ventricles twitch in a feeble uncoordinated fashion with no blood being pumped fro the heart.
Fig 1.4: Atrial and Ventricular Fibrillation
If the foci discharge repetitively and regularly for a long time, it can lead to Atrial Flutter (repetitive P waves) if the site is in the atria or a paroxysmal tachycardia (repetitive QRS Complexes) if the site is in the ventricles.
Fig 1.5: Paroxysmal tachycardia and Atrial Flutter
The different types of electrodes for acquiring ECG signals are
Limb electrodes- most common, generally preferred during surgery. Not used for long term monitoring.
Suction Cup electrodes- easily attachable. Commonly used to record the unipolar chest leads
Floating electrodes- The metal surface does not make direct contact with the skin. Motion artifacts are lesser.
Pregelled Disposable Electrodes- Employed in Stress testing or long term monitoring.
The most common Electrode configuration for acquiring ECG signal is the 12 Lead system. This comprises of Unipolar, Bipolar and Augmented leads
Unipolar Leads- V1, V2, V3, V4, V5 and V6 are the chest leads
Bipolar leads- Lead I, Lead II and Lead III are the Limb leads.
I = LA - RA
II= LL - RA
III= LL - LA
LA - Left Arm RA - Right arm LL - Left Leg
Augmented Leads - aVR, aVL and aVF are limb leads
2.1 Literatures on ECG Signal Classification
In the literature survey, various techniques have been proposed for the classification of cardiac arrhythmias using Neural Network Classifiers. The Accuracy of the classifier is the most important parameter to be considered for classification. Some of the recently published works are as follows:
Table 2.1: Literature Survey
Classification of Cardiac Arrhythmias Based On Hybrid System
Nazmy H.EL-Messiry and B.AL-Bokhity
Six different classes of ECG Signals are taken. Feature extraction involving ICA and Power Spectrum along with R-R interval forms the Feature vector which is given as input to the Feed Forward Neural Network (FFNN), Fuzzy Inference System (FIS) and Adaptive Neuro Fuzzy Inference System (ANFIS) classifiers.
Superior Accuracy of ANFIS (97.1%) Over FFNN (94.3%) and FIS (95.1%) are demonstrated. ANFIS Classifier is a hybrid System combining both Fuzzy logic and Neural network BPN.
A Brief Performance Evaluation of ECG Feature Extraction Techniques for Artificial Neural Network Based Classification
This Essay is
a Student's Work
This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.Examples of our work
Rajesh Ghongade and Dr.
Three Classes of ECG Signals are taken and feature extraction is performed which mainly covers transform feature extraction (DWT, PCA, DFT) and morphological feature extraction. The features are given as input to an ANN which is trained to classify the patterns of which the PVC(Premature ventricular contraction) class of ECG Signal is considered most important
Comparison of classification performance in Four different cases-
DWT and MLP, DFT and MLP, PCA and MLP for all the Three classes of ECG signal are done and the average accuracy for each case is obtained. Found to be highest in DFT and MLP (96%)
Arrhythmia Detection and Classification using Morphological and Dynamic Features of ECG Signals.
CanYe, Miguel Tavares Coimbra and B.V.K.
An SVM (Support Vector Machine) classifier is used to classify 15 classes of ECG Signals. Two categories of features are taken. The first one involves applying ICA and Wavelet Transform to every individual beat. The second feature considered is R-R interval. The same procedure is then applied to data from two ECG leads.
Comparison of the two Classification methods. An overall accuracy of 99.26 % on 85945 individual beats.
Classification of ECG Signals Using Extreme Learning Machine
Arthanari and M.
Feature extraction and classification is performed on different ECG Signals and they are classified as belonging to normal or abnormal classes.
Proves that the performance of the ELM classifier is superior to the SVM classifier.
Correlation Analysis For Abnormal ECG Signal Features Extraction
Alias Bin Ramli and Putri Aidawati Ahmad
ECG Features are extracted .Auto Correlation and Cross Correlation techniques are applied to analyze the normal and abnormal ECG signal. The similarity between the two signals are measured using cross correlation analysis and extracts the information about the signals
The results show that the correlation analysis is the easier method and the normalized auto correlation and cross correlation technique can represent and distinguish the abnormal and normal signals in a better manner.
ECG Signals With Support Vector Machines and Particle Swarm Optimization
Farid Melgany and Yakoub Bazi
Five kinds of normal and abnormal signals are collected from MIT-BIH arrhythmia database .The heart beat is considered as a feature and it is given as a input to the classifiers for classification. three different classifiers (SVM, kNN and RBF) are considered and their results are compared.
Showed the superiority of the SVM approach as compared to other classifiers. The PSO-SVM yields an overall accuracy of 89.72% against 85.98%,83.70% and 82.34% for the SVM, kNN and RBF Classifiers, respectively.
3.1 Data Description
Six different ECG Signals are obtained from the MIT-BIH Physionet database namely, MIT-BIH Normal Sinus Rhythm, MIT-BIH Arrhythmia, MIT-BIH Supraventricular Arrhythmia, Intracardiac Atrial Fibrillation, MIT-BIH Malignant Ventricular Ectopy and CU Ventricular Tachyarrhythmia and their corresponding sampling frequencies are 128 Hz, 360Hz, 128 Hz, 1000Hz, 250Hz and 250Hz. 20 records, each of one minute signal window length are considered under each class of ECG Signal.
Resampling of the various classes of ECG Signals is done for proper feature extraction and accurate classification. All the signals of different sampling frequency mentioned above are resampled to a constant frequency of 250 Hz.
The first step in Preprocessing involves smoothening of the ECG Signals. The Purpose of Smoothening is Baseline drift removal. An IIR Notch filter is used to remove the 50 Hz power line interference from the signal.
Fig 3.1: Block Diagram
Wavelet decomposition is performed for signal clearance and simplification i.e denoising of the signals. The ECG signal is decomposed to the required level using Discrete Wavelet Transform (DWT) and the daubechies wavelet function db4 is used. The db4 wavelet function is preferred and chosen because of its morphological resemblance to the QRS Complex of the ECG Signal. Hence when it is applied to the signal, the QRS complexes are separated and the R Peaks are detected. Dynamic thresholding is used for detecting R-peaks.
Fig 3.2: Daubechies wavelet function (db4)
The underlying principle in wavelet decomposition is that the signal gets decomposed into different levels. Each level has a set of wavelet coefficients which are broadly categorized as approximate and detail coefficients. The Approximate and detail coefficients have the low and high frequency components of the signal respectively. By this process the high frequency noise is removed when the signal is reconstructed .
Fig 3.3: Wavelet Decomposition tree
3.4 Feature Extraction
For the efficient Classification of ECG Signals a Feature Vector is given as input to the Neural Network Classifiers. This Feature vector is a matrix that contains the ECG Signal features. The different Morphological and Statistical features considered are Beat rate, R-R interval, Mean, Standard Deviation and Correlation (the shoot at Zero lag). The Beat rate calculation algorithm that is used is 'Beat to Beat heart Rate Calculation'. The difference between two successive time intervals of the detected R Peaks gives the R-R Interval. From this, the corresponding value of beat rate for the signal is obtained.
Fig 3.4: Extracted features for a normal signal
Fig 3.5: Preprocessed output and Detected R-Peaks for the normal signal
Fig 3.6: Extracted features for a ventricular tachyarrhythmia (VTA) signal
Fig 3.7: Preprocessed output and Detected R-Peaks for the VTA signal
Fig 3.8: Auto Correlation analysis of the normal signal
Fig 3.9: Auto Correlation analysis of the VTA signal
ECG is one of the most important biosignal in the human body. Any variability in the signal pattern can be an indicator of a fatal cardiac disease.
Therefore, for efficient diagnosis, the ECG signal pattern and heart rate
Variability may have to be observed over several hours. Hence manual study is tedious and time consuming owing to the large volume of data. This calls for the need to have computer-based analysis and classification of cardiac diseases which can provide with efficient and speedy diagnosis. One such automated classification approach is using neural network classifiers.
The feature vector is given as input to the neural network. The feature vector data is divided into training data set and testing data set which is given as training and testing input to the classifier. The classifier adopts the supervised learning algorithm to classify the ECG Signals into one of the 6 classes based on the given training data. Then the accuracy of the classifier is checked by giving a sample testing data set to see how well each signal in the test set is classified under each target.
For the classification of Six classes of ECG Signals, two different classifiers are used- Feed Forward Back Propagation Multi-Layer Perceptron Neural Network and Support Vector Machine.
The accuracy of classification and the performance depends on factors like the number of testing data, the number of neurons in the hidden layer, the number of training iterations.
3.5.1 Multi Layer Perceptron ( MLP)
The Feed Forward Backpropagation network consists of N layers- the input layer, two or more hidden layers and an output layer. The first layer gets weights from the input. Subsequently, each layer gets the weights from the previous layer and every layer also has a Bias associated with it. The final layer's output is the network output. With each iteration, the weights of each neuron are updated with respect to a particular learning function. This is called the Network's adaptation. A specific training function trains the neural network and the performance of the network can be measured by a performance function.
Fig 3.10: General structure of MLP
A Feed forward MLP classifier is built that can identify the type of ECG signal from its specific features- both statistical and morphological. The aim of the classifier is to identify the type of ECG Signal based on the measured value of each of the selected feature. The five features serve as the inputs to a neural network and the type of the ECG Signal e.g. Normal, Atrial fibrillation, ventricular tachyarrhythmia, ventricular ectopy etc are the targets and six such targets are considered. To achieve this, training of the MLP network is done by presenting previously recorded inputs and then tuning it to produce the desired target outputs. The samples are divided into training and test sets. The training set is used to teach the network. The test set provides a measure of network accuracy. The network response is then compared with the desired target response. This creates a classification matrix which gives an idea of the classifier's performance. In the ideal classification matrix the sum of the diagonal should be equal to the number of samples. 240 records are taken under training set and 42 records under testing set. The number of neurons in the hidden layer and the number of training iterations are varied and for each case the classifier accuracy is noted. A final accuracy of 76 percentages was obtained with 1200 iterations and 20 neurons in the hidden layer.
Fig 3.11: Performance curve for 150 iterations
Fig 3.12: Classification matrix for 150 iterations
Fig 3.13: Classification matrix in percentage for 150 iterations
Fig 3.14: Performance curve for 300 iterations
Fig 3.15: Classification matrix for 300 iterations
Fig 3.16: Classification matrix in percentage for 300 iterations
Fig 3.17: Performance curve for 1200 iterations
Fig 3.18: Classification matrix for 1200 iterations
Fig 3.19: Classification matrix in percentage for 1200 iterations
3.5.2 Support Vector Machine (SVM)
In SVM a set of input training data is first given to the classifier and the classifier classifies each of the data into two possible classes. It determines which of the two targets the given input belongs to. So the SVM is a binary linear classifier. Based on this principle that training data can be identified as belonging to one of the two given targets, an SVM Training algorithm can be built that assigns more sample data( testing data) given as input to it, as belonging to one of the two classes.
Fig 3.20: Linear decision boundary separating training data into two classes
Fig 3.21: Complex structure to classify new test samples on the basis of the already existing training samples.
The SVM Builds decision planes (hyperplanes) in the three dimensional infinite space. These decision planes define decision boundaries and they are used for the purpose of classification. The simplest example is in the case of a linear classifier that has a linear decision function( a simple line) that separates training data as belonging to one of two different classes which are on either side of the line that defines the boundary separating the two classes. However, a more complex structure is required to classify new test samples on the basis of the already existing training samples. This calls for the concept of mapping or transformation. Mathematical functions called kernels are used to rearrange the original objects so that the mapped or rearranged objects become linearly separable and the need for the complex structure is not needed. SVM classifiers are specifically built for this.
Fig 3.21: Mapping or transformation to rearrange the original objects and make them linearly separable
For classifying more than two targets, the dominating Multiclass approach is used. Here, a single Multiclass problem is reduced into one or more Binary classification situations.
For building such individual binary classes for a major Multiclass, two common approaches are adopted
one class against all other classes( one versus all approach)
between every pair of classes
Here, for the classification of six classes of ECG Signals with five features, the one versus all approach is used.
4 Results and discussion
The performance and accuracy of the classifier depends on the extracted features and also the number of training iterations given. For attaining the best possible results, adequate number of training and testing inputs to the classifier should be given to improve the sensitivity and reduce misclassification.
4.1 Performance evaluation
Sensitivity= (True Positives) / (True Positives + False Negatives) (eq.4.1)
Specificity= (True Negatives) / (True Negatives+ False Positives) (eq.4.2)
Accuracy = (True Positives + False Negatives) / (Total Number of Samples) (eq.4.3)
4.2 Performance and results of MLP
Table 4.1: Performance evaluation of MLP
Number of iterations
Percentage Correct Classification (%)
Percentage Incorrect Classification (%)
On increasing the number of iterations above 1200, no change in accuracy was observed.
Table 4.2: Theoretical calculation of Sensitivity, Specificity and Accuracy of MLP
Number of Iterations
4.3 Performance and results of SVM
Table 4.3: Performance evaluation of SVM
Correct Classification Accuracy (%)
The Overall Accuracy of the SVM Classifier is 84%. Out of the six classes, the highest accuracy is observed in Malignant Ventricular Ectopy (MVE).
From the above results, it can be concluded that Support Vector Machine (SVM) Classifier shows a better performance than MLP based ANN Classifier. For the same number of Features and targets considered, SVM demonstrates superior accuracy and also has lesser Computational Complexity than MLP.