K-Nearest Neighbor based QRS delineator for single lead ECGs recorded in lifestyle monitoring applications

Rohit Hadia, D Finlay, D Guldenring, Alan Kennedy, Ghalib Janjua, RR Bond, James McLaughlin

Research output: Contribution to journalMeeting Abstractpeer-review


The QRS complex is the most prominent waveform present on the Electrocardiogram (ECG). In addition to being a fiducial marker for disease diagnosis, QRS complexes are also used as the reference point for detection of other features on the ECG such as P wave, T wave, RR interval variability etc.

In this study, we report on a QRS complex annotation algorithm that is based on a machine learning approach. We used 21 ECG recordings from MIT-BIH arrhythmia database to train the algorithm and another 23 ECG recordings from the same database to measure the performance of the algorithm to accurately detect QRS complexes.

In the ECG preprocessing step we implemented the first five steps as proposed in the Pan-Tompkin’s algorithm, namely, band-pass filtering, high-pass filtering, signal differentiation, nonlinear scaling, and moving window integration. Then, we detected the probable signal windows (PSWs) on the integrated waveform. The end point of each PSW is detected by implementing the peak detection method mentioned in the Hamilton-Tompkin’s Algorithm. Three features were computed from each PSW namely, maximum amplitude value within PSW, the width of the PSW, and PSW amplitude which is integral of overall amplitude within the PSW. A K-nearest neighbor (KNN) binary classifier was designed based on the distribution of the features from PSWs corresponding to the QRS complexes and those of non-QRS complexes. Based on six-fold cross-validation the value of nearest neighbors’ K was set to 5, and the Euclidean distance was used as the distance metric. The designed KNN classifier was used to predict the QRS complexes from the testing dataset.

The performance of the KNN classifier to correctly detect the QRS complexes from the testing dataset was quantified by computing the sensitivity and positive predictive value (PPV) respectively. The algorithm has reported mean sensitivity of 97.91% and the mean PPV of 99.24%. The method proposed in this research work allows for an efficient QRS annotator for single lead ECGs. This is an area where there is renewed interest based on the emergence of a plethora of lifestyle monitoring devices.
Original languageEnglish
JournalJournal of Electrocardiology
Issue numberSupplement
Publication statusPublished (in print/issue) - 6 Dec 2019
Event43rd Annual Conference of the International Society for Computersied Electrocardiology: Opening Session - Utah, Park City, United States
Duration: 25 Apr 201829 Apr 2018
Conference number: 43


  • Machine learning
  • signal processing
  • ECG
  • QRS
  • beat detection


Dive into the research topics of 'K-Nearest Neighbor based QRS delineator for single lead ECGs recorded in lifestyle monitoring applications'. Together they form a unique fingerprint.

Cite this