0% found this document useful (0 votes)
119 views60 pages

Classification of ECG Signals Report PDF

This document presents a project on the classification of electrocardiogram (ECG) signals using artificial neural networks. The project was submitted by Sahana Ramesh and Tejaswini Sumanam to the faculty of the Department of Electrical and Electronic Engineering at California State University, Sacramento in partial fulfillment of the requirements for a Master of Science degree. The document provides background on ECG signals and their analysis, describes the implementation of neural networks for ECG classification, and outlines the research methodology used in the project.

Uploaded by

Nandaxl77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views60 pages

Classification of ECG Signals Report PDF

This document presents a project on the classification of electrocardiogram (ECG) signals using artificial neural networks. The project was submitted by Sahana Ramesh and Tejaswini Sumanam to the faculty of the Department of Electrical and Electronic Engineering at California State University, Sacramento in partial fulfillment of the requirements for a Master of Science degree. The document provides background on ECG signals and their analysis, describes the implementation of neural networks for ECG classification, and outlines the research methodology used in the project.

Uploaded by

Nandaxl77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

CLASSIFICATION OF ECG SIGNALS

A Project

Presented to the faculty of the Department of Electrical and Electronic Engineering

California State University, Sacramento

Submitted in partial satisfaction of


the requirements for the degree of

MASTER OF SCIENCE

in

Electrical and Electronic Engineering

by

Sahana Ramesh

Tejaswini Sumanam

FALL
2016
CLASSIFICATION OF ECG SIGNALS

A Project

by

Sahana Ramesh

Tejaswini Sumanam

Approved by:

____________________________, Committee Chair


Dr. Fethi Belkhouche

____________________________, Second Reader


Dr. Preetham B. Kumar

____________________________
Date

ii
Student: Sahana Ramesh
Tejaswini Sumanam

I certify that these students have met the requirements for format contained in the University format

manual, and that this project is suitable for shelving in the Library and credit is to be awarded for

the project.

__________________________, Graduate Coordinator ___________________


Dr. Preetham B. Kumar Date

Department of Electrical and Electronic Engineering

iii
Abstract

of

CLASSIFICATION OF ECG SIGNALS

by

Sahana Ramesh

Tejaswini Sumanam

Electrocardiogram (ECG) plays an enormous role in the medical field. An electrocardiograph is a

device used in cardiology, which records heart’s electrical signals over time. ECG can be used to

determine various heart diseases or damages to the heart along with the pace at which the heart

beats as well as the effects of drugs or devices used to control the heart. The interpretation of the

ECG signals is an application of pattern recognition. The technique used in this project integrates

the study of the ECG signals and their classification. Analysis of ECG signals is done using neural

network pattern recognition and classification methods. The study includes simulation of ECG

signals, comparison between ECG signals, and detection of any abnormalities in the signal by using

effective learning algorithms & pattern recognition techniques.

The processed signals used in this project are obtained from an arrhythmia database, which was

developed for research in cardiac electrophysiology by Massachusetts Institute of Technology-Beth

Israel Hospital (MIT-BIH). The neural clustering application available in the pattern recognition

tool software is used to classify ECG signals based on self-organizing maps. Self-organizing maps

are used to cluster the data, based on the similarity and topology, which reduces the dimensionality

iv
of the data. Thus, after training the network using the classification tool, a given ECG signal can

be classified as normal or arrhythmic signal based on its features.

____________________, Committee Chair


Dr. Fethi Belkhouche

____________________
Date

v
ACKNOWLEDGEMENTS

I would like to take an opportunity to express my deepest gratitude to Dr. Fethi Belkhouche,

Electrical and Electronic Engineering, Department Coordinator Dr. Preetham B. Kumar, California

State University Sacramento (CSUS), for their support and guidance throughout the project. I

would like to thank all my advisors and extend my sincere thanks to the organization which gave

me the opportunity to work on this project.

A special thanks to my teammate, who gave me her constant support in developing the project and

helped in completing the project successfully.

Finally, I would like to thank my family and friends, for their continuous support and

encouragement throughout this project.

vi
TABLE OF CONTENTS

Page

Acknowledgements……………………………………………………………………………......vi

List of Tables………………………………………………………………………………………ix

List of Figures………………………………………………………………………………………x

Chapter

1. INTRODUCTION ................................................................................................................... 1

1.1. Basics of Electrocardiogram (ECG) ........................................................................... 1

1.2. Functioning of the Heart and ECG ............................................................................. 2

1.3. Generation of ECG Waveform ................................................................................... 4

1.4. Standard ECG Signal Segmentation ........................................................................... 6

1.5. Traditional Methods of ECG Measurement .............................................................. 10

1.5.1. Standard Method or Bipolar Method of Recording .................................. 12

1.5.2. The Standard 12-Lead ECG System ......................................................... 13

1.6. Ongoing Research .................................................................................................... 16

1.7. Future Scope of Research ......................................................................................... 17

1.8. Literature Review ..................................................................................................... 18

2. ARTIFICIAL NEURAL NETWORKS ................................................................................. 20

2.1. Introduction to ANN ................................................................................................ 20

2.2. Implementation of Neural Networks in ECG Classification ..................................... 22

2.3. Pattern Recognition .................................................................................................. 23

vii
2.4. Architecture and Training Methods .......................................................................... 24

2.5. Learning Algorithms ................................................................................................ 27

3. RESEARCH METHODOLOGY ........................................................................................... 29

4. RESULTS AND CONCLUSION .......................................................................................... 37

Appendix. MATLAB Code for Generation of the ECG Signal .................................................... 43

References.................................................................................................................................... 46

viii
LIST OF TABLES

Tables Page

1. ECG Standard 12-Lead System ............................................................................................. 14

ix
LIST OF FIGURES

Figures Page

1. Cross-Sectional View of the Human Heart .............................................................................. 2

