# Fog-Computing-Based Heartbeat Detection and Arrhythmia Classification Using Machine Learning
## 2 Preliminaries and Previous Work
One of the earliest and most established algorithms introduced by [PERSON] [27] identifies the \(QRS\) complexes based upon digital analysis of the slope, the amplitude, and the width of the ECG data. The algorithm periodically adjusts the thresholds and the parameters used to detect changes in the \(QRS\) morphology and heart rate. For this reason, this approach is also known as the _adaptive-thresholds_ approach. Another method is the _dual-slope QRS detection_, which calculates the slopes on both sides of the complex. The algorithm presented by [PERSON] et al. [28] uses low computational complexity techniques to calculate the steepness, the shape, and the height of the signal to locate each \(QRS\) complex. Yet another approach relies on the use of the _wavelet transform_[29; 30]. The wavelet transform decomposes a time-variant signal into components appearing at _various scales_ (or resolutions). The components in each scale represent the signal temporal features, on the basis of their frequency contents. In contrast to the previous techniques, which require prior knowledge about the frequency spectrum, the _multistage multiscale mathematical morphology_ filtering used by [PERSON] et al. [31] allows for the detection of the various components of the \(PQRST\) complex by suppressing the impulsive noise and uses the multi-frame differential modulus accumulation to remove the baseline drift and to enhance the signal. There exist many algorithms for computerized detection of abnormal heart activity which are based on the interpretation of ECG recordings. However, [PERSON] et al. [32] report that they are very inaccurate. This explains why it is necessary for the diagnosis to be performed by medical specialists and physicians. Very recently, [PERSON] et al. [33] investigated the use of machine-learning techniques to reduce the errors in the computerized electrocardiogram interpretation of the cardiac rhythm. An application of the \(k\)-Nearest Neighbor (KNN) algorithm as a classifier for the detection of the \(QRS\)-complex in ECG produced very high detection rates. [PERSON] [34] developed an evolutionary neural system which makes the efficient classification of cardiac disorders possible. The best results were observed with the use of an evolutionary neural system, which was based on the SVM classifier and obtained a recognition sensitivity at a level of 90%. The same author also developed revolutionarily effective ensembles of classifiers for the automatic recognition of myocardium dysfunctions based on ECG signals [35]. The best genetic ensemble of classifiers optimized by sets obtained a recognition sensitivity of 17 myocardium dysfunctions at a level of 91.4%, which is the best result achieved to  
Figure 1: \(PQRST\) complex: the pattern of electrical activity of the heart during one cardiac cycle as recorded by electrocardiography. Created by [PERSON], source: [[https://www.wikilectures.eu/w/Electrocardiogram](https://www.wikilectures.eu/w/Electrocardiogram)]([https://www.wikilectures.eu/w/Electrocardiogram](https://www.wikilectures.eu/w/Electrocardiogram)). date against the background of the current scientific literature. [PERSON] et al. [PERSON] et al. (2018) proposed another deep-learning approach for the detection of cardiac arrhythmia, which is based on a one-dimensional convolutional neural-network model. The proposed method is simple, efficient, and fast (it allows for real-time classification), thus making it very practical. More recently, [PERSON] et al. [PERSON] et al. (2019) applied a 34-layer convolutional neural network, which maps a sequence of ECG samples to a sequence of rhythm classes. They make a comparison between the performance of the deep-learning network and that of certified cardiologists in detecting a wide range of heart arrhythmias from electrocardiograms recorded with a wearable monitor. Interestingly, their system outperforms the average cardiologist performance in both recall (sensitivity) and precision (positive predictive value).