Abstract
Cardiac arrhythmias are serious health hazards that need precise, understandable diagnostic instruments. This study proposes an Explainable Hybrid DT-ATTN Model that combines Decision Trees (DT) and an Attention-Based Neural Network (ATTN) to detect and classify arrhythmias using real-time Electrocardiogram (ECG) data. The Biocare ECG-1210 equipment was used to gather a dataset of 30,000 ECG signals from the Sher-i-Kashmir Institute of Medical Sciences (SKIMS), Soura, Srinagar. The Pan-Tompkins technique and Min-Max Normalisation were used for data pre-processing. The model was trained and validated using an augmented dataset of 72,000 ECG records that included five classes: normal sinus rhythm, Atrial Fibrillation, Ventricular Tachycardia, bradycardia, and Atrial Flutter. While the attention technique enhances feature extraction and enables the model to focus on key ECG patterns, the decision tree component ensures interpretability. In every class, the Hybrid DT-ATTN Model achieves an accuracy of 97%, a precision of 97.01%, a recall of 97.03%, and an F1-score of 97.39% demonstrating its outstanding performance. Additionally, SHAP and LIME were used to illustrate the model's explainability, providing doctors with clear insights into how it makes decisions. The suggested DT-ATTN framework is a dependable tool for real-time arrhythmia diagnosis, as it not only provides high diagnostic accuracy but also bridges the gap between clinical interpretability and the complexity of deep learning models. This study demonstrates how accurate and comprehensible ECG analysis, utilising hybrid AI models, can improve patient outcomes.
Introduction
Cardiovascular diseases (CVDs) are the leading cause of mortality worldwide, accounting for approximately 17.9 million deaths each year, which represents about 32% of all global deaths (World Health Organisation). Among these, cardiac arrhythmias remain a significant concern due to their high prevalence and clinical severity. Atrial fibrillation (AFib), the most common sustained arrhythmia, affects more than 33 million people globally, and its prevalence is expected to double by 2050 as populations continue to age (The Lancet). Ventricular arrhythmias, on the other hand, are a primary cause of sudden cardiac death, which contributes to 15–20% of all deaths worldwide annually (Circulation, American Heart Association). These statistics underscore the pressing need for reliable and effective arrhythmia detection frameworks to facilitate timely diagnosis and enhance patient outcomes.
Cardiac Arrhythmias are Irregular heart rhythms that differ from the normal sinus rhythm, including AFib, ventricular tachycardia (VT), bradycardia, and atrial flutter (shown in Figure 1) (Katal et al., 2023). These anomalies might be sporadic or chronic, which makes it difficult to identify and categorise them (Sheerinsithara and Raj, 2025). AFib, bradycardia, VT, and atrial flutter are examples of irregular heart rhythms that deviate from the typical sinus rhythm (Han et al., 2024). It is challenging to recognise and classify these anomalies since they may be intermittent or persistent. Explainable AI (XAI) is a field of artificial intelligence that focuses on creating models that offer clear and understandable insights into how they make decisions (Daydulo et al., 2023). Explainability is essential in the healthcare industry for fostering clinician trust and guaranteeing the secure implementation of AI-powered solutions.