2. Generic Depolarization Waveform .......................................................................................... 3

3. Functioning of the Heart and Generation of ECG Waveform .................................................. 4

4. Pictorial Representation of the ECG Signal ............................................................................. 5

5. Shaded Region Represents PR Interval ................................................................................... 7

6. Shaded Region Represents PR Segment .................................................................................. 7

7. Shaded Region Represents QRS Complex .............................................................................. 8

8. Shaded Region Represents QT Interval ................................................................................... 9

9. Shaded Region Represents ST Segment .................................................................................. 9

10. Shaded Region Represents RR Interval ................................................................................. 10

11. Position and Orientation of Bipolar Limb Lead ..................................................................... 12

12. Generic Flowchart Indicating the Steps for Classification of ECG Signal ............................. 16

13. Flowchart for Pattern Recognition Method............................................................................ 23

14. Feed-Forward Neural Network .............................................................................................. 25

15. Single-Layer Perceptron Network ......................................................................................... 26

16. Multi-Layer Perceptron Network ........................................................................................... 26

17. Recurrent Artificial Neural Network ..................................................................................... 27

18. Neural Network Start Command Window ............................................................................. 30

19. Neural network Clustering Tool (nctool) for Pattern Classification ....................................... 31

20. Dataset Obtained from MIT-BIH Database ........................................................................... 31

x
21. Loading Data in the Neural Network Clustering Tool (nctool) .............................................. 32

22. Network Architecture ............................................................................................................ 33

23. Training the Network in the Neural Network Clustering Tool (nctool) ................................. 33

24. Detailed Options of the Plots Obtained after Training the Neural Network. .......................... 34

25. Evaluation of the Obtained Network ..................................................................................... 35

26. MATLAB Code Generation in the nctool .............................................................................. 35

27. MATLAB Simple Script and Advanced Script Generation ................................................... 36

28. Plot of SOM Neighbor Distances .......................................................................................... 38

29. Plot of SOM Sample Hits ...................................................................................................... 38

30. Plot of SOM Weight Positions............................................................................................... 39

31. Plot of SOM Topology .......................................................................................................... 39

32. Plot of SOM Neighbor Connections ...................................................................................... 40

33. Plot of SOM Weight Planes ................................................................................................... 40

34. ECG waveform obtained using MATLAB ............................................................................ 45

xi
1

Chapter 1

INTRODUCTION

In today’s world, because of the increasing stress and unhealthy diet, problems related to heart

diseases are increasing. An initial breakthrough occurred by inventing ECG – Electrocardiogram

in 1901 [1]. ECG is a device which measures and records the heart’s electrical activity over a period

of time [2]. Since then, the procedure has become one of the routine check-ups to monitor and

obtain information about the structure, function, and condition of the heart.

1.1. Basics of Electrocardiogram (ECG)

An electrocardiogram is the most important diagnostic tool used in the field of medicine, to record

and measure the electrical activity of the heart as waveforms [2]. Understanding the obtained

waveforms helps in the diagnosis of the heart condition which can range from minor to life-

threatening.

A nerve impulse stimulus to the heart generates an ECG signal. When current diffuses over the

surface of the body, it develops a voltage drop in the range of μV to few mV with an impulse

variation [2].
2

1.2. Functioning of the Heart and ECG

The heart is a muscular organ, located in the middle compartment of the chest. It has four chambers.

The upper left and right chambers are called Atria and the lower left and right chambers are called

Ventricles [3]. The heart is protected by ribs and has many one-way valves as shown in figure 1.

The main functionality of the heart is to pump blood through blood vessels of the circulatory

system.

The contraction and expansion of the muscles of the heart enable the blood to be pumped. Under

normal conditions, these contractions are triggered in two areas of the heart – Sinoatrial (SA) and

Atrioventricular (AV) nodes [3] as indicated in figure 1.

Figure 1: Cross-Sectional View of the Human Heart [4]


3

The triggered electrical signals are detected by ECG. Because of the electrical activity, currents are

produced in the body which radiates around the skin tissue. When electrodes come in contact with

the skin, they sense the electrical currents and transmit them to electrocardiograph [2]. The obtained

electrical current is then transformed into waveforms which represent the heart’s depolarization-

repolarization cycle [2].

Depolarization is defined as the sudden change within a cell, during which the cell undergoes a

dramatic electric change from negative to positive in a brief time. The electrical changes on the

skin that arise from heart muscle depolarization during each heartbeat are detected by the electrodes

of [2]. Depolarization occurs in the four chambers of the heart

 first in atria

 then in ventricles

The typical waveform generated during depolarization looks like figure 2 as shown below.

Figure 2: Generic Depolarization Waveform


4

1.3. Generation of ECG Waveform

Referring to figure 1, the sinoatrial (SA) node on the wall of the right atrium initiates depolarization

at the right & left atria. This causes atrial contraction resulting in the generation of P wave (figure

3). The resulted QRS complex is generated due to ventricular depolarization, caused by the

spreading of the electrical activity from the Atrioventricular node (AV node) through the ventricles.

This precedes ventricle contraction. At this time, atrial repolarization also occurs. Finally, the T

wave is the result of ventricular repolarization. Repolarization is slower than depolarization, hence

the T wave is usually wider than the P wave and the QRS complex [5].

Figure 3: Functioning of the Heart and Generation of ECG Waveform

Repolarization- This is the relaxation phase [2]. ECG measures a precise sequence of electrical

events occurring in cardiac cells throughout the process. Any conduction abnormalities and rhythm

disturbances are identified [2].


5

An ECG tracing of a normal heartbeat typically looks like figure 4. The ECG signal comprises of

three distinguishable waves which are known as deflection waves, each representing an important

aspect of cardiac function [5]. The three main elements of ECG signals are a P wave, a QRS

complex wave, and a T wave. Parameters such as the values of amplitude, range etc.., of P, QRS &

