Multirate ECG Processing and k-Nearest Neighbor Classifier Based Efficient Arrhythmia Diagnosis

The goal of this work is to make a contribution to the development of computationally efficient multirate Electrocardiogram (ECG) automated detectors of arrhythmia. It utilizes an intelligent combination of multirate denoising plus wavelet decomposition for an effective realization of the ECG wireless implants. The decomposed signal subband features are mined and in next step these are utilized by the mature k-Nearest Neighbor (KNN) classifier for arrhythmia diagnosis. The multirate nature substantially reduces the processing activity of the system and thus allows a dramatic decrease in energy consumption compared to traditional counterparts. The performance of the system is estimated also in terms of the classification performance. Obtained results reveal an overall 22.5-fold compression gain and 4-folds processing outperformance over the traditional equals while securing 93.2% highest classification accuracy and specificity of 0.956. Findings confirm that the proposed solution could potentially be embedded in contemporary automatic and mobile cardiac diseases diagnosis systems.


Introduction
Cardiovascular diseases have drawn global attention. This is due to its increasing prevalence and incidence [1,14]. Electrocardiogram (ECG) measures electrical activities with respect to time. Manual examination of cardiac arrhythmias can be time consuming and complicated. This challenge may be solved using computer-aided automatic cardiac decision tools. The computer-aided or pattern-based recognition systems could increase the effectiveness of cardiac health analysis by detecting subtle differences in frequency and amplitude components of the heartbeat [2].
Many scientists have previously explored computer-assisted solutions for cardiac health monitoring as reviewed in [7]. Preprocessing is the first ECG processing stage. The popular ECG denoising methods are the finite impulse response (FIR) filtering, principle component analysis (PCA) and Kalman filtering [2,8]. The extraction of features is one of the essential steps of computer-aided ECG diagnostic solutions. Certain extensively used ECG signal feature extraction approaches are the "Wavelet Transform" (WT), "Discrete Cosine Transform" (DCT) and "Short Time Fourier Transform" (STFT). The pertinent signal features are afterward employed for the classification purpose. Techniques adopted for this purpose are the "Naïve Bias", the "K-Nearest Neighbor" (KNN), the "Artificial Neural Networks" (ANN) and the "Support Vector Machine" (SVM).
Classical ECG systems are by definition time-invariant [3,4]. This can lead to inefficient use of system resources and energy consumption [2,5]. For such signals, an effective solution can be achieved by diminishing the rates of data collection, processing and transmission [5]. In this framework, multirate signal processing tactics have been employed [6]. The subsampling is intelligently employed in the suggested framework. It allows overcoming the downsides of the counter fix rate ECG processing approaches [3,4]. Therefore, it allows realizing a simplified and power efficient ECG wireless implant with a real-time compression of data.

Materials and Methods
Figure 1 illustrates the adopted system block level diagram. A description of the different modules of the system is given in the coming subsections.

Dataset
In this study, the ECG signals, obtained from a standard ECG dataset are used [1]. 3 different ECG classes the "Wolff-Parkinson-White" (WPW), "Right Bundle Branch Block" (RBBB) and the "Normal Sinus Rhythm" (N) are considered. ECG analog signals are band limited up to 60 Hz and each channel is recorded via an 11-Bit resolution analog to digital converter (ADC). The employed sampling frequency is of 360 Hz. The digitized versions of intended ECG signals are splitted into fixed length segments to split the continuous time signals into ECG impulses. Each impulse is considered as an instance. In order to avoid any biasing an equal representation is selected for each considered class. In this framework, 150 instances are considered for each class. It results in total 450 instances from 3 ECG classes.

Subsamp. D=3
x n xf n Classifica on xd n xs n Decision Support

Denoising
The digitized signal x n is denoised by using an offline designed band-pass FIR filter. The denoising diminishes the noise like the "Power Line Interference" (PLI) and "Baseline Wander" (BW) from the ECG signal. It improves the efficiency of collection and classification of the features. The ECG signal's useful frequency range lies between [0.5; 50] Hz [9,10]. Accordingly, a band-pass linear phase filter is configured offline for the cut-off frequencies of [Fc L = 0.5; Fc H = 50] Hz it resulted in a 122 nd order filter designed for F S ¼ 360 Hz. For proper filtering, Fc H is kept less than half of the signal sampling rate [5]. Therefore, F S ¼ 360 Hz fulfils this criterion.

