## 9 Discussion  
We introduced a deep learning based Recurrent Neural Network (RNN) that calls the different states of consciousness in rats from EEG and EMG recordings. The proposed model automatically learns features which exist in the data and uses them to classify sleep stages. We analyzed the challenge of class imbalance problem and investigated the generalization of the model. Two types of class imbalance problems, i.e., minority and majority cases for binary and multiclass classification, were studied in depth. Both types \begin{table}
\begin{tabular}{c|c c c} \hline \hline \multicolumn{4}{c}{SINGLE PC ELECTRODE} \\ \hline \hline \multicolumn{4}{c}{SINGS} & **NREM** & **REM** \\ \hline \multirow{6}{*}{Actual} & **SERS** & **NREM** & **REM** \\ \cline{2-4}  & **NREM** & 45,747 & 391 \\ \cline{2-4}  & **REM** & 3769 & 591 \\ \cline{2-4}  & **SERS** & **NREM** & **WAKE** \\ \cline{2-4}  & **NREM** & **NREM** & **WAKE** \\ \cline{2-4}  & **NREM** & 42,073 & 4166 \\ \cline{2-4}  & **WAKE** & 7593 & 15,854 \\ \cline{2-4}  & **SERS** & **WAKE** & **REM** \\ \cline{2-4}  & **WAKE** & 23,246 & 306 \\ \cline{2-4}  & **REM** & 3726 & 521 \\ \cline{2-4}  & **SERS** & **NREM** & **REM** & **Wake** \\ \cline{2-4}  & **NREM** & 42,095 & 146 & 3877 \\ \cline{2-4}  & **REM** & 2020 & 605 & 1781 \\ \cline{2-4}  & **WAKE** & 7145 & 177 & 16,145 \\ \hline \multicolumn{4}{c}{Confusion Matrix of Single FC Electrode} \\ \hline \hline \multicolumn{4}{c}{SINGLE PC-FC ELECTRODE} \\ \hline \multicolumn{4}{c}{Predicted} \\ \hline \multirow{6}{*}{Actual} & **SERS** & **NREM** & **REM** \\ \cline{2-4}  & **NREM** & 45,387 & 686 \\ \cline{2-4}  & **REM** & 2889 & 1536 \\ \cline{2-4}  & **SERS** & **NREM** & **WAKE** \\ \cline{2-4}  & **NREM** & 42,154 & 4027 \\ \cline{2-4}  & **Wake** & 7559 & 15,946 \\ \cline{2-4}  & **SERS** & **WAKE** & **REM** \\ \cline{2-4}  & **WAKE** & 22,986 & 529 \\ \cline{2-4}  & **REM** & 3025 & 1259 \\ \cline{2-4}  & **SERS** & **NREM** & **REM** & **Wake** \\ \cline{2-4}  & **NREM** & 42,124 & 375 & 3814 \\ \cline{2-4}  & **REM** & 1508 & 1654 & 1198 \\ \cline{2-4}  & **WAKE** & 6029 & 428 & 16,861 \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Confusion matrices. show negative correlations with the performance measures: precision, recall, or F1-Score. This indicates that the performance is inversely proportional to the number of imbalanced classes. The performance trend indicates that performance degraded as the majority group increases. The reason is that the imbalance rate increases in the minority cases. Based on the analysis, we investigated a dichotomy of the sleep stages, i.e., binary classification with the aim of handling majority and minority classes. When minority and majority class difference was small, the results for Recall and F1-Score improved. This shows that we can do generalization for a minority class, and, furthermore, help to balance performance. Moreover, the results show that the class decomposition into binary form does not provide any advantages in learning with class imbalance. In the case of REM stage, the Recall and F1-Score were reduced by class decomposition. A possible explanation for this behavior is that the global information of class distribution is reduced as a result of class decomposition. We conclude that a non-decomposition method is better than decomposition because the class distribution information is fully utilized. Hence, the model performance is improved. Our model achieves high F1 scores in the multi-class problem. Decreasing the number of input channels that were available for our model to infer sleep stages decreased the prediction performance. This shows that our model will yield good prediction performance even for experiments in which multiple channels are included. For multiple channels and classes, F1 scores became better. This observation agrees with our expectation that the accuracy increases if all channel recordings are available. The prediction performance of our model was poorer for a single channel when compared to multiple channel data.