# QRS Detection Based on Medical Knowledge and Cascades of Moving Average Filters
## 4 Discussion
To highlight the light computational cost of the proposed QRS detection algorithm, we measured its execution time. On average, 0.1137 s were required to process an hour of ECG recording on our test machine, which is 33.56% of the time required by the quickest of the other programs. This result confirms the low processing power required by the algorithm we propose. While the detection accuracy of any method remains the fundamental performance metric, low execution time is nonetheless relevant for low-power devices such as wearable and portable devices. In our algorithm, the derivative filter that maximizes the signal quality index is chosen on a selected 15 s signal interval at the beginning of the record. On longer records, e.g., 24-h-long Holter ECG, the derivative that maximizes the quality index could change throughout the record. Posture changes of the patient can alter the relative position of the heart and the electrodes, thus changing the amplitude and shape of the signal in each lead. To tackle this effect, the derivative filter selection could be repeated at regular intervals. As an alternative, the signal quality index of each derivative filter could be updated iteratively. This would remove the need to maximize the signal quality index multiple times. A derivative filter updating rule is a possible future development of this algorithm. In the existing literature, the performance reported in some papers achieved higher scores than our algorithm. For example, [PERSON] and [PERSON] [16] reported higher F1 scores on the first channel of the MIT-BIH Arrhythmia (99.95% vs. 99.84%), the MIT-BIH Noise Stress Test (99.53% vs. 91.71%) and QT (99.98% vs. 99.92%) databases using convolutional neural networks. Machine learning, and specifically deep learning, have been applied with great effect to many biomedical topics, and rightly so. Yet, these approaches come at a cost in both in terms of processing time and memory requirements. Moreover, machine learning algorithms crucially depend on the training data and must satisfy specific regulatory demands to be implemented in commercial devices. The scope of our algorithm is instead to propose an accurate algorithm with an emphasis on execution efficiency and a clear, explainable decision logic. The literature on QRS detection is rich. Many approaches have been proposed over time, and results are often reported using heterogeneous criteria. Moreover, database annotations are another source of confusion in results comparison, as human observers occasionally disagree on annotation protocols. For this reason, the question of finding the 'best' QRS detection approach has no simple, unambiguous answer and comparison of published results may not be equitable. [PERSON] [8] developed a QRS detection approach that aimed to be efficient and accurate, with moving averages, considering multiple databases, and is thus closer to the scope of our algorithm. [PERSON] reported the performances for only the first channel of several databases, including the databases we considered. The comparison with our work is favorable for the MIT-BIH Arrhythmia (99.82% vs. 99.84%) and QT (99.81% vs. 99.92%) databases. Conversely, the performances of the algorithm we propose are lower on the INCART (98.05% vs. 96.51%), MIT-BIT Noise Stress Test (92.75% vs. 91.71%), and T Wave Alternans (99.00% vs. 98.20%) databases. A future comparison of execution time between these two algorithms would be of interest. [PERSON] [25] reported performances as high as 99.91% F1 on the MIT-BIH database, which have been confirmed in our implementation of their code (99.88% F1) and are higher than our score (99.84% F1). Despite this, on all the other databases we included their algorithm reached lower performances. This may possibly be an effect of overfitting an algorithm on a small pool of data. For this reason, comparing implemented algorithms on multiple databases can offer greater insight on the characteristics of a QRS detection algorithm. This task, however, is easier when code is shared by its authors.