Ischemia episode detection in ECG using kernel density estimation, support vector machine and feature selection

Background Myocardial ischemia can be developed into more serious diseases. Early Detection of the ischemic syndrome in electrocardiogram (ECG) more accurately and automatically can prevent it from developing into a catastrophic disease. To this end, we propose a new method, which employs wavelets and simple feature selection. Methods For training and testing, the European ST-T database is used, which is comprised of 367 ischemic ST episodes in 90 records. We first remove baseline wandering, and detect time positions of QRS complexes by a method based on the discrete wavelet transform. Next, for each heart beat, we extract three features which can be used for differentiating ST episodes from normal: 1) the area between QRS offset and T-peak points, 2) the normalized and signed sum from QRS offset to effective zero voltage point, and 3) the slope from QRS onset to offset point. We average the feature values for successive five beats to reduce effects of outliers. Finally we apply classifiers to those features. Results We evaluated the algorithm by kernel density estimation (KDE) and support vector machine (SVM) methods. Sensitivity and specificity for KDE were 0.939 and 0.912, respectively. The KDE classifier detects 349 ischemic ST episodes out of total 367 ST episodes. Sensitivity and specificity of SVM were 0.941 and 0.923, respectively. The SVM classifier detects 355 ischemic ST episodes. Conclusions We proposed a new method for detecting ischemia in ECG. It contains signal processing techniques of removing baseline wandering and detecting time positions of QRS complexes by discrete wavelet transform, and feature extraction from morphology of ECG waveforms explicitly. It was shown that the number of selected features were sufficient to discriminate ischemic ST episodes from the normal ones. We also showed how the proposed KDE classifier can automatically select kernel bandwidths, meaning that the algorithm does not require any numerical values of the parameters to be supplied in advance. In the case of the SVM classifier, one has to select a single parameter.