Normal sinus rhythm and irregular heart rhythms.
Recent advances in machine learning (ML) and deep learning (DL) have shown great promise in the automated identification of arrhythmias. Traditional approaches, such as rule-based systems and traditional ML models (e.g., support vector machines and random forests), have been widely employed; however, they often lack the accuracy and stability necessary for clinical applications (Daydulo et al., 2023; Ismail et al., 2023; Katal et al., 2023). DL models, notably convolutional neural networks (CNNs) and recurrent neural networks (RNNs), have achieved cutting-edge performance in ECG analysis due to their ability to automatically extract complex features from raw data (Han et al., 2024; Sheerinsithara and Raj, 2025). However, these models are sometimes criticised for their “black-box” nature, which limits their interpretability and prevents their use in clinical practice.
To overcome this limitation, hybrid models that integrate interpretable components with DL techniques have been proposed (Daydulo et al., 2023). These models aim to strike a balance between accuracy and explainability, making them more suitable for healthcare applications (Ismail et al., 2023). Despite their potential, research in this field is restricted, with few papers investigating the integration of attention mechanisms—a powerful DL technique for feature extraction—with interpretable models such as decision trees (DT). Furthermore, most recent research utilises benchmark datasets, such as MIT-BIH, which may not accurately represent the variability and complexity of real-world ECG data.
The goal of this research is to create an Explainable Hybrid DT-ATTN Model that combines DT and an attention-based neural network (ATTN) to detect arrhythmias accurately and interpretably using real-time ECG data. The proposed model aims to address the limitations of existing approaches by leveraging the interpretability of DT and the attention mechanism's feature extraction capabilities, resulting in a trustworthy tool for real-time arrhythmia diagnosis.
The structure of the research paper is as follows: A detailed review of existing studies and related literature is presented in the Literature Review (Section 2). The research methodology, which includes data collection, data pre-processing, feature extraction, and classification, is described in the Proposed Methodology (Section 3). The experimental results, performance analysis, and comparisons with current models are presented in the Results and Discussion (Section 4). The limitations and possible enhancements for further research are emphasised in the Challenges and Future Directions (Section 5). The study's main conclusions and contributions are outlined in the Conclusion (Section 6). Lastly, a list of all the sources cited in the paper can be found in the References (Section 7).
The automated detection of CVDs, particularly cardiac arrhythmias, has progressed significantly with the adoption of ML and DL techniques. Improvements in computational efficiency, the availability of large-scale ECG datasets, and the emergence of XAI have collectively enhanced the reliability and clinical relevance of ECG-based diagnostic systems. This section briefly reviews key developments while highlighting persistent research gaps.
Early comparative investigations demonstrated the superiority of DL models over traditional ML techniques. Katal et al. (2023) showed that CNN- and RNN-based architectures achieved higher arrhythmia classification accuracy because they can automatically learn discriminative features from ECG signals. However, the absence of external validation limited the clinical generalizability of their findings. Building on this, Sheerinsithara and Raj (2025) proposed a hybrid ML–DLNN framework that combined handcrafted and learned features, improving classification performance. Despite these gains, the study relied on a small dataset and lacked patient-wise validation, raising concerns regarding robustness.
To address deployment challenges, Han et al. (2024) introduced a transformation-based DL model integrated with edge computing, enabling low-latency, real-time arrhythmia detection. While effective for scalable deployment, the model did not evaluate long-term stability or performance under noisy ECG conditions. Similarly, Daydulo et al. (2023) employed time–frequency representations to capture nonlinear ECG characteristics, thereby improving feature extraction. Nevertheless, increased computational complexity and limited multi-dataset evaluation constrained broader applicability.
Reinforcement learning (RL) has also been explored to enhance adaptability. Ismail et al. (2023) proposed RL-ECGNet, a resource-aware framework capable of multi-class arrhythmia detection under constrained computational settings. Although suitable for embedded systems, the approach lacked interpretability analysis and comprehensive baseline comparisons.
Beyond core DL architectures, several studies have contributed complementary perspectives. Feature selection strategies were investigated to improve ML-based CVD detection efficiency (Ullah et al., 2024), while disease-specific frameworks targeted specialised populations such as diabetic patients (Mokesh Rayalu et al., 2024). Traditional ML approaches remain clinically relevant when paired with effective pre-processing (Jat et al., 2024). Edge-AI solutions have further extended arrhythmia detection to resource-constrained and extreme environments (Mani et al., 2024). Hybrid deep architectures (Denysyuk et al., 2023; Issa et al., 2023; Talukder et al., 2024), IoT-enabled ECG systems (Sai Kumar et al., 2023), ensemble learning methods (Ramkumar et al., 2023), and optimised single-lead ECG models (Karthiga and Santhi, 2022; Madan et al., 2022) have expanded applicability to wearable and remote healthcare scenarios. Earlier inter- and intra-patient modelling approaches also laid important foundations for generalisation-aware learning (Mousavi and Afghah, 2019).
The availability of large, well-annotated datasets has been instrumental in advancing this field. The 12-lead ECG database introduced by Zheng et al. (2020) significantly improved benchmarking and generalisation, while broader clinical perspectives on AI in electrophysiology contextualised algorithmic progress within real-world practice (Feeny et al., 2020). Earlier ML-based rhythm detection studies (Figuera et al., 2016; Ganesh Kumar and Kumaraswamy, 2014; Mitra and Samanta, 2013) established baseline methodologies that continue to influence modern designs.
More recent contributions include automated ML-based arrhythmia-detection systems (Tutuko et al., 2021), multi-band nonlinear ML frameworks for cardiovascular diagnosis (Ribeiro et al., 2024), and heartbeat-feature-driven ML classifiers that bridge arrhythmia detection with broader CVD assessment (Alarsan and Younes, 2019). Hambarde et al. (2025) demonstrated effective arrhythmia detection using a hybrid deep neural network on single-lead ECG data, highlighting suitability for wearable devices.
Advanced architectures integrating transformers have also emerged. Kim et al. (2025) proposed a hybrid CNN-Transformer model using the Stockwell transform, eliminating the need for R-peak detection and enabling end-to-end classification. However, the computational cost and reduced interpretability of transformer-based models remain concerns. Lamba et al. (2025) introduced the FADLEC framework, integrating feature extraction and classification within a unified DL model, though robustness under noise and cross-device variability was not evaluated.
Addressing efficiency, Elsheikhy et al. (2025) proposed a lightweight DL architecture for multi-lead ECG analysis suitable for constrained environments, but real-time deployment on actual edge devices was not validated. Finally, comprehensive reviews by Reshad et al. (2025) synthesised recent advances in DL-based arrhythmia detection, outlining both technical progress and clinical challenges, while underscoring the need for experimentally validated, interpretable, and computationally efficient solutions.
To synthesise the critical analysis presented in the preceding narrative review, Table 1 provides a structured summary of the state of the art in ECG-based arrhythmia detection. This tabular overview crystallises the dominant trends and, more importantly, the persistent methodological gaps identified across the literature. It systematically juxtaposes the technical approaches and their reported performance against fundamental limitations in generalizability, computational efficiency, and clinical practicality. The consolidation of this information objectively delineates the research landscape, offering a definitive reference that underscores the necessity of the novel contribution proposed in this work.
Summary of ECG Arrhythmia Detection Methods, Highlighting the Critical Gap Between High Benchmark Accuracy and Limitations in Clinical Deployment.
Summary of ECG Arrhythmia Detection Methods, Highlighting the Critical Gap Between High Benchmark Accuracy and Limitations in Clinical Deployment.
Despite advances in automated arrhythmia identification, significant gaps persist. Hybrid models that combine interpretable DT with DL remain underexplored, restricting clinical application due to a lack of transparency. Most studies use benchmark datasets like MIT-BIH, which do not account for real-world issues like noise and artefacts. It is critical to conduct research on real-time clinical ECG data. Furthermore, XAI remains limited, and issues in recognising unusual or overlapping arrhythmias require further research. Addressing these shortcomings is critical for creating accurate, interpretable, and clinically useful models.
The proposed model directly addresses the scarcity of research on hybrid interpretable models for ECG analysis and the unique challenge of integrating real-time clinical data into AI-driven diagnostic tools. By emphasising explainability and real-world applicability, this work aims to address the limitations of prior research and advance automated arrhythmia identification. Attention mechanisms enhance the model's ability to focus on crucial ECG patterns, while DT provide clear insights into the decision-making process, bridging the gap between complex AI models and clinical interpretability.
This paper introduces a Hybrid Decision Tree and Attention-Based Neural Network (DT-ATTN) Framework for detecting multi-class arrhythmias using real-time ECG data. The institutional Ethical Committee of Lovely Professional University issued ethical approval for this research (Ref No.: IEC-LPU/2025/1/19). The methodology is divided into three main stages: data collection and pre-processing, feature extraction, and classification. Each stage is critical to establishing accurate, interpretable, and robust arrhythmia categorisation.
Data Collection
In this work, 30,000 ECG signals from the Sher-i-Kashmir Institute of Medical Sciences (SKIMS), located in Soura, Srinagar, were used as the dataset. The Biocare ECG-1210 equipment was used to capture the ECG signals, which had a fixed sampling rate of 250 Hz and lasted 10 s each. To ensure efficient processing, we assigned numerical labels to each arrhythmia class: 0 for Normal Sinus Rhythm, 1 for AFib, 2 for VT, 3 for Bradycardia, and 4 for Atrial Flutter. Although the dataset was initially balanced, data augmentation using SMOTE was applied to expand the sample size and introduce greater variability in the ECG recordings. This approach enhances the model's ability to generalise, reduces the risk of overfitting, and ensures improved stability and reliability in classifying different arrhythmia types. Graph 1 illustrates the class distribution before data augmentation, with each class comprising approximately 6,000 samples and balanced evenly. Graph 2 illustrates the class distribution after augmentation, where the dataset size has increased to approximately 14,500 samples per class, thereby maintaining a balance across all classes
Class Distribution of the original dataset [AQ10]. Class distribution of the augmented dataset.


