# Resource-Aware ECG Classification with Heterogeneous Models in Federated Learning
## 3 Materials and Methods
### Dataset  
The purpose of this study was to explore ECG classification in a heterogeneous FL environment. While single-lead ECG classification has been extensively studied, our work focused on a more complex scenario that integrates signals from multiple ECG sources with varying configurations. This study specifically addressed the challenges posed by device heterogeneity, signal variability, and privacy constraints in a distributed learning setting. By leveraging FL, we aimed to enable effective model training across diverse ECG devices while ensuring data security and robustness in real-world deployments. The MIT-BIH Arrhythmia dataset is a crucial dataset in the field of cardiology and biomedical signal processing, widely utilized for the development and assessment of arrhythmia detection algorithms. Released in 1980, this dataset has since become an essential resource for ECG research [18]. It contains heart recordings from 47 patients, captured using a two-lead Holter monitor over a span of 48 h. It is digitized at 360 Hz to provide high-resolution data, which is important in cardiovascular computing for accurate beat detection. Each sample was captured with an 11-bit resolution across a 10 mV range, offering precise heart activity measurements. The dataset includes 48 recordings, identified by record numbers 100-109, 111-119, 121-124, 200-210, 212-215, 217, 219-223, and 228-231. Each recording is 30 min long. Two or more cardiologists independently annotated each recording, identifying key events such as heartbeats and arrhythmias. Disagreements between the cardiologists were resolved through collaboration, resulting in computer-readable reference annotations. This process led to the annotation of approximately 110,000 heartbeats, making the dataset a valuable tool for arrhythmia research and the development of diagnostic algorithms [18]. However, to maintain the quality of the dataset, certain records were excluded. Specifically, records 102, 104, 107, and 217 were removed due to insufficient signal quality, making them unreliable for cardiac diagnosis [37]. Consequently, the number of heartbeats in the dataset available for classification was reduced to 99,188. The dataset includes five distinct classes of beats: normal beats (N), atrial premature beats (A), premature ventricular contraction beats (V), left bundle branch block beats (L), and right bundle branch block beats (R). ECG signal classification relies on analyzing the morphological features of the detected P-, Q, R-, S-, and T- waves, as represented in Figure 1. Normal beats (N) display consistent P-wave activity, along with well-defined QRS and T-wave structures. Atrial contractions (A) are characterized by irregular P-waves due to premature atrial depolarization. Ventricular contractions (V) typically lack a preceding P-wave and feature widened, abnormal QRS complexes. Left bundle branch blocks (L) present broad QRS complexes with notched R-waves in specific leads, whereas right bundle branch blocks (R) are marked by prolonged QRS durations and distinctive secondary R-waves. By examining these waveform characteristics within ECG cycles, the classification system categorizes each heartbeat based on its deviation from normal patterns [37; 38]. The MIT-BIH Arrhythmia dataset is heavily imbalanced, as shown in Table 1, with the majority of beats classified as normal beats (N), while the other classes appear much less frequently. This imbalance presents a challenge for ML models, as the underrepresentation of minority classes can lead to biased predictions where the model favors the dominant normal class, reducing the overall classification performance for arrhythmic beats. \begin{table}
\begin{tabular}{c l c} \hline \hline
**Class** & **Description** & **Samples** \\ \hline N & Normal Beat & 74,000 \\ A & Atrial premature Beat & 6640 \\ V & Premature Ventricular Contraction Beat & 6732 \\ L & Left Bundle Branch Block Beat & 8843 \\ R & Right Bundle Branch Block Beat & 2979 \\ \hline \hline \end{tabular}
\end{table}