T waves together with durations are measured. The typical PR, QRS, QT and RR intervals are

shown in figure 4. The isoelectric line is the baseline voltage of the electrocardiogram at point 0 on

the y-axis, i.e.., at 0mV [2]. The waveform below the baseline is the negative deflection. The

portion of the tracing after the T wave to starting of the next P wave is indicated as the isoelectric

line.

Figure 4: Pictorial Representation of the ECG Signal

From these calculations, the heart condition is determined based on the amount of variation, so that

the cardiologist can recommend the amount of dose required for medication.
6

1.4. Standard ECG Signal Segmentation

Each point of the heartbeat produces different deflection on the ECG signal. Referring to figure 4,

one complete ECG wave is divided into various segments and intervals which relate directly to the

phases of cardiac conduction. Each component is important in the detection of abnormalities since

they occur at a specific time and have a particular range. Limits can then be set on these components

to diagnose deviations from normality.

The main ECG signal characteristics are:

1. The PR interval,

2. The PR segment,

3. The QRS complex,

4. The QT interval,

5. The ST segment and

6. The RR interval.

PR interval – PR interval can be identified as the region from the starting of the P wave to starting

of the QRS complex as shown in figure 5. Since Q wave is frequently absent, this interval is termed

as PR interval. PR interval can be defined as the time the impulse takes to reach the ventricles from

the sinus node [6]. The normal PR interval range is between 0.12-0.2s. If the value of the PR interval

is less than 0.12 seconds, it is termed as a short PR interval. If the value of the PR interval is greater

than 0.20s, the first atrioventricular block is identified.


7

Figure 5: Shaded Region Represents PR Interval

PR segment - The region of the PR segment is the endpoint of the P wave to the beginning of the

QRS complex as shown in figure 6. The duration of the conduction in the atrioventricular muscle

is represented by PR segment. The PR segment is considered to be isoelectric, representing atrial

systole and ventricular diastole. The isoelectric property deviates in the presence of an atrial injury

[6].

Figure 6: Shaded Region Represents PR Segment


8

QRS complex - This indicates the interval of ventricular depolarization. The region of the QRS

complex begins at the Q wave and ends at the S wave. QRS complex is as shown in figure 7. It tells

us the amount of time the signal takes to spread throughout the ventricles, which normally should

be 0.12s [6]. However, various conditions can cause a lengthened QRS duration. Generally, all

QRS complexes look alike. Even if one of the waves of QRS complex is absent, they are still termed

as QRS complexes.

Figure 7: Shaded Region Represents QRS Complex

QT interval – The QT interval indicates the duration of the ventricles from the depolarization to the

repolarization. The region begins at the beginning of the QRS complex and extends to the endpoint

of the T wave as shown in figure 8. The duration varies with gender, seniority, and the heart rate.

Some of the diseases like hypercalcemia, hyperthyroidism, and hyperkaliemia are due to short QT

intervals [6]. Few others such as, slow heart rates, myocarditis, hypokalemia, hypocalcemia are due

to long QT intervals which increase the risk of ventricular ectopic beats.


9

Figure 8: Shaded Region Represents QT Interval

ST segment – It starts at the endpoint of the S wave and finishes at the onset of the T wave, as

shown in figure 9. It is normally isoelectric. During this period, the electrical activity is not visible

since the atrial cells experience relaxation and the ventricles experience contraction. ST segment

depression, termed as myocardial ischemia is occurred due to blocked arteries [6]. Cardiac injury

or ventricular aneurysms are due to ST segment elevation [6].

Figure 9: Shaded Region Represents ST Segment


10

RR interval - The RR interval is measured as the time between the R wave of two adjacent

heartbeats. This is as shown in figure 10. The RR intervals are normally regular, but the irregularity

in RR intervals may be due to sinus node disease or supraventricular arrhythmias [6].

Figure 10: Shaded Region Represents RR Interval

1.5. Traditional Methods of ECG Measurement

The electrical current radiates in many directions over the surface of the skin and the diffused

current builds a voltage drop. This is usually a couple of μV to mV with an impulse variation [2].

Since this is a very small amplitude, the signal has to be amplified in order to get a complete picture

of the electrical activity. To measure the electrical activity, electrodes are placed at different

locations on the body. The electrocardiogram then records the information from different

perspectives, called leads and planes [2].

Leads: A lead provides a view of the electrical activity between two points or poles. Each lead

consists of one positive and one negative pole. There is an imaginary line between two poles which
11

represents lead axis, indicating the direction of current moving through the heart. Since each lead

measures the heart’s electrical potential, each generates its characteristics tracing obtained from a

different direction [2]. The direction in which the electric current flows, tells us how the waveform

appear on the ECG tracing [2]. When the current flows along the axis towards the positive pole of

the electrode, the waveform deflects upward and is called positive deflection. If the current flows

in an opposite direction, the waveform deflects downwards below the baseline, which is called

negative deflection. When the current goes perpendicular to the axis, it may go in both directions

or may be very small. However, if there is the absence of electrical activity or if the amount is

negligible to measure, the resulted waveform will be a straight line, called an isoelectric deflection

[2].

Plane: It provides a different view of the electrical activity [2]. The frontal plane is a vertical cut

through the middle of the heart that is from top to bottom. The electrical activity is viewed from

the right and left [2] (the plane of the body that is parallel to the ground when one is lying on the

back [5]). The horizontal plane is a horizontal cut through the middle of the heart, dividing it into

upper and lower portions. The electrical activity is viewed as moving anteriorly and posteriorly [2]

(the plane of the body that is parallel to the ground when one is standing straight [5]). For two or

three channel ECG, only the leads in the frontal plane are required [5].
12

1.5.1. Standard Method or Bipolar Method of Recording

Generally, there are three basic leads in the frontal plane of an electrocardiogram, resulting in a