Overall methodology.
The raw ECG signals underwent several pre-processing procedures to ensure high-quality inputs for model training. The detection of R-peaks, which is essential for precise heartbeat segmentation, was done using the
Feature Extraction
The pre-processed ECG signals were subjected to a thorough extraction of time-domain, frequency-domain, and morphological features in order to improve classification accuracy. To assess heartbeat fluctuations and identify arrhythmias, such as AFib, time-domain parameters, including RR intervals and QRS duration, were calculated. Fast Fourier Transform (FFT) coefficients and other frequency-domain properties helped distinguish between different types of arrhythmias by offering insights into the spectrum characteristics of ECG data. Furthermore, waveform shape variations were captured by morphological aspects, including P-wave amplitude and T-wave variability, which are crucial for detecting disorders such as atrial flutter. To ensure a well-organised dataset for model training, these extracted characteristics were arranged using Biocare 1000 Data Management Software and saved in a .csv format.
Classification
The proposed Hybrid DT-ATTN Model combines an ATTN for enhanced feature extraction and classification accuracy with DT for interpretability (shown in Figure 2). The DT component offers a structured, rule-based approach that makes the model's predictions transparent and interpretable for clinicians, while the ATTN mechanism improves classification by emphasising the most relevant signal features, allowing the model to prioritise essential ECG segments. The model was trained on an augmented dataset of 72,000 ECG signals, optimised using the Adam optimiser, and assessed using accuracy, precision, recall, and F1-score, achieving over 97% accuracy across all arrhythmia classes. Explainability was further validated via feature importance analysis and attention weight visualisation, guaranteeing dependable and clinically interpretable decision-making.
The hybrid DT-ATTN model enhances the accuracy and explainability of arrhythmia detection by combining interpretable decision tree classification with a DL-based attention mechanism. A detailed explanation of how the results are combined to yield the final prediction, which is presented below, is provided.
A DT is a hierarchical model that predicts a class label using learned decision rules. Given an ECG set of parameters
Where
An attention mechanism assigns different importance scores to ECG features before classification. Given input feature vectors X the attention scores are computed as:
W is the weight matrix v is a learnable weight vector b is a bias term tanh(·) is the activation function.
The normalised attention scores
The final attention-weighted feature representation is computed as:
Where
Finally, the ATTN classifies the ECG signal using a softmax function:
Where:
To combine the outputs of both models, we compute a weighted sum of the probability distributions obtained from DT and ATTN:
is the final predicted probability distribution over arrhythmia classes σ is the softmax activation function that ensures probabilities sum to 1.
Expanding σ, we get:
The model is optimised by minimising the cross-entropy loss:
Table 2 presents the step-by-step pseudocode of the proposed DT-ATTN Hybrid Model for arrhythmia detection. The algorithm demonstrates the sequential processing of ECG features through two complementary branches—DT-ATTN, followed by a fusion mechanism and cross-entropy optimisation to yield the final classification outcome.
Pseudocode Representation of the DT-ATTN Hybrid Model for Arrhythmia Detection.
To evaluate the robustness and generalisation capability of the proposed hybrid Decision Tree-Attention (DT-ATTN) model for cardiac arrhythmia classification, we employed a 10-fold cross-validation strategy. In this method, the dataset is divided into ten equal subsets. Each subset serves as a validation set once, while the remaining nine subsets are used for training. We recorded the classification accuracy for each fold and calculated the mean and standard deviation to assess the overall stability and reliability of the model. This approach ensures that the model's performance is evaluated across multiple partitions of the dataset, reducing potential bias and providing a comprehensive assessment of its predictive capability.
The Hybrid DT-ATTN Model was validated using standard methods and demonstrated remarkable classification performance, with an overall accuracy of 97%, a precision of 97.01%, a recall of 97.03%, and an F1-score of 97.39%. Themodel'sprecision, recall, and F1 score were consistently excellent across all arrhythmia classifications, confirming its reliability for real-time ECG analysis. The developed DT-ATTN model was assessed using standard performance metrics:
Where TP = True Positives TN = True Negatives FP = False Positives FN = False Negatives.
The 10-fold cross-validation results demonstrated that the DT-ATTN model achieved consistently high accuracy across all folds. The accuracies for the individual folds were 97.12%, 97.44%, 97.49%, 97.10%, 96.96%, 97.25%, 97.03%, 97.29%, 96.93%, and 97.07%, resulting in an average accuracy of 97.17% with a standard deviation of ±0.18%. These results indicate that the proposed hybrid model performs reliably across different subsets of the dataset, confirming its effectiveness for multi-class arrhythmia detection and its potential applicability in real-world clinical settings.
The Receiver Operating Characteristic (ROC) Curve and Area Under Curve (AUC) were used to assess the model's ability to differentiate between different arrhythmia classes. The ROC curve compares the True Positive Rate (TPR) to the False Positive Rate (FPR) at different classification thresholds, displaying the trade-off between sensitivity and specificity.
The per-class analysis of the ROC curves reveals outstanding classification performance across all categories, as shown in Figure 3. The Area Under the Curve (AUC) values are exceptionally high, with Class 0 and Class 4 achieving a perfect score of 1.00, while Class 2 also performs near-perfectly with an AUC of 0.99. Classes 1 and 3 follow closely with a strong AUC of 0.96. Since all AUC scores are substantially greater than the 0.5 benchmark of a random classifier, this indicates that the model possesses a robust and consistent ability to distinguish each individual class from all others, with minimal misclassification. The results confirm the model's high discriminatory power and reliability across the entire classification scheme.