http://www.biomedical-engineering-online.com/content/11/1/30 Background Coronary artery disease is one of the leading causes of death in modern world. This disease mainly results from atherosclerosis and thrombosis, and it manifests itself as coronary ischemic syndrome [1].
When a patient experiences coronary ischemic syndrome, his or her electrocardiogram (ECG) shows some peculiar appearances. Each segment of ECG can be divided into P, Q, R, S and T waves as shown in Figure 1 where QRS complex and T wave represent ventricular depolarization and repolarization, respectively. In most cases of normal ECG, the ST segment has the same electric potential as the PR segment. When myocardial ischemia is present, however, the electric potential of the ST segment is elevated or depressed with respect to the potential of the PR segment [1,2]. When ischemia occurs, the PR segment is altered, or the ST segment deviates from normal level. If the PR segment moved instead of the ST segment, this looks as if the ST segment itself were modified. This is because the PR segment provides a kind of reference voltage level [1].
The ST segment deviation is mainly due to injury current in myocardial cells [1]. If the coronary artery becomes blocked by blood clot, some myocytes are affected to be unresponsive to depolarization, or to repolarize earlier than adjacent myocytes. In this case, voltage gradient can occur in the myocytes, and this comes to appear as ST-segment deviation in ECG [1]. Figure 2 shows two cases when the voltage level of the ST segment deviates from its normal position. The left column of the figure shows the distribution of electric charges around myocytes when the heart is in resting state. This is related to the PR segment in ECG. The right column shows the distribution of electric charges right after the ventricles contracted. This is related to the QRS complex and the ST segment in ECG. The shaded region represents the area being affected by myocardial ischemia. In the case of the upper row in Figure 2, there is no voltage gradient at first. After the ventricles contracted, however, the voltage gradient comes to appear because the injured area did not respond to electric depolarization. In the second case of the bottom row, there is no voltage gradient right after the ventricles contracted. In the left figure, however, there was initial voltage gradient, and this makes the PR segment to be modified. The PR segment acts as a reference voltage level when we judge whether the ST segment deviated from normal position. The modified PR segment makes us conclude that there was a ST segment deviation [1].  [1]. Left column shows distribution of electric charges before the ventricles contracts. The right column shows the charge distribution after the ventricles contracted. Shaded area represents that the area was affected by ischemia.
There are several approaches to detect ischemic ST deviations. Some researchers used the entropy. Rabbani et al. used the fact that signal perturbation of normal people is lower than the perturbation of ischemic patients. They computed entropy measure of wavelet subband of ECG signal, and classified the ECG by examining which signal exhibited a more chaotic perturbation [3]. Lemire et al. calculated signal entropy at various frequency levels. They computed the entropy in each wavelet scale [4]. Some used adaptive neurofuzzy inference system. Pang et al. used Karhunen-Loève transform to extract several feature values. They classified ECG signal by an adaptive neuro-fuzzy inference system [5]. Tonekabonipour et al. used multi-layer perceptron and radial basis function to detect ischemic episode. They classified ECG signals by adaptive neuro-fuzzy network [6]. There are many papers which used artificial neural network. Stamkopoulos et al. used nonlinear principal component analysis to analyze complex data. They classified ECG signal by radial basis function neural network [7]. Maglaveras et al. used neural network optimized with a backpropagation algorithm [8]. Afsar et al. used Karhunen-Loève transform to find feature values, and classified an input ECG by using a neural network [9]. Papaloukas et al. used artificial neural network which was trained by Bayesian regularization method [10]. There are papers studied some other approaches. Bulusu et al. determined morphological features of ECG, and classified the ECG data by support vector machine. Andreao et al. used hidden Markov models to analyze ECG segments. They detected ischemia episode by using median filter and linear interpolation [11]. Faganeli and Jager tried to distinguish ischemic ST episode and non-ischemic ST episode caused by heart rate change.
To this end, they computed heart rate values, Mahanalobis distance of Karhunen-Loève transform coefficients and Legendre orthonormal polynomial coefficients [12]. Exarchos et al. used decision tree. They formed decision rules comprising specific thresholds, and developed a fuzzy model to classify ischemic ECG signals [13]. Garcia et al. considered root mean square of difference between the input signal and the average signal composed http://www.biomedical-engineering-online.com/content/11/1/30 of first 100 beats. They adopted an adaptive amplitude threshold to classify ECG signal [14]. Murugan and Radhakrishnan used ant-miner algorithm to detect ischemic ECG beats. They calculated several feature values such as ST segment deviation from input ECG signal [15]. Bakhshipour et al. analyzed coefficients resulted from wavelet transform. They examined the relative quotient of the coefficients at each decomposition level of the wavelet transform [16].
We approached this problem by extracting feature values from a ECG waveform. We first found time positions of QRS complexes, and then determined values of the three features. We calculated the feature values for each heart beat, and averaged their values in five successive beats. After that, we classified them by the methods of kernel density estimation and support vector machine.
We showed techniques of removing baseline wandering and detecting time positions of QRS complexes by discrete wavelet transform. With these explicit methods of dealing with ECG, we could discriminate ischemic ST episode from normal ECG. We did not adopt implicit methods such as artificial neural networks or decision trees, because we considered it was important to utilize explicit features for processes of decision making. The artificial neural network has a kind of black box nature in its hidden layers [17], and a decision tree is apt to include several numerical thresholds [13].

Materials
We used the European ST-T database from Physionet. European ST-T database has 90 records which are two-channel and each two hours in duration [18,19]. Each record in this database has a different number of ST episodes. Overall there are 367 ischemic ST episodes in the database. Sampling frequency of each ECG data is 250 Hz.
We excluded 5 records because these had some problems. The records e0133, e0155, e0509, and e0611 had no ischemic ST episodes. The record e0163 had so limited ST episode whose length was just 31 seconds.

