The application of AI algorithms represents a highly promising and powerful tool, particularly in the biomedical domain, enabling the resolution of complex problems and providing valuable support to clinicians in the diagnostic process.
Notably, numerous algorithms based on machine learning (ML) or deep learning (DL) have been documented in the literature, demonstrating the ability to distinguish a healthy trace from one affected by AF. A convolutional neural network (CNN) tested on a 12-lead ECG of 10 s duration was implemented and achieved an overall accuracy of 83.3%, a sensitivity of 82.3%, a specificity of 83.4%, and an F1 score of 45.4%. A total of 180,922 patients—with 649,931 having normal sinus rhythm ECG recordings—were enrolled for analysis, comprising 454,789 ECGs from 126,526 patients in the training set, 64,340 ECGs from 18,116 patients in the internal validation set, and 130,802 ECGs from 36,280 patients in the testing set [
11]. A hybrid approach using feature selection followed by ensemble classification for the diagnosis of arrhythmia was also proposed, achieving an accuracy of 77.27% and a precision of 76%. This research utilized the UCI arrhythmia dataset, which comprises 452 records categorized into 16 distinct arrhythmia types, including one representing healthy individuals. Among these, 245 instances correspond to healthy subjects, while the remaining 207 are from patients diagnosed with arrhythmia. [
12]. Another study proposes the combination of modified frequency slice wavelet transform (MFSWT) and convolutional neural networks (CNNs), reaching an accuracy of 84.85%, with a corresponding sensitivity and specificity of 79.05% and 89.99%, respectively. These performance parameters were calculated on the test dataset, excluding ECG recordings with low signal quality. The database utilized was from the MIT-BIH AFDB [
13]. The dataset includes 25 individual recordings, each derived from ambulatory ECG monitoring of a different subject. Every recording spans 10 h and 15 min and contains two ECG signal channels. The recordings were separated into five groups and, in order to employ a balanced dataset to train the model, an equal number of AF and non-AF samples were selected for training, while all remaining samples in the held-out fold were used for testing [
14]. A novel algorithm called Ensemble Learning and Multi-Feature Discrimination (ELMD) was proposed for the identification and detection of AF signals. The proposed method was evaluated on the MIT-BIH AF database [
13], reaching a specificity and accuracy that exceed 99% in AF detection in long-term ECG and reaching a sensitivity and accuracy that exceed 96% by testing the algorithm on cardiac segments [
15]. Another study employed a methodology based on the extraction of features derived from the RR interval. In this case as well, the MIT-BIH Atrial Fibrillation Database was utilized [
13]. Specifically, the extracted features include the robust coefficient of variation (RCV), the skewness parameter (SKP), and the Lempel–Ziv complexity (LZC), which, respectively, characterize the discrete degree of the RR interval, the distribution of shape of the RR interval, and the complexity of the RR interval. These features were subsequently used as input into a support vector machine (SVM) classifier, achieving a sensitivity of 95.81% and an accuracy of 96.09% [
16]. Another study presented a deep neural network strategy (DNN) followed by a genetic algorithm (GA) process to obtain the best feature’s combination, extraction, and classification [
17]. The algorithm is implemented on the MIT-BIH AF database [
13]. Finally, another study proposed a deep learning model named HBBI-AI, designed to predict atrial fibrillation episodes during sinus rhythm [
18]. For the testing phase, multiple datasets were employed, including the Long-Term Atrial Fibrillation Database [
19] and the Autonomic Aging Dataset [
20], which were also used in the evaluation of our proposed algorithm. The HBBI-AI model achieved a sensitivity of 73.8% and a specificity of 76.5%, which are comparable to the performance of our method. In fact, our algorithm obtained a sensitivity of 96% and a specificity of 96%. The approach of identifying pathology using deep learning is promising as these algorithms can detect heart diseases with an accuracy level comparable to that of medical experts [
21]. However, several challenges must be addressed for the direct application of these algorithms in clinical settings, including issues related to accuracy, reliability, consistency, and interpretability [
21]. This limitation is primarily due to the available datasets being limited and failing to reflect the quality of signals obtained in a real-world context [
21]. Furthermore, machine learning methods often require many features (over 150) to achieve high classification accuracy, which can compromise the interpretability and physiological relevance of those features. Additionally, while ML techniques can automatically extract features and classify data, they are prone to overfitting, bias, and limitations due to insufficient training data, which affects their accuracy and reliability. Moreover, most current ML algorithms need long ECG recordings (more than 100 heartbeats), reducing their practicality in clinical settings [
22]. Therefore, a deterministic automatic discrimination algorithm is proposed, as it does not require training on large datasets and the extraction of many features, unlike AI approaches, and could thus be a viable alternative for application in contexts characterized by limited data availability or in clinical settings. For this reason, only the P wave was considered, as the primary characteristic of the pathology lies in malformations of this specific wave. Although variations in RR intervals can also indicate the presence of atrial fibrillation, such changes are not exclusive to AF and are commonly observed in other types of arrhythmias [
23]. In previous studies, several deterministic algorithms based on the analysis of the P wave have been proposed. While these approaches have demonstrated promising results, their performance metrics remain inferior to those achieved by the algorithm presented in our work. For example, a study conducted using the MIT-BIH Normal Sinus Rhythm [
24] and AF Termination Challenge databases [
25,
26] examined the standard deviation between consecutive RR intervals and analyzed data points within four windows preceding the detected R-peaks [
27]. However, this study only highlights the observation that patients with atrial fibrillation exhibit a higher RR interval standard deviation and a lower P power value—a parameter used to quantify the presence of the P wave—compared to healthy individuals. Notably, the algorithm does not perform beat-level detection, nor does it distinguish between healthy subjects and those affected by AF, unlike our proposed method. Another study utilized signal-averaged ECG recordings of the P wave in 73 patients following successful cardioversion. It calculated the duration of the filtered P wave and the root mean square (RMS) voltage of the final 20 ms of the P wave. The reported sensitivity and specificity for detecting AF recurrence post-cardioversion were 70% and 76%, respectively [
28], which are inferior to the performance metrics achieved by our algorithm. Finally, a further study based on the CSE and MIT-BIH databases proposed a set of features extracted from the P wave, including duration, morphological descriptors, spectral characteristics, and wavelet entropy parameters. The reported sensitivity and specificity ranged between 65% and 70% [
29], again demonstrating a lower performance compared to our approach.