Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
4.1 Introduction
Automatic ECG analysis is basically aiming towards automatic classification of different cardiac events or
in other words the occurrence of pathological conditions in heart. Research on techniques to recognize and
classify the ECG on a stored database like Holter ECG analysis or detection on real-time basis are
accelerated with the development of modem high-end computers and different software tools.
Classification depends on a basic fact that ECG pattern takes different morphology in different cardiac
disorder. Hence there is a change in the time or amplitude features in ECG waveform. For this reason
almost all kinds of classifiers are based on the features. The general scheme for automatic classification is
represented by block diagram in figure 4.1.
85
Classification ofECG signals chapter 4
Though the block diagram is self explanatory, still it is worthwhile to mention that computerized ECG
classification is an algorithmic procedure where feature set selection and extraction is of immense
importance as classifier solely depends on the accuracy of the features.
It is worthwhile to mention that there is definitely a change of ECG pattern in most of cardiac abnormalities
with respect to the normal beats. This variation in ECG rhythm can be divided into two categories -
variation that does not change periodicity of ECG and variations that alters the signal by making it non
periodic. Myocardial Infarction is one of the examples of diseases of first kind and Cardiac Arrhythmia,
Arterial Fibrillation, Ventricular Fibrillation etc. are the examples of second type.
It is not possible to work with all possible kinds of cardiac abnormalities in the scope of this thesis, but one
is each category of ECG pattern is considered here for generality. In this chapter three different
classification techniques are discussed for the two different types of cardiac abnormalities. Section 4.2
presents the method of detection of Myocardial Infarction (MI) using supervised classification technique, in
section 4.3 the method of binary coding based logical classifier for arrhythmic beats detection is discussed
and the classification technique for Premature Ventricular Contraction (a special pattern generated by
ventricular arrhythmia) using Artificial Neural Network is elaborated in section 4.4.
Vectors constructed from similar objects are expected to form a cluster. For efficient pattern classification,
accurate pre-processing of the signal and feature extraction is very essential. The following sections explain
the supervised classification method and its application for MI detection.
86
Classification ofECG signals chapter 4
Figure 4.2 shows the possible pathological changes in ECG pattern due to MI. Any one of these or more
may occur during MI. Thus a MI classifier based on features requires the following parameters to be
detected:
• Q onset
• Q peak
• R onset
• R peak
• ST segment onset
• ST segment end
• T wave onset
• T wave end
• T wave direction
• T wave shape
The required features are pictorially depicted in figure 4.3.
87
Classification of ECG signals chapter 4
88
Classification ofECG signals chapter 4
Any error in extraction of these features may misclassify the ECG pattern and more number of features
leads to rather complicated classifier which involves more computational cost and time. In view of this
intuitive feature minimization is made. It is noticed that all the irregularities noticed in MI are confined in
the Q onset to T end section of ECG. So signal complexity of this section can be treated like a figure of
merit of the condition of heart. In other words ‘form factor’ of QT segment is calculated along with the
same of a complete wave between two consecutive R peaks. Thus the numbers of required features are
reduced as mentioned below:
signal. It is an indication of the variance of signal activity. Activity of a signal x(n) is calculated as the
variance ax2 of the stipulated segment of the signal. From the activity of the signal, mobility Mx is
calculated as the ratio of square root of the activity of the first derivative of the signal and Square root of
the original signal. Thus
Mv=(-i)1/2
(4.2)
<T <7
FF = (4.3)
CTr. / Cx
89
Classification ofECG signals chapter 4
where X = (x,, x2, x3xn, 1)T is the feature vector which is augmented by an additional entry equal
to unity and W = (w,, vv2, w,wn, vv’)Hl)' is the augmented weight vector corresponding to the
feature vector.
For a general M class pattern classification M number of decision functions are required such that,
> 0 if X £ C,.
dj(X) = W‘X (4.5)
< 0 otherwise
where Wi = (wn, wi2, Wriwjn, W(. n+I)' is the weight vector for class Ct.
Three cases may arises in solving this problem [16].
CASE 1:
Each class is separable from the rest by a single decision surface:
90
Classification ofECG signals chapter 4
CASE 2:
Each class is separable from all other classes individually by a distinct decision surface, i.e., the classes are
M(M —1)
pair-wise separable. There are------ ------- decision surfaces given by,
[dQ{X)=-d„{X)\
CASE 3:
There exists M decision function dk (X) = Wk X, k = 1,2,3,.... ,M , with the property that,
if d,(X) > d,(X) V j i, then X e Cf (4.8)
This is a special instance of case 2. It can be defined that,
Figure 4.5: Two dimensional feature vectors of two classes Cl and C2 along with the
decision function d(x)
91
Classification ofECG signals chapter 4
If the classes are separable under case 3, they are separable under case 2 but the reverse is not true, in
general.
Patterns which are separable by linear decision functions as described above are called linearly separable.
But infinite numbers of complex decision functions may be formulated using generalized discrimination
function based on nonlinear functions of feature vectors.
In present case the disease MI is classified against the normal ECG beats, thus the classification is done
within two possibilities. A two-class pattern classification problem may be represented as,
> 0 if X e C,
d(X) = WrX (4.10)
<0ifXe C,
where C] and C2 represent the two classes. The discriminant function may be interpreted as the boundary
92
Classification of ECC signals chapter 4
4.2.5.2 Training
To make the detection convenient and less time consuming two features are detected-form factor of RR
section and form factor of QT section of an ECG wave. The steps of computation of decision function are
given below:
1. The prototype feature vectors or the mean feature vectors are calculated from the normal and MI data
from training set. It is the mean value of the feature vectors of each class. For the training data set
considered here, the prototype vectors are (1.505, 1.064) and (1.305, 1.088) for Myocardial Infarction
group and normal group respectively.
2. The equation of the straight line joining the two prototype vectors is computed. The normal bisector of
this line is the optimal Mnear decision function.
93
Classification ofECG signals chapter 4
4.2.5.2 Testing
Figure 4.7: Feature vector space for test database [ ‘o’ stands for normal and **’ stands for MI]
The proposed classification rule for identification of myocardial infarction is tested and validated against
95 databases taken from same source, among which 50 are normal and 45 are infarcted. 175 beats are
considered from the databases for testing where 100 and 75 beats are from normal and MI categories
respectively. Feature vectors are calculated for all the samples using the form factor value of RR interval
and QT interval as mentioned in the earlier section. The decision rules as in equation 4.12 are applied to the
94
Classification ofECC signals chapter 4
feature vectors of unknown samples for testing and the beats in the signals are automatically classified as
normal or MI. The feature vector space and the decision boundary are shown in figure 4.7.
TABLE 4.1: PARTIAL LIST OF FORM FACTOR VALUES FOR RR AND QT INTERVALS
Database and Form Factor Values
Serial No.
Patient id FF of RR FF of QT
1 Patientl22s312 1.3211 1.123
2 Patient 180s490 1.2736 1.2165
3 Patientl98s402 1.2921 1.1468
4
N Patient! 85s336 1.3056 1.1252
5 0 Patient 174s300 1.2924 1.1133
6 R
Patient236s462 1.3086 1.1.38
M
7
A Patient235s461 1.205 1.189
L
8 Patient276s504 1.1937 1.3058
9 Patient239s467 1.3549 1.1783
10 Patient237s465 1.285 1.1224
1 Patient35s 124 1.4679 1.0322
2 Patient36s 111 1.5115 1.0252
3 Patient41sl32 1.6501 1.0393
D
4 Patient46sl56 1.6812 1.0698
I
5 S Patient25s 150 1.6919 1.0447
95
Classification ofECG signals chapter 4
.Figure 4.7 clearly depicts that the normal ECG and myocardial infarcted ECG are well separated by the
proposed classification method. It is noticeable that the classification accuracy solely depends on Form
Factor values which in turn depend on feature extraction accuracy. Figure 4.7 further shows that among all
95 databases under test only two normal beats and three MI beats are misclassified by the proposed
supervised learning based decision function. In view of this three performance indexes are used as
sensitivity, specificity and accuracy.
TP + TN
Accuracy (%) = ----------------------------- X100%
TP + FN + TN + FP
where TP stands for true positive, TN for true negative, FP stands for false positive and FN stands for false
negative. Definition of sensitivity and specificity are already given in section 3.4.5. Table 4.2 shows the
performance parameter values.
It is seen that the detection parameters are moderately good for the small group of training and testing
dataset. Table 4.1 indicates that the use of Form Factor of the stipulated segment of signal as a
classification parameter enables the classifier to handle less number of feature; thereby making it fast and
simple. Classification parameters as indicated in table 4.2 are found satisfactory for the two class
classification. It is expected to get better result with larger data set. As the periodicity of ECG signal is
96
Classification of ECC signals chapter 4
retained in MI, the beats from a particular subject within a specific interval are expected to be similar,
hence more beats from the same subject is not considered.
97
Classification of ECG signals chapter 4
k i| fll n J
.
Figure 4.8: Normal, PVC, Paced and BBB beat morphology
k
The cardiac impulse propagates from the AV node to entire ventricular region through the Bundle of His. It
is divided into right and left bundle branches. The right and left ventricles contract almost simultaneously
when the right and left bundle branches function normally. When the bundle branch is camaged due to any
heart disease or cardiac surgery, it cannot carry the impulse properly resulting a slow rate of propagation
and/or a different pathway for the impulse. Thus bundle branch block (BBB) alters the normal and
directional propagation of electrical impulse in the two ventricles. Right bundle branch block (RBBB)
slows or ceases the conduction in right ventricle and LBBB does the same for left ventricle. Though RBBB
has no appreciable medical significance, LBBB can be treated as an indication of underlying cardiac
abnormalities like coronary artery disease, arterial valve disease, cardiomyopathy etc. So it is required to
detect the BBB as it originates. Longer QRS duration and prolonged ventricular activation time or QR
interval confirms the presence of BBB.
Paced beats are artificial beats generated by pacemaker. A pacemaker is an external pace setter for hearts
with extremely slow heart rate. Slow heart rate is mostly due to the blockage in arteries in cardiac
conduction system and it may lead to weakness, fainting, breathlessness and death. Typical morphology of
normal, PVC, Paced and BBB beats are shown in figure 4.8.
98
Classification ofECC signals chapter 4
60
HR = (4.15)
RtoR
where RtoR stands for the time interval between two consecutive R peaks.
PVC beats appear much earlier than the normal beats and thereby abruptly increases the heart rate. So heart
rate change is a measure of PVC beats.
99
Classification ofECG signals chapter 4
• Presence of R’Peak
R’ peak is a sharp notch near the R peak in the QRS complex. Presence of R’ peak is a definite indication
of BBB. It may appear in either QR or RS sector of QRS complex. As QR and RS sectors are more or less
constant slope regions, so any change in the direction of slope is predictive of the presence of R’ peak. As
the element by element difference is approximately the slope of an equi-sampled digitized data, change in
the sign in difference value and persistence of the same for a stipulated time intervals for 4 samples
indicates the occurrence of R’ peak.
QR
measured. ----- ratio is the ratio between the OR duration and RS duration. S length is measured as the
RS
magnitude of the peak from the zero potential line.
4.3.2.1 Coding
As normally the feature set is non-stationary and has a wide variation for same type beats and obviously
for different type beats also, it is very difficult to deal with the features directly. For example, PVC beats
have a completely different pattern and different PVC beats show different morphology too. But fortunately
there are some typical values for the features for different categories though they are not fixed. So here a
code is generated depending on the probable feature values. The code is formed by 5 binary bits and stands
for the signature of a beat. Each bit or a combination of two bits represents a feature as extracted earlier.
100
Classification ofECG signals chapter 4
Coding makes the classification easier. The method of assigning a code to a feature is explained below and
also pictorially represented in figure 4.9.
1) It is experimentally seen that as signal complexity is high for PVC beats, the value of FF for PVC
beats is completely different and larger from the other test beats. So it is a measure of the presence of PVC
beat. For confirmation the heart rate is calculated which is higher than the normal or any other beats. So if
FF value is greater by a predetermined value iVl than that of its earlier beat and if heart rate change is
more than a predetermined value N2 for the same pair of beats, than D4 is set to 1, or it is 0.
2) D3 beat stands for the R’ feature. The presence of R’ peak corresponds to D3 = 1, otherwise it
is 0.
3) D2 and D\ are collective bits. It is related to QRS duration as follows:
4) If QRS _ duration <= H1 then D\ = 0, D2 = 0
It is noticed that the QRS duration for BBB beats and that for paced beats are more than the normal QRS
duration. Hence this coding will be helpful for classification of the test beats other than PVC beats. H1 and
101
Classification ofECG signals chapter 4
H2 are experimentally determined constants based on QRS complex duration and their values are shown in
figure 4.10.
QRS DURATION
QR
7) If ratio is greater than a certain value M or if S wave height is more than L then DO = 1,
RS
otherwise it is 0. This bit is related to BBB beats.
4.3.22 Classification
The technique for classification of different arrhythmic beats is illustrated in figure 4.11. Intuitively the
arrhythmias are classified based on the values of the features, in turn, depending upon the status of the code
bits. The PVC beat is identified first. As mentioned earlier, PVC beat is classified based on FF value and
heart rate. Both of these parameter abruptly changes at the onset of PVC beats and thus it is detected by a
simple if —elsebased rule. For two consecutive PVC beats, this change is not possible to occur. In that
case individual FF value for each beat should exceed a certain predetermined value. Experimentally it is
seen that this value should be 1.2. If any of these conditions occur, D4 is set at 1 which indicates the test
beat to be a PVC type irrespective of other bits.
If D4bit status is 0 then bit D3 is checked. A complete BBB generates a sharp notch like R’ peak in the
QRS section. As D3 bit is assigned with this feature, a 1 in D3 bit indicates the presence of complete
BBB. But the presence of R’ peak is not mandatory in BBB. So further inspection is required for detection
incomplete BBB or BBB without R’ peak as discussed later in this section.
102
Classification ofECC signals chapter 4
Next the status of bits D2 and D\ are checked collectively. It deals with the QRS duration feature.
Normal beats have the minimum value of QRS duration among all the test beats considered here. It is
followed by BBB with paced beat having the largest duration of QRS complex. Depending upon this
feature normal and paced beats are separated with lower and higher range of QRS duration for normal and
paced beats respectively and middle one is for BBB as shown in the figure 4.10. The values of HI and H2
are also indicated in the figure.
103
Classification ofECG signals chapter 4
Some BBB beats may not have R’ peak but there QRS duration is longer than the normal along with a
larger RS section and S height. If any of these features is present, DO bit status is high indicating a BBB
beat without R’ peak. For longer S wave, obviously the RS section will be longer than QR section and
QR
hence----- ratio should be less than unity for BBB beats.
RS
TP
Positive Predictivitv (Pp%)=-------------Xl00%
‘ TP + FP
Other performance parameters are already defined in sections 3.4.5 and 4.2.6.
The efficiency of the proposed method depends on the accuracy of feature extraction as the features form
the status word. Verification of five bit status word is made bit by bit starting from the ltft side. As each bit
is set to 1 depending upon a specific feature condition, there is no scope of overlappirg of decision. For
104
Classification ofECG signals chapter 4
example, when heart rate and form factor value abruptly changes, D4 bit is set which specifically indicates
the occurrence of PVC beat. Thus when the next bit is checked for a 0 in D4 bit, there is no possibility of
having any PVC beat. In this way, the proposed algorithm reduces the probability of misclassification.
An artificial neural network based approach can also be proposed using the feature values. In that case the
input is to be made with the extracted feature set and a training and testing based algorithm can be proposed
with four standard output neuron for four kinds of arrhythmic beats. Two output neuron can also be
proposed. But the application of neural network may make the classification a time consuming one because
of its complicated mathematical approach. For clinical purposes the response time of the method should be
such that the arrhythmic beats can be classified as early as possible.
Moreover, table 4.4 shows the comparison of proposed method with some standard method for PVC
detection based on the proposed performance parameters. In the PVC beats the wave shape is modified to
an unknown manner. So a form factor based approach is proved to be promising since it deals with signal
complexity.
TABLE 4.4: COMPARISON OF PROPOSED PVC BEAT DETECTION METHOD WITH SOME
STANDARD TECHNIQUES
Detection Technique Method Performance Parameter
It shows that the proposed method is comparable to the other reported works.
Instead of if —else based rules formation, ANN based classification method can also be used. In this case
as the inputs are in binary mode, the neural network should be a fixed weighted ANN.
105
Classification ofECG signals chapter 4
106
Classification ofECG signals chapter 4
A neural network is a parallel-distributed processor with a natural tendency and ability for storing
experimental knowledge and to make it available for use. It is similar to the brain in two respects:
(i) Knowledge is acquired by the network through a learning process.
(ii) Inter-neuron connection strengths known as synaptic weights are used to store the knowledge.
A neural network can be trained to perform on a particular leading to a specific target output as shown in
figure 4.12. Here the network is adjusted based on the comparison of the output and the target until the
network output matches the target. Typically many such input/target pairs are used to train a network in this
supervised learning process.
The simplest Neural Network is a single layer perceptron which can decide whether an input belongs to one
of two possible classes. The model of simple neuron is shown in figure 4.13.
Alike the biological phenomena, neuron processes the inputs which arrives at the dendrites and transmits
the resulting output to other connected neurons using its axons. The classical biological explanation of this
processing is that the cell carries out the summation of the incoming signals on its dendrites. If this
summation exceeds a certain threshold the neuron responds by issuing a new pulse which is propagated
along the axon. If the summation is less than the threshold, the neuron remains inactive. This output passes
through a nonlinearly called a transfer function.
107
Classification ofECG signals chapter 4
(4.13)
i=l
and
°j=f(Uj-Tj) (4.14)
Here the signal X at the input of synapse i connected to the neuron j is multiplied by the synaptic
weight Wy.
The activation function or the transfer function modifies the output as per the type of the function used.
Linear, Log-sigmoid, Tan-sigmoid etc. are the most popular transfer functions.
Development of a classifier involves first the choice of an appropriate classifier model and then the use of a
suitable training algorithm to train the network for the specific patterns of data. Finally the test data set can
be used to check the performance of the network for the specified classes.
Table 4.5: SPECIFICATION OF USED ANN
Network Information Command Description
Network type —
Feed-forward back propagation
Training function trainlm Levenberg-Marquardt back-propagation rule
Adaptation learning function learngdm gradient descent with momentum weight and bias
learning function
Transfer function purelin Linear transfer function
Performance function —
Mean square error
108
Classification of ECG signals chapter 4
crossing point of the denoised wave after or before the R peak can be treated as the measurement reference.
Thus the required features are,
• Form factor of RR segment
• R peak height from zero reference
4.4.2.2 Training
More than 350 beats of both classes are used to train the network. For two input features, the ANN should
have two input neurons. First the input and outputs are normalized with respect to their maximum values as
it is observed that the neural networks work better if the input and outputs lie between 0 and 1. The weights
connecting the input neurons and hidden neurons and the weights connecting the hidden neurons and output
neurons are initialized between 0 and 1. One set of inputs and outputs are used as training data. By using
linear activation function, the output of the input layer may be evaluated. The inputs to the hidden layer are
calculated by multiplying corresponding weights of synapses. Then the inputs to the output layer by
multiplying corresponding weights of synapses. Output layer units evaluate the output using linear
activation function. The error as the difference between the network output and the desired output is
calculated. Lastly adjustments in the weights are made until the error (MSE) reaches the desired level with
allowable tolerance value.
4.4.2.3 Testing
Once the network is trained, it is ready for classification of unknown beats. 136 beats are used for testing in
which 86 are normal and 50 are PVC beats. The results are shown in the next section.
109
Classification ofECG signals chapter 4
Experimental study further shows that only two (one normal and one PVC) are misclassified among all 136
test beats as shown in figure 4.14. Here the occurrence of two M’s represents the misclassification in terms
of normalized mean square error and all other positions indicate accurate classification. In view of this,
performance parameters are calculated as in table 4.7.
110
Classification ofECG signals chapter 4
Thus it is seen that the proposed classification technique is efficient in terms of detection parameters. In
this case also the use of FF makes the classification work simpler.
4.5 Conclusion
In this chapter different solutions for ECG classification based on the application of preliminary supervised
learning method, neural networks and a novel binary logical classifier is discussed. The recognition and
classification of patterns require a set of well defined features which accurately characterize the patterns in
order to enable their class differentiation. The feature set is required to be accurate for proper classification,
which in turn requires efficient pre-processing of the signal. Here ECG enhancement is done using time-
frequency based approach as explained in chapter 2 and 3. This method can retain all the temporal and
spatial information intact as described in the respective chapters. Broadly two different types of cardiac
abnormalities are considered for identification - myocardial infarction which retains the periodicity ofECG
signal and cardiac arrhythmia which makes ECG non-periodic. Both diseases are individually fatal to the
health of the person having the disease; moreover, situation worsens to a higher degree if one is
accompanied by the other.
In section 4.2 a feature index based Myocardial Infarction classification algorithm is presented. MI is a
coronary artery disease which is characterized by Q wave duration and amplitude, T wave direction and
amplitude, and ST segment morphology in ECG signal. It is not a very easy task to correctly extract all the
features for different leads and find a unique decision function based on a number of features. In this
proposed method, only R to R wave and QT wave segments are required which reduces the task of
extracting a number of features. Hence there is a less probability of errors that may occur in various
duration and amplitude measurements. Moreover, form each wave segment Form Factor is calculated
which generates a representative feature vector for each ECG pattern. So the ECG pattern is thus
represented by a specific vector in the vector space. This simplifies the decision making process.
Furthermore, the proposed algorithm could be expected to offer faster implementation than other feature set
based algorithm because of less complexity and less data involvement.
Ill
Classification ofECG signals chapter 4
Premature ventricular contraction (PVC) is a special type of ventricular arrhythmia (VA) in which the wave
shape alters abruptly. In section 4.3 a specialized ANN based approach is proposed for PVC detection. VA
evolve from premature ventricular contractions which are in most situations leads to ventricular tachycardia
(VT) and finally to critical ventricular fibrillation episode. It is potentially fatal and the main cause of
sudden cardiac death. PVC beats are morphologically different from the normal one in terms of different
temporal and spatial features. In this case also the calculation of form factor gives the complexity variation
of the entire wave due to PVC. Moreover, R wave amplitude also gets a remarkable change in PVC. So
these two features can be identified as two inputs in an ANN based classification method. This approach
also reduces the need of features and thus error and complexity in classification due to error in feature
extraction, if any.
A simpler technique for arrhythmic beat classification is proposed in section 4.4. As arrhythmia may be
fatal to a person having some critical cardiac condition, the detection of arrhythmic beats at the instant of
its occurrence is very important. Here the proposed method addresses a technique of classification of PVC,
BBB, Paced beats along with normal beats. Almost all beat or disease classification works are feature
extraction based. Extracted features are fed to a pre-developed classifier which may be based on ANN,
SVM or other. In this work an intermediate step for coding is proposed. Actually arrhythmic beats have
different textures with respect to the normal and different kind of arrhythmia causes different morphology
of beats. A specific feature or a set of features are combined together to generate a specific bit representing
a particular morphology of beat. Thus a sequential beat identification results in arrhythmic beat
classification. As the method does not require any complicated classifier, it can identify the presence of an
arrhythmic beat at the time of its onset. This method is highly applicable in case of quick reference of
arrhythmic beats in standalone cardiac monitoring systems. A fixed weight ANN can also provide fast
response with the proposed binary beat status word as input. Since the binary coding depends upon the
value of the features, the performance of the proposed method depends upon the accuracy of the feature
extraction. Comparison of the present method with some reported works (table 2) for PVC detection shows
the effectiveness of the proposed algorithm. Comparison of this method for detection of other arrhythmic
beats considered here is not made due to lack of reported works. Anyway, it shows appreciable result for
other arrhythmic beats as per the performance parameters are concerned. Moreover, being driven by binary
logic, the proposed algorithm has the potential to be implemented in hardware by simple digital logic.
112