###### Abstract  
Arrhythmias are the most common events tracked by a physician. The need for continuous monitoring of such events in the ECG has opened the opportunity for automatic detection. Intra- and inter-patient paradigms are the two approaches currently followed by the scientific community. The intra-patient approach seems to resolve the problem with a high classification percentage but requires a physician to label key samples. The inter-patient makes use of historic data of different patients to build a general classifier, but the inherent variability in the ECG's signal among patients leads to lower classification percentages compared to the intra-patient approach. In this work, we propose a new unsupervised algorithm that adapts to every patient using the heart rate and morphological features of the ECG beats to classify beats between supraventricular origin and ventricular origin. The results of our work in terms of F-score are 0.88, 0.89, and 0.93 for the ventricular origin beats for three popular ECG databases, and around 0.99 for the supraventricular origin for the same databases, comparable to supervised approaches presented in other works. This paper presents a new path to make use of ECG data to classify heartbeats without the assistance of a physician despite the needed improvements. beats classification; ECG; algorithms; ML +
Footnote †: journal: Medical  
shapes and intensity levels in the pixels; some examples of this are the CADe/CADx systems developed for detection of lung and breast cancer, colonoscopy, etc. [5; 6; 7; 8], but there are still no applications thus far for the classification and diagnosis of cardiac arrhythmias. As an example of arrhythmia, we have the ventricular extrasystoles, which are a reflection of the activation of the ventricles from a site below the AV node. Its outcome is linked to an underlying disease, and there could be three causes for it: reentry, increased automatism, and triggered activity. The increased automatism suggests an ectopic group of cells in the ventricle. This process is the underlying mechanism of arrhythmias secondary to hyperkalemia. Reentry occurs in patients with underlying scarring ischemic heart disease or myocardial ischemia. This mechanism can produce isolated ectopic beats or trigger ventricular tachycardia and eventually sudden cardiac death [9; 10]. Moreover, nowadays, a new trend is emerging in the deep learning (DL))-based ECG heartbeat classification, and several scientists present their efforts in this field. Although extensive experimental work is carried out on this topic, it is not suitable yet for real-time scenarios. Their approaches are not optimally efficient to cover the inter-patient variability issue in ECG signals [11; 12]. Although ECG signals have been used for diagnosis for over a century, manually tracking these arrhythmias over even a thousand heartbeats is an infeasible task, even for expert physicians, because of the amount of time required to perform such endeavors. These kinds of tasks require automated mechanisms to detect and classify all these events. This is why AI is now an extremely relevant and important part of the algorithms for automated learning in electrocardiographic signals [13; 14; 15]. On an ECG, rhythm refers to the part of the heart that is controlling the initiation of electrical activity. Under normal circumstances, the sinoatrial node (SAN) initiates electrical activity because it undergoes spontaneous depolarization first at a rate of 60-100 bpm.