ROC curve of all classes.
The confusion matrix (as shown in Figure 4) demonstrates the strong performance of the proposed model in classifying different arrhythmia types, with the majority of predictions aligned along the diagonal. Classes 0 and 4 were perfectly classified, and Classes 1, 2, and 3 also had high correct classification rates with only a littleerlap. This result highlights the robustness and reliability of the model, confirming its effectiveness in distinguishing between complex ECG patterns and supporting its potential for accurate clinical decision-making in arrhythmia detection.

Confusion matrix for the DT-ATTN model on the five-class arrhythmia classification task, showing high accuracy along the diagonal.
SHAP interaction values (as shown in Figure 5) offer a detailed view of how pairs of features jointly influence a model's predictions, providing insight beyond individual feature contributions. In this analysis, interactions were evaluated across five key cardiac features: PR interval, QRS duration, heart rate (HR), systolic blood pressure (BP), and QT interval. Each point in the interaction plot represents a sample, with the SHAP interaction value quantifying the combined effect of a feature pair on the prediction. The colour gradient indicates the relative value of the feature on the y-axis. Notably, significant interactions were observed between the HR and QT intervals, suggesting a physiologically relevant relationship that may influence predictive performance. These findings emphasise the importance of accounting for feature interactions in clinical model interpretation.