combination of a pair of electrodes, placed at Right Arm (RA), Left Arm (LA) and Left Leg (LL)

of the patient. The leads are defined as, Lead I – LA to RA, Lead II – LA to RA and Lead III – LL

to LA [5].

Figure 11: Position and Orientation of Bipolar Limb Lead [7]

Bipolar leads record the voltages between the electrodes placed on the wrist and legs [5]. The types

of ECG recording obtained from the lead method are shown in figure 11. They are as follows:

Lead I – recordings are obtained between Right Arm and Left Arm

Lead II – recordings are obtained between Right Arm and Left Leg.

Lead III – recordings are obtained between Left Arm and Left Leg.
13

1.5.2. The Standard 12-Lead ECG System

The standard 12-lead electrocardiogram represents the heart’s electrical activity in three orthogonal

directions. The electrical activity is obtained from the recording of four limb electrodes and six

chest electrodes placed on the surface of the body. The three directions are from Right to Left and

vice versa, Superior to Inferior and vice versa, Anterior to Posterior and vice versa [8]. The recorded

electrical activity is obtained from 12 different positions, 6 standard limb leads and 6 precardial

chest leads [3]. Important characteristics of the leads include:

 Each lead electrical activity is defined and represented in a different angle.

 Each lead has both a positive and a negative component

 Each lead monitors a specific portion of the heart in the positive electrode’s point of view

of that lead [3].

Each of 12 leads represents a particular orientation in space indicated as RA- (Right Arm), LA-

(Left Arm), and LL- (Left Leg) [8].


14

Table 1: ECG Standard 12-Lead System [8] (Jardins T.D., 2002)

The measurements are as follows:

 The bipolar limb leads towards frontal plane have the following leads. Namely:

a. Lead I, indicates the measurement between RA (negative) and LA (positive)

from right-left, or lateral direction.

b. Lead II, indicates the measurement between RA (negative) and LL (positive)

from superior to inferior direction.

c. Lead III, indicates the measurement between LA (negative) and LL (positive)

from superior to inferior direction.

 The augmented unipolar limb leads towards frontal plane have the following leads.

Namely:
15

a. Lead AVR (aVR), indicates the measurement from RA (positive) to LA & LL

(negative). The direction is rightward.

b. Lead AVL (aVL), indicates the measurement from LA (positive) to RA & LL

(negative). The direction is leftward.

c. Lead AVF (aVF), indicates the measurement from LL (positive) to [RA & LA]

(negative). The direction is inferior.

 The unipolar (positive) chest leads towards horizontal plane have the following leads.

Namely:

a. V1, V2, V3, indicates the measurement from posterior to anterior.

b. V4, V5, V6, indicates the measurement from right left or lateral.

Referring from table 1,

V1 indicates Right 4th intercostal space,

V2 indicates Left 4th intercostal space,

V3 indicates halfway between V2 and V4,

V4 indicates Left 5th intercostal space, midclavicular line,

V5 indicates horizontal to V4, anterior-axillary line,

V6 indicates horizontal to V5, mid-axillary line.


16

1.6. Ongoing Research

ECG is the device which takes electrical activity of human heart into consideration and records the

readings which on further analysis helps in saving human life. The recorded ECG signal has noise

such as baseline wandering, power line interface, muscle noise, instability of electrode-skin

contacts, instrumental and electrosurgical, which leads to misclassification of cardiac arrhythmias.

Hence, the ECG signal must be preprocessed before classification and then features are extracted

from them for classification.

The ongoing research aims at reducing noise and better classification methods to get more accurate

results.

Figure 12: Generic Flowchart Indicating the Steps for Classification of ECG Signal
17

Since noise removal also plays an important role in the signal detection and the nature of most noise

sources are known, we can reduce noise or even attenuate it completely. In recent times, many

noise removal techniques have been developed such as band pass filters, Fourier-based analysis

and transforms etc.., which are dependent on averaging and smoothing the signal or transforming

the signal from time domain to frequency domain. By using the above mentioned techniques, it

helps to obtain the noise free or noise attenuated ECG signal.

Generally, classification is a two-step process. Supervised learning is the first step, in which the

predefined class labels are assigned the training data. The second step is to evaluate the

classification accuracy.

1.7. Future Scope of Research

Based on the present situation and medical literature inspection, we can conclude that future work

in this field should be focused on the efforts to further standardize annotations and testing principles

and methodologies. Algorithms need to be proposed for effective classification and multi-lead

analysis.

The features related to other cardiac conditions should be identified in the feature extraction step,

an important step in classification. This research can be applied in the field of telemedicine. Remote

access of ECG diagnosis is a very useful service. The clustering and the pattern recognition tool

should train the network effectively to classify the signals at an early stage of training.
18

1.8. Literature Review

Many algorithms have been developed so far for the detection of ECG signal, feature extraction of

the signal and classification of ECG signals. A.B Ramli and P.A.Ahmad [9] used cross-correlation

analysis technique for the extraction of features from 12-lead ECG signal measurement technique.

They also concluded that the cross-correlation and auto-correlation methods work better in

evaluating and analyzing the parameters which are extracted. Thus differentiating between normal

and abnormal ECG signal.

Pawel Tajedko and Waldemar Rakowski [10] used Kohonen maps or self-organizing maps. They

also used learning vector quantization algorithms to classify and compare the QRS complexes.

Normal or arrhythmatic beats are accessed for their performance. They used MIT-BIH arrhythmia

database for their evaluation method based classification.

Xiaomin Xu and Ying Liu [11] proposed sloped waveform vector algorithm for ECG QRS complex

detection and evaluation of the RR interval. They used variable stage differentiation and non-linear

amplification to extract the features and reduce noise in the signal.

B. Castro, D. Kogan and A.B. Geva [12] proposed an algorithm based on wavelet transformation

