## 2 Methods
### Training and Testing of the OSA Detectors  
In order to ensure the most accurate and unbiased evaluation of a classification model's performance, it is essential to separate the training and testing procedures using different datasets. This approach is recommended to avoid overly optimistic results that often occur when the same patient data are shared in both stages, as pointed out by the Transparent Reporting of a Multivariate Prediction Model for Individual Prognosis or Diagnosis (TRIPOD) initiative [76]. In the present study, such a recommendation was followed by employing balanced subsets of the MIT-BIH and UCD-DB datasets for training the OSA detection models and leaving Apnea-ECG dataset for testing. During the model testing phase, all the observations from the Apnea-ECG dataset were employed. This choice was made because the Apnea-ECG dataset has been widely used in previous research, allowing to indirectly compare the obtained results with previous works.  
Hence, to train all the CNN-based models, provided with DM, RP, and CWT images, the learning rate was established at the initial value of 0.001 following the guidelines of the state of the art [6]. This parameter refers to the step size for updating network weights [77]. The epoch refers to the number of times that the learning algorithm is going to work through the entire training set [78]. In the present work, the generated DL models were trained over 10 epochs. Then, the mini-batch size was established to 128, which is the number of samples sent to the model in each training cycle [77]. Additionally, the adaptive moment estimation (ADAM) optimizer was employed to update model weights during training [79]. While hyper-parameter optimization techniques such as grid search or Bayesian optimization were not employed in this study, the selected hyper-parameter values follow established conventions and were validated through preliminary experiments to ensure robust performance. This approach was chosen to prioritize simplicity and reproducibility.  
Figure 7: Visual comparison between apneic and normal scalograms: (**a,b**) represent apneic episodes, whereas (**c,d**) represent normal episodes.  
Eventually, several performance measures were calculated, such as sensitivity (Se), specificity (Sp), accuracy (Ac), positive predictive value (PPV), negative predictive value (NPV), and F\({}_{1}\)-score [75]:  
\[Ac =\frac{TP+TN}{TP+TN+FP+FN}, Se =\frac{TP}{TP+FN}, Sp =\frac{TN}{TN+FP},\] \[PPV =\frac{TP}{TP+FP}, NPV =\frac{TN}{TN+FN},\text{ and } F_{1} =\frac{2\cdot TP}{2\cdot TP+FP+FN}.\]  
where true positive (TP) represents the number of episodes correctly classified as OSA, true negative (TN) corresponds to the number of episodes correctly classified as normal, false positive (FP) corresponds to the number of episodes incorrectly classified as OSA, and false negative (FN) corresponds to the number of episodes incorrectly classified as normal.  
All experiments were implemented in MATLAB R.2023a for Linux and the included Deep Learning Toolbox. Whereas the training process was conducted on a cluster of graphical processing units consisting of two NVIDIA GEFORCE RTX (TM) 3080 mounted on an Ubuntu (20.04 LTS) server, the testing stage was performed on an Intel (R) Core (TM) i7-4790 CPU (3.6 GHz) with 16 GB RAM.