# Hybrid Deep Learning Approach for Automated Sleep Cycle Analysis
## 4 Results and Discussion
### Model Evaluation  
Once the best model was trained, its performance was evaluated in the test set. The confusion matrix shown in Figure 13 summarizes the classification results by class. Since this set was neither preprocessed nor balanced, the natural class distribution was maintained, \begin{table}
\begin{tabular}{c c} \hline \hline
**Metric** & **Value** \\ \hline Overall Accuracy & 78.21\% \\ \hline Precision & 79.20\% \\ \hline Recall & 78.21\% \\ \hline F1-Score & 78.43\% \\ \hline Specificity & 94.55\% \\ \hline NPV & 94.55\% \\ \hline Jaccard & 66.12\% \\ \hline Cohen’s Kappa & 72.77\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Classification results of the best model on the validation set. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**Metric \%**} \\ \hline
**Class** & **Precision** & **Recall** & **F1-Score** & **Specificity** & **NPV** & ** Jaccard** \\ \hline N1 & 58.68 & 59.78 & 59.23 & 89.48 & 89.90 & 42.07 \\ \hline N2 & 82.47 & 83.24 & 82.85 & 95.58 & 95.80 & 70.73 \\ \hline N3 & 94.29 & 95.34 & 94.81 & 98.56 & 98.83 & 90.14 \\ \hline R & 66.83 & 77.28 & 71.68 & 90.41 & 94.09 & 55.85 \\ \hline W & 93.75 & 75.42 & 83.59 & 98.74 & 94.14 & 71.81 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Per-class validation performance metrics. allowing the model's performance to be observed in a real-data context. In total, 9232 test examples were used, equivalent to 276,960 s of recordings (27,696,000 samples). The class distribution was as follows: N1 = 450, N2 = 3638, N3 = 1224, R = 1811, and W = 2109. This distribution is typical in sleep analysis, where N1 is often underrepresented and N2 is usually the most frequent stage, reflecting the natural prevalence of certain sleep cycle patterns. According to the confusion matrix, the model correctly classified 221 N1 examples, 3105 N2, 1093 N3, 1284 R, and 1560 W. With these results, the overall accuracy of 78.67% was calculated for the test set, demonstrating the model's ability to correctly classify most examples not used during training. Detailed class-wise metrics are shown in Table 5. A summary of the performance metrics per class is presented below. * N1: Class N1 remained the hardest to predict. The precision was 17.40% and recall 49.11%, with an F1-score of 25.70%, revealing limited performance in this class but with some success in detection. The specificity was 88.06% and the NPV 97.12%, indicating more reliable rejection than detection. The Jaccard index was 14.74%, reflecting poor overlap between the predictions and the true labels. * N2: Class N2 maintained strong metrics. The precision was 87.54% and recall 85.35%, with an F1-score of 86.43%, indicating effective classification with balanced accuracy and coverage. The specificity was 92.10% and the NPV 90.62%, showing the reliable identification of non-N2 cases. The Jaccard index was 76.10%, confirming the consistent predictions. * N3: Class N3 produced the most reliable results. The precision was 86.61% and recall 89.30%, with an F1-score of 87.93%, reflecting both accurate predictions and strong sensitivity. The specificity reached 97.89% and the NPV 98.36%, with a Jaccard index of 78.46%, showing a high degree of overlap with the true labels. * R: For class R, the precision was 82.63% and recall 70.90%, with an F1-score of 76.32%, showing decent performance with slightly lower coverage. The specificity was 96.36% and the NPV 93.14%, indicating the effective rejection of incorrect cases. The Jaccard index was 61.70%, reflecting moderate agreement. * W: Class W achieved 97.56% precision and 73.97% recall, with an F1-score of 84.14%, suggesting high accuracy and good but improvable detection. The specificity was 99.45% and the NPV 92.81%, highlighting an excellent ability to avoid false positives. The Jaccard index was 72.63%, supporting its solid overall performance. Figure 13: Confusion matrix for the best-performing model on the test set.