Subsampling
The functioning of conventional ECG acquisition and analysis processes is of timeinvariant nature [2][3][4]. Consequently, a worst-case parameterization is enforced [5]. It causes the processing ineffectiveness in the case of time-varying and sporadic ECG signals. These inadequacies can be diminished by using multirate processing approaches [2,5,6]. In this framework, the denoised signal xf n is subsampled with a factor of D ¼ 4 to obtain xd n ¼ xf Dn . Subsampling without a prior digital antialiasing filtering can cause aliasing [6]. However, a proper choice of D allows to perform subsampling without prior filtering. In this case, the selected value of D should respect the condition: D F S F Nyq ¼ 3:6. Here, F S ¼ 360 Hz, F Nyq ¼ 2: f max and f max is the bandwidth of xf n and is equal to Fc H = 50 Hz. It shows that for the chosen D ¼ 3 subsampling does not cause aliasing.

Segmentation
In order to split the continuous time ECG records into ECG pulses, xd n is divided in 0.9-s length segments. Each segment, xs n , contains one ECG pulse. The segmentation is realized by using fixed length rectangular windows [6]. The process can be mathematically depicted as: yd n w nÀs : Here, L T and s are respectively the length in seconds and the central time of an intended segment.

Discrete Wavelet Transform
The "Wavelet Transform" (WT) can be mathematically expressed by Eq. (1) where, s and u respectively represent the dilation and the translation parameters.
A discrete time wavelet transform (DWT) is used for decomposing the xs n . A translation-dilation representation is attained by employing digital filters. In this case, each segment xs n is decomposed through the "Daubechies Algorithm" based wavelet decomposition process. It consists of half-band low-pass filter and high-pass filter with subsampling with a factor of two. It allows the computation of approximation, a m and detail, d m , coefficients at each level of decomposition.
The mathematical processes of computing a m and d m are respectively depicted by Eq. (2) and Eq. (3). Where, m represents the level of decomposition. In this study a third level of decomposition is employed. Therefore, m 2 1; 2; 3 f g. g 2nÀk and h 2nÀk are respectively the half-band low-pass and high-pass filters using a subsampling factor of two.

Features Extraction
The wavelet coefficients, obtained for each intended subband,

Classification
After features extraction, each instance is presented in the form of a reduced data matrix, composed of 16 features. The intended dataset is composed of 3 ECG classes namely the "Normal Sinus Rhythm (N), the "Right Bundle Branch Block" (RBBB) and the "Wolff-Parkinson-White" (WPW). For equal representation, 150 instances are taken into consideration for every class. Thus, in total 450 ECG instances are considered. After features extraction, the resulting data matrix has a size of 450 Â 16. To classify this data matrix, the "k-Nearest Neighbor" (KNN) classification algorithm is employed.
The KNN is well known for its ability of delivering high quality results even for applications wit high complexity [16]. In a data set, the features' distance is used by KNN to decide which data belongs to what class. When the distance in the data is near, a group is formed, and when the distance in the data is far, other groups are formed. A category membership might be the output of the KNN classifier. The categorization of an object is done through the majority vote by its neighbors. That is, the object is added to the class which is most common among its k closest neighbors (k could generally be a small positive whole number). The object is assigned solely to the nearest neighbor's single classification if the k equals one [11].

