## 4 Results and Discussion
### Simulation Results  
To train the models effectively, we used a technique called Adam to optimize their performance and categorical cross-entropy to measure errors. Additionally, five-fold cross-validation was employed to assess the models' accuracy by splitting the data into five equal subsets, ensuring no overlap. During training, we used three of these subsets for training, one for fine-tuning the model (validation), and the remaining one for final testing. This ensures all data points contribute to the training process at least once, while a dedicated subset is used for the final evaluation. We trained the two CNN + GRU models for both datasets for 30 epochs (iterations). We fed the data in batches with a batch size of 32. Figure 9 illustrates an example of how the accuracy of the two models improved, and their errors (loss) decreased during training for the last fold (fold 5). It is important to note that for each of the five folds, we built and trained the two models from scratch. This means we separately obtained the five confusion matrices that summarize the performance of the two models on each data split. Figure 10 displays these confusion matrices for both models, applied to the three-class and five-class datasets, one for each fold of the evaluation process. \begin{table}
\begin{tabular}{l c c c c} \hline \hline  & \multicolumn{2}{c}{**3-Class Dataset (MIT-BIH + BIDMC)**} & \multicolumn{2}{c}{**5-Class Dataset (MIT-BIH)**} \\ \hline
**Parameters** & **Accuracy** & **Loss** & **Accuracy** & **Loss** \\ \hline ReLU + Average & **99.796** & **0.0106** & **99.780** & **0.0246** \\ Pooling & 98.922 & 0.0359 & 96.969 & 0.1098 \\ ReLU + & 99.270 & 0.0214 & 99.760 & 0.0285 \\ Average Pooling & 98.905 & 0.0364 & 90.589 & 0.3724 \\ Pooling & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance comparison of CNN + GRU using different pooling layers and activation functions on two datasets. \begin{table}
\begin{tabular}{l c c c c} \hline \hline  & \multicolumn{2}{c}{**3-Channel Model**} & \multicolumn{2}{c}{**1-Channel Model**} \\ \cline{2-5}  & \multicolumn{2}{c}{**Spectrogram**} & **LBP** & **HOG** \\ \hline Training time (min) & 3.48 & 1.47 & 1.46 & 1.74 \\ Prediction time & 0.0027 & 0.0010 & 0.0010 & 0.0010 \\ (sec/image) & & & & \\ Loss rate & 0.0189 & 0.29 & 0.029 & 0.031 \\ Accuracy rate & 99.75 & 98.69 & 98.53 & 98.51 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison between the proposed 3-channel fusion-based CNN + GRU model and the corresponding 1-channel versions for the 3-class dataset (MIT-BIH + BIDMC). The confusion matrices from Figure 10 are used to calculate various performance metrics for our models. The performance of the proposed CNN + GRU model is evaluated using five-fold cross-validation on both a three-class dataset (MIT-BIH + BIDMC) and a five-class dataset (MIT-BIH), and the results in Table 4 demonstrate consistently high metrics across the board. For the three-class dataset, the model achieves near-perfect precision, recall, F1-score, and accuracy, with values ranging from 99.66% to 99.92% across all folds, culminating in an average score of 99.80% for each metric. This indicates that the model is highly reliable, with minimal variance between folds, and consistently performs well in classifying the three categories. On the five-class dataset, the model maintains an impressive level of performance, with precision, recall, F1-score, and accuracy ranging between 99.60% and 99.90%, resulting in an average score of 99.76% across all metrics. Although slightly lower than the three-class dataset, this performance is still exceptional, suggesting that the model is capable of handling the increased complexity of classifying five different classes. The consistency in performance across all folds for both datasets underscores the robustness  
Figure 10: Confusion matrices for the 3-class dataset, MIT-BIH+BIDMC (**top row**), and the 5-class dataset, MIT-BIH (**bottom row**), for each fold.