for feature extraction and identification of abnormal heartbeats. Thus helped in finding out the best

correlation with ECG signal. The ECG signal is preprocessed first to attenuate noise and using

optimal wavelet function, each PQRST cycle is divided into coefficients vector. The ECG signal
19

components P wave, QRS complex and T wave are separated and summed up to obtain the feature

vectors of the signal.

K. Zhu, P.D. Noakes and A.D.P. Green [13] discussed the use of artificial neural networks to detect

abnormalities in ECG. The proposed method uses waveform slope to locate the QRS complex and

are used as a training dataset to detect abnormalities.

H. Gholam Hosseini, D. Luo, K.J. Reynolds [14] proposed a two-stage feed forward neural

network. Here they have chosen two network architectures based on single stage and two stage feed

forward networks to recognize abnormalities. They concluded that the two-stage network used

compressed components method for effective ECG signal classification.


20

Chapter 2

ARTIFICIAL NEURAL NETWORKS

2.1. Introduction to ANN

An Artificial Neural Network (ANN) is an information processing entity, which is inspired by how

biological nervous systems process information [15]. The information processing system’s

structure is made up of many interconnected processing elements called neurons, working together

to solve problems. The structure to be configured, is specific to the application. Learning in

biological systems requires adjustments to the connections between the neurons [15].

An ANN is a highly simplified model of a Biological Neural Network. ANN is made up of an

interconnected process unit, which consists of a summing part and an output. The process unit

computes output according to N input values, weights and their sum (sum of the product of input

and corresponding weight). The weighted sum is the activation value on which the output is based

[15].

For pattern recognition tasks, interconnections are needed. To achieve the pattern recognition task,

many processing units are connected with particular topologies. These processing units get inputs

from an output of another process unit or from an external source. At each time, the output has the

unique value due to its unique weighted input values during computation. The activation value at
21

any particular instant is nothing but the set of N activation values of the network. Similarly, the

output at any particular instant is the set of N output values of the network [15].

During operation, each unit of ANN will get inputs from other units or externally from another

source. The activation value determines the output from the functional unit. A pattern is stored in

the network when an input is provided to the activation dynamics. To store a pattern, the weights

corresponding to the input connections are to be adjusted. A weight vector is the set of all weights

on all connections, which is nothing but the weight space [15]. Synaptic dynamics can be found by

the change in the weight space of the network.

There are three classical models of artificial neurons (processing units) namely, McCulloch-Pitts

Model, Perceptron and Adaline [15]. Neuronal dynamics govern every neural network’s operation.

Neuronal dynamics consist of 2 parts. The first one corresponds to the activation state and the

second to the synaptic weights. The short-term and long-term memory networks are modeled by

activation state of the network which correspond to an encoded pattern information in weights due

to learning [15]. The process of adjusting the weights to store the pattern is called learning. After

the learning process, the final set of weight values corresponds to the long-term memory function

of the network.
22

2.2. Implementation of Neural Networks in ECG Classification

A neural network is known as the MART, which is an abbreviation for multi-channel adaptive

resonance theory developed by Carpenter and Grossberg [3]. A computer-aided diagnosis system

is required in monitoring cardiac health status since it is difficult to understand and replicate the

ECG signals due to their nonlinear and nonstationary nature. MART performs a process where, the

weights are updated with each QRS. It is governed by on-line and supervised learning.

Artificial neural networks are nothing but pattern matching techniques. They can be used for

detecting morphological changes in non-linear signals like ECG signal. Selection of an optimal set

of relevant features plays a vital role in pattern classification [15]. Having the best pattern

classification technique is not enough to meet higher accuracy in pattern classification. The selected

features should be able to separate the classes up to a considerable extent, otherwise, they become

irrelevant. It is necessary to check the selected features for redundancy and irrelevancy. Even

though various methods can be used to extract different features from the same raw data, the role

of a feature extractor and a pattern classifier is equally important.


23

The flowchart below represents the different stages before feeding the signal to the pattern

recognition tool and pattern classification tool.

Figure 13: Flowchart for Pattern Recognition Method

2.3. Pattern Recognition

Pattern recognition is the study of how machines can observe the environment and analyze the

different patterns in order to categorize them into groups [15]. Even after 60 years of research, the

best pattern recognizers are humans, yet we do not understand how we recognize patterns [15]. Our

goal here is to use the best possible pattern recognition technique using artificial neural networks

in the best possible way to make decisions automatically.

The recognition problem is grouped as a classification, where the system designer defines classes

(supervised classification) or a categorization, in which patterns are learned, based on the similarity

between them (unsupervised classification). There are many applications such as data mining,

document classification, biometrics and organization and retrieval of multimedia databases. It plays

a crucial role in the data analysis and classification because of the rapid growth and availability of

computing power, while enabling faster processing of huge data sets. At the same time, due to high

performance requirements and immense database availability, demand for automatic pattern
24

recognition system increases. The design of a pattern recognition system involves the following

three aspects:

 Data acquisition and preprocessing,

 Data representation, and

 Decision making.

To perform pattern classification or clustering efficiently, the learning process is very important. It

involves updating network architecture, connections and weights. In addition to the existing feature

extraction and classification, Artificial Neural Networks (ANNs) provide a new technique of

nonlinear algorithms for efficient implementation. Learning process or training the network is an

important feature of the most pattern recognition systems. The four best known approaches for

pattern recognition [15] are:

 Template matching,

 Statistical classification,

 Syntactic or structural matching and

 Neural networks.

2.4. Architecture and Training Methods

Based on the connections of the network, ANNs are classified into two types:

 Feed-forward neural network,

 Recurrent neural network


25

In the feed-forward neural network, data flows forward from the input to the output as shown in

figure 14.

Figure 14: Feed-Forward Neural Network

Single-layer perceptron network is one of the simplest kind of feed-forward neural networks where

the inputs are directly fed to the output through a series of weights. The output obtained at each