Evaluation Measures
Compression Ratio compares the designed system performance in terms of reduction in the amount of information to be classified compared to the conventional approach where acquired ECG data points are transmitted towards classifier without performing any features selection. If N r and P are respectively the count of data points to be classified, for a given time length of L T -Sec., in the conventional and the devised approach then the compression ration, R COMP , can be calculated as: Computational Complexity compares the designed system performance with the fixed-rate counter equals in terms of the count of required standard operations like additions, multiplications and divisions [12]. In conventional case, the denoised signal is segmented by employing a rectangular window. It splits the incoming samples sequence in L T -Sec. segments. Each segment is composed of N r samples. The processing cost of this process is negligible compared to operations like additions and multiplications [12]. Each segment is further split into subbands by using the 3 rd level Daubechies wavelet decomposition. It consists of half-band FIR high-pass and lowpass filters with a subsampling factor of two. Let Kg be the order of half-band filters and same filters are employed at all levels of decomposition. It is well known that a Kg order filter performs Kg additions and Kg multiplications [5]. Therefore, the computational complexity of this fixed rate wavelet decomposition process C FRÀWD can be mathematically expressed by Eq. (4). This mathematical derivation is also clear from For the case of designed solution xf n is firstly subsampled and then xd n is segmented by employing a rectangular window. Each segment is composed of N ¼ 0:25 Â N r samples. If Kg is the order of half-band filters and same filters are employed at all levels of decomposition then the computational complexity of this process C PÀWD can be mathematically expressed by Eq. (5). If M ¼ 0:5 Â M r is the count of samples processed by the denoising module then the total computational complexity for the designed front-end processing chain can be expressed by using Eq. (10).
Classification Accuracy and Specificity are used to evaluate the overall system precision. The processes may be formally described by means of Eq. (6) and Eq. (7). Where, "True Positives" (TP) and "True Negatives" (TN) are correct classifications. "False Negatives" and "False Positives" (FP) (FN) are wrong classification results [13].

Results and Discussions
Examples of the considered ECG signal classes are shown in Fig. 2. These incoming signals x n are denoised by employing the band-pass FIR filter. It improves the expected signal SNR ("Signal to Noise Ratio") and results in an increased classification precision. An example of the filtered version of signal for the (RBBB) class is shown in Fig. 3-a. The de-noised signal xf n is down-sampled with a factor of D ¼ 3. An example of the subsampled versions of signal for the RBBB class is shown in Fig. 3 The decimated signal xd n is splitted into fixed length segments of 0.9 s durations. Onward each segment is decomposed into subbands via the application of a 3 stages wavelet decomposer. Computational Gain of the designed front-end processing chain over the fixed-rate counterpart is calculated by using Eq. (4) and Eq. (5). It results in 4fold reduction in terms of count of additions and multiplications of the designed solution compared to the fixed-rate counterpart.  In next step, four statistical features are extracted from each subband. In this way each intended instance is presented by 16 parameters. The compression gain of the designed framework over the conventional equal is computed by using R COMP ¼ N r P . It results in 22.5-fold real-time compression gain of the proposed solution over the conventional equal.
Above results show that the devised solution outperforms the conventional equals in terms of processing efficiency and compression gain. However, due to the multirate processing feature it may lose its performance in terms of the precision. Therefore, the overall performance of the system is measured in terms of the accuracy of the classification process. The KNN classifier is employed with k = 5 configuration. Training and testing sets are made of 3 distinct classes. Total 450 instances are used. The 10-fold cross validation technique is used for all experiments. Classifier's performance is quantified in terms of the accuracy and the specificity by using Eq. (6) and Eq. (7). The obtained results are summarized in Table 1. It shows that for the studied case, the obtained classification accuracies are high. The highest classification accuracy is obtained for the (WPW) class, 93.2%. The average classification accuracy of the designed framework is 91.87% with an average specificity of 0.947. It concludes that the suggested approach not only attains the outperformance in terms of compression gain and processing efficiency but it also secures an appropriate ECG arrhythmia classification precision.

Conclusion
In this paper a novel multirate ECG processing, subbands decomposition and classification framework is designed. The decomposed signal subband features are mined and in next step these are utilized by the mature k-Nearest Neighbor (KNN) based classifier for an effective arrhythmia diagnosis. The multirate feature diminishes the system processing load. It is shown that because of the multirate feature the system has attained the 4 folds diminishing in the count of processing load as compared to the conventional equals. Additionally, the features extraction process has induced 22.5 times compression gain in the system. It also assures a same factor of processing load diminishing at the post classification stage. The overall performance of the system is quantified in terms of the accuracy of the classification process. For the studied case the designed framework has attained the highest classification accuracy of 93.2% and specificity of 0.956. It assures that the devised solution is a potential candidate to be embedded in contemporary automatic and mobile cardiac diseases diagnosis systems. A possible future direction of work is to adopt a model-based testing methodology for validating the proposed approach [15][16][17][18]. Integration and investigation of event-based processing modules [19][20][21][22] in this system is another prospect.