SHAP summary plot displaying feature importance and impact direction for the proposed model, highlighting heart rate and QT interval as the most influential predictors in arrhythmia classification.
The LIME (Local Interpretable Model-Agnostic Explanations) graph for class 1 (AFib) visually highlights the most influential ECG and cardiac features driving the model's prediction. In this explanation, features like HR, diastolic BP, and QT interval positively affect the prediction, meaning that higher values of these measurements make it more likely for the arrhythmia to be classified as AFib. Conversely, features such as systolic BP and T axis contribute negatively, slightly reducing the predicted probability. This interpretability analysis enables clinicians to understand which physiological measurements most impact the model's decisions, enhancing trust in automated arrhythmia detection and offering potential insights for personalised patient monitoring and intervention strategies. Figure 6 shows the LIME graph for class 1, illustrating the relative contributions of each feature to the prediction.

LIME explanation for class 1 (atrial fibrillation) showing the contribution of key ECG and cardiac features.
The proposed Hybrid DT-ATTN framework outperforms both DL and conventional approaches in key assessment criteria for arrhythmia detection and multi-class classification (as shown in Figure 7). DT-ATTN with an accuracy of 97%, a precision of 97.01%, a recall of 97.03%, and an F1-score of 97.39% when compared to methods such as DT, SVM, Random Forest, CNN, RNN, and LSTM, as demonstrated in Table 3. The model's capacity to recognise intricate ECG patterns is enhanced by combining decision tree-based feature selection with attention-based DL, making it the most efficient technique for classifying arrhythmias.