node of a single layer network is the sum of products of the weights and the inputs [16]. The neuron

excites if the computed value is above the threshold (which is typically 0) and takes the activated

value (which is typically 1) else, it takes the deactivated value (which is typically -1). These neurons

with activation function are also called artificial neurons or linear threshold units [15]. The

term perceptron in this literature refers to networks consisting of just one of these units [16]. Single-

layer perceptron network is shown in figure 15.


26

Figure 15: Single-Layer Perceptron Network

In multi-layer perceptron network, each neuron of one layer is connected to another neuron of the

subsequent layer in a feed-forward way which results in multiple layers of computational units as

shown in figure 16. Among the various learning techniques, it uses the most popular technique

called back-propagation. Here, it computes the value of some pre-defined error-function by

comparing correct answers with output values [16].

Figure 16: Multi-Layer Perceptron Network


27

Recurrent Neural Networks (RNNs) form a cycle between units to create network states, enabling

the dynamic behavior. Figure 17 shows recurrent artificial neural network. RNNs use memory to

process random inputs [15]. RNNs find their application in handwriting and speech recognition.

Figure 17: Recurrent Artificial Neural Network

2.5. Learning Algorithms

As mentioned above, the process adjusting the weights is called learning and it is carried out using

algorithms like back-propagation techniques [15]. Depending on the application and architecture,

they may be supervised, unsupervised or reinforcement-based [15].

In supervised learning, set of inputs and outputs are given and the training algorithm will adapt the

weights in a way to produce an exact output corresponding to the input [15]. The network can

produce expected output for sample inputs, because of which, they are suited to model and control,

dynamic systems, hence they can differentiate noisy data, and predict events [17].
28

In unsupervised learning, ANN creates an algorithm by using variable features in the unlabeled

dataset [15] where the network is trained by varying inputs and finding a correlation between data

to classify it [17]. Neural Network toolbox has self-organizing, unsupervised networks. They are

competitive layers and self-organizing maps.

In reinforcement learning, weights are changed by considering environment support with respect

to the training algorithm. Neural Network toolbox supports various supervised and unsupervised

network architectures. Custom network architecture can be built using neural modular approach.
29

Chapter 3

RESEARCH METHODOLOGY

Automated ECG interpretation makes use of the artificial intelligence and pattern recognition

software knowledge to carry out the interpretation automatically, test reporting, and computer-

aided diagnosis of electrocardiogram tracings. The first automated ECG programs were developed

in the 1970s, during which the digital ECG machines also became practicable by third generation

digital signal processing boards and few commercial models developed by Hewlett-Packard,

assimilated these programs into clinically used devices [18]. In order to improve the accuracy

compared to first models, extensive research was carried out by universities during the 1980s and

1990s.

As discussed, the methods of classifying ECG signals involve various steps, including signal

acquisition, noise removal, QRS detection, feature extraction and most importantly, the artificial

neural networks techniques. In this project, the dataset for the classification of the ECG signal is

extracted from MIT-BIH database and fed as an input to the Neural Network Toolbox which further

classifies the ECG signals. We use the concept of Self-Organizing Maps (SOMs) which is also

known as Kohonen maps in order to categorize the given set of signals. It incorporates unsupervised

learning for categorization.

Neural network toolbox provides algorithms and functions to visualize and simulate neural

networks. It also includes auto encoder and deep learning algorithms for pattern recognition
30

techniques [19]. To speed up the training of large datasets, we can distribute computations and data

across multicore processor, computer clustering using parallel computing toolbox. The toolbox

contains functions for the creation, visualization, and analysis of Self-Organizing Maps [20]. The

features are used to classify input vectors according to the groups in the input space [17].

Neural network classification or clustering toolbox from the MATLAB is used in this study. Here

are the steps to be followed in the nctool (Neural Network Classification or Clustering Tool) in

order to classify the ECG signals.

Step 1: To classify patterns with Neural Networks, start the neural network GUI command – nnstart,

which gives a couple of options to work with ANN.

Figure 18: Neural Network Start Command Window


31

Step 2: Select the “Clustering app” to perform classification with nctool – Neural Network

Clustering Tool.

Figure 19: Neural network Clustering Tool (nctool) for Pattern Classification

Step 3: Click on the highlighted “Next” button to select the data to feed as an input to the tool. The

dataset to be loaded is obtained from MIT-BIH database as shown in figure 20.

Figure 20: Dataset Obtained from MIT-BIH Database [21]


32

Step 4: Load the dataset for classification. Click on the highlighted “Next” option. The selected

data is loaded.

Figure 21: Loading Data in the Neural Network Clustering Tool (nctool)

Step 5: Select the network size (number of neurons to train the network) as shown in figure 22. The

network has one layer where neurons are organized in a grid. The network can be created by

specifying the required number of rows and columns in the grid. For the first iteration, required

number of rows and columns are set to 5, which gives the number of neurons. The network

architecture is created by the tool for the specified number of neurons. To improve the functionality

of the network, the number of neurons of the network can be changed by navigating back to this

step.
33

Figure 22: Network Architecture

Step 6: Next, click on “Train” button to train the network in order to learn the topology and

distribution of the input samples. The performance depends on the number of neurons in the hidden

layer. Training multiple times generates different plots and outputs, as inputs and sampling change

each time. The number of epochs can be defined before training the network.

Figure 23: Training the Network in the Neural Network Clustering Tool (nctool)
34

Once the network is trained, various plot options are obtained in order to study the behavior of

the network as shown in figure 24.

Figure 24: Detailed Options of the Plots Obtained after Training the Neural Network.

At this step, a number of plots such as- Plot SOM Neighbor Distances (plotsomnd), Plot SOM

Sample Hits (plotsomhits), Plot SOM Weight Planes (plotsomplanes), Plot SOM Weight