Removing baseline wandering
The ST segments in ECG can be strongly affected by baseline wandering [20]. Main causes of the baseline wandering are respiration and electrode impedance change due to perspiration [20,21]. The frequency content of the baseline wandering is usually in a range below 0.5 Hz [20,21].
We use discrete wavelet transform to remove baseline wandering in ECG. We transform signal vector into two sequences of coefficients, approximation and detail coefficients sequences [22]. We do this in each step in an iterative fashion, until we get an input signal whose length is smaller than the length of the filter which characterizes the wavelet. In our case, we used Daubechies8 wavelet with filter length of 8. The resulting approximation coefficient sequence becomes the input signal to the next discrete wavelet transform as shown in Figure 3(a) [22].
In each step, the coefficient sequence implies a band of frequencies. If the sampling frequency of a discrete ECG signal ecg(n) is x, we can determine a continuous and band-limited signal within frequency limits of 0, x 2 by Nyquist sampling theorem [23]. Therefore if we have transformed the input signal ecg(n) into the approximation coefficient sequence h 1 (n) and detail coefficient sequence g 1 (n), then the frequency content http://www.biomedical-engineering-online.com/content/11/1/30 of g 1 (n) is from x 4 to x 2 , and the frequency content of h 1 (n) is below x 4 . In this regard, if we have transformed the ecg(n) into the approximation coefficient sequence h k (n), and the detail coefficient sequences g k (n), g k−1 (n), · · · , g 1 (n), the frequency contents of [24,25]. To remove baseline wandering, we should choose appropriate wavelet scale. We follow argument similar to that presented by Arvinti et al. except that they used stationary wavelet transform instead of its discrete counterpart [26]. We remove signal components whose frequency content is less than 1/2 Hz [20,21]. If we have transformed the ECG signal ecg(n) into coefficient sequences h k (n), g k (n), g k−1 (n), · · · , g 1 (n), the frequency contents of h k (n) and g k (n) become 0, x 2 k+1 and x 2 k+1 , x 2 k respectively, where x is the sampling frequency. If we choose k as x 2 k+1 ≤ 1 2 , k = log 2 x , the frequency content of the approximation coefficient sequence h k (n) becomes less than 1/2 Hz. Thus, we assign zero http://www.biomedical-engineering-online.com/content/11/1/30 sequence 0(n) to all the detail coefficient sequences g k (n), g k−1 (n), · · · , g 1 (n), and calculate inverse transform of h k (n), 0(n), 0(n), · · · , 0(n) to form the baseline(n) in the bottom of Figure 3(b). If we subtract baseline(n) from ecg(n), we obtain the flattened signal like the one shown in Figure 3(c).
If we select a wrong wavelet scale k to find coefficient sequences of ecg(n), we obtain disappointing results. The flattened signal in Figure 3(c) is obtained when k is log 2 250 = 8, where 250 is the sampling frequency expressed in Hz. When select k=4 to use h 4 (n), g 4 (n), g 3 (n), g 2 (n), g 1 (n), we obtain a plot in Figure 3(d). The middle waveform, baseline(n), resulted from the inverse discrete wavelet transform of h 4 (n), 0(n), 0(n), 0(n) 0(n). This middle waveform is too detailed, so the bottom waveform ecg(n)-baseline(n) was negatively affected. When we select k=12, see Figure 3(e), the bottom waveform was not different from the input waveform ecg(n). We adopt a discrete wavelet transform to retain the details of the ECG waveform because filtering by some cut-off frequency can deteriorate the quality of the ECG waveforms [27].

