## 2 Materials and Methods
### Performance Metrics and Experimental Setup  
The performance of the AF classification was evaluated by the following quality factors: accuracy (Acc), sensitivity (Sen), specificity (Spec), positive predictivity value (PPV), negative predictivity value (NPV), and F1 score. The factors were calculated on the unseen (testing) dataset using a confusion matrix. These factors are defined, respectively, as  
\[\text{Acc}=\frac{TP+TN}{TP+FN+FP+TN}, \tag{18}\]  
\[\text{Sen}=\frac{TP}{TP+FN}, \tag{19}\]  
\[\text{Spec}=\frac{TN}{FP+TN}, \tag{20}\]  
\[\text{PPV}=\frac{TP}{TP+FP}, \tag{21}\]  
\[\text{NPV}=\frac{TN}{TN+FN}, \tag{22}\]  
\[\text{F1}=\frac{2\cdot\text{Sen}\cdot\text{PPV}}{\text{Sen}+\text{PPV}}, \tag{23}\]  
where \(TP\) is true positive, \(TN\) is true negative, \(FP\) is false positive, and \(FN\) is false negative.  
\begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline \hline \multirow{2}{*}{**File**} & \multicolumn{10}{c}{**Signal**} \\ \cline{2-13}  & **4015** & **4043** & **4048** & **4126** & **4746** & **4908** & **4936** & **5091** & **5121** & **5261** & **6426** & **6453** \\ \hline \(N_{AF}\) & 17 & 489 & 27 & 109 & 1028 & 197 & 1323 & 4 & 1129 & 30 & 1770 & 16 \\ \(N_{nAF}\) & 1449 & 1574 & 1304 & 1319 & 567 & 1861 & 465 & 1222 & 533 & 1487 & 68 & 1145 \\ \(N_{AF}/N_{seg}\) (\%) & 1.16 & 23.70 & 2.03 & 7.63 & 64.45 & 9.57 & 79.99 & 0.33 & 67.93 & 1.98 & 96.30 & 1.38 \\ \hline \multirow{2}{*}{**File**} & \multicolumn{10}{c}{**Signal**} \\ \cline{2-13}  & **6995** & **7162** & **7859** & **7879** & **7910** & **8215** & **8219** & **8378** & **8405** & **8434** & **8455** & **All** \\ \hline \(N_{AF}\) & 916 & 1309 & 2008 & 1334 & 225 & 1104 & 475 & 383 & 1502 & 77 & 1475 & 16947 \\ \(N_{nAF}\) & 923 & 0 & 0 & 552 & 994 & 341 & 1501 & 1134 & 459 & 1251 & 510 & 20659 \\ \(N_{AF}/N_{seg}\) (\%) & 49.81 & 100.00 & 100.00 & 70.73 & 18.46 & 76.40 & 24.04 & 25.25 & 76.6 & 5.79 & 74.30 & 45.06 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The number of analyzed classes described by the number of AF (\(N_{AF}\)) and non-AF (\(N_{nAF}\)) segment labels and the ratio of AF labels (\(N_{AF}\)) to the total number of segments (\(N_{seg}\)) for a given signal.  
The LS-SVM classifier performance was estimated using the cross-validation (CV) statistical method. In this work, all data were validated with a five-fold CV. Using the \(K\)-fold CV method can help produce an efficient model for imbalanced data. The average performance of the model was calculated on all test sets. The set of parameters for the DQ-TQWT was the following: \(Q_{1}=6\), \(r_{1}=4\), \(J_{1}=45\), \(Q_{2}=1\), \(r_{2}=4\), \(J_{2}=11\). The _modwt_ and _modwtar_ procedures started with the wavelet 'db2' and level \(L=12\). After extensive experimentation, this number was determined to produce the optimal results. The parameters of the genetic algorithm in the feature selection method (wrapper method) were as follows: the crossover rate was 0.8, and the mutation rate was 0.01. For SVM-type classification, class labels \(\{-1,1\}\) were assigned to the feature vectors to represent the presence or absence of the AF episode. The input data were scaled to the range \([-1,1]\)[4, 63]. A Matlab 2022b environment (Mathworks, Natick, MA, USA) was used to implement the proposed method. All signal processing and model training and testing procedures for this study were custom programed in Windows 10 on a computer equipped with an AMD(R) AMD Ryzen 7 2700X and 32 GB RAM.