# Fog-Computing-Based Heartbeat Detection and Arrhythmia Classification Using Machine Learning
## 1 Introduction  
The design of advanced health-monitoring systems has always been a topic of active research. During the past decades, numerous portable devices have been introduced for the early detection and diagnosis of heart failure, since it is a common, costly, disabling, and deadly syndrome. Advanced heart-monitoring devices are capable of providing reliable, accurate heart monitoring and are able to detect sporadic events during periods of time when things would otherwise be unclear. Functioning as a black box, these devices have the potential to enhance the decision-making process, by notifying doctors when patients need readmission and in this way constituting an effective alternative capable of saving patients' lives. Various portable devices have been introduced by the industry (e.g., Wahoo Fitness ([[https://www.wahoofitness.com](https://www.wahoofitness.com)]([https://www.wahoofitness.com](https://www.wahoofitness.com))), Polar H10 Heart Rate Sensor ([[https://www.polar.com/en/products/accessories/H10_heart_rate_sensor](https://www.polar.com/en/products/accessories/H10_heart_rate_sensor)]([https://www.polar.com/en/products/accessories/H10_heart_rate_sensor](https://www.polar.com/en/products/accessories/H10_heart_rate_sensor))), and Fitbit PurePulse ([[https://www.fitbit.com/purepulse](https://www.fitbit.com/purepulse)]([https://www.fitbit.com/purepulse](https://www.fitbit.com/purepulse)))) to monitor and record variations in the heart rate, rhythm, and other patterns of its operation, by detecting electrical impulses generated by the polarization and depolarization of cardiac tissue. Such devices rely on nearby smartphones that act as a gateway for transmitting the recorded sensor signals to cloud services, where appropriate signal processing, analysis, and classification algorithms are applied. The analyzed electrocardiogram (ECG) can be used in decision-support systems to assist physiciansand cardiologists to evaluate irregular heart rhythm, potentially diagnose cardiac abnormalities, and predict critical clinical states [1]. Existing portable heart monitoring devices are very inaccurate as a result of electromagnetic noise produced by the environment (e.g., mobile phones, electrical wires, appliances) or from the noise produced by the muscular movement of the human while wearing the device [2; 3]. Moreover, depending on the accuracy of the ECG device, even a short recording may lead to a large volume of data, thus affecting the battery performance of the portable devices as well as that of the accompanying smartphone while storing and transmitting the recording wirelessly [4; 5], thus limiting their diagnostic use to 24 h monitoring or even less [6]. Finally, the concept of transmitting the sensor data to cloud services for processing and analysis creates a number of security issues that need to be addresses as they are directly related with the privacy of the users [7; 8; 9]. Existing portable solutions are totally cloud-centric: all personal data collected are stored on the cloud and in most cases users no longer own the data they produce. This approach severely limits the ability of the user to maintain control of personal data. Now, more than ever, there is a need for privacy-preserving applications where users are always in control of their sensitive data [8; 10]. The major challenge in the evolving landscape of wearable devices is to increase the accuracy of the biosignals collected [2], broaden the capabilities for interpretation of data [11], whilst at the same time improving the long-term operativity [5] and guaranteeing the privacy of the users [12]. With the advent of wearable-sensing technologies [13] and smart textiles [14; 15], the miniaturization of embedded systems and energy generators [16], and the introduction of new communication protocols [17] and access technologies [18; 19; 20], the development of wearable devices that can provide accurate and precise measurements is becoming a realistic possibility.