scieee AI-readable full text Open interactive document viewer

Detection of atrial fibrillation in ECG hand-held devices using a random forest classifier

Zabih, M,Rad, A.B,Katsaggelo, A.K,Kiranyaz, S,Narkilahti, S,Gabbouj, M

Full text

Detection of Atrial Fibrillation in ECG Hand-held Devices Using a Random Forest Classifier Morteza Zabihi1*, Ali Bahrami Rad2*, Aggelos K. Katsaggelos3, Serkan Kiranyaz4, Susanna Narkilahti2, and Moncef Gabbouj1 1Tampere University of Technology, Tampere, Finland 2University of Tampere, Tampere, Finland 3Northwestern University, Evanston, Illinois, USA 4Qatar University, Doha, Qatar Abstract 1Atrial Fibrillation (AF) is characterized by chaotic electrical impulses in the atria, which leads to irregular heartbeats and can develop blood clots and stroke. Therefore, early detection of AF is crucial for increasing the success rate of the treatment. This study is focused on detection of AF rhythm using hand-held ECG monitoring devices, in addition to three other classes: normal or sinus rhythm, other rhythms, and too noisy to analyze. The pipeline of the proposed method consists of three major components: preprocessing and feature extraction, feature selection, and classification. In total, 491 hand-crafted features are extracted. Then, 150 features are selected in a feature ranking procedure. The selected features are from time, frequency, time-frequency domains, and phase space reconstruction of the ECG signals. In the final stage, a random forest classifier is used to classify the selected features into one of the four aforementioned ECG classes. Using the scoring mechanism provided by PhysioNet/Computing in Cardiology (CinC) Challenge 2017, the overall score (meanΒ±std) of 81.9Β±2.6% is achieved over the training dataset in 10-fold crossvalidation. The proposed algorithm tied for the first place in the PhysioNet/CinC Challenge 2017 with an overall score of 82.6% (rounded to 83%) on the unseen test dataset. 1. Introduction Atrial Fibrillation (AF) is associated with too quick or chaotic contraction of atria’s muscle fibers. This can cause uncompleted blood transfer from atria to ventricles and decrease the efficiency of heart functioning. The AF global prevalence is estimated as 33.5 million in 2010 [1], and its rate is increasing based on regional studies [2]. This * The first two authors have contributed equally to this paper. arrhythmia is one of the main public health problems because of not only its prevalence but also its complications and costs. Symptomatic AF patients are more probable to be diagnosed and treated, whereas asymptomatic patients (silent AF) are more prone to serious complications caused by AF such as ischemia, stroke, or early mortality [3]. Therefore, early detection of AF is crucial for effective treatment, improving the clinical outcomes, and decreasing the costs. Based on the AF management guidelines [4], prompt ECG (at least 30s recording) is a diagnostic and effective method. The absence of significance P wave and irregular distances of QRS complexes are the main signs of AF on the ECG recordings. Therefore, to date, several studies have been conducted to automatically detect AF rhythm using signal processing and machine learning methods [5] [6]. However, only a few of them studied the ECG recorded by single-lead portable devices. Although it is shown that the hand-held devices cannot substitute a conventional ECG devices [7] [8], they can be used for daily usage and improve the accuracy of early AF detection [7]. This work proposes a hybrid classification approach for ECGs recorded by the AliveCor hand-held devices [9]. It combines features from multi domains including time, frequency, time-frequency, phase space, and meta-level. It utilizes a feature selection approach based on a random forest classifier. Finally, the selected features are classified by another random forest classifier. The main contributions of this study are: 1) To investigate a comprehensive set of discriminative features, which is independent of the ECG lead positioning (Section 2.1). This is crucial because there are different alternatives for lead placement in hand-held devices, e.g., the measurement between left and right hand, or directly on the chest. 2) To design an effective classification algorithm in order to classify four ECG types including the AF rhythms Computing in Cardiology 2017; VOL 44 Page 1 ISSN: 2325-887X DOI:10.22489/CinC.2017.069-336 Since volume 33 (2006), CinC has been an open-access publication, in which copyright in each article is held by its authors, who grant permission to copy and redistribute their work with attribution, under the terms of the Creative Commons Attribution License. (Section 2.2). The proposed algorithm is evaluated over recently released single-lead ECG dataset [9]. In Sections 3 and 4, the results and conclusion are discussed. 2. Materials and methods For this challenge, 8528 single-lead ECG recordings with sampling frequency of 300 Hz are provided by Physionet/Computing in Cardiology Challenge 2017 [10]. The objective of the challenge is to classify each ECG recording into one of the following classes: healthy (normal), AF, other rhythms, and noisy. More detailed information can be found in [9]. The proposed feature extraction and classification approach will be presented next. 2.1. Feature engineering First as the preprocessing stage, the quality of the ECG recordings are enhanced based on the sparse derivative decomposition and denoising algorithm [11]. Once the ECGs are denoised and the baseline wander is removed, a set of 491 hand-crafted features is extracted. The extracted features are a combination of base-level (i.e., signal-level) features and meta-level features (i.e., the prediction of the base-level classifiers). Then, a random forest classifier ranks the features in decreasing order of importance. The importance of each feature is evaluated based on the reduction of the entropy. A subset of 150 highest-ranked features is then selected. The selected features are listed as follows: (1) Base-level time domain and morphological features: The 67 selected features in the time domain are: the average of RR intervals (𝑅𝑅     ); the coefficient of variation of 𝑅𝑅 intervals (πΆπ‘œπ‘’π‘“π‘‰π‘Žπ‘Ÿ(𝑅𝑅)); variance of the P wave amplitudes; mean of kurtosis values of T waves; eigenvalues of the covariance matrix of beats; the correlation coefficients and RΓ©nyi entropy [12] of P waves. Furthermore, mean, standard deviation, range, interquartile range (IQR), percentiles of energy, slope and angles of PQRS-T waves [13], PR intervals, and R amplitudes are extracted. (2) Base-level frequency domain features: First, the power spectral density of each beat is estimated using Burg’s method (𝑃). Then, two features are calculated for each beat in different frequency (𝑓) range (Hz) as follows: 𝑃𝑓1=βˆ‘π‘ƒπ‘“ 15 𝑓=5 βˆ‘π‘ƒπ‘“ 40 𝑓=5 (1) 𝑃𝑓2=βˆ‘π‘ƒπ‘“ 40 𝑓=1 βˆ‘π‘ƒπ‘“ 40 𝑓=0 (2) The average of 𝑃𝑓1 and 𝑃𝑓2 in each signal are used as two features in this domain. (3) Base-level time-frequency domain features: In total, 46 features are selected from this domain. Shannon, Tsallis, and RΓ©nyi entropies [12] of the five levels of detail and one level of approximation coefficients obtained by Symlet 4 wavelet are used. These entropy measures are extracted separately from the whole signal, P, and T waves. In addition, the statistical and morphological features of details and approximation coefficients of seven level decomposition, obtained by Daubechies 4 wavelet, are extracted [14]. Moreover, the homogeneity of the ECG signal is defined using continuous wavelet transform (CWT): π»π‘œπ‘šπ‘œπ‘”π‘’π‘›π‘–π‘‘π‘¦= βˆ‘π‘Šπ‘–,𝑗 𝐾 (3) where π‘Šπ‘–,𝑗 =𝑃𝑖,𝑗 +|π‘–βˆ’π‘—|, 𝑃𝑖,𝑗 is the probability of bin (𝑖,𝑗) in CWT space, and 𝐾 is the number of all bins. (4) Base-level nonlinear (phase space) features: In phase space representation, 1-D time series are embedded into higher dimensional space in order to reveal their dynamical evolution through time. In this study, we have used different embedding methods of 𝑅𝑅 series in order to characterise the different types of arrhythmia. The first feature is defined as if an ellipsoid can be fitted in the 2-D phase space with lag 1 (reconstructed based on Takens’ delay embedding theory [15]). The possibility or impossibility of fitting an ellipse representing the geometrical properties of 𝑅𝑅’s dynamic. Moreover, the local temporal behaviour of the phase space points is analyzed based on co-occurrence matrix [6]. The next selected feature is defined as: 𝑠𝑑𝑒𝑝𝑝𝑖𝑛𝑔= 1 π‘›βˆ’2βˆ‘βˆš(πΌπ‘—βˆ’πΌπ‘—+1)2+(𝐼𝑗+1 βˆ’πΌπ‘—+2)2 π‘›βˆ’2 π‘˜=1 1 π‘›βˆ‘πΌπ‘— 𝑛 𝑗=1 , (4) where 𝐼𝑗 is 𝑗th point in a 2-dimensional space formed by 𝑅𝑅s (horizontal coordinate) and 𝑑 𝑅𝑅𝑠 𝑑𝑑 (vertical coordinate) [16]. Furthermore, two different phase space reconstruction methods, parabolic [17] and triangle [18] mappings, are used. Parabolic mapping is formed by 𝑅𝑅𝑖 and (𝑅𝑅     βˆ’ 𝑅𝑅𝑖)2 as the horizontal and vertical coordinates, respectively. The coefficients of a fitted second order polynomial in this space are used as descriptive features. Likewise, the perimeter and area of the triangle phase space, which is constructed by 𝑅𝑅𝑖 and |(𝑅𝑅     βˆ’ 𝑅𝑅𝑖)|, are selected as the key characteristics of this domain. In addition, AFEvidence, ATEvidence, and OrgIndex metrics [5] are used. (5) Meta-level features: these features are the statistical descriptors of the prediction of the base-level classifiers. In this work, we use three base-level classifiers: linear and quadratic discriminant analysis (LDA & QDA), and a random forest with 30 decision trees. These classifiers are then trained on the 20% random subset of the training data to generate the meta-level features for the next level classifier (see Fig.1). This process is discussed Page 2 in the following. The number of abnormal segments in an ECG signal can signify the irregularities with more resolution. For this purpose, first, the signal is windowed into 5s segments with 4s overlap. Once the R, P and T waves are detected in each segment, the following base-level features are extracted: π‘“π‘ π‘’π‘ž1 = πΆπ‘œπ‘’π‘“π‘‰π‘Žπ‘Ÿ (𝑅𝑅) (5) π‘“π‘ π‘’π‘ž2 =π‘šπ‘’π‘Žπ‘›(𝑠𝑑𝑑(π‘‡π‘€π‘Žπ‘£π‘’)) (6) π‘“π‘ π‘’π‘ž3 =max(π‘šπ‘’π‘Žπ‘›(π‘‡π‘€π‘Žπ‘£π‘’)) (7) π‘“π‘ π‘’π‘ž4 =βˆ‘π‘šπ‘’π‘Žπ‘›(πΈπ‘π‘€π‘Žπ‘£π‘’) (8) π‘“π‘ π‘’π‘ž5 =βˆ‘π‘šπ‘’π‘Žπ‘›(πΈπ‘‡π‘€π‘Žπ‘£π‘’) (9) where πΈπ‘π‘€π‘Žπ‘£π‘’ and πΈπ‘‡π‘€π‘Žπ‘£π‘’ are the energy of P and T waves, respectively. In addition, each segment is modelled as an order 4 autoregressive process. The parameters of this model are used as new features (π‘“π‘ π‘’π‘ž6-π‘“π‘ π‘’π‘ž9). Then, all nine base-level features are fed into the three aforementioned base-level classifiers. Each classifier is used to generate four posterior probabilities of classes for each 5s segment. The mean and standard deviation of these posterior probabilities are used as meta-level features. 2.2. Classification In this work, we used a hybrid classification framework in the sense that we combined the base-level and metalevel features to generate the hybrid feature vectors, and then fed them into a single learning algorithm to classify. For this purpose, an (external) random forest classifier is trained over the remaining 80% of the training data by using 500 decision trees and random selection of features at each node creation. We use bagging, i.e. bootstrapped replicas of the training data, to train each decision tree, and 30 features are randomly selected for each node. Then the entropy measure is used to decide which feature to split on at each node. 3. Results and discussion The accuracy of the proposed method is evaluated in 10fold cross validation manner. Because 20% of data has already been used to train the base-level classifiers, we have used the remaining 80% of the training data for evaluation in order to avoid overfitting. These results are reported in Table 1. In hand-held devices, each ECG recording typically includes noise and artifacts, low-quality signals, intermediate rhythms, and transitional states between rhythms. The proposed algorithm in this paper only partially handles these difficulties. The sequential classification algorithms such as hidden Markov models (HMM), conditional random fields (CRFs), and recurrent neural networks (RNN) which analyze consecutive windows can be a possible solution for the aforementioned difficulties. They will be investigated in our future work. Table 1: Results of the proposed method: the overall score (meanΒ±std) over 80% of the training dataset in 10-fold cross-validation and the overall score on the unseen test dataset. Evaluation metrics Training set (%) Testing set (%) F1n (Normal) 90.49 Β± 0.96 90.87 F1a (AF) 79.43 Β± 4.52 83.51 F1o (Other) 75.64 Β± 3.11 73.41 F1p (Noisy) 61.11 Β± 7.53 50.42 F1 81.85 Β± 2.57 83 Figure 1. The proposed classification strategy Page 3 4. Conclusions In this paper, we have proposed a systematic approach for the detection of AF rhythms in ECG hand-held devices. We have investigated a comprehensive set of hand-crafted 491 features, and ranked them based on their importance. A set of 150 highest-ranked features is selected and fed into a random forest classifier in order to detect AF rhythms in addition to three other ECG rhythms/types. The proposed method tied for the first place in the PhysioNet/CinC Challenge 2017 with an overall score of 82.6%. With this overall performance, the proposed algorithm has a potential for improvement, which is the subject of our future work. References [1] S. S. Chugh, R. Havmoeller, K. Narayanan, D. Singh, M. Rienstra, E. J. Benjamin, R. F. Gillum, Y. Kim, J. H. McAnulty, Z. Zheng, M. H. Forouzanfar, M. Naghavi, G. A. Mensah, M. Ezzati, C. J.L. Murray, "Worldwide Epidemiology of Atrial Fibrillation A Global Burden of Disease 2010 Study," Circulation, vol. 129, no. 8, 2014. [2] M. Zoni-Berisso, F. Lercari, T. Carazza, and S. Domenicucci, "Epidemiology of atrial fibrillation: European perspective," Clinical Epidemiology, no. 6, p. 213–220, 2014. [3] P. E. Dilaveris, and H. L. Kennedy, "Silent atrial fibrillation: epidemiology, diagnosis, and clinical impact," Clinical Cardiology, vol. 40, no. 6, pp. 413-418, 2017. [4] P. Kirchhof, S. Benussi, D. Kotecha, A. Ahlsson, D. Atar, B. Casadei, M. Castella, H. Diener, H. Heidbuchel, J. Hendriks, G. Hindricks, A. S. Manolis, J. Oldgren, B. A. Popescu, U. Schotten, B. V. Putte, P. Vardas, "2016 ESC Guidelines for the management of atrial fibrillation developed in collaboration with EACTS," European Heart Journal, vol. 37, no. 38, pp. 2893-2962, 2016. [5] S. Sarkar, D. Ritscher, and R. Mehra, "A Detector for a Chronic Implantable Atrial," IEEE Transactions on Biomedical Eengineering, vol. 55, no. 3, pp. 1219 - 1224, 2008. [6] S. Moharreri, S. Parvaneh, N. J. Dabanloo, A. M. Nasrabadi, "Utilizing occurrence sequence of Heart Rate's phase space points in order to discriminate heart Arrhythmia," in 17th Iranian Conference of Biomedical Engineering (ICBME), Isfahan, Iran, 2010 . [7] D. C. Peritz, A. Howard, M. Ciocca, E. and H.Chung,, "Smartphone ECG aids real time diagnosis of palpitations in the competitive college athlete," Journal of Electrocardiology, vol. 48, no. 5, pp. 896-899, 2015. [8] K. M Griffiths, E. N Clark, B. Devine, and P. W. Macfarlane, "Assessing the accuracy of limited lead recordings for the detection of Atrial Fibrillation," in Computing in Cardiology Conference (CinC), Cambridge, MA, USA, 2014. [9] G. Clifford, C. Liu, B. Moody, L. H. Lehman, I. Silva, Q. Li, A. Johnson, and R. Mark, "AF Classification from a Short Single Lead ECG Recording: the PhysioNet Computing in Cardiology Challenge 2017," Computing in Cardiology (In Press), vol. 44, 2017. [10] "AF Classification from a short single lead ECG recording: the PhysioNet/Computing in Cardiology Challenge 2017," 2017. [Online]. Available: https://physionet.org/challenge/2017/. [Accessed 7 9 2017]. [11] X. Ning, I. W. Selesnick, and L. Duval, "Chromatogram baseline estimation and denoising using sparsity (BEADS)," Chemometrics and Intelligent Laboratory Systems, vol. 139, pp. 156-167, 2014. [12] M. Zabihi , A. Bahrami Rad, S. Kiranyaz, M. Gabbouj, and A. K. Katsaggelos, "Heart sound anomaly and quality detection using ensemble of neural networks without segmentation," in Computing in Cardiology Conference (CinC), Vancouver, BC, Canada, 2016. [13] T. Hamdi, A. B. Slimane, and A. B. Khalifa, "A novel feature extraction method in ECG biometrics," in Image Processing, Applications and Systems Conference (IPAS), Sfax, Tunisia, 2014. [14] A. Bahrami Rad, T. Eftestol, K. Engan, U. Irusta, J. T. Kvaloy, J. Kramer-Johansen, L. Wik, A. K. Katsaggelos, "ECG-based Classification of Resuscitation Cardiac Rhythms for Retrospective Data Analysis," IEEE Transactions on Biomedical Engineering, vol. 64, no. 10, pp. 2411 - 2418, 2017. [15] F. Takens, "Detecting strange attractors in turbulence," Lecture Notes in Mathematics, vol. 898, pp. 366-381, 1981. [16] J. Park, S. Lee, and M. Jeon, "Atrial fibrillation detection by heart rate variability in Poincare plot," BioMedical Engineering OnLine, vol. 38, no. 8, 2009. [17] S. Moharreri, S. Rezaei, N J. Dabanloo, S. Parvaneh, "Extended Parabolic Phase Space Mapping (EPPSM): Novel quadratic function for representation of Heart Rate Variability signal," in Computing in Cardiology Conference (CinC), Cambridge, MA, USA, 2014. [18] S. Moharreri, S. Rezaei, and S Salavatian, "Discrimination of heart arrhythmias using novel features in heart rate phase space," in Computing in Cardiology Conference (CinC), Zaragoza, Spain, 2013. Address for correspondence: Morteza Zabihi, Ali Bahrami Rad P.O. Box 527, FI-33101 Tampere, Finland. P.O. Box 100, FI-33014 Tampere, Finland [email protected], ali.[email protected] Page 4