An enhanced hypergraph CNN with adaptive focal loss for automated ECG heartbeat classification Authors: Akash Vijayan, Suchetha Manikandan, Deepak Joshi Published: 2026 ABSTRACT AbstractDeep learning techniques have shown significant promise for the automated diagnosis of CVD using ECG analysis. Nevertheless, several critical challenges persist with current approaches: severe class imbalance, intricate temporal dependencies, and poor modeling of inter-beat relationships ultimately limit clinical applicability. This work presents a novel hybrid deep learning framework that combines a CNN for time-domain feature extraction, k-nearest neighbor-based hypergraph construction with cosine similarity to model inter-beat dependencies, and a residual-connection-enhanced hypergraph neural network (EHGNN) for robust classification. To address class imbalance, focal loss is implemented with adaptive class weighting. For evaluation, our model was tested on two benchmark datasets: the MIT-BIH Arrhythmia Database and the St. Petersburg Institute of Cardiological Technics (INCART) 12-lead Arrhythmia Database. In the case of the MITBIH dataset, a classification accuracy of 98.66% was achieved using the AAMI five-class classification system, whereas the results indicated a three-class arrhythmia detection accuracy of 95.46% for the INCART database. The model demonstrated consistent performance on two separate data sets, thus emphasizing its ability to generalize well. These results confirm that the proposed framework effectively addresses class imbalance through focal loss and SMOTE, temporal dependencies through CNN-based feature extraction, and inter-beat relationships through EHGNN, demonstrating great potential for clinical diagnostic systems by capturing complex heartbeat patterns that are otherwise overlooked by standard modelsKeywords: Deep learning, Electrocardiogram (ECG), Cardiovascular disease diagnosis, Convolutional neural networks, Hypergraph neural networks, Arrhythmia detectionSubject terms: Cardiology, Computational biology and bioinformatics, Diseases, Engineering, Health care, Mathematics and computing Introduction As the World Health Organization confirms, cardiovascular diseases are at the top of the list of global fatalities, accounting for 31% of all fatalities and 17.9 million annual deaths worldwide1. Among the wide range of cardiovascular diseases, cardiac arrhythmias are one of the specially noticed conditions because of the sudden occurrence and potentially lethal results, making the diagnostic and treatment process extremely challenging. In order to enhance success rates and decrease mortality rates, early and correct diagnosis of arrhythmias is the key. To date, the ECG is the gold standard method of diagnosis because of the high accuracy of the cardiac activation timing that is of prime importance in the precise diagnosis of cardiac rhythms2,3. Experienced cardiologists can also use their naked eye to notice subtle features in an ECG signal such as variations in the ST segment, P wave characteristics, and the QRS complexity in order to infer the possibility of certain Arrhythmias. However, manual analyses are rather subjective, consuming, as well as prone to inter-observer variability. Excess fatigue, inter-observer variability, and the subjective nature of such analyses can also influence their accuracy. This has led to the development of automated ECG signal processing systems for efficient diagnosis. In the early stages of automation, most approaches relied on manually designed feature extraction combined with traditional machine learning techniques. These systems typically extracted morphological and temporal features, such as QRS complex duration, RR intervals, P-wave amplitude, and ST-segment deviation4–6.In some scenarios, people also used frequency-domain features from Fourier transforms or wavelet analyses. All these methods may reach decent results on balanced datasets, but they mostly struggle with minority classes, have a limited generalization, and are heavily dependent on domain expertise to craft the right features. With the introduction of deep learning, the automated ECG analysis changed drastically, In an end-to-end configuration, models can now learn the representation of features directly from raw signals without the extraction of hand-engineered features. Among the various architectures, CNNs are unparalleled for ECG classification, especially adept at picking out local spatial patterns and unique shapes in heart wave forms. However, standard CNNs process each fixed-length segment independently and lack any capability to capture long-range temporal dependencies that characterize sequential cardiac events across multiple heartbeats7. RNNs and LSTM networks have been adapted to capture sequential dependencies in ECG signals by incorporating them to compensate for the limitations of temporal modeling8–10. The hybrid CNN–LSTM architectures have evinced great success by effectively fusing spatial feature extraction and temporal sequence modeling11. However, all these methods are still susceptible to vanishing gradients during training and present computational challenges as ECG recording lengths increase. Very recently, transformer-based architectures with inherent self-attention mechanisms have been explored for modeling long-range dependencies without recurrence. Though these models have achieved great success in many other domains, they express limited effectiveness in modeling complex, multi-scale, and hierarchical relationships that are naturally involved with ECG signals, which consist of intricate interactions among different cardiac events as well as across multiple leads12,13. Graph Neural Networks (GNNs) have recently gained attention in ECG analysis because of their inherent ability to model relationships among cardiac events as graph-structured data14. By representing ECG beats as and their relationships as edges, GNNs can capture spatiotemporal dependencies that are challenging for conventional network architectures. However, traditional GNNs are fundamentally limited to modeling pairwise relationships between, proving insufficient for capturing the high-order dependencies present in multi-lead ECG recordings and inter-beat dynamics. Hypergraph Neural Networks (HGNNs) extend this representation to hypergraphs, where a single hyperedge can connect multiple simultaneously as shown on Fig. 1, enabling the modeling of complex many-to-many relationships15,16. This capability is especially relevant in ECG analysis, where arrhythmia patterns frequently involve coordinated changes across several leads and consecutive heartbeats. Comparison of (a) a conventional pairwise graph and (b) a hypergraph with multi-vertex hyperedges. In this work, we propose a hybrid deep learning framework that combines CNNs for capturing local features with HGNNs for capturing high-order relationships. We balance the relative strengths of the two architectures while carefully tuning the architecture and training strategy to amend their respective limitations. Our model segments data using fixed-size windows aligned with anchor annotations, providing improved reliability in the beat extraction process. We further employ physiology-inspired data augmentation to enhance generalization and apply focal loss with adaptive class weighting to address the pronounced class imbalance. The main contributions of this work are as follows: We present a new hybrid architecture that integrates CNN-based temporal feature extraction with a k-nearest neighbor hypergraph construction using cosine similarity, enabling explicit modeling of inter-beat relational dependencies that are inherently overlooked by standard sequential and convolutional models. We present a new hybrid architecture that integrates CNN-based temporal feature extraction with a k-nearest neighbor hypergraph construction using cosine similarity, enabling explicit modeling of inter-beat relational dependencies that are inherently overlooked by standard sequential and convolutional models. We developed an Enhanced Hypergraph Neural Network (EHGNN) with residual connections across hypergraph convolutional layers and batch normalization, yielding significantly improved gradient flow, training stability, and convergence speed compared with standard hypergraph architectures. We developed an Enhanced Hypergraph Neural Network (EHGNN) with residual connections across hypergraph convolutional layers and batch normalization, yielding significantly improved gradient flow, training stability, and convergence speed compared with standard hypergraph architectures. We propose a comprehensive data processing pipeline that includes annotation-anchored segmentation, physiologically constrained augmentation, and focal loss with class-specific weighting to effectively address the serious class imbalance problem in clinical arrhythmia datasets. We propose a comprehensive data processing pipeline that includes annotation-anchored segmentation, physiologically constrained augmentation, and focal loss with class-specific weighting to effectively address the serious class imbalance problem in clinical arrhythmia datasets. Extensive experimental validation is carried out on two benchmark datasets with distinct characteristics: the MIT-BIH Arrhythmia Database17 achieving 98.66% accuracy for five-class AAMI classification) and the INCART 12-lead Arrhythmia Database (achieving 95.62% accuracy for three-class classification), demonstrating superior performance, robustness, and generalizability across diverse recording conditions18. Extensive experimental validation is carried out on two benchmark datasets with distinct characteristics: the MIT-BIH Arrhythmia Database17 achieving 98.66% accuracy for five-class AAMI classification) and the INCART 12-lead Arrhythmia Database (achieving 95.62% accuracy for three-class classification), demonstrating superior performance, robustness, and generalizability across diverse recording conditions18. Methodology Overall architecture The overall architecture of the model proposed is shown in Fig. 2. The model follows a multistage pipeline architecture that integrates CNNs with hypergraph neural networks in order to solve the complex tasks involved in automated cardiac rhythm analysis. We initialize by preprocessing the original ECG signals through bandpass filtering (0.5–50.5 Hz) to eliminate baseline wander, powerline interference, and high-frequency noise using a 4th-order Butterworth filter. In our CNN model, we adopt sequential convolutional layers with increasing filter depth to extract morphological features from single beats. Then we construct the hypergraphs by k-nearest neighbors based on cosine similarity of CNN features that present the morphological relationship across beats. Finally, an enhanced HGNN with residual connections along with focal loss performs classification through specialized hypergraph convolutions to predict arrhythmia predictions. Overview of the proposed multi-stage ECG arrhythmia classification framework. Feature extraction via convolutional neural networks A CNN-based feature extractor is employed to automatically learn discriminative representations from preprocessed ECG segments. The architecture is designed to handle recordings with different sampling rates and extract hierarchical morphological features suitable for both the MIT-BIH Arrhythmia Database (360 Hz) and the INCART Database (257 Hz). All ECG segments are standardized to 256 samples via annotation-anchored segmentation, corresponding to approximately 0.71 s for MIT-BIH and 0.99 s for INCART19. This ensures consistent temporal coverage of complete cardiac cycles, including the P-wave, QRS complex, and T-wave. Convolutional feature extraction The CNN architecture consists of four successive one-dimensional convolutional blocks with progressively increasing filter depths as shown in Fig. 3, enabling capture of multi-scale cardiac morphology. The first layer has 64 filters of size 7 × 7 to capture the shape of low-level evidence such as QRS boundaries, the presence of the P-wave, the beginning of the T-wave, baseline shifts, and peculiarities of high-frequency noise. Its wide receptive field allows it to capture entire waveform structures. The second layer increases complexity with 128 filters and a 5 × 5 kernel, focusing on mid-level, decision-making features, including details of the ST segment (rising or falling shape), polarity and height of the T-wave, evidence from the PR interval, layout of the QT interval, and relationships among wave timings. These features are critical for distinguishing S/NR from other rhythm groups. The third layer, comprising 256 filters with a 3 × 3 kernel, targets fine-grained morphologies such as QRS notches and fragmentation, minute displacements in the P-wave, the presence of U-waves, evidence of premature beat morphologies, and rhythm-specific oscillations such as baseline wobble in atrial fibrillation. The fourth layer employs a set of 512 filters with a 3x3 kernel to detect high-level abstract patterns indicative of complex arrhythmia patterns. It can detect beat-to-beat morphology patterns in beats that correspond to compensatory pauses or fusion beats in addition to detecting patterns at a higher level over multiple beats. Each convolutional block consists of batch normalization to improve convergence during training, ReLU activation to introduce non linearity, and a dropout value of 0.2 to control overfitting during training. Following the sequence of convolutional layers is a hierarchical averaging pooling layer with a pool size of 4x1 and a stride value of 2 to reduce the size of samples along the time axis from 256 samples to a value around 46 samples in two steps. Average pooling is preferred over max pooling to achieve proper morphology rather than minute details that may coincide with isolated spikes of noise in a real-world scenario like a medical environment for a Holter monitor. The feature map is subsequently flattened to a column vector to obtain a feature value from a densely connected layer with a hidden size of 768 to further compute low-dimensional mappings that preserve all levels of morphology features in a compact manner. To incorporate features indicative of rhythms in the input signal, two dimensions comprising feature values of R-R interval and instantaneous heart rates are appended to a densely connected feature map to generate a feature map of a size of 770 features that further form a hypergraph. Let denote the i-th preprocessed ECG segment and represent all trainable CNN parameters (convolutional weights, biases, and normalization parameters); the feature extraction process is expressed as , where is the learned morphological feature vector. After concatenation with RR-interval and heart-rate information, the final representation becomes 770-dimensional. The CNN architecture was implemented in TensorFlow/Keras and kept identical across both databases, demonstrating strong generalizability to different sampling rates and heterogeneous recording conditions without requiring dataset-specific architectural modifications.The CNN feature extractor operates entirely independently of the hypergraph structure. Each ECG beat is processed in isolation through the convolutional blocks, with no graph connectivity involved at this stage. The hypergraph is constructed exclusively in the subsequent stage using the k-nearest neighbour (kNN) algorithm applied to the CNN-extracted feature vectors, as described in Section "Hypergraph construction via k-nearest neighbors". Proposed CNN architecture for ECG beat classification. Hypergraph neural network Hypergraph formulation Hypergraph H = (V, E) is generated based on a vertex set , where each vertex represents an individual heartbeat signal, and an edge set involving hyperedges. The distinguishing characteristic of a hypergraph, different from that of a traditional graph, is that the hyperedge may involve any number of vertices, not necessarily pairs. This characteristic makes the hypergraph more suitable for modeling the higher-order relationships that exist among the heartbeats within the ECG signal20. In the proposed method for classifying heartbeats, a vertex represents a single ECG heartbeat, and a hyperedge represents multi-beat morphological features among multiple heartbeats. The representation of hyperedges is highly effective for modeling the complex arrhythmic patterns that evolve over a few consecutive heartbeats. For example, bigeminy, which represents alternate occurrences of normal and premature heartbeats, does not form a pairwise relationship suitable for a graph representation, which can easily be represented using hyperedges connecting every alternate heartbeat. Similarly, the irregular and non-pairwise dependencies observed in atrial fibrillation rhythms are more accurately captured through hyperedge-based representations. Let denote the set of feature vectors extracted using the CNN, where each feature vector encodes the morphological and temporal characteristics of the i-th heartbeat, comprising 768 features from the CNN dense layer and two additional RR-interval-based features. Next, a weighted hypergraph is developed. where assigns a weight to each hyperedge representing the strength or reliability of the multi-way similarity relationship. The feature extraction operation is written formally as: where is the preprocessed ECG segment of length T = 256, denotes the full set of trainable CNN parameters, and is the resulting representation. Cosine similarity distance metric Cosine similarity is used to measure morphological similarity between heartbeat feature vectors. It offers several advantages: Scale invariance: ECG amplitudes vary widely across patients and recording conditions. Cosine similarity emphasizes waveform shape rather than magnitude. Scale invariance: ECG amplitudes vary widely across patients and recording conditions. Cosine similarity emphasizes waveform shape rather than magnitude. High-dimensional robustness: Unlike Euclidean distance, cosine similarity remains discriminative in high dimensions by focusing on angular relationships. High-dimensional robustness: Unlike Euclidean distance, cosine similarity remains discriminative in high dimensions by focusing on angular relationships. Morphological focus: Diagnostic ECG interpretation relies primarily on waveform shape, which cosine similarity captures effectively. Morphological focus: Diagnostic ECG interpretation relies primarily on waveform shape, which cosine similarity captures effectively. The cosine similarity between and is defined as: The corresponding cosine distance is: with . Small values indicate strong morphological similarity (e.g., consecutive normal beats), whereas large values indicate substantial differences (e.g., normal vs. PVC). Cosine similarity was selected as it remains discriminative in high-dimensional spaces, which is particularly important for ECG signals where amplitude varies across patients while waveform shape remains the primary diagnostic indicator21,22. Although the nominal feature dimensionality is 770, the CNN-learned representations have substantially lower intrinsic dimensionality, as evidenced by the clear class separability under t-SNE projection in Fig. 8. t-SNE visualization of INCART dataset features. (a,c) CNN features before HGNN processing. (b,d) HGNN embeddings showing improved class separability. Classes: Normal (blue), SVEB (orange), VEB (green). Hypergraph construction via k-nearest neighbors To construct hyper edges, a K-nearest neighbor (k-NN) strategy is applied in the feature space using cosine distance.The KNN approach was chosen for hypergraph construction due to its k × n directed edges, yielding a sparse and computationally efficient structure and due to its ability to directly connect each beats to its k most similar neighbors in CNN feature space23–25. For each vertex , its k most morphologically similar neighbors form the neighborhood: where is the distance to the k-th nearest neighbor of . For each vertex , we form a hyperedge: k-NN based hyperedge construction. Because k = 5 is determined to be optimal, every hyperedge is connected to exactly six vertices. This is a reflection of the finding that arrhythmia patterns tend to occur in 3 to 7 cycles of the heartbeat26,27.In order to empirically validate this decision, a sensitivity analysis over the set of was carried out, assessing both the hypergraph structural properties as well as the classification accuracy achieved. The number of nodes and hyperedges is constant across all configurations at 113,883, corresponding to the total number of beats in the MIT-BIH dataset. As depicted in Table 1, the best accuracy rate of 98.66% and the highest macro F1-score of 0.9397 are obtained when using k = 5, thus supporting the decision to connect each beat to its five most morphologically similar neighbours. This choice captures the optimal contextual relationship between beats for accurate arrhythmia classification. While a smaller value of k = 3 yields sparser graphs that fail to adequately capture morphological contextual relationships, a larger value such as k \ge 7 produces noisier graphs by connecting beats across dissimilar morphological classes. This negatively impacts minority class discrimination, as evidenced by the lower macro F1-scores obtained. Table 1Effect of k on hypergraph structure and classification performance.kHyperedge SizeDirected EdgesGraph DensityAccuracy (%)Macro F134341,6490.0000263498.140.928156569,4150.0000439198.660.939778797,1810.0000614798.200.919710111,138,8300.0000878198.550.935915161,708,2450.0001317298.490.9327 Effect of k on hypergraph structure and classification performance. Incidence matrix representation We represent the hypergraph using an incidence matrix , where A formula that defines an entry in the matrix, in particular, an entry for row i and column j in Now from the matrix H, vertex degree is defined as: This is valuable for identifying beats that are involved in many groups of morphological similarity; such groups are often associated with transitional cardiac activity. The hyperedge degree is given by: This hypergraph technique is very effective compared to the conventional graph technique used for ECG-based arrhythmia classification problems. Firstly, hypergraphs can inherently represent high-order relationships between entities with directly, making it possible to explicitly represent patterns that span multiple heartbeats. This is particularly important for issues such as ventricular bigeminy, difference in the amplitude or electrical alternans between beats, or ST segment changes over multiple consecutive beats. Graphs, on the other hand, have to represent such patterns over multiple edges, potentially making them less significant over time. Furthermore, clustering with hyperedges adequately combines similarly shaped features over heartbeats, making possible the community-based rather than isolate heartbeat examination that is common with conventional graph techniques. This facilitates more robust discrimination of subtle waveform variations that are critical for accurate arrhythmia characterization. Finally, the transitive relationship carried out through the hyperedge makes it possible to pass messages among all the connected beats. This indicates that heartbeats with some uncertainty can rely on the collective support of similar heartbeats within the same hyperedge to improve the-confidence of the classification.Fourth, “minority classes in arrhythmias, which are often underrepresented in a clinical dataset, benefit substantially from the link structure provided by hypergraphs. Rare instances of abnormal beats can aggregate knowledge about patterns that have a similar morphology across a given dataset. This amplifying the learning signal despite limited training samples and mitigating class imbalance effects that challenge conventional approaches.Finally, despite modeling complex higher-order relationships, the sparse structure of the incidence matrix with density (where k = 5 and n is the number of samples) ensures computational efficiency comparable to standard graph neural networks. So, this method remains scalable for very large databases of ECGs but still takes advantage of the representational power of hypergraph methods. Instead of using graph convolutions like normal graphs, the hypergraph convolution approaches the problem by including high-order connections in the form of multiple graph paths or directions. This method enables the aggregation of information from more than two morphologically similar ECG signals that share hyperedges simultaneously28. Instead of relying on edges like normal graph convolutions, the hypergraph convolution employs the use of the incident matrix to transmit information regarding the hyperedges. We explain the hypergraph convolution using two degree matrices that reflect the fundamental properties of the hypergraph structure29. We define vertex degree matrix as a diagonal matrix, with each diagonal entry indicating the number of hyperedges that a vertex (ECG beat) is involved with: where n is the number of vertices/ECG beats, m is the number of hyperedges, and H represents the incidence matrix. High-degree vertices correspond to beats with complex or ambiguous morphologies that resemble multiple arrhythmia patterns (e.g., premature atrial contractions with aberrant conduction), whereas low-degree vertices correspond to highly class-specific morphologies. The diagonal hyperedge degree matrix measures the size (cardinality) of each hyperedge: In our star-centered k-NN hypergraph construction with k=5, every hyperedge contains exactly k+1=6 vertices; hence, all hyperedges have identical degrees. Normalization by and balances the aggregation, preventing highly connected beats from dominating the representation and ensuring proportional contributions from hyperedges of different sizes. Hypergraph convolution The hypergraph convolution at layer l is defined as: where is the vertex feature matrix, is a learnable weight matrix, is the nonlinearity (LeakyReLU), and is the transpose of the incidence matrix. This operation admits a three-stage interpretation: 1) Feature transformation: 2) Vertex-to-hyperedge aggregation: with element-wise expression 3) Hyperedge-to-vertex propagation: with the vertex-wise form: A standard 1D convolution computes local weighted sums over a fixed and pre-defined receptive field using a kernel30. In contrast, hypergraph convolution utilizes a two-stage message passing mechanism between vertices and hyperedges, followed by hyperedges and vertices20. In this framework, each beat updates its feature representation based on information aggregated from its k most morphologically similar beats across the entire dataset. This communication with the ability to go between the and hyperedges enables each heartbeat signal to receive plenty of information regarding shapes from a variety of similarity patterns. Specifically, ensures that all morphologically similar heartbeats converge to consistent descriptions while smooth features are propagated with the assistance of this normalized hypergraph Laplacian. From a spectral perspective, this operator admits an intuitive interpretation, wherein low-frequency components encode global cardiac rhythms, whereas high-frequency components capture patient-specific and beat-level variations. To further stabilize training and promote effective gradient flow in deep hypergraph architectures, residual connections are incorporated into the hypergraph convolutional layers31. The residual mapping facilitates optimization and preserves clinically important features. The gradient with respect to layer l satisfies ensuring non-zero gradients even when the Jacobian becomes small and its shown in Fig. 4. The architecture of the proposed EHGNN. Training objective and loss function The training objective of the Enhanced Hypergraph Neural Network (E-HGNN) is formulated as a multi-class classification problem designed to address the severe class imbalance present in clinical ECG arrhythmia datasets. Given a hypergraph representation and hierarchical features learned from the CNN and hypergraph layers, the goal is to learn a mapping , where C denotes the number of arrhythmia classes (5 for MIT-BIH AAMI, 3 for INCART). The complete training objective integrates focal loss to mitigate class imbalance and regularization to prevent overfitting: where includes CNN parameters, hypergraph convolutional weights, and batch normalization parameters. The regularization term is given by with , while and denote predicted log-probabilities and ground-truth labels, respectively. Standard cross-entropy loss treats all samples equally, which is unsuitable for imbalanced medical datasets where normal beats vastly outnumber pathological ones. Focal loss addresses this through class-frequency weighting and difficulty-based modulation32. For a sample with label , Focal loss is the predicted probability of the correct class. The class weight compensates for imbalance, and the focal loss is the focusing parameter γ = 2.0 controls how aggressively easy examples are down-weighted. Class weights are computed via normalized inverse-frequency weighting: where is the number of samples in class c. The total focal loss for a batch is: For optimization, we use the Adam algorithm: with hyperparameters η = 0.01, , , and . To enhance convergence stability, we apply a ReduceLROnPlateau learning-rate scheduler: weight decay encourages smoother and more generalizable parameter updates. Training and validation losses are monitored continuously, and early stopping is triggered if no validation improvement is observed for 20 epochs. The checkpoint with the highest validation accuracy is saved for final evaluation. Dataset and preprocessing In this work, electrocardiographic recordings obtained from the MIT-BIH Arrhythmia Database were utilized for the systematic categorization of cardiac rhythm abnormalities17. This dataset is widely regarded as a representative source of diverse arrhythmias and has been extensively used as a benchmark for evaluating medical signal classification algorithms. It includes 48 ECG recordings from 47 subjects, with two recordings (201 and 202) belonging to the same individual. Each record contains two-channel ECG data that is a 30-minute record predominantly coming from lead II and lead V1. This dataset is compatible with AAMI recommendations on developing and testing beat classification-related algorithms. The five-class approach is based on the ANSI/AAMI EC57:1998/(R)2008 standard for testing and reporting performance of cardiac rhythm classification algorithms, which is the internationally recognized benchmark for single-lead ECG beat classifiers and is followed by the majority of comparative approaches in Table 2. Table 2Performance comparison of ECG arrhythmia classification methods on the MIT-BIH Arrhythmia Database. Reference Method Accuracy (%) Precision (%) Recall (%) Specificity (%) F1-Score (%) Hannun et al.331D CNN94.9595.4694.95—94.97Kachuee et al.34Deep RCNN95.9095.2095.10——Teijeiro et al.35Clustering97.9891.13—97.6686.26Ghorbani Afkhami et al.36GMM + Enhanced EM96.1588.90———Hammad et al.37DL + GA + kNN98.0095.80—98.9088.84Mousavi et al.38CNN + ELP97.6291.46—96.1485.82Xu et al.391D CNN + BiLSTM95.9096.3495.9095.92—Xia et al.40CNN + Transformer97.6699.00———Zhao et al.41ECGNN90.00———82.40Qiang et al.14Conv-RGNN88.1877.4876.29—78.73Wang et al.42IIVYA-SE-CNN-BiLSTM95.5095.5095.40—94.90Li et al.43ResNet-18 + CBAM + Auxiliary Classifier96.7087.6096.7096.7092.00 Proposed Method CNN + HGNN 98.66 98.64 98.63 98.64 98.63 Performance comparison of ECG arrhythmia classification methods on the MIT-BIH Arrhythmia Database. The INCART 12-lead Arrhythmia Database provided by the St. Petersburg Institute of Cardiological Technics contains 75 records that were taken from 32Holter recordings. Each record consists of 30 minutes, contains 12 standard leads, and has a sample rate of 257 Hz. The INCART recordings used lead II as their lead in our experiments. For the INCART Database, Lead II was selected among the available 12 leads to ensure anatomical consistence with the MIT-BIH Database. Five-class AAMI classification is used for the MIT-BIH Database, and three-class classification is used for the INCART Database, based on the annotation characteristics of the two datasets instead of any arbitrary modeling choice. The INCART Database has less than 15 instances of Fusion Beats and no Paced Beats at all, which is not sufficient to conduct any statistical classification. Therefore, the three clinically viable classes - Normal (N), Supraventricular Ectopic Beat (SVEB), and Ventricular Ectopic Beat (VEB) - are selected for the INCART Database, as they represent the most critical decision in any Holter-based arrhythmia screening process. A proper ECG signal preparation is a precondition for providing proper model predictions. The ECG signal preparation includes five key steps: noise component elimination, heartbeat segmentation based on interbeat intervals, standardization of lengths of these heartbeat intervals, aggregation of heartbeat classes, and dealing with a class imbalance problem. A fourth-order Butterworth filter has been used to eliminate noise that contains lower frequency components less than 0.5 Hz, as well as noise that has higher frequency components above 50 Hz. The analog transfer function can be defined as: where n = 4 is the filter order, is the cutoff frequency, and ε denotes the ripple factor. Zero-phase filtering was applied using forward-backward filtering to prevent phase distortion. Individual heartbeats were segmented using a physiologically informed, RR-interval-based approach (Algorithm 2)44,45. This approach captures complete cardiac cycles, including the P-wave, QRS complex, T-wave, and the initial portion of the subsequent P-wave. In Fig. 5, we illustrate the preprocessing and segmentation of the MIT-BIH Arrhythmia Database. In particular, we have segments of varying lengths given by the expression , which had to be resampled to a fixed length for model input. No form of signal-level up- or downsampling was applied to either of the considered datasets; i.e., both the MIT-BIH (360 Hz) and INCART (257 Hz) signals were processed at their native sampling rates throughout band-pass filtering and segmentation. The boundaries of the adaptive windows in Algorithm 2 are determined based on the native sampling frequency of the corresponding signal. In other words, the length of the raw segments varies according to both the instantaneous RR interval and the sampling rate of the signal. This issue is resolved in a single step at Line 8 of Algorithm 2, where all raw segments—regardless of arrhythmia type, heart rate, or sampling frequency—are linearly interpolated to a fixed length of exactly 256 samples. It can be seen from the data that indeed there is a significant imbalance among the classes (top-left panel). Analysis of the RR interval amplitudes demonstrates physiological variation from one beat to another that averages 0.750 sec per period and approximately 84.1 beats per minute. There is successful segmentation of a whole heartbeat cycle among all arrhythmias, and there is notable variation among the waveform samples. RR-adaptive ECG beat segmentation for MIT-BIH and INCART datasets. RR-interval–based cardiac cycle segmentation. Implementation details This work proposes a hybrid deep learning framework which integrates CNNs to extract hierarchical features with enhanced hypergraph neural networks to capture higher-order relationships for ECG arrhythmia classification. The framework is evaluated in an end-to-end manner, encompassing signal filtering, heartbeat segmentation, hypergraph construction, model training, and performance evaluation. Experimental validation is conducted on both the MIT-BIH Arrhythmia Database and the INCART 12-lead Arrhythmia Database to demonstrate the effectiveness and generalizability of the proposed approach. The raw ECG signals are first denoised using a fourth-order Butterworth bandpass filter. For MIT-BIH, a passband of 0.5–50 Hz is used at a sampling frequency of Hz, whereas for INCART a passband of 0.5–40 Hz is applied at Hz. A 50/60 Hz notch filter further suppresses powerline interference. The lower cut-off of 0.5 Hz effectively removes baseline wander due to respiration and motion, while the upper cut-off (40–50 Hz) attenuates electromyographic and instrumentation noise. Zero-phase filtering using the forward–backward approach avoids temporal distortion of clinically important PQRST morphology. ECG heartbeat segmentation is performed using annotation-anchored fixed windows. For each annotated R-peak , a window of length L=256 samples is extracted: where x[k] is the filtered ECG signal and the \max function prevents out-of-bound indexing. The 256-sample window corresponds to approximately 0.711 s for MIT-BIH and 0.996 s for INCART, capturing the full PQRST complex across heart rates ranging from 40–150 bpm. For INCART 12-lead recordings, Lead II is selected to maintain consistency with MIT-BIH. Each extracted segment is standardized using z-score normalization: where and . This normalization removes inter-patient and inter-session amplitude variations, allowing the CNN to focus on waveform morphology. Annotations are mapped to AAMI classes, where the class distribution is highly imbalanced (Normal , Fusion <1%). To mitigate imbalance in MIT-BIH, a conservative SMOTE strategy is applied: where is the original class count and is the number of synthetic samples generated. Synthetic samples are produced via linear interpolation: where is one of the nearest neighbors of . For INCART, physiologically valid augmentations are used instead of SMOTE, including amplitude scaling, Gaussian noise injection, temporal warping (resampling factor ), and baseline modulation using sinusoidal components with frequencies Hz46,47. The CNN feature extractor consists of four sequential 1D convolutional blocks with filter counts 64, 128, 256, and 512, and kernel sizes 7, 5, 3, and 3, respectively. Each layer is followed by batch normalization (momentum = 0.9, ), ReLU activation, and dropout (p=0.2). Hierarchical average pooling (pool size 4, stride 2) is applied twice, reducing the temporal dimension from 256 to approximately 46 samples. Features are flattened and passed through a dense layer with 768 neurons (ReLU, dropout p=0.3). Two additional RR interval features (interval duration and instantaneous heart rate) are appended, yielding final 770-dimensional feature vectors. Hypergraphs are constructed using a 5-nearest-neighbor scheme based on cosine similarity in the 770-dimensional feature space. The EHGNN comprises four hypergraph convolution layers with hidden dimension 128, residual connections from layers 2–4, batch normalization (momentum = 0.9), LeakyReLU activation (slope = 0.2), and dropout (p=0.3). The final layer produces log-probabilities over the arrhythmia classes via log-softmax, with C=5 for MIT-BIH and C=3 for INCART48. Model optimization is performed using the Adam optimizer with initial learning rate , , , and weight decay . A ReduceLROnPlateau scheduler halves the learning rate when validation accuracy plateaus for 10 epochs. Focal Loss with focusing parameter γ =2.0 and inverse-frequency class weights is used to address imbalance. For MIT-BIH, the approximate class weights are: Training uses batch size 256 and a stratified 80/20 train–test split. The maximum epochs are 200 for MIT-BIH and 300 for INCART, with early stopping (patience = 20). Random seed 42 is used for reproducibility. The CNN is implemented in TensorFlow 2.12 (Keras), while the EHGNN is implemented in PyTorch 2.0 using PyTorch Geometric 2.3. All experiments are conducted on a Dell Precision 3660 workstation equipped with an Intel Core i7-12700 CPU (12 cores, 20 threads), 128 GB DDR4 RAM, an NVIDIA RTX A4000 GPU (16 GB), and Windows 11 Pro. Training typically converges within 200 epochs for MIT-BIH and 200 epochs for INCART. Model performance is evaluated using accuracy, precision, recall, F1-score, confusion matrices, and ROC–AUC curves, computed on the held-out 20% test set. Evaluation metrics The performance evaluation of the model is presented with a set of comprehensive metrics that collectively demonstrate the accuracy, class performance, and usefulness of the solutions. Accuracy measures the overall correct assignment of the heartbeat patterns, representing the ability of the system to assign patterns to the correct class on average. Precision measures the validity of the predicted arrhythmic events, analyzing the positive predictions to ascertain the likelihood that the actual predictions are true, illustrating the ability of the system to avoid raising false positive alerts that would affect the clinical validity of the predictions. The value of recall, which corresponds to the sensitivity, provides the ability to analyze the actual performance of the predictions to ensure the clinically significant events are reported, hence reflecting the capacity to identify the real occurrences without omitting the significant ones. The use of an F1 value, which averages the precision and recall, provides a solution that represents a complete performance evaluation without the imprecise nature introduced by the imbalanced dataset that could suggest a different performance value based on the use of accuracy alone. The use of the confusion matrices helps to evaluate the relative performance of the true class compared to the predicted class, allowing the identification of potential errors, for instance, supra ventricular beats that are classified under the normal, along with the errors that are introduced due to the overlap, which are the fusion beats classified under the ventricular ectopics, thus enabling the correction of the performance of the models. The evaluation of the performance further uses the ROC calculations for all the classes on a one-vs.-rest approach, along with the micro-avged ROC to ascertain the ability of the models to discriminate without consideration of the threshold value applied. The evaluation of the performance uses the stratified set that represents 20% of the entire dataset without any consideration to allow an unbiased performance on unseen data that was not part of the training or optimization time. Results A. Classification performance on the MIT-BIH database In Fig. 6(a), the confusion matrix for the MIT-BIH test set shows how well the classifier is able to distinctly classify the five classes of AAMI arrhythmias with hardly any confusion. A high diagonal value of the matrix is an indicator of well-defined class boundaries. Normal beats are similarly close to being fully correctly classified, with only 40 errors out of 18,324 as incorrect, of which the majority are misclassified into other categories. This yields a high recall of 99.78%. Ventricular ectopic beats are similarly close to being fully correct, with 1,581 correct identifications out of 1,647 samples for a recall of 95.99%. Most of these are incorrectly classified as Normal beats because of the existence of samples with small QRS complexes and a morphology closely resembling the morphology of SVEB beats. SVEB is similarly the hardest category of beats for humans to classify: only 624 out of 756 samples are correctly identified for a recall of 82.54%. Most of these misclassifications are of SVEB as Normal beats because of the existence of premature atrial contractions with abnormal conduction or Normal beats with Bundle Branch Block pattern morphologies. There are relatively few samples of beats of the Fusion category (241 samples), but these beats are still identified correctly in 195 samples for a recall of 80.91% as depicted in Table 3. Most of these misclassifications lie amongst the Normal, SVEB, VEB, or Unknown categories of beats. This is an indicator of how high-order connections of the hypergraph helped understand commonalities amongst morphologies of beats of differing types. Finally, there is an almost perfect classification of Unknown beats, with 1,789 samples being correctly identified out of 1,809 for a recall of 98.89%. There are 20 samples of this category that are identified as wrong. Confusion matrices for both datasets: (a) MIT-BIH confusion matrix showing five-class AAMI performance. (b) INCART confusion matrix demonstrating three-class generalization capability. Table 3Classification performance on MIT-BIH Database. Class Precision Recall F1-score Support Normal0.98830.99780.993018,324SVEB0.96590.82540.8902756VEB0.97590.95990.96791,647Fusion0.90700.80910.8553241Unknown0.99550.98890.99221,809Accuracy0.986622,777Macro Avg0.96650.91620.939722,777Weighted Avg0.98640.98660.986322,777 Classification performance on MIT-BIH Database. Referring to training dynamics, Fig. 7(a) depicts that the training loss declines steeply from 2.5 to 0.1 in the range of the first 50 epochs, after which it becomes relatively stable. The validation accuracy rises to approximately 95% in those first 50 epochs, after which it stabilizes to attain a maximum of 98.66% accuracy at epoch 195. This explains that the model converges to an optimal point where there is no overfitting. The stability of both training and validation accuracy further indicates that regularization techniques such as dropout, weight decay, and normalization are functioning effectively. (a) MIT-BIH training loss convergence; (b) ROC curves for multi-class classification on MIT-BIH; (c) focal loss convergence during training; (d) class-wise ROC curves on the INCART dataset. B.INCART three-class classification and cross-database generalization The proposed approach uses the EHGNN on the INCART 12-lead ECG database with three categories: Normal, SVEB, and VEB. The confusion matrix for INCART (Fig. 6(b)) portrays good results with an accuracy of 95.62% despite large differences in recording rates (257 Hz and 360 Hz), leads (12 and 2), and patients (Europe and North America). The number of correct identifications for the normal patterns is 29,351 out of 30,082, showing a sensitivity of 97.57%. The major mistakes belong to class SVEB with 683 occurrences. Then come VEB patterns with 48 mistakes. In class SVEB, 2,879 out of 3,674 patterns have been identified correctly, yielding a sensitivity of 78.36%. Most mistakes belong to class Normal with 730 occurrences. These patterns were identified due to strong morphological links. VEB patterns have been identified aptly with 3,870 out of 4,003 patterns tested; its sensitivity is 96.75%, showing good adaptation to the traits of INCART’s features. Convergence of training on the INCART dataset (Fig. 7(c)) also reveals fast acceleration, where the training loss significantly declines in the first 25 epochs. The optimal operating point (epoch 106, red dotted line) represents a validation accuracy of approximately 95.62%. The slight reduction in performance between the INCART and MIT-BIH datasets (95.62% vs. 98.66%) stems from cross-database evaluation issues, such as reduced temporal resolution, couplings among the 12 channels, as well as differences in ECG morphology between the target population groups. However, it should be noted that our method succeeds in sustaining accuracy values above 95% on both datasets, revealing effective detection of minority classes on both datasets. These observations are validated through the classification accuracy reported in Table 4. Table 4Classification report of INCART dataset.ClassPrecisionRecallF1-ScoreSupportNormal0.97080.97570.973330082SVEB0.81700.78360.79993674VEB0.96830.96750.96794003Accuracy——0.956237759Macro Avg0.91870.90900.913737759Weighted Avg0.95560.95620.955837759 Classification report of INCART dataset. C. Ablation study The ablation study in Table 5 is designed to measure the impact of each module of the proposed model. By replacing the hypergraph-based EHGNN with a regular GNN, the recall is reduced significantly to 81.03% and the F1-score is reduced to 86.06%, which validates the importance of the proposed hypergraph-based higher-order relational modelling for capturing the dependencies between ECG beats. By removing the SMOTE oversampling technique, the recall is reduced to 97.25% and the accuracy is reduced to 96.17%, thereby validating the importance of the proposed oversampling technique for discriminative modelling of minority arrhythmias. By removing the residual connections, the accuracy is reduced to 97.22% and the F1-score is reduced to 96.63%, while the mean gradient norm is reduced from 0.3118 to 0.1627 and the minimum gradient norm is reduced from 0.0166 to 0.0156, thereby validating the importance of the proposed residual connections in maintaining gradient flow and preventing vanishing gradients in deeper networks as per Equation 18. The proposed model achieves the highest accuracy of 98.66% and the highest F1-score of 98.63% across all metrics, thereby validating the importance of each proposed module in improving the overall classification performance. Table 5Ablation study of the proposed model.ModelPrecision (%)Recall (%)F1-Score (%)Accuracy (%)GNN + CNN94.4181.0386.0694.43Proposed (without SMOTE)95.5197.2597.2296.17Proposed (without Residual)97.4296.6296.6397.22Proposed98.6498.6398.6398.66 Ablation study of the proposed model. Comparative analysis For the purpose of analyzing our EHGNN approach, we compare our proposal directly with the top ten arrhythmia classification models on the ECG signals using the MIT-BIH Arrhythmia Database. As evident from the comparison table provided in Table 2, our hybrid approach using CNN and HGNN achieves an accuracy of 98.66%, outclassing the previous best result of 97.96% provided by Hammad et al.37 by 0.68 percentage points, using the same MIT-BIH Arrhythmia Database with the application of a deep learning approach using an optimization technique fueled by the genetic algorithm and k-NN. It is also able to achieve precision, recall, and F1-score values of 98.64%, 98.66%, and 98.63%, constituting the best-ever recorded performance in the literature for the respective parameters. Early deep learning methods solely based on CNNs, such as Hannun et al.33 with 94.95% accuracy using 1D CNN and Kachuee et al.34 with 95.9% accuracy using Deep RCNN, demonstrated the feasibility of end-to-end learning for ECG classification but had limited capability in capturing temporal dependencies and handling class imbalance, resulting in F1-scores around 95%. Hybrid spatial-temporal architectures that combined CNNs with recurrent components, such as Xu et al.39 with 95.90% accuracy and 96.34% precision using 1D CNN+BiLSTM, improved temporal modeling but remained vulnerable to vanishing gradient problems and showed moderate performance on minority classes. More modern approaches based on increasingly complex architectural units provide only marginal performance improvements. The work of Xia et al. achieved an accuracy of 97.66% with an unusually high precision of 99.00% using a CNN–Transformer architecture, indicating strong false-positive suppression. However, recall and F1-score were not reported, suggesting potential compromises in sensitivity, particularly for minority-class arrhythmias. Traditional methods relying heavily on feature engineering, such as Teijeiro et al.35 and Ghorbani Afkhami et al.36, show respectable but limited performance. Graph neural network approaches—although motivated by the need to model inter-beat relationships—exhibit significant performance gaps: Zhao et al.’s ECGNN41 achieves only 90.0% accuracy with 82.4% F1-score, and Qiang et al.’s Conv-RGNN14 reports 88.18% accuracy with a 78.73% F1-score. These results indicate that traditional pairwise graph structures fail to capture the complex higher-order dependencies characteristic of ECG dynamics. The substantially higher performance of our hypergraph-based method (98.66% accuracy, 98.63% F1-score) over conventional graph approaches (88–90% accuracy, 78–82% F1-score) strongly supports our core hypothesis: hypergraph convolutions effectively model higher-order relationships among multiple morphologically similar heartbeats, capturing clinically significant multi-beat patterns (e.g., bigeminy, electrical alternans, progressive morphological changes) that cannot be represented by standard pairwise graph edges. The t-SNE projections shown in Fig. 8 describe differences in feature representations before (a, c) and after hypergraph neural network processing (b, d) in the INCART dataset49,50. The features derived via CNN (left) demonstrate partial clustering with highly overlapping classes for Normal (blue), SVEB (orange), and VEB (green) classes in particular. Clustering after HGNN processing (right) clearly indicates improved feature separation, with each class well encapsulated in compact and clearly distinguishable clusters. This provides a visual indication of how the HGNN enhances feature granularity by integrating local temporal cues with global relational awareness through hypergraph modeling, enabling the identification of relationships that conventional CNN-based features alone are unable to capture. Thus, it can be stated that a well-balanced performance is achieved through the approach as it attains a precision of 98.66% to prevent False Positives, a recall of 98.63% to prevent False Negatives, and an F1 score of 98.63% for precision and recall trade-off. In clinical applications, both false positives and false negatives are equally critical in terms of patient-level clinical severity. The framework is designed by constructing CNN-based hierarchical feature representations, validated through cosine similarity-based hypergraph construction, enhanced by improving residual hypergraph convolutional layers (R-HGConvs) using residual connections, and further strengthened by employing focal loss to address class imbalance. Through extensive empirical validation on the MIT-BIH dataset, the proposed EHGNN effectively addresses the key limitations of existing methods, including CNNs, RNNs, transformers, and conventional GNNs, for ECG-based arrhythmia classification. Discussion The Enhanced Hypergraph Neural Network (EHGNN) is very effective in classification tasks for both the MIT-BIH and INCART collections with an accuracy of 98.68% and 95.46%, respectively, and overall performance is excellent for all classes too. Especially worthy of note is that all the more challenging classes for classification are handled very effectively too: Ventricular Ectopic Beats (VEB) with 96.79% F1-Score, Fusion Beats with 85.53% F1-Score, and SupraVentricular Ectopic Beats (SVEB) with 89.02% F1-Score. The key insight of this approach is its effective combination of convolutional neural networks for morphological feature learning at multiple scales with Hypergraph Neural Networks capable of capturing complex inter-beat interactions. The use of hyperedges which simultaneously connect five morphologically similar samples helps to effectively capture clinically significant temporal patterns like Ventricular Bigeminy, Electrical Alternans, or the evolution of ST-segment activity which very intrinsically require context about multiple instances of beats in time. The use of Cosine Similarity for Hypergraph construction provides an additional benefit of being invariant to scales to help remove the effects of variability due to different scales or patient physiology for the same morphological feature being matched—irrespective of the actual amplitude. Additionally, by using focal loss with class-specific weights and difficulty adjustment, class imbalance can also be mitigated to some extent because it gives less priority to simply classified and abundant instances of some classes and concentrates more on those of other classes that are more difficult to classify. Residual learning blocks, BN layers, Leaky ReLU activation functions, and judicious use of dropout layers are also quite important in making training stable for the proposed deeper hypergraph structure without causing instabilities observed in their predecessors in the ECG graphs domain. The slightly lower recall on the fusion beat series is because such beats involve the integration of ventricular and supraventricular activation, resulting in intermittent waveforms that vary highly on the morphological spectrum. These waveforms do not belong to tight groups. Moreover, the data is sparse (only 241 instances, or 1.06%), making them difficult to identify, even for the expertise of a cardiologist. Although the databases vary on sampling rates, configurations, patients, and level of detail on labeling, the robust performance on the INCART databases demonstrates well the ability to generalize. A number of directions exist in terms of further work based on the current limitations. Firstly, the utilization of only a single-lead modality falls short of the spatial information conveyed within the multi-lead ECGs. Secondly, to fully explore patient- or rhythm-dependent associations, it may be desirable to maintain the fixed size of the chosen neighbors within the hypergraph, k=5. Thirdly, from a real-world application perspective, offline analysis carries myriad limitations. Fourthly, interpretability lags rule-based methods. Lastly, it proves necessary to extend validation to different sources of databases to include varied demographics, types of recordings, before actual clinical applications. One may consider adaptive hypergraph apparatuses that could automatically change the value of the fixed size of the neighbors within the hypergraph. Additionally, online machine learning strategies to suit real-time processing of ECG signals could further these studies. Furthermore, attribution methods based on hypergraphs to discuss the morphological components underlying the decisions could significantly improve these studies. To further illustrate the decision-making behaviour of the proposed model, the Grad-CAM saliency maps of the EHGNN model for one exemplary beat per AAMI class are depicted in Fig. 9a. It can be observed that the saliency maps of the EHGNN model show significant attention focused on the clinically relevant temporal regions of the ECG signal. Specifically, Normal-class beats show high saliency values in the QRS complex, VEB-class beats show high saliency values in the wide ventricular deflection area, Fusion-class beats show high saliency values across the entire QRS and ST segments of the signal, and Unknown-class (Paced) beats show high saliency values in the pacing spike region. Moreover, the global node saliency distribution of the hypergraph, depicted in Fig. 9b, shows that the Unknown class exhibits the highest saliency values and that the top 20 most salient nodes in the hypergraph belong exclusively to the Unknown class. This observation indicates that the EHGNN model assigns the highest relational importance to beats that deviate most significantly from the dominant Normal-class morphology. Grad-CAM saliency maps for representative beats per AAMI class (a) and global node saliency distribution across classes with top-20 most salient nodes (b). Clinical relevence The proposed EHGNN model is not only focused on achieving a good accuracy rate but is valuable to the clinical community due to its ability to identify potentially life-threatening arrhythmias that are both rare and hazardous to the patient’s health. It performed exceptionally on the detection of the minority class of ventricular ectopic and fusion beats (with 96.79% and 85.53% F1-scores, respectively). These are relatively rare and highly variable signals that are, nevertheless, of great clinical significance. Ventricular ectopy may indicate structural heart disease, electrolyte imbalances, and/or drug toxicity. However, among patients with a reduced EF and those who have had a heart attack, a high incidence of ventricular ectopy confers a substantially increased risk of sudden cardiac death. Therefore, a highly sensitive tool to identify such dangers is of great use. It should be remembered that fusion beats are also of equal importance, reflecting co-existing pacing and the potential diagnoses of AV dissociation, complete heart block, and/or ventricular tachycardia. In such situations, timely detection is vital. An EHGNN model that is both highly sensitive and has a good positive predictiveness prevents potentially lethal omission detections. Besides the distinct classes identified, the performance of the model for the different kinds of arrhythmic events collectively is balanced. The macro-averaged precision, recall, and F1-score for the model is 96.65%, 91.62%, and 93.97%, respectively. These scores are practically equal to the weighted averages of 98.64%, 98.66%, and 98.63%, which implies that the technique is universally effective, irrespective of the prevalence rates of the various kinds of events. This makes the technique useful for almost any application, be it automatic ECG recording for ambulatory patients and ICU patients or risk evaluation and EHR assistance. Another validation task conducted on a different database, named INCART, emphasizes its translational ability. It also reached 95.46% accuracy levels despite significant domain shifts with regard to sampling rates (360 Hz vs. 257 Hz), lead configurations (2-lead ambulatory vs. 12-lead ECGs), as well as with subjects’ geographical confinements (North America vs. Europe).In typical ECG applications, validating significant domain shifts with regard to ECG leads is particularly challenging for most algorithms. Nevertheless, EHGNN performs effectively for MIT-BIH as well. It is ready for real-time surveillance, wearables, and population screening. Ultimately, the generalization capability and diagnostic equity of EHGNN support its potential to democratize access to expert-level ECG interpretation globally, reduce disparities in cardiovascular disease detection, and enhance patient safety across diverse clinical and resource settings. Conclusion This work proposes a novel combination of a deep learning configuration that pairs CNNs for the morphological characterization of heartbeats with an Enhanced Hypergraph Neural Network (EHGNN) for encoding strong relations between the beats. The proposed deep configuration has achieved state-of-the-art performance on ECG arrhythmia classification tasks, with 98.66% accuracy and an F1-score of 98.63% on the MIT-BIH Arrhythmia Database, and a 95.62% accuracy level on the INCART Database. The essence of the innovation is the hypergraph concept itself, as it connects different morphologically similar heartbeats via hyperedges, reflecting the complex dependencies between rhythms, which cannot be represented by the simple connections used in traditional graphs. It combines a number of different elements in order to address the long-standing problem of ECG classification, including CNN-based encoders that extract multi-scale features from individual beats, a hypergraph constructed based on the similarity of morphologies between scales using the cosine similarity function allowing for scale-invariant matching, residual hypergraph convolutions to enhance the flow of information at a deeper level and to couple signals from neighboring regions, residual blocks, and focal loss with class-aware weights for dealing with significant class imbalance, emphasizing the difficult rhythms for classification. Author contributions A.V. conceived the study, designed and implemented the proposed methodology, conducted all experiments, analyzed the results, and wrote the original manuscript. S.M. supervised the research, provided critical guidance throughout the study, and reviewed and edited the manuscript. D.J. contributed to technical discussions and manuscript revision. All authors reviewed and approved the final manuscript. Funding Open access funding provided by Vellore Institute of Technology. Data availability The experimental data supporting the results and findings of this study are publicly available from the PhysioNet repository. The MIT-BIH Arrhythmia Database can be accessed at https://physionet.org/content/mitdb/1.0.0/, while the INCART 12-lead Arrhythmia Database is available at https://physionet.org/content/incartdb/1.0.0/. Declarations Competing interests The corresponding author is responsible for submitting a competing interests statement on behalf of all authors of the paper. This statement must be included in the submitted article file. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The experimental data supporting the results and findings of this study are publicly available from the PhysioNet repository. The MIT-BIH Arrhythmia Database can be accessed at https://physionet.org/content/mitdb/1.0.0/, while the INCART 12-lead Arrhythmia Database is available at https://physionet.org/content/incartdb/1.0.0/.