Positions (plotsompos), SOM Topology (plotsomtop), Plot SOM Neighbor connections

(plotsomnc) are obtained.


35

Step 7: Next step is to evaluate the network as shown in figure 25, either with a new set of data or

increasing the performance by increasing the number of neurons (Go to Step 5).

Figure 25: Evaluation of the Obtained Network

Step 8: Then we deploy and save the results and obtain the code of the entire procedure followed

for classification using neural network clustering tool.

Figure 26: MATLAB Code Generation in the nctool


36

Step 9: Next step is to complete the training process and exit. The following window appears, where

simple and advanced scripts are generated.

Figure 27: MATLAB Simple Script and Advanced Script Generation


37

Chapter 4

RESULTS AND CONCLUSION

While investigating the work in chronological order we realized that there are various ways and

techniques through which the most accurate output can be obtained. Computerized detection and

classification of cardiac conditions is an active area of research. Though there are merits in the

implementation of ANN for pattern recognition and classification, it always gives sound results.

The automatic cardiac classification has a vast number of applications and may provide a

significant contribution to the implementation of other intelligent diagnostic systems. This

research provides a complete description of the procedure required in a system that categorizes and

classifies ECG signal depending on the abnormality.

The most important step in ECG signal classification is to detect and measure the peaks and

different waveforms which form the entire ECG signal. Various supervised and unsupervised

Artificial Neural Network models have been proposed for ECG signal feature extraction and

classification in the literature. Neural network clustering tool, based on self-organizing maps is

used in this paper to classify the ECG signals.

The various plots obtained for five neurons, meaning, a 5 * 5 two-dimensional map are as shown

in the following figures.


38

a) SOM Neighbor Distances (MATLAB function: plotsomnd): The distance between each neuron

and their associativity.

Figure 28: Plot of SOM Neighbor Distances

b) SOM Sample Hits (MATLAB function: plotsomhits): Representation of the classified input

vectors of each neuron and the relative number of vectors for each neuron via the size of colored

patch.

Figure 29: Plot of SOM Sample Hits


39

c) SOM Weight Positions (MATLAB function: plotsompos): Here we see that the neurons are

located at different positions when we train the network for the first time. This means that the

required value of the weight vectors is not assigned to the inputs at the first iteration. So,

training the network is necessary till the neurons get closer to the groups. Once the appropriate

weights get adjusted to the corresponding inputs, the response to the input space is very strong.

Figure 30: Plot of SOM Weight Positions

d) SOM Topology (MATLAB function: plotsomtop): Topology of the neurons.

Figure 31: Plot of SOM Topology


40

e) SOM Neighbor Connections (MATLAB function: plotsomnc): This plot gives us the

arrangement of the neurons with their neighbors.

Figure 32: Plot of SOM Neighbor Connections

f) SOM Weight Planes (MATLAB function: plotsomplanes): SOM weight planes give the plots

of weights with different inputs. Figure 33 shows the weight panel for each element of the input

vector. If two inputs are very similar, then we can assume that the inputs are highly correlated.

Figure 33: Plot of SOM Weight Planes


41

For SOM training, the weight vector attached to each neuron moves to the center of the cluster.

These cluster of input vectors along with the neurons gets organized in a structured manner. When

an n - dimensional data is fed as an input to the SOM, it organizes all the input data into different

classes.

Among all input data available, there will be an input which is a stimulus to the corresponding

winning (output) neuron. Depending on that particular input value, the output updates it's

displacement with other neurons and categorizes into groups. The minimization of the distance

means maximization of weights at the output [22].

Additionally, the neurons that are next to each other in the network topology also move close to

each other because of which we can interpret high-dimensional input space in the two dimensions

of the network topology [22].

From the MIT- BIH database, 16 sets of data were used for classification. Training the network for

different number of neurons and many iterations was analyzed.

Number of neurons is represented as n in the following cases.

Case1: n=5,

Case2: n=15,

Case3: n=25,

Case4: n=30 and

Case5: n=60.
42

Comparisons were made between different network topology plots for each case. In order to

classify the signals, one has to train the network until the required distribution of weights and the

required topology are obtained. Based on the neighboring distances, weight planes, and distribution

of weight vectors, we could classify the signals as normal or arrhythmic.


43

APPENDIX

MATLAB Code for Generation of the ECG Signal

Simple script generated according to the network.

% Solve a Clustering Problem with a Self-Organizing Map


% Script generated by Neural Clustering app
% Created 17-Nov-2016 08:04:14
%
% This script assumes these variables are defined:
%
% data - input data.

x = data;

% Create a Self-Organizing Map


dimension1 = 5;
dimension2 = 5;
net = selforgmap([dimension1 dimension2]);

% Train the Network


[net,tr] = train(net,x);

% Test the Network


y = net(x);

% View the Network


view(net)

% Plots
% Uncomment these lines to enable various plots.
%figure, plotsomtop(net)
%figure, plotsomnc(net)
%figure, plotsomnd(net)
%figure, plotsomplanes(net)
%figure, plotsomhits(net,x)
%figure, plotsompos(net,x)
44

Advanced script

% Solve a Clustering Problem with a Self-Organizing Map

% Script generated by Neural Clustering app


% Created 17-Nov-2016 08:05:49
%
% This script assumes these variables are defined:
%
% data - input data.

x = data;

% Create a Self-Organizing Map


dimension1 = 5;
dimension2 = 5;
net = selforgmap([dimension1 dimension2]);

% Choose Plot Functions


% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotsomtop','plotsomnc','plotsomnd', ...
'plotsomplanes', 'plotsomhits', 'plotsompos'};

% Train the Network


[net,tr] = train(net,x);

% Test the Network


y = net(x);

% View the Network


view(net)

% Plots
% Uncomment these lines to enable various plots.
%figure, plotsomtop(net)
%figure, plotsomnc(net)
%figure, plotsomnd(net)
%figure, plotsomplanes(net)
%figure, plotsomhits(net,x)
%figure, plotsompos(net,x)