Performance comparison of arrhythmia detection methods with DT-ATTN.
Comparison of Different Methods with the Proposed Method (DT-ATTN).
While the proposed DT-ATTN framework demonstrates excellent performance, this study has certain limitations that warrant acknowledgement. The model was developed and validated using data from a single medical institution, which may affect its generalizability across diverse populations and clinical settings. Additionally, the evaluation focused on five specific arrhythmia types, excluding other clinically significant rhythm abnormalities. The computational complexity of the hybrid architecture, though providing valuable interpretability, may present challenges for deployment on resource-constrained devices without further optimisation. Future research should focus on multi-centre validation studies, expansion to include a broader spectrum of arrhythmias, and development of optimised versions for wearable device implementation to enhance clinical applicability and adoption.
Conclusion
This study introduces a novel Hybrid DT-ATTN model for accurate and interpretable detection of cardiac arrhythmias using real-time ECG data. Trained on an augmented dataset of 72,000 ECG signals, the model achieved consistently high performance, with an accuracy of 97%, a precision of 97.01%, a recall of 97.03%, and an F1-score of 97.39%, as validated through 10-fold cross-validation. The ROC–AUC values, approaching 1.0 across all classes, further confirm its strong discriminatory capability. Beyond performance, the framework ensures clinical interpretability by integrating feature importance analysis, SHAP interaction values, and LIME visualisations, allowing clinicians to understand and trust the decision-making process. Comparative evaluation demonstrates that DT-ATTN outperforms both conventional ML and DL approaches, including SVM, RF, CNN, RNN, LSTM, and Transformer-based models. With its combination of accuracy, transparency, and real-time capability, the DT-ATTN framework demonstrates significant promise for deployment in computer-aided diagnosis, wearable cardiac monitoring systems, and telemedicine applications, ultimately contributing to enhanced patient care and informed clinical decision-making.
Footnotes
Funding
The authors received no financial support for the research, authorship, and/or publication of this article.
Declaration of Conflicting Interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