Detecting QRS complexes
We have to select an appropriate wavelet scale to capture proper time positions of QRS complexes. We will deal with only the flattened ECG waveform ecg(n)-baseline(n) referred in the previous section. We will denote it as fecg(n).
We select the wavelet scale j which produces the largest drop of score j − score j+1 (j ≥ 2). The bottom waveform in Figure 4(b) shows the time positions of QRS complexes when selecting this suitable wavelet scale.
After finding the locations of QRS complexes, we choose QRS onset and offset points in each QRS complex. We search QRS onset point in backward direction from a peak point in each QRS complex. We take the QRS onset point if the point is at the place of changing direction of rising and falling of fecg(n) twice. In the same way, we take the QRS offset point in forward direction from the peak point.
Algorithm 1 shows a process of removing baseline wandering and detecting QRS complexes.
Algorithm 1 A procedure to find time positions of QRS onset, peak and offset points. This procedure includes the method of removing baseline wandering in ECG. nBeats stands for the number of QRS peaks. It is the length of the sequences idx_QRS_Onset(n), idx_QRS_Peak(n) and idx_QRS_Offset(n).
· · · {//When QRS complex protrudes downward, code is same with reversing directions of inequality signs.} end if end for

Feature formation for classification problems
We deal with the flattened waveform, fecg(n), to obtain the values of the features. We take voltage level of QRS onset point as the reference from which we measure voltage deviation [2,28]. We denote the mean value of electric potentials at QRS onset points as fecg (QRS onset). We consider this value as an effective zero voltage, so we measure voltage deviation from the fecg (QRS onset). http://www.biomedical-engineering-online.com/content/11/1/30 To form the first feature, we sum up all the voltage deviation from QRS offset point to T wave peak point as shown in Figure 5(a) and (b).
The second feature is similar to the first feature with an exception of the ending position of the sum. We terminate the summation as we reach the first point, F, at which the voltage becomes equal to the reference voltage fecg (QRS onset), see Figure 5. When doing this, we add the signed values of the voltage deviation to find whether the area is lower or higher with respect to the reference voltage. Then we divide the value by the voltage at QRS peak point. The second feature value is given as follows.
The third feature is a slope from the QRS onset point to the QRS offset point.
We calculate these three feature values for each heart beat. Then we average these values in five successive beats, and arrange the three mean values as feature 1 , feature 2 , feature 3 . Algorithm 2 A procedure to compute feature values. nBeats denotes the number of QRS peaks. It is the length of the sequences idx_QRS_Onset(n), idx_QRS_Peak(n) and idx_QRS_Offset(n). n cl is equal to nBeats/5.

Classification by kernel density estimation
We approximate probability density at a point by considering the other points. Let us assume we have d-dimensional points {x 1 , x 2 , · · · , x n }. We can estimate the probability density at a point y as p (y) = 1 n K V where V is a small volume around y, and K is a number of enclosed points in the volume V [29]. We replace the term K V by d-dimensional Gaussian function as follows [30].
If we assume that the covariance matrix is a diagonal matrix with each diagonal element b 2 j 1 ≤ j ≤ d , the probability density at the point y is given as follows [31].
We classify a test point by examining posterior probabilities in which the test point belongs to two classes, normal or ischemic ST episode. We assume we have n S points x (S) 1 , x (S) 2 , · · · , x (S) n S , and n N points x (N) 1 , x (N) 2 , · · · , x (N) n N . The first and the second set designate training sets of ischemic ST episode and normal part, respectively. Each point is described by three components feature 1 , feature 2 , feature 3 . http://www.biomedical-engineering-online.com/content/11/1/30 We compute posterior probability in which the test point y belongs to each class by Bayes' theorem as follows [29].
The prior probability P (class) is given as P (class = N) = n N / (n N + n S ) or P (class = S) = n S / (n N + n S ). The likelihood p (y | class = N) and p (y | class = S) reads as are called kernel bandwidths. We calculate these bandwidths for each class (N or S) and component (1 ≤ i ≤ 3). These kernel bandwidths impact accuracy of kernel density estimation [32].
We have n cl training points x (cl) where cl denotes class, N (normal) or S (ischemic ST episode). For each component (1 ≤ i ≤ 3) of the feature vector, we calculate the mean value of differences as follows.

Classification with the use of support vector machine
Let us assume we have n cl training points x (cl) 1 , x (cl) 2 , · · · , x (cl) n cl . Each point is described as feature 1 , feature 2 , feature 3 in a three-dimensional feature space. We construct support vector machine classifier by solving the following optimization problem [33] The target label t (cl) i is specified as 1 (normal) or -1 (ischemic ST episode). The parameter C controls the trade-off between the slack variable (ξ i ) penalty and the margin (w T · w) penalties [29]. The dual form of the above classifier reads as follows where the matrix H is expressed as [33]. When we classify a new pattern y, we examine decision function, sgn was changed, we varied the parameter C to find its value which produced the highest classification rate.

Experiments setting
We used kernel density estimation and support vector machine methods to evaluate the proposed approach. We completed the experiment for each channel and record available in the European ST-T database. First, we trained the classifier based on a subset of ST episodes and normal ECG. Then we tested how well the feature values discriminated the two classes, ST episode and normal. When we formed the ST episode data, we used all the ischemic ST episodes except ST deviations data resulted from non-ischemic causes such as position related changes in the electrical axis of the heart. To preserve balance between ST episode and normal ECG data, we collected normal data from the beginning of each record as much as the amount of ST episode data. When dividing the data into training and test sets, we assigned one tenth of data to the training data, and the rest to the test data. In the cases of e0106 lead 0, e0110, e0136, e0170, e0304, e0601, and e0615 records, we constructed the training data of one third of all data and test data of two thirds because these records had much small ischemic ST episode data. To avoid ambiguous region between ischemic ST episode and normal ECG, we removed 10 seconds amount of ECG data from each side of the boundary.
When we classified a test set y i , four quantities were computed: true positive (TP), false negative (FN), false positive (FP), and true negative (TN). TP is a number of ischemic events correctly detected. FN is a number of erroneously rejected (missed) ischemic events. FP is a number of non-ischemic, that is, normal parts which the classifier erroneously detected as ischemic events. TN is a number of normal parts which our classifier correctly rejected as non-ischemic events [34]. These are numbers of corresponding y i points which were obtained by averaging three feature values of successive five beats in Algorithm 2. The sensitivity and specificity are expressed in a usual fashion, Se = TP/(TP + FN) and Sp = TN/(TN + FP) respectively [6].
We tested the classifiers by counting how many ST episodes were correctly caught, out of 367 episodes in the 85 records of European ST-T database. For an interval of ischemic ST episode data, we formed n test points y 1 , y 2 , · · · , y n from the data (Algorithm 2), and classified each test point and then counted numbers of two classes, "ischemic" and "normal". If the number of class "ischemic" was larger than n/2, we declared the interval to be an ischemic ST episode. The experiments were completed for 367 ischemic ST episodes.
We compared the results of kernel density estimation (KDE) and support vector machine (SVM) methods with those formed by artificial neural network (ANN). The corresponding ANN classifier exhibits the following topology. The input layer has three nodes which accept feature 1 , feature 2 and feature 3 respectively. The output layer has two nodes which have target values (1, 0) and (0, 1) in the cases of "ischemia" and "normal" classes, respectively. We initialized bias weights as 0, and assigned random values between -1.0 and 1.0 to the weights of the network. The learning was carried out by running the http://www.biomedical-engineering-online.com/content/11/1/30 backpropagation method [17] for 3000 iterations. We used a sigmoid activation function 1/ 1 + e −x and set learning rate 0.01. We adopted various topologies of hidden layers such as 3 → (5) → (5) → 2, 3 → (6) → 2, 3 → (7) → 2 and 3 → (8) → 2 where the number in each parenthesis represents a number of nodes in the corresponding hidden layer. We used stochastic (incremental) gradient descent method to alleviate some drawbacks of the standard gradient descent method, see [17].

KDE with various kernels
We can use various kernels in kernel density estimation. If we have training points {x 1 , x 2 , · · · , x n } and a test point y, the probability density at y is given as follows [35].
Here k G , k R , k E , k B , k Triw and k Tria are constants, and u 2 i is given as u 2 because we use three feature values. The indicator function 1 {|u i |≤1} is given as follows. Table 1 shows classification results for various kernels. In all cases we used Daubechies8 wavelet to produce training and test sets. We took each bandwidth b factor for class cl, ischemic or normal, and 1 ≤ i ≤ 3. The "detect" means how many ST  i . We varied this factor from 0.1 to 3.0, and selected the one for which a sum of sensitivity and specificity values attains a maximum. Because the Gaussian kernel produced best results, in the sequel we will use the Gaussian kernel. Table 2 shows the results with respect to various kernel bandwidths.

Results for KDE, SVM and ANN with various wavelets
We examined the classifiers to find out how their performance depends on the mother wavelets which were used to produce training and test sets in Algorithm 1. We used 7 wavelets, Haar, Daubechies4, Daubechies8, Daubechies10, Coiflet6, Coiflet12 and Coiflet18 [22,36]. The number forming a part of the name of each wavelet designates the length of filter which characterizes corresponding wavelet. Figure 6 shows selected shapes of wavelet functions except for the Haar wavelet which is given as Table 3 shows the classification results obtained for KDE. The kernel bandwidth is expressed as b i /2 for each class cl and 1 ≤ i ≤ 3. We used Gaussian kernel.   Table 4 shows the classification results for the KDE with respect to various bandwidths and wavelets. The first column for each wavelet item represents the sum of sensitivity and specificity. The second column shows how many ST episodes were correctly detected. We used the kernel bandwidths b (cl) i = mean (cl) i · factor for each class cl and 1 ≤ i ≤ 3. The sum of sensitivity and specificity becomes maximum when the bandwidth b Table 5 shows the classification results obtained for SVM. The parameter C controls the trade-off between the slack variable (ξ i ) penalty and the margin (w T · w) penalties. We examined the classification accuracy versus the values of C changing from 0.1 to 300.0 in step of 0.1, and selected the one that made the sum of sensitivity and specificity maximal. Table 6 shows the classification results obtained by ANN. The number in parenthesis represents the number of nodes in the corresponding hidden layer. The first, second and third column express sensitivity, specificity and the "detect" respectively. We experimented 10 times, and averaged the results because we obtained different results each time due to the random initialization of weights.   Tables 3, 5 and 6 show that the Daubechies8 and Daubechies10 wavelets give us superior results. The shapes of these two wavelets are similar to typical ECG waveforms [37,38]. From now on, we use the Daubechies8 wavelet exclusively. Table 7 shows the classification results by KDE, SVM and ANN when we did not remove baseline wandering in ECG. If we compare this table with the Tables 3, 5 and 6, we get to know it is essential to remove baseline wandering in Algorithm 1. In the Table 7, we selected the kernel bandwidths b

Effects of baseline wandering in ECG
. We used the ANN classifier with sizes of layers expressed as 3 → (7) → 2. The results of ANN were obtained by averaging results for 10 repetition of the experiments. The parameter C of the SVM classifier was 297.9.
If we use unsuitable wavelet scale like the one in Figure 3 to remove baseline wandering, it becomes difficult to obtain good results. As the sampling frequency was 250 Hz, we selected the wavelet scale log 2 250 = 8 in Algorithm 1. Table 8 shows the classification results when wrong wavelet scales were selected. The kernel bandwidth setting in KDE and layer composition of ANN classifier were same as the Table 7. The middle row of wavelet scale 8 in Table 8 was our choice in Algorithm 1. Each entry in the row of wavelet scale 8 has counterparts in "Daubechies8" rows in Tables 3, 5 and 6.

Effects of simulated noise
We examined performance of the classifiers when we added simulated noise into the original ECG signal. We modeled the noise as the sum of wandering baseline and AC power line 60 Hz noise. Let us assume we have original signal data, ecg(i) (1 ≤ i ≤ n). First, we compute mean value and standard deviation of the ECG signal as m = where a is an amplification factor and b is an angular frequency of the added baseline.
Here Samp_Freq means sampling frequency which was 250 Hz in our case. We varied a from 0.1 to 1.0 in step of 0.1, and selected b to be equal to 2, 4 or 6. Figure 7 shows the original ECG and its noise-impacted version. Tables 9, 10 and 11 show the experimental results for the noisy ECG signal. The first, second and third column in each b item represent the sensitivity, specificity and the "detect" respectively. The kernel bandwidth is set as b (cl) i = mean (cl) i /2 for the KDE classifier. The layer composition of the ANN classifier was 3 → (7) → 2. The first column in each b item in Table 10 includes the trade-off parameter C which produced best results.

Comparison with others' works
To compare our approach with others' works, we tested the classifiers on 10 selected records, e0103, e0104, e0105, e0108, e0113, e0114, e0147, e0159, e0162 and e0206. Table 12 shows results of comparison. The papers by Papaloukas et al. [10], Goletsis et al. [39], Exarchos et al. [13] and Murugan et al. [15] in Table 12 dealt with the 10 records. We used the Daubechies8 wavelet in Algorithm 1 to analyze the ECG waveform, and took the kernel bandwidths b i /2 for the KDE classifier with Gaussian kernel. We used the SVM classifier with C = 281.1. Table 1 showed how the classification results were dependent on various kernel functions in kernel density estimation. Gaussian kernel produced best results. Tables 3, 4, 5 and 6 show how the classification results depend on mother wavelets used in Algorithm 1. Daubechies8 and Daubechies10 wavelets were best. Because we implemented wavelet transform program with the use of matrix multiplication, we selected Daubechies8 wavelet to reduce computational burden. Daubechies10 wavelet did not produce much better classification accuracy than Daubechies8 wavelet.

Discussion
Tables 2 and 4 indicate that the choice of kernel bandwidths was reasonable. When we took the kernel bandwidths b (cl) i = mean (cl) i /2 for class cl, 1 ≤ i ≤ 3, we obtained best results except for the case of Coiflet18 wavelet. Even in the case, the best parameter   Tables 7, 8 and 9. In this way, we could automatically select 6 kernel bandwidths, and this exempted us from choosing any numerical parameters.
The SVM classifiers in Tables 5, 7 and 8 produced better results than the KDE classifiers, but they required us to determine optimal value of the parameter C. Whenever we used different wavelets on the same data set in Table 5, we had to choose different trade-off parameter C. This was also the case in Table 8 where we intentionally selected incorrect wavelet scales to remove baseline wandering.
Order of magnitude of feature 3 was very different from feature 1 and feature 2 . When we produced the feature values using Daubechies8 wavelet in Algorithm 1, mean values of feature 1 , feature 2 and feature 3 were 7.327, 7.613 and 0.004, respectively. Thus we had to normalize the feature values to use them in classification. Even if the orders of magnitude of feature 1 , feature 2 and feature 3 were very different, the equation of kernel density estimation included a term , normalization by kernel bandwidth. We thought these would be helpful to overcome the difference of order of magnitude between feature 1 , feature 2 and feature 3 . This was a main driving force to adopt the kernel density estimation. We implemented the KDE and ANN classifier in C language for ourselves. For SVM classifier, we used libsvm library [33]. We compiled the programs with gcc and g++ without using any SIMD (single instruction multiple data) math library. Total amount of ECG text files which we used in our analysis was 200.4 MB. This amount is just about voltage information not including time information. When we ran our programs to process the ECG text files in Pentium4 3.2 GHz CPU, it took 243.0 seconds until the procedures of removing baseline wandering and detecting time positions in Algorithm 1 were completed. This was when we used Daubechies8 wavelet. Feature extraction in Algorithm 2, required 0.6 seconds. It took 1.2 seconds for the KDE classifier to process all the files. The SVM classifier required 0.8 seconds for the same job. The ANN classifier with layer composition 3 → (7) → 2 required 94.7 seconds.
We compared our QRS detection algorithm with Hamilton and Tompkins' algorithm [40] which was implemented in C language as an open source software [41]. We supplanted the portion from DWT of fecg(n) to making idx_QRS_Peak(n) in Algorithm 1, with the Hamilton and Tompkins' program. When we ran the modified program to process the procedures of removing baseline wandering and detecting time positions, it took