% Deployment
% Change the (false) values to (true) to enable the following code blocks.
% See the help for each generation function for more information.
45

if (false)
% Generate MATLAB function for neural network for application
% deployment in MATLAB scripts or with MATLAB Compiler and Builder
% tools, or simply to examine the calculations your trained neural
% network performs.
genFunction(net,'myNeuralNetworkFunction');
y = myNeuralNetworkFunction(x);
end
if (false)
% Generate a matrix-only MATLAB function for neural network code
% generation with MATLAB Coder tools.
genFunction(net,'myNeuralNetworkFunction','MatrixOnly','yes');
y = myNeuralNetworkFunction(x);
end
if (false)
% Generate a Simulink diagram for simulation or deployment with.
% Simulink Coder tools.
gensim(net);
end

Waveform Obtained - ECG signal

Figure 34: ECG waveform obtained using MATLAB


46

REFERENCES

[1] Omics International. “Electrocardiography”. [Online]. Available:

http://research.omicsgroup.org/index.php/Electrocardiography. [Accessed: June 2016].

[2] ECG basics. [Online]. Available:

http://www.lww.com/opencms/opencms/PEMR/content/WCZ623/ECG_Strip_Ease_p30_

-_558302.pdf [page 12 - 13] [Accessed: June 2016].

[3] Computerized Detection and Classification of Five Cardiac Conditions By George Qi

Gao. [Online]. Available:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0ahUKE

wjY9NHPw6fQAhVjylQKHcoBCEMQFggsMAM&url=https%3A%2F%2Fptop.only.wip.la%3A443%2Fhttps%2Fxa.yimg.co

m%2Fkq%2Fgroups%2F16244888%2F105180463%2Fname%2FGaoQ.pdf&usg=AFQj

CNG52jcFFUVq8_l801qdSuNxlKZPng&sig2=RTg1u8RecyGVXWhrSqV7JQ&bvm=bv

.138493631,d.cGw&cad=rja. [Accessed: September 2016].

[4] Gambar. “Human Heart Outline HH001 References of Human Heart”. [Online].

Available: http://www.healthsanaz.com/human-heart-outline-hho01.html. [Accessed:

October 2016].

[5] Scribd. “ECG”. [Online]. Available: https://www.scribd.com/document/55880997/ECG.

[Accessed: June 2016].

[6] Cardionetics. “Introduction to the ECG”. [Online]. Available:

http://www.cardionetics.com/ecg-durations [Accessed: August 2016].


47

[7] Studyblue. “Cardiovascular”. [Online]. Available:

https://www.studyblue.com/notes/note/n/cardiovascular/deck/13827179 [Accessed:

October 2016].

[8] ECG Learning Center. “The Standard 12 Lead ECG”. [Online]. Available:

http://ecg.utah.edu/lesson/1#ecgwaves. [Accessed: October 2016].

[9] A.B. Ramli and P.A. Ahmad, “Correlation analysis for abnormal ECG signal features

extraction” in Telecommunication Technology, 2003. NCTT 2003 Proceedings. 4th

National Conference [Accessed: August 2016].

[10] Pawel Tadejko and Waldemar Rakowski “Mathematical Morphology Based ECG Feature

Extraction for the Purpose of Heartbeat Classification” in Computer Information Systems

and Industrial Management Applications, 2007. CISIM '07. 6th International Conference

[Accessed: October 2016].

[11] NCBI. “ECG QRS complex detection using slope vector waveform (SVW) algorithm”.

[Online]. Available: https://www.ncbi.nlm.nih.gov/pubmed/17271069. [Accessed:

September 2016].

[12] B. Castro, D. Kogan and A.B. Geva “ECG feature extraction using optimal mother

wavelet” in Electrical and Electronic Engineers in Israel, 2000. The 21st IEEE Convention

[Accessed: October 2016].

[13] K.Zhu, P.D.Noakes and A.D.P.Green “ECG Monitoring with artificial neural networks” in

Artificial Neural Networks, 1991. Second International Conference [Accessed: October

2016].
48

[14] The comparison of different feed forward neural network architectures for ECG signal

diagnosis. [Online]. Available:

https://www.researchgate.net/publication/7642798_The_comparison_of_different_feed_f

orward_neural_network_architectures_for_ECG_signal_diagnosis. [Accessed: October

2016].

[15] B.Yegnanarayana “Artificial Neural Networks”, New Delhi: Prentice Hall of India

Private Limited, 2005, pp [15-35].

[16] Wikipedia. “Feedforward Neural Network”. [Online]. Available:

https://en.wikipedia.org/wiki/Feedforward_neural_network. [Accessed: October 2016].

[17] MathWorks. “Neural Network Toolbox”. [Online]. Available:

https://www.mathworks.com/products/neural-network/features.html#network-

architectures. [Accessed: October 2016].

[18] Wikipedia. “Automated ECG interpretation”. [Online]. Available:

https://en.wikipedia.org/wiki/Automated_ECG_interpretation. [Accessed: July 2016].

[19] MathWorks. “Neural Network Toolbox”. [Online]. Available:

https://www.mathworks.com/products/neural-network/. [Accessed: September 2016].

[20] Self-organizing map in Matlab: the SOM Toolbox. [Online]. Available:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.97.179&rep=rep1&type=pdf.

[Accessed: October 2016].

[21] Physionet. “PhysioBank ATM”. [Online]. Available: http://www.physionet.org/cgi-

bin/atm/ATM. [Accessed: June 2016].


49

[22] MathWorks. “Cluster Data with a Self-Organizing Map”. [Online]. Available:

https://www.mathworks.com/help/nnet/gs/cluster-data-with-a-self-organizing-map.html.

[Accessed: October 2016].

You might also like