## 2 Materials and Methods
### ECG SQIs and Other Features  
For the ML classification model of the ECG signal, features were extracted and divided into two domains: time and SQIs (Table 2). Regarding the time domain features, the standard deviation of the RR intervals (SDRR) was calculated. Additionally, the variability of the R-peaks relative to the maximum amplitude of the signal (MaxRR) was determined by calculating the ratio of the maximum amplitude of the R-peaks to the maximum amplitude of the signal. Different types of variability in heartbeat templates were evaluated, including intra-beat variability (IntraV) and inter-beat variability (InterV). IntraV measures the variability within each individual beat by first calculating the standard deviation for each beat and then averaging these standard deviations (Figure 4). This approach captures the variability in the shape or \begin{table}
\begin{tabular}{l l l} \hline \hline
**Domain** & **Feature** & **Explanation** \\ \hline \multirow{7}{*}{Time} & Standard deviation of RR intervals (SDRR) & Standard deviation of the intervals between \\  & & consecutive R-peaks. \\ \cline{2-3}  & Variability of R-peaks compared to maximum & Ratio of the maximum amplitude of R-peaks to \\  & amplitude (MaxRR) & the maximum amplitude of the signal. \\ \cline{2-3}  & Inter-beat variability (InterV) & Average standard deviation of each time point \\  & & across all heartbeat templates, quantifying the \\  & variability between different heartbeat patterns. \\ \cline{2-3}  & Intra-beat variability (IntraV) & Average standard deviation computed within \\  & & each heartbeat template, quantifying the \\  & variability in the shape or pattern of each beat. \\ \cline{2-3}  & Flatline percentage (FlatP) & Percentage of the signal where the amplitude is \\  & & below a certain threshold. \\ \hline \multirow{7}{*}{SQI} & Quality & Numeric representation of overall ECG quality \\  & based on multiple SQIs (qSQI, pSQI, kSQI, and basSQI). \\ \cline{2-3}  & & Combination of the skewness quality index \\ \cline{1-1}  & hosQI & absolute value (sSQI) and the kurtosis quality \\ \cline{1-1}  & & index (kSQI). \\ \cline{1-1} \cline{2-3}  & cQI & Ratio of the standard deviation to the mean of \\ \cline{1-1}  & & RR intervals. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Extracted ECG signal features for model training, divided into two domains: time and SQIs. pattern of each beat. On the other hand, InterV assesses the variability between beats by stacking all the beats together, calculating the standard deviation at each time point across beats, and then averaging these standard deviations. This reflects the variability among different beats as a whole. Finally, the flatline percentage (FlatP) was computed, indicating the percentage of the signal that fell below a certain threshold. The \"Quality\" feature in the SQIs was derived from the BioSPPy library using the ZZ2018 function, categorizing the signal quality as \"Excellent\", \"Barely acceptable\", or \"Unacceptable\". These quality levels were numerically mapped for training the model. The SQIs involved in the \"Quality\" feature included qSQI, which assessed the agreement between two peak detectors, and pSQI, which calculated the ratio of the energy of the QRS complex to the total energy of the ECG signal [23]. If there was noise interference, the high-frequency component increased and pSQI decreased. It also included kSQI, which calculated the kurtosis of the ECG signal, and basSQI, which computed the complementarity of the power ratio in the frequency bands from 0 to 1 Hz to the power in the frequency bands from 0 to 40 Hz. The basSQI measured the effect of baseline drift noise reduction in ECG signals [24]. The analysis used a fuzzy mode to calculate the quality measure by combining the weighted sums of the four SQIs, chosen due to its superior Ac compared to other methods [24]. The cSQI [24] assessed the variability in the RR intervals by calculating the ratio between the mean of the RR intervals and their standard deviation.