# Efficient Sleep-Wake Cycle Staging via Phase-Amplitude Coupling Pattern Classification
## 4 Discussion  
The objective and automatic detection of sleep stages is of paramount importance in its neuroscientific investigation and several different algorithms exist for this purpose. Instead of using computationally heavy and complex machine learning models, here we implemented and tested a simple and straightforward MLP network topology, which was trained and tested using conventional algorithms and with a very meaningful electrographic biomarker, the phase-amplitude coupling (PAC) between oscillations of different frequencies. The results of phase 1, designed to test different protocols of input data usage and to find the optimal number of hidden neurons, showed that such an approach can yield good to excellent overall performances, as assessed by the AUC metric (Figure 2). Protocols that use more data from the comodulogram (protocols 3 and 4, full or half comodulograms, respectively) displayed significantly improved performances, with AUC values around 0.98. Moreover, the results from multiple metrics of phase 2, which was designed to assess  
Figure 8: The classification performance decreases significantly as the extrapolation strategy becomes more demanding, in which the training data represent less of the total dataset. Using the one-way ANOVA and post hoc Tukey, the resulting statistics were as follows (mean \(\pm\) s.e.m. ): WK) strategy 1: 0.976 \(\pm\) 0.005; strategy 2: 0.973 \(\pm\) 0.005; strategy 3: 0.960 \(\pm\) 0.005; strategy 4: 0.955 \(\pm\) 0.005; and strategy 5: 0.937 \(\pm\) 0.005 (differences a-bc and a-c: \(p\) < 0.05). SWS) strategy 1: 0.981 \(\pm\) 0.002; strategy 2: 0.979 \(\pm\) 0.002; strategy 3: 0.972 \(\pm\) 0.002; strategy 4: 0.965 \(\pm\) 0.002; and strategy 5: 0.967 \(\pm\) 0.002 (differences a-bcd: \(p\) < 0.05; differences a-cd, a-d, and ab-cd: \(p\) < 0.0001; and differences ab-d: \(p\) < 0.001). REM) strategy 1: 0.997 \(\pm\) 0.002; strategy 2: 0.998 \(\pm\) 0.002; strategy 3: 0.997 \(\pm\) 0.002; strategy 4: 0.990 \(\pm\) 0.002; and strategy 5: 0.988 \(\pm\) 0.002 (difference a-b: 0.05). ALL) strategy 1: 0.985 \(\pm\) 0.003; strategy 2: 0.983 \(\pm\) 0.003; strategy 3: 0.976 \(\pm\) 0.003; strategy 4: 0.970 \(\pm\) 0.003; and strategy 5: 0.964 \(\pm\) 0.003 (differences: a-bc and ab-c: 0.01; and difference a-c: 0.0001). The boxplots display the median and 25 th and 75 th percentiles in the main box; the whiskers depict the extremities of the data; and the outliers are displayed as red + symbols. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **WK** & **SWS** & **REM** \\ \hline Strategy 1 & 0.877 & 0.943 & 0.926 \\ Strategy 2 & 0.883 & 0.940 & 0.916 \\ Strategy 3 & 0.845 & 0.932 & 0.853 \\ Strategy 4—best & 0.846 & 0.913 & 0.775 \\ Strategy 4—worst & 0.784 & 0.924 & 0.772 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: F1-score values for all extrapolation strategies. the applicability of the network in a simulation of usage in the electrophysiology lab, indicate that the network architecture with the highest AUC values for the present data (half comodulogram input and 15 neurons in the hidden layer) can also perform well in extrapolations across different days (Figure 5), different animals (Figure 6), or even in the most demanding scenario in which data from a single animal in a single day can be used to classify the rest of the dataset (Figure 7). Yet, some caution is advised in these situations (see more on this further down the text). Regarding the different choices of input (protocols 1 to 4), the usage of only the PAC values described as highly important for sleep phenomena in the literature (Table 1; protocols 1 and 2) were enough to classify all the stages reasonably well, at least as assessed by the AUC values only (Figure 2). On the other hand, it was somehow expected that the network architectures would perform significantly better when fed with more input values, i.e., whole or half comodulograms instead of frequency points or ranges, which happened (Figure 3).