Utility of complexity analysis in electroencephalography and electromyography for automated classification of sleep-wake states in mice
In recent years, a multitude of genetically modified mouse models and neuronal manipulation techniques have been utilized to decipher the mechanisms that regulate sleep-wakefulness states, as well as genes and neuronal circuits involved. The sleep phases in mammals are typically classified into three stages: wakefulness (WAKE), non-rapid eye movement sleep (NREM) and rapid eye movement sleep (REM). Sleep-wakefulness states has been identified with electroencephalogram (EEG) and electromyogram (EMG) signals and are scored visually by human experts. However, there are difficulties in the evaluation costs and variability among scorers both in human , and animal – studies. To address these challenges, various signal analyses , and machine learning methods , , including deep learning , , , have been employed to automate sleep stage scoring , , , although perfection has yet to be achieved. As living organisms are highly complex systems, each set of physiological data exhibits a unique complexity profile. The brain, composed of an enormous number of neurons, forms multiple hierarchical neuronal feedback loops ranging from local to long-range connections , and neural oscillations, measured through method like EEG, offer insight into the complexity of brain activity across different time scales , . Consequently, in addition to power spectral density (PSD), which has traditionally been utilized for sleep stage scoring , various oscillatory characteristics such as entropy and fractality could be an alternative approach , . Entropy, in this context, refers to the degree of irregularity or unpredictability in a time series, often computed using methods such as sample entropy (SampEn) or approximate entropy, which evaluates how often similar patterns are followed by additional similar patterns or dissimilar patterns. Fractality, on the other hand, relates to the self-similarity of EEG signals across different scales, typically assessed using methods like detrended fluctuation analysis (DFA), which evaluates the presence of long-range temporal correlations within the signal. Given the complex neural circuit of the sleep-wakefulness mechanism, involving intricate neuronal networks within the brainstem, hypothalamus and cortex, we posit that the utilization of complexity analysis on EEG time series data decomposed into frequency, amplitude, and phase by frequency decomposition and Hilbert transform, which have previously been demonstrated to be effective for the diagnosis of Alzheimer’s disease and for neural decoding , could be suitable for detailed extraction of EEG features. In the present study, we aimed to identify complexity profiles for each sleep stage and integrate these with deep learning to develop an automated sleep scoring system for mice. Our approach combines traditional analyses like EEG spectra and EMG amplitude with complexity analyses. This combination allows for a nuanced analysis of sleep stages, highlighting the complementary nature of traditional and complexity-based analyses. We tested the performance of this system by comparing the hypnograms of wild type (WT) mice, which were independently scored by three experts, and the automated scoring system. Additionally, the scoring performance was also validated in prepro-orexin knockout (OXKO) mice, a narcolepsy model, to examine its applicability to mice with abnormal sleep architectures, as fragmentation of sleep-wakefulness states and abnormality of REM sleep expression in this model have previously been challenging to analyze using existing automated scoring methods. 

Complexity features of EEG and EMG for each sleep-wakefulness stage Initially, we explored the complex characteristics of EEG and EMG signals of each sleep-wakefulness stage using entropy and fractal analyses. A comparative analysis of EEG and EMG irregularities among the stages was conducted utilizing multiscale entropy (MSE), which investigates sample entropy across multiple time scales (Fig. ). Significant differences were observed across various frequency bands and time scales. Specifically, the theta phase MSE were NREM > WAKE > REM, while the gamma phase MSE were NREM > REM > WAKE. Furthermore, significant reductions in alpha to gamma amplitude MSE were observed during NREM sleep. Subsequently, to evaluate the fractality of EEG and EMG during each stage, detrended fluctuation analysis was applied. Our findings revealed variances in fluctuations over various time scales τ , not only in the broadband (bb) EEG and EMG, but also in the narrowband amplitude of EEG, especially within the beta and gamma frequencies (Fig. a). Moreover, significant differences were observed in the exponent α of the narrowband amplitudes, more pronounced on longer time scales (Fig. b). Generation of sleep analyzer complex (SAC) Considering the results in the previous section, we developed an automated framework for sleep stage classification that integrates traditional and complexity analyses, termed the sleep analyzer complex (SAC). In developing SAC, we organized the system into three distinct convolutional blocks for local feature extraction, each dedicated to a specific type of analysis: time frequency (TF) analyses (EEG spectrum and EMG amplitude), MSE, and DFA. These extracted features are then processed through fully connected layers. We elaborated on the details in the Materials and Methods section, but a summary is shown in Fig. . In the TF block, feature extraction was modeled after the SPINDLE approach, which incorporates convolutional and fully connected layers in the original model to process three-dimensional inputs . These inputs were combined to form the EEG TF map and the EMG amplitude map, which was replicated across the frequency dimension to align with EEG data, resulting in a tensor of dimensions (time) × (frequency) × (EEG/EMG). For the computation of MSE and DFA, we utilized a diverse set of parameters and magnitude rescaling methods to enrich the input. Consequently, the convolutional layers for MSE and DFA were designed to accept four-dimensional input, structured as (frequency band) × (temporal scale τ ) × (magnitude rescale) × (tolerance r + EEG/EMG) for MSE, and (frequency band) × (temporal scale τ ) × (magnitude rescale) × (EEG/EMG) for DFA. To address the importance of each frequency band, we conducted separate evaluations for the MSE and DFA blocks. This approach involved calculating the decrease in accuracy when excluding each frequency band from the MSE and DFA blocks individually, rather than assessing the decrease in accuracy from models that included all features (TF, MSE, and DFA). Although this method does not allow for direct comparison of the importance scores between MSE and DFA, it was chosen to mitigate the risk of multicollinearity, which can otherwise obscure the importance of each frequency band in each block when all features are considered together. Separate evaluation revealed that in both the MSE and DFA blocks, all frequency bands, from delta to gamma, exhibited positive feature importance (Fig. ). Additionally, comparing the prediction results with and without each frequency band showed that all frequency bands were effective in improving the predictions (for both MSE and DFA blocks, McNemar test showed p < 0.001 for all frequency bands). Consequently, the entire frequency band was included in the MSE and DFA blocks. As shown in Table , the accuracy achieved by DFA was lower than that achieved by MSE, and the accuracy difference between MSE and MSE + DFA was only 0.1%. However, since the McNemar test revealed a significant difference (p < 0.001, not shown in Table ), DFA block was also adopted in our model. In addition, to ensure consistency with expert assessments that require a minimum of 12 s for each sleep stage, we incorporated the Rescoring Short Epoch (RSE) method into our convolutional neural network (CNN) model. This method involves replacing short-duration predictions with the next most probable prediction iteratively until all stages meet the 12-s minimum duration criterion. We evaluated the performance of this model with fivefold cross-validation using data from 72 WT mice (Table ). The model was compared against a clustering-based algorithm, FASTER , the previously mentioned SPINDLE , and a model based solely on complexity analyses. Additionally, we compared the RSE constraining method with a hidden Markov model (HMM). The model based solely on complexity analyses demonstrated performance comparable to that of SPINDLE, which employs convolutional layers identical to those in the TF algorithm. As expected, the highest performance was observed in the model with combination of TF and complexity analysis. Furthermore, although a significant difference was observed in the McNemar test, the RSE constraining method exhibited a performance that was very close to the HMM (98.3 ± 0.1% vs. 98.4 ± 0.1%). Additionally, the learning curves and the scoring results for TF and TF + MSE + DFA demonstrated high reproducibility (Supplementary Fig. and Supplementary Table ). Performance of SAC on WT mice Following the retraining of SAC, a TF + Complexity CNN model constrained by the RSE method, using the entire dataset as previously outlined, we evaluated the model’s performance by comparing its outputs against the hypnograms scored by three expert human scorers (Experts, Ex1, Ex2 and Ex3). Analysis of the scoring for an additional set of eight WT mice, not included in the training, validation, or test dataset, showed that the concordance between SAC’s predictions and the experts’ assessments ranged from 97.4 to 98.1% (Cohen’s Kappa = 0.953 to 0.965) (Fig. b). This level of agreement was similar to that among the experts themselves, which varied from 97.3 to 97.8% (Cohen’s Kappa = 0.951 to 0.961), indicating that the variability in SAC’s predictions was comparable to the inter-expert variability (Table ). Furthermore, we extracted sleep profiles from each hypnogram (Fig. c and Table ). Despite observing statistically significant differences among SAC and the experts in the post-hoc paired t -tests, these differences were relatively minor compared to the variability within each respective group (Table ). Consequently, SAC’s performance exhibited no significant biases when assessed against the expert evaluations. Additionally, no significant discrepancies were noted in the 2-hourly variation analysis (Fig. c), indicating a consistent level of agreement between SAC’s predictions and the expert scores. These findings suggest that SAC, alongside the human experts, consistently provided highly similar sleep profiles. Applicability of SAC to narcoleptic mice Next, we explored how well SAC could be applied to model mice with abnormal sleep architecture, specifically using OXKO mice as a narcolepsy model. In OXKO mice, abnormalities in EEG signals for each sleep stage are not prominent, but sleep architecture abnormalities, that is, disruptions in the transition between sleep-wakefulness stages, are observed . The agreement between SAC’s predictions and Ex1’s assessments was reliable, at 97.1 ± 0.5% (Cohen’s Kappa = 0.949 ± 0.010), as indicated in Fig. b. This reflects SAC’s reliable accuracy in models with sleep irregularities, even though it is slightly below the accuracy of 98.1 ± 0.2% observed in WT mice. However, a closer examination of the sleep profiles revealed some discrepancies between SAC and Ex1, particularly in OXKO mice where more significant differences were noted compared to WT mice. Specifically, REM sleep displayed significant differences in total time and number of episodes during both light and dark periods, and NREM sleep also showed differences in total time and mean duration during the light period (Table ). Additionally, 2-hourly vari_3ation analysis showed differences in total REM sleep time at some segments (Fig. c). These differences suggest SAC’s predictions deviated slightly from Ex1’s assessment, likely due to SAC being trained on WT mice data. Despite these differences, SAC demonstrated a strong ability to capture the abnormal sleep-stage transitions characteristic of OXKO mice when comparing WT and OXKO hypnograms. For most parameters, including sleep onset REM (SOREM), which refers to REM sleep occurring immediately after a waking period, SAC detected differences between WT and OXKO mice similar to those identified by Ex1 (Fig. a,d and Table ). This consistency in detecting abnormal transitions, rather than differences in individual sleep stages, underscores SAC’s adaptability and reliability in identifying key narcoleptic features across different mouse models. 

Initially, we explored the complex characteristics of EEG and EMG signals of each sleep-wakefulness stage using entropy and fractal analyses. A comparative analysis of EEG and EMG irregularities among the stages was conducted utilizing multiscale entropy (MSE), which investigates sample entropy across multiple time scales (Fig. ). Significant differences were observed across various frequency bands and time scales. Specifically, the theta phase MSE were NREM > WAKE > REM, while the gamma phase MSE were NREM > REM > WAKE. Furthermore, significant reductions in alpha to gamma amplitude MSE were observed during NREM sleep. Subsequently, to evaluate the fractality of EEG and EMG during each stage, detrended fluctuation analysis was applied. Our findings revealed variances in fluctuations over various time scales τ , not only in the broadband (bb) EEG and EMG, but also in the narrowband amplitude of EEG, especially within the beta and gamma frequencies (Fig. a). Moreover, significant differences were observed in the exponent α of the narrowband amplitudes, more pronounced on longer time scales (Fig. b). 

Considering the results in the previous section, we developed an automated framework for sleep stage classification that integrates traditional and complexity analyses, termed the sleep analyzer complex (SAC). In developing SAC, we organized the system into three distinct convolutional blocks for local feature extraction, each dedicated to a specific type of analysis: time frequency (TF) analyses (EEG spectrum and EMG amplitude), MSE, and DFA. These extracted features are then processed through fully connected layers. We elaborated on the details in the Materials and Methods section, but a summary is shown in Fig. . In the TF block, feature extraction was modeled after the SPINDLE approach, which incorporates convolutional and fully connected layers in the original model to process three-dimensional inputs . These inputs were combined to form the EEG TF map and the EMG amplitude map, which was replicated across the frequency dimension to align with EEG data, resulting in a tensor of dimensions (time) × (frequency) × (EEG/EMG). For the computation of MSE and DFA, we utilized a diverse set of parameters and magnitude rescaling methods to enrich the input. Consequently, the convolutional layers for MSE and DFA were designed to accept four-dimensional input, structured as (frequency band) × (temporal scale τ ) × (magnitude rescale) × (tolerance r + EEG/EMG) for MSE, and (frequency band) × (temporal scale τ ) × (magnitude rescale) × (EEG/EMG) for DFA. To address the importance of each frequency band, we conducted separate evaluations for the MSE and DFA blocks. This approach involved calculating the decrease in accuracy when excluding each frequency band from the MSE and DFA blocks individually, rather than assessing the decrease in accuracy from models that included all features (TF, MSE, and DFA). Although this method does not allow for direct comparison of the importance scores between MSE and DFA, it was chosen to mitigate the risk of multicollinearity, which can otherwise obscure the importance of each frequency band in each block when all features are considered together. Separate evaluation revealed that in both the MSE and DFA blocks, all frequency bands, from delta to gamma, exhibited positive feature importance (Fig. ). Additionally, comparing the prediction results with and without each frequency band showed that all frequency bands were effective in improving the predictions (for both MSE and DFA blocks, McNemar test showed p < 0.001 for all frequency bands). Consequently, the entire frequency band was included in the MSE and DFA blocks. As shown in Table , the accuracy achieved by DFA was lower than that achieved by MSE, and the accuracy difference between MSE and MSE + DFA was only 0.1%. However, since the McNemar test revealed a significant difference (p < 0.001, not shown in Table ), DFA block was also adopted in our model. In addition, to ensure consistency with expert assessments that require a minimum of 12 s for each sleep stage, we incorporated the Rescoring Short Epoch (RSE) method into our convolutional neural network (CNN) model. This method involves replacing short-duration predictions with the next most probable prediction iteratively until all stages meet the 12-s minimum duration criterion. We evaluated the performance of this model with fivefold cross-validation using data from 72 WT mice (Table ). The model was compared against a clustering-based algorithm, FASTER , the previously mentioned SPINDLE , and a model based solely on complexity analyses. Additionally, we compared the RSE constraining method with a hidden Markov model (HMM). The model based solely on complexity analyses demonstrated performance comparable to that of SPINDLE, which employs convolutional layers identical to those in the TF algorithm. As expected, the highest performance was observed in the model with combination of TF and complexity analysis. Furthermore, although a significant difference was observed in the McNemar test, the RSE constraining method exhibited a performance that was very close to the HMM (98.3 ± 0.1% vs. 98.4 ± 0.1%). Additionally, the learning curves and the scoring results for TF and TF + MSE + DFA demonstrated high reproducibility (Supplementary Fig. and Supplementary Table ). 

Following the retraining of SAC, a TF + Complexity CNN model constrained by the RSE method, using the entire dataset as previously outlined, we evaluated the model’s performance by comparing its outputs against the hypnograms scored by three expert human scorers (Experts, Ex1, Ex2 and Ex3). Analysis of the scoring for an additional set of eight WT mice, not included in the training, validation, or test dataset, showed that the concordance between SAC’s predictions and the experts’ assessments ranged from 97.4 to 98.1% (Cohen’s Kappa = 0.953 to 0.965) (Fig. b). This level of agreement was similar to that among the experts themselves, which varied from 97.3 to 97.8% (Cohen’s Kappa = 0.951 to 0.961), indicating that the variability in SAC’s predictions was comparable to the inter-expert variability (Table ). Furthermore, we extracted sleep profiles from each hypnogram (Fig. c and Table ). Despite observing statistically significant differences among SAC and the experts in the post-hoc paired t -tests, these differences were relatively minor compared to the variability within each respective group (Table ). Consequently, SAC’s performance exhibited no significant biases when assessed against the expert evaluations. Additionally, no significant discrepancies were noted in the 2-hourly variation analysis (Fig. c), indicating a consistent level of agreement between SAC’s predictions and the expert scores. These findings suggest that SAC, alongside the human experts, consistently provided highly similar sleep profiles. 

Next, we explored how well SAC could be applied to model mice with abnormal sleep architecture, specifically using OXKO mice as a narcolepsy model. In OXKO mice, abnormalities in EEG signals for each sleep stage are not prominent, but sleep architecture abnormalities, that is, disruptions in the transition between sleep-wakefulness stages, are observed . The agreement between SAC’s predictions and Ex1’s assessments was reliable, at 97.1 ± 0.5% (Cohen’s Kappa = 0.949 ± 0.010), as indicated in Fig. b. This reflects SAC’s reliable accuracy in models with sleep irregularities, even though it is slightly below the accuracy of 98.1 ± 0.2% observed in WT mice. However, a closer examination of the sleep profiles revealed some discrepancies between SAC and Ex1, particularly in OXKO mice where more significant differences were noted compared to WT mice. Specifically, REM sleep displayed significant differences in total time and number of episodes during both light and dark periods, and NREM sleep also showed differences in total time and mean duration during the light period (Table ). Additionally, 2-hourly vari_3ation analysis showed differences in total REM sleep time at some segments (Fig. c). These differences suggest SAC’s predictions deviated slightly from Ex1’s assessment, likely due to SAC being trained on WT mice data. Despite these differences, SAC demonstrated a strong ability to capture the abnormal sleep-stage transitions characteristic of OXKO mice when comparing WT and OXKO hypnograms. For most parameters, including sleep onset REM (SOREM), which refers to REM sleep occurring immediately after a waking period, SAC detected differences between WT and OXKO mice similar to those identified by Ex1 (Fig. a,d and Table ). This consistency in detecting abnormal transitions, rather than differences in individual sleep stages, underscores SAC’s adaptability and reliability in identifying key narcoleptic features across different mouse models. 

EEG profiles of each sleep stage Sleep stages are typically classified by examining EEG spectrum, along with EMG signals in mouse studies , . During the wakefulness stage, the EEG exhibits predominantly high-frequency, low-voltage wave, accompanied by high EMG activity. In NREM sleep, there is an increase in delta power in the EEG, indicating slow-wave activity, along with a decrease in EMG amplitude. On the other hand, REM sleep is characterized by a relatively higher theta/delta ratio in the EEG and very low EMG amplitude. These features have been used to classify the different stages of sleep. However, achieving complete automation of sleep–wake stage determination through the mere inclusion of these factors in an automated program remains challenging. In the present study, we aimed to establish an automated sleep scoring system using a new approach. Initially, the analysis of entropy, assessing irregularities, unveiled numerous distinctive characteristics in EEG patterns across different stages (Fig. ). For instance, theta phase exhibited greater regularity during REM sleep compared to WAKE, consistent with the well-documented presence of coherent theta oscillations in the hippocampus during REM sleep. Moreover, unexpectedly, beta and gamma amplitudes demonstrated higher regularity during NREM sleep than during WAKE or REM sleep. Regarding sleep scoring model, our findings revealed that not only theta entropy but also entropies across the entire frequencies from delta to gamma were important (Fig. ). Consequently, the entropy analysis highlighted subtle differences in seemingly similar EEG patterns, especially at higher frequencies, which had not received much attention in prior research on mice . On the other hand, in the fractality of time series, temporal correlations can be evaluated by the absolute value of the exponent α . When 0 < α < 0.5, it suggests an inverse correlation, while 0.5 < α < 1 suggests a positive temporal correlation. Specifically, α = 0.5 indicates white noise, and α = 1 suggests a long-range temporal correlation. When α > 1, the time series is considered non-stationary. In this study, we examined two scaling regions in all narrow bands (Table ). It is noteworthy that for all bands on the long-time scale, 0.5 < α < 1, suggesting a positive temporal correlation (Fig. b). Among them, theta and alpha showed stronger temporal correlations during REM than during WAKE and NREM, while beta and gamma showed stronger temporal correlations in the order of NREM > REM > WAKE. The brain is a complex system operating on multiple time scales , hence these decomposed complexity might correspond to the neural basis of each sleep stage. Previous studies suggested that frequency bands, amplitudes, and phases are associated with different neural bases . Additionally, various mechanisms ranging from microscopic processes like intracellular and synaptic transmission to macroscopic circuits such as cortico-cortical and cortico-thalamic connections could affect neural oscillations on specific time scales . Especially, the frequency of neural oscillations has been well studied. For example, cholinergic and gamma-aminobutyric acid (GABA)-ergic neurons in the basal forebrain are involved in the generation of hippocampal theta oscillations , and thalamocortical circuits are involved in the generation of alpha oscillations , . However, the neural basis of the complexity time scale remains unclear. We previously showed a low correlation between phase and amplitude SampEn , suggesting that amplitude and phase irregularities are independent parameters. In the entropy analysis of the present study (Fig. ), the MSE profiles of each stage displayed notable distinctions between phase and amplitude across all narrow bands. Additionally, the same component has different characteristic time scales depending on the sleep stage. For example, gamma complexities on short-time scales are REM > WAKE > NREM, while those of long-time scales are NREM > REM > WAKE. The tendency to observe different relationships among three stages at different time scales was also evident in many from normal MSE, as well as in beta phase MSE and gamma amplitude MSE. Therefore, the neural oscillations were characterized not only by frequency, amplitude, and phase, but also by complexity time scale. These findings suggest that the neural basis decomposed by frequency, amplitude, and phase are influenced by various neural processes with specific time scales. Although the neural basis of each sleep stage remains unclear, various complexity patterns, characterized by frequency, amplitude, phase, and their temporal scales, might be related to it. These aspects, which have previously received little attention in mouse studies, could provide new insights into sleep research. Automated sleep stage scoring application As discussed in the previous section, we observed distinctive complexity profiles across sleep stages, not only within the lower frequency range (delta to theta), but also in the higher frequency range (alpha to gamma). However, visually identifying these features proves challenging due to the intricate nature of irregularity and fractality, unlike the PSD. Consequently, we leveraged these complexity features in our deep learning approach for sleep scoring. The CNN model, utilizing MSE and DFA, demonstrated an accuracy of 97.7% and a Cohen’s Kappa of 0.958 during fivefold cross validation, comparable to SPINDLE, a leading model for sleep scoring (Table ). Incorporating a TF extraction block similar to SPINDLE, our model achieved an unprecedented accuracy of 98.2% (Cohen’s Kappa = 0.967). Given that each MSE and DFA showed improved scoring performance by each frequency range, our program utilized the full range from delta to gamma for both MSE and DFA. However, in the TF + MSE + DFA model that combines all blocks, the increased multicollinearity may allow us to exclude some features from certain frequency bands in each block without compromising scoring performance. This will be a subject for future investigation. Moreover, our SAC model excelled particularly in detecting REM sleep. Comparing precision, recall, and F1 scores between TF and TF + MSE + DFA, we observed less than a 1% improvement for all metrics in WAKE and NREM. However, for REM, there was not only a small improvement in precision of less than a 1%, but also a significant increase in recall of nearly 3% (from 91.8 to 92.0% with TF to 94.4–94.9% with TF + MSE + DFA, Table and Supplementary Table ). This suggests a reduction in false negatives. This difficulty of REM scoring was also observed with other algorithms. FASTER, for instance, had an overall accuracy of 87.2 ± 3.0% (Cohen’s Kappa = 0.767 ± 0.054), while its REM scoring performance was even lower than its overall performance, with precision at 70.3 ± 2.8%, recall at 48.1 ± 6.6%, and F1 at 56.9 ± 5.3% (Table ). Previous studies have also highlighted the difficulty of accurately detecting REM sleep compared to WAKE and NREM. For example, one of the state-of-the-art models, MC-SleepNet, employs long short-term memory (LSTM), a recurrent neural network, for sequential learning. While it demonstrated high overall performance in the literature with an accuracy of 96.6% (Cohen’s Kappa = 0.94), even this advanced model had lower REM detection performance, with recall at 80.1% and precision at 90.1%. As described in Fig. b, in SAC, REM was more likely to be misclassified as NREM than as WAKE. This pattern was also observed in MC-SleepNet and in some datasets used by SPINDLE. These studies addressed this issue using adjustments to the loss function or employing rescoring models. However, while the rescoring model improved recall in MC-SleepNet, it led to a reduction in precision . In SPINDLE, REM detection performance varied significantly across datasets . In this study, we adjusted class weights, but as in MC-SleepNet, a trade-off between recall and precision occurred, leading to a decline in overall performance in both the TF and TF + MSE + DFA models (Supplementary Table ). Taken together, improving REM scoring performance is difficult to achieve solely through class imbalance adjustments. However, SAC, with its greater diversity of features introduced by the addition of complexity, likely captured the characteristics of EEG and EMG across sleep stages, particularly in REM, and contributed to the improvement in REM detection performance without compromising other metrics. Additionally, the RSE method, designed to prevent too short stages, yielded performance comparable to the HMM algorithm (Table ). Although HMM is an excellent constraining algorithm considering stage transition probabilities, it is less suitable for disorders with abnormal transitions. Indeed, SPINDLE studies reported zero transitions from WAKE to REM. Our straightforward constraining algorithm, which excludes stages shorter than 12 s, maintains performance comparable to the HMM while enabling the detection of sleep architecture abnormalities (Table and Fig. d). Furthermore, in the final validation against the scores from three experts using novel WT mice measured under three different conditions (see “Materials and Methods”), SAC demonstrated an agreement of 97.4 to 98.1% (Cohen’s Kappa = 0.953 to 0.965), comparable to the inter-expert agreement of 97.3 to 97.8% (Cohen’s Kappa = 0.951 to 0.961) (Table ). This achievement underscores the benefit of integrating complexity features that are challenging to discern visually. Furthermore, despite a slight bias in SAC’s sleep profiles, this bias was within the range observed among experts and relatively minor compared to the variability within individual scorers (Table ). Considering the system’s precise extraction of sleep profiles and its ability to detect abnormal sleep architecture in narcoleptic model mice effectively (Fig. d and Table ), the need for human visual inspection might be significantly reduced. Additionally, given the system’s utilization of not only low-frequency but also high-frequency information along with complex features for scoring, it is speculative that the system’s assessments could be more consistent and less subjective than those of human scorers. Further research is needed to validate this. This method may also contribute to the creation of new knowledge and perspectives in the field of sleep medicine. For example, although cataplexy has been regarded as a pathological intrusion of REM sleep into wakefulness, this interpretation is sometimes debated, primarily due to the discernible contrast between REM sleep and cataplexy, which lies in the presence of consciousness. In our study, we devised a system employing deep learning techniques based on data from wild type mice, which do not exhibit cataplexy. Through this approach, the SAC redefined the categorization of sleep/wakefulness states, adopting a novel perspective compared to previous methods. Surprisingly, despite a slight increase in the misclassification of REM as NREM (Fig. b), the SAC still accurately identified most of the REM episodes, including those with cataplexy, as REM sleep (Fig. a and Table ). This finding supports the idea that cataplexy bears a striking resemblance to REM sleep, while subtle differences may arise from the preceding state—wakefulness versus NREM sleep. The ability to automate sleep stage determination, which until now has had to rely on the judgment of skilled humans, is expected to be an advancement that will greatly contribute to the objectivity of sleep science. 

Sleep stages are typically classified by examining EEG spectrum, along with EMG signals in mouse studies , . During the wakefulness stage, the EEG exhibits predominantly high-frequency, low-voltage wave, accompanied by high EMG activity. In NREM sleep, there is an increase in delta power in the EEG, indicating slow-wave activity, along with a decrease in EMG amplitude. On the other hand, REM sleep is characterized by a relatively higher theta/delta ratio in the EEG and very low EMG amplitude. These features have been used to classify the different stages of sleep. However, achieving complete automation of sleep–wake stage determination through the mere inclusion of these factors in an automated program remains challenging. In the present study, we aimed to establish an automated sleep scoring system using a new approach. Initially, the analysis of entropy, assessing irregularities, unveiled numerous distinctive characteristics in EEG patterns across different stages (Fig. ). For instance, theta phase exhibited greater regularity during REM sleep compared to WAKE, consistent with the well-documented presence of coherent theta oscillations in the hippocampus during REM sleep. Moreover, unexpectedly, beta and gamma amplitudes demonstrated higher regularity during NREM sleep than during WAKE or REM sleep. Regarding sleep scoring model, our findings revealed that not only theta entropy but also entropies across the entire frequencies from delta to gamma were important (Fig. ). Consequently, the entropy analysis highlighted subtle differences in seemingly similar EEG patterns, especially at higher frequencies, which had not received much attention in prior research on mice . On the other hand, in the fractality of time series, temporal correlations can be evaluated by the absolute value of the exponent α . When 0 < α < 0.5, it suggests an inverse correlation, while 0.5 < α < 1 suggests a positive temporal correlation. Specifically, α = 0.5 indicates white noise, and α = 1 suggests a long-range temporal correlation. When α > 1, the time series is considered non-stationary. In this study, we examined two scaling regions in all narrow bands (Table ). It is noteworthy that for all bands on the long-time scale, 0.5 < α < 1, suggesting a positive temporal correlation (Fig. b). Among them, theta and alpha showed stronger temporal correlations during REM than during WAKE and NREM, while beta and gamma showed stronger temporal correlations in the order of NREM > REM > WAKE. The brain is a complex system operating on multiple time scales , hence these decomposed complexity might correspond to the neural basis of each sleep stage. Previous studies suggested that frequency bands, amplitudes, and phases are associated with different neural bases . Additionally, various mechanisms ranging from microscopic processes like intracellular and synaptic transmission to macroscopic circuits such as cortico-cortical and cortico-thalamic connections could affect neural oscillations on specific time scales . Especially, the frequency of neural oscillations has been well studied. For example, cholinergic and gamma-aminobutyric acid (GABA)-ergic neurons in the basal forebrain are involved in the generation of hippocampal theta oscillations , and thalamocortical circuits are involved in the generation of alpha oscillations , . However, the neural basis of the complexity time scale remains unclear. We previously showed a low correlation between phase and amplitude SampEn , suggesting that amplitude and phase irregularities are independent parameters. In the entropy analysis of the present study (Fig. ), the MSE profiles of each stage displayed notable distinctions between phase and amplitude across all narrow bands. Additionally, the same component has different characteristic time scales depending on the sleep stage. For example, gamma complexities on short-time scales are REM > WAKE > NREM, while those of long-time scales are NREM > REM > WAKE. The tendency to observe different relationships among three stages at different time scales was also evident in many from normal MSE, as well as in beta phase MSE and gamma amplitude MSE. Therefore, the neural oscillations were characterized not only by frequency, amplitude, and phase, but also by complexity time scale. These findings suggest that the neural basis decomposed by frequency, amplitude, and phase are influenced by various neural processes with specific time scales. Although the neural basis of each sleep stage remains unclear, various complexity patterns, characterized by frequency, amplitude, phase, and their temporal scales, might be related to it. These aspects, which have previously received little attention in mouse studies, could provide new insights into sleep research. 

As discussed in the previous section, we observed distinctive complexity profiles across sleep stages, not only within the lower frequency range (delta to theta), but also in the higher frequency range (alpha to gamma). However, visually identifying these features proves challenging due to the intricate nature of irregularity and fractality, unlike the PSD. Consequently, we leveraged these complexity features in our deep learning approach for sleep scoring. The CNN model, utilizing MSE and DFA, demonstrated an accuracy of 97.7% and a Cohen’s Kappa of 0.958 during fivefold cross validation, comparable to SPINDLE, a leading model for sleep scoring (Table ). Incorporating a TF extraction block similar to SPINDLE, our model achieved an unprecedented accuracy of 98.2% (Cohen’s Kappa = 0.967). Given that each MSE and DFA showed improved scoring performance by each frequency range, our program utilized the full range from delta to gamma for both MSE and DFA. However, in the TF + MSE + DFA model that combines all blocks, the increased multicollinearity may allow us to exclude some features from certain frequency bands in each block without compromising scoring performance. This will be a subject for future investigation. Moreover, our SAC model excelled particularly in detecting REM sleep. Comparing precision, recall, and F1 scores between TF and TF + MSE + DFA, we observed less than a 1% improvement for all metrics in WAKE and NREM. However, for REM, there was not only a small improvement in precision of less than a 1%, but also a significant increase in recall of nearly 3% (from 91.8 to 92.0% with TF to 94.4–94.9% with TF + MSE + DFA, Table and Supplementary Table ). This suggests a reduction in false negatives. This difficulty of REM scoring was also observed with other algorithms. FASTER, for instance, had an overall accuracy of 87.2 ± 3.0% (Cohen’s Kappa = 0.767 ± 0.054), while its REM scoring performance was even lower than its overall performance, with precision at 70.3 ± 2.8%, recall at 48.1 ± 6.6%, and F1 at 56.9 ± 5.3% (Table ). Previous studies have also highlighted the difficulty of accurately detecting REM sleep compared to WAKE and NREM. For example, one of the state-of-the-art models, MC-SleepNet, employs long short-term memory (LSTM), a recurrent neural network, for sequential learning. While it demonstrated high overall performance in the literature with an accuracy of 96.6% (Cohen’s Kappa = 0.94), even this advanced model had lower REM detection performance, with recall at 80.1% and precision at 90.1%. As described in Fig. b, in SAC, REM was more likely to be misclassified as NREM than as WAKE. This pattern was also observed in MC-SleepNet and in some datasets used by SPINDLE. These studies addressed this issue using adjustments to the loss function or employing rescoring models. However, while the rescoring model improved recall in MC-SleepNet, it led to a reduction in precision . In SPINDLE, REM detection performance varied significantly across datasets . In this study, we adjusted class weights, but as in MC-SleepNet, a trade-off between recall and precision occurred, leading to a decline in overall performance in both the TF and TF + MSE + DFA models (Supplementary Table ). Taken together, improving REM scoring performance is difficult to achieve solely through class imbalance adjustments. However, SAC, with its greater diversity of features introduced by the addition of complexity, likely captured the characteristics of EEG and EMG across sleep stages, particularly in REM, and contributed to the improvement in REM detection performance without compromising other metrics. Additionally, the RSE method, designed to prevent too short stages, yielded performance comparable to the HMM algorithm (Table ). Although HMM is an excellent constraining algorithm considering stage transition probabilities, it is less suitable for disorders with abnormal transitions. Indeed, SPINDLE studies reported zero transitions from WAKE to REM. Our straightforward constraining algorithm, which excludes stages shorter than 12 s, maintains performance comparable to the HMM while enabling the detection of sleep architecture abnormalities (Table and Fig. d). Furthermore, in the final validation against the scores from three experts using novel WT mice measured under three different conditions (see “Materials and Methods”), SAC demonstrated an agreement of 97.4 to 98.1% (Cohen’s Kappa = 0.953 to 0.965), comparable to the inter-expert agreement of 97.3 to 97.8% (Cohen’s Kappa = 0.951 to 0.961) (Table ). This achievement underscores the benefit of integrating complexity features that are challenging to discern visually. Furthermore, despite a slight bias in SAC’s sleep profiles, this bias was within the range observed among experts and relatively minor compared to the variability within individual scorers (Table ). Considering the system’s precise extraction of sleep profiles and its ability to detect abnormal sleep architecture in narcoleptic model mice effectively (Fig. d and Table ), the need for human visual inspection might be significantly reduced. Additionally, given the system’s utilization of not only low-frequency but also high-frequency information along with complex features for scoring, it is speculative that the system’s assessments could be more consistent and less subjective than those of human scorers. Further research is needed to validate this. This method may also contribute to the creation of new knowledge and perspectives in the field of sleep medicine. For example, although cataplexy has been regarded as a pathological intrusion of REM sleep into wakefulness, this interpretation is sometimes debated, primarily due to the discernible contrast between REM sleep and cataplexy, which lies in the presence of consciousness. In our study, we devised a system employing deep learning techniques based on data from wild type mice, which do not exhibit cataplexy. Through this approach, the SAC redefined the categorization of sleep/wakefulness states, adopting a novel perspective compared to previous methods. Surprisingly, despite a slight increase in the misclassification of REM as NREM (Fig. b), the SAC still accurately identified most of the REM episodes, including those with cataplexy, as REM sleep (Fig. a and Table ). This finding supports the idea that cataplexy bears a striking resemblance to REM sleep, while subtle differences may arise from the preceding state—wakefulness versus NREM sleep. The ability to automate sleep stage determination, which until now has had to rely on the judgment of skilled humans, is expected to be an advancement that will greatly contribute to the objectivity of sleep science. 

Animals and sleep recordings All experimental procedures were approved by the Animal Experiment and Use Committee of the University of Tsukuba, or the Animal Experimental and Use Committee of Kanazawa University, in compliance with National Institutes of Health (NIH) guidelines, and reported in accordance with ARRIVE guidelines ( https://arriveguidelines.org ). The mice were maintained at 22–23 °C with a strict 12 h light/dark cycle and had ad libitum access to food and water. For implantation of EEG/EMG electrodes, four holes were drilled at ± 2 mm anterior and 2 mm lateral to the bregma. Stainless wires (Cooner) for monitoring EMG were inserted bilaterally into the neck muscles and connected to the EEG/EMG electrodes. The electrodes were fixed rigidly with dental cement. After a recovery period of at least 1 week in home cages, implanted EEG/EMG electrodes were connected to slip rings via flexible customized wires at least 5 days prior to the measurements. Sleep recording was performed in specially designed recording chambers for 24 h. The EEG/EMG signals were amplified and filtered under three different conditions. In condition A, the EEG/EMG signals were amplified and filtered (EEG, 0.5–100 Hz; EMG, 5–300 Hz) using an amplifier AB-611 J (Nihon Koden), digitized at a sampling rate 250 Hz. In condition B, the signals were amplified and filtered (EEG, 0.5–250 Hz; EMG, 16–250 Hz) using BAS-8103P (Biotex), digitized at a sampling rate 128 Hz. In condition C, the signals were amplified and filtered (EEG, 0.5–100 Hz; EMG, 5–100 Hz) using BAM-8103 (Biotex), digitized at a sampling rate 128 or 256 Hz. All these signals were recorded using the VitalRecorder software (Kissei Comtec). EEG and EMG measurements were conducted using one channel each. For subsequent analyses, mice were excluded if the EEG or EMG data exceeded the dynamic range of the recording system, were contaminated by the other, or were compromised by significant environmental noise. Consequently, 72 WT mice measured under condition A were utilized. For the final validation, a total of eight WT mice were utilized, three of which were measured under condition A, another three under condition B, and the remaining two under condition C. All eight OXKO mice were measured under condition C. All mice used in this study, including WT and OXKO, are C57BL/6J strain. Time series analyses Because the data in this study were measured under various conditions, we aligned the conditions through preprocessing. The EEG and EMG signals were subjected to band-pass filtering from 0.5 to 50 Hz and converted into a time series with a sampling frequency of 128 Hz using cubic spline interpolation. We referred to this as the bb time series. We decomposed these signals into different frequency bands using finite impulse response filters: 2–4 Hz (delta), 4–8 Hz (theta), 8–13 Hz (alpha), 13–25 Hz (beta), and 25–45 Hz (gamma). We divided these time series into 25-s epochs with a 1-s sliding window. Next, we quantified irregularity and unpredictability using SampEn , and fractality using DFA , . Detailed information on these complexity analyses can be found in our previous research . In earlier studies, embedding dimension m = 2 and tolerance r = 0.1–0.25 SD of the original time series before coarse-graining are often chosen for computing SampEn . To investigate the oscillatory profiles, we employed a value of r = 0.2 SD, whereas to develop our sleep scoring model, we augmented the feature set using three different parameters: r = 0.1 SD, 0.2 SD, and 0.4 SD. Additionally, for MSE, the profile of SampEn across multiple time scales , , we chose scale factor = 1, 2, 4, 8, 16, 32, and 64, with time delays of 7.8, 15.6, 31.3, 62.5, 125, 250, and 500 ms, respectively. To ensure accuracy, it is recommended to use at least several hundred data points for SampEn calculations , . While coarse-graining is typically applied in MSE calculations, a moving average was employed to avoid the loss of time points at longer time scales, enabling the utilization of 3200 time points (128 Hz × 25 s) for the computation of SampEn, independent of the scale. Furthermore, following our previous studies , , we examined not only the SampEn of bb and decomposed time series (normal MSE) but also the SampEn of phase and amplitude modulation in the delta to gamma range (phase and amplitude MSE). In order to avoid discontinuities in the time series, phase SampEn was calculated for the cosine of the phase time series. Additionally, we computed DFA with time windows of n = 3, 4, 7, 11, 18, 29, 46, 73, 116, 184, 290, 459, 726, and 1147 (corresponding to time scale τ = 23, 31, 55, 86, 141, 227, 359, 570, 906, 1438, 2266, 3586, 5672, and 8961 ms, respectively) of standardized bb and the amplitude of narrowband time series. Since each narrowband amplitude exhibited two distinct scaling regions (Table ), we investigated their exponent values, α. The SampEn and DFA described here was computed using a Python module AntroPy ( https://github.com/raphaelvallat/antropy ). Additionally, following the methodology employed in SPINDLE, we utilized EEG spectra and EMG amplitude for deep learning applications. For EEG, bb data from 2-s epochs underwent Fast Fourier Transform (FFT), and adjacent frequencies were averaged to create a 1 Hz step across 24 frequencies (1 to 24 Hz), prepared with a sliding window of 0.125 s. For EMG, FFT was applied to 2-s epochs of EMG data, integrating frequencies from 0.5 to 30 Hz, and replicated 24 times to align with EEG. The logarithm of these values standardized across 24 h were concatenated, resulting in an input matrix of 24 frequencies × 160 time points × EEG/EMG for each epoch. Deep learning To automate sleep scoring, we applied deep learning techniques utilizing complexity features. For the training, validation, and testing phases, data from a total of 72 WT mice were used, supplemented by additional eight WT mice and eight OXKO mice for the final validation. Sleep-wakefulness stages in the training, validation, and test dataset were scored by Ex1 (author N.F., with seven years of experience in sleep research and ten years as a psychiatrist). For the final validation, sleep stages in WT mice were scored by three human experts: Ex1, Ex2 (Y.S., with 14 years of experience in sleep research), and Ex3 (Y.K., with one year of experience in sleep research). OXKO mice sleep stages were scored by Ex1. Unlike the SPINDLE study , we did not label epochs as artifacts but scored all epochs into three stages: WAKE, REM, or NREM. Cataplexy-like episodes were scored as REM stage. For the final validation, Ex1 was blinded to whether the mice were WT or OXKO when scoring the sleep stages. Each sleep stage was required to have a minimum duration of 12 s, with stages shorter than this threshold adjusted to match the preceding or following stages. As described in the Results section, the SAC model consists of three convolutional blocks for feature extraction from TF, MSE, and DFA, with their outputs integrated through fully connected layers (Fig. ). The TF analysis followed the SPINDLE algorithm, processing inputs of 24 frequencies × 160 time points × EEG/EMG through a convolutional block that includes a max-pooling layer with filter size and stride of (2, 3), a convolutional layer with 50 filters, filter size of (3, 3) and stride of (1, 1), and another max-pooling layer with filter size and stride of (2, 2). While SPINDLE’s original study used two EEG channels and one EMG channel, our study trained the model with one EEG and one EMG channel. Meanwhile, for MSE and DFA, four-dimensional inputs were prepared by employing multiple parameters and magnitude rescales. MSE analyses were conducted on 17 types of time series, including bb, EMG, and five narrow bands, each decomposed into three types (normal/phase/amp), using seven temporal scales and three tolerance levels, as previously explained. DFA was applied to a total of seven time series (bb, five narrow band amplitudes, and EMG) across 14 temporal scales. We applied various magnitude rescaling methods, such as standardization across all mice, within each mouse, and normalization excluding 1st, 3rd, 5th, 7th, and 9th percentile edges within each mouse, yielding seven types of magnitude rescaled inputs. Similar to the TF block, the dimensions of EMG were matched with those of EEG for concatenation. These procedures resulted in four-dimensional matrices, with MSE inputs comprising 16 time series × 7 time scales × 7 magnitude rescales × 6 (three tolerances × EEG/EMG), and DFA inputs consisting of 6 time series × 14 time scales × 7 magnitude rescales × EEG/EMG. Local features were extracted using convolutional layers with 50 filters for MSE and 30 filters for DFA, filter size of (2, 2, 2), and stride of (1, 1, 1). The features extracted from TF, MSE, and DFA blocks were integrated through two layers of fully connected networks implementing 50% dropout and batch normalization (with 1000 nodes in the first layer and 500 in the second) and then output through a softmax function for WAKE, REM, and NREM stages. In contrast, following the original study , the SPINDLE model integrated its features through two fully connected layers with 1000 nodes each, implementing only 50% dropout without batch normalization. To address the class imbalance between WAKE, REM, and NREM, we also tested adjusting the class weights (Supplementary Table ). In the SPINDLE study, the HMM algorithm, which accounts for transition probabilities, was employed to refine the stages predicted by the CNN. However, this method might fail to detect specific characteristics, such as SOREM, which are particularly prevalent in mice with abnormal sleep architecture like OXKO mice, due to the differences in transition probabilities compared to WT mice. To counter this, we introduced the RSE method as a constraint technique, which straightforwardly replaces stages shorter than 12 s with the next most probable stage, aligning the minimum duration criteria with expert assessments. Given that REM stages, generally shorter than other stages, often last several tens of seconds , a 12-s threshold is considered reasonable. Table also includes a comparison with FASTER, an unsupervised learning approach that classifies using principal components of EEG/EMG power spectra through non-parametric density estimation clustering. Designed for 8-s epochs, FASTER’s methodology is not compatible with our study, which has a time resolution of 1 s. To align the time resolution, we divided the data into eight time series, each offset by one second, and analyzed them individually before integration. For epochs that FASTER was unable to score, the stage of the preceding epoch was adopted. Since FASTER does not output through a softmax function, constraining methods like RSE or HMM were inapplicable. Furthermore, the feature importance of MSE and DFA shown in Fig. was calculated using drop column importance, which measures the performance decline when a specific feature group is excluded. While the importance could be underestimated due to multicollinearity among features, excluding all features within a single frequency band minimized the impact of multicollinearity. Statistical analyses To assess the usefulness of each feature in classifying sleep stages, a one-way analysis of variance (ANOVA) was conducted for each feature (Figs. and ). For this analysis, each feature was picked per 25 s from 72 WT mice, and epochs, where the stage did not persist continuously for 25 s, were excluded to also remove stage transitional points. ANOVA was carried out using all data samples collected from the entire 72 mice. Furthermore, the inclusion of each feature in our scoring model was evaluated using the McNemar test, as described in the "Generation of sleep analyzer complex (SAC)" section. Contingency tables were created based on the correctness of each prediction from the two models and the true labels obtained from all folds of the fivefold cross-validation. The chi-squared test was then conducted. The agreement of hypnograms was assessed using the F1 score for each stage, accuracy, and Cohen’s Kappa (Table ). The F1 score is derived as the harmonic mean of precision and recall, indicating high values only when both metrics are high. Thus, this metric ensures a balanced evaluation of both false positives and false negatives in stage classification. The sleep profiles during 24-h, light and dark periods, were subjected to 4-group ANOVA for each profile in the WT mice (Table ). Post-hoc paired t -tests were then conducted among SAC and three experts for profiles showing ANOVA p < 0.01 (with Bonferroni correction applied to the six combinations). As for the paired t -tests in the OXKO mice (Table ), Bonferroni correction was applied for 10 profiles in each of the 24-h, light and dark period. In the comparison between WT and OXKO mice (Table ), Welch’s t -tests were performed, with Bonferroni correction applied for 10 profiles in each row. For the 2-hourly variations, sleep profiles of WT mice (Fig. c) were subjected to 4-group × 12 time points ANOVA. Post-hoc paired t -tests between SAC and experts were conducted for three combinations (SAC-Ex1, Ex2, Ex3) and each time point showing ANOVA p < 0.01 in between scorer or scorer × time interaction (with Bonferroni correction applied to the 12 time points × 3 combinations). As for the OXKO mice (Fig. c), 2-group × 12 time points ANOVA were performed, and post-hoc paired t -tests were conducted for time points showing ANOVA p < 0.01 (with Bonferroni correction applied to the 12 time points). In the comparison between WT and OXKO mice (Fig. d), 2-group × 12 time points ANOVA were conducted, and post-hoc Welch’s t -tests were performed for time points showing ANOVA p < 0.01 (with Bonferroni correction applied to the 12 time points). 

All experimental procedures were approved by the Animal Experiment and Use Committee of the University of Tsukuba, or the Animal Experimental and Use Committee of Kanazawa University, in compliance with National Institutes of Health (NIH) guidelines, and reported in accordance with ARRIVE guidelines ( https://arriveguidelines.org ). The mice were maintained at 22–23 °C with a strict 12 h light/dark cycle and had ad libitum access to food and water. For implantation of EEG/EMG electrodes, four holes were drilled at ± 2 mm anterior and 2 mm lateral to the bregma. Stainless wires (Cooner) for monitoring EMG were inserted bilaterally into the neck muscles and connected to the EEG/EMG electrodes. The electrodes were fixed rigidly with dental cement. After a recovery period of at least 1 week in home cages, implanted EEG/EMG electrodes were connected to slip rings via flexible customized wires at least 5 days prior to the measurements. Sleep recording was performed in specially designed recording chambers for 24 h. The EEG/EMG signals were amplified and filtered under three different conditions. In condition A, the EEG/EMG signals were amplified and filtered (EEG, 0.5–100 Hz; EMG, 5–300 Hz) using an amplifier AB-611 J (Nihon Koden), digitized at a sampling rate 250 Hz. In condition B, the signals were amplified and filtered (EEG, 0.5–250 Hz; EMG, 16–250 Hz) using BAS-8103P (Biotex), digitized at a sampling rate 128 Hz. In condition C, the signals were amplified and filtered (EEG, 0.5–100 Hz; EMG, 5–100 Hz) using BAM-8103 (Biotex), digitized at a sampling rate 128 or 256 Hz. All these signals were recorded using the VitalRecorder software (Kissei Comtec). EEG and EMG measurements were conducted using one channel each. For subsequent analyses, mice were excluded if the EEG or EMG data exceeded the dynamic range of the recording system, were contaminated by the other, or were compromised by significant environmental noise. Consequently, 72 WT mice measured under condition A were utilized. For the final validation, a total of eight WT mice were utilized, three of which were measured under condition A, another three under condition B, and the remaining two under condition C. All eight OXKO mice were measured under condition C. All mice used in this study, including WT and OXKO, are C57BL/6J strain. 

Because the data in this study were measured under various conditions, we aligned the conditions through preprocessing. The EEG and EMG signals were subjected to band-pass filtering from 0.5 to 50 Hz and converted into a time series with a sampling frequency of 128 Hz using cubic spline interpolation. We referred to this as the bb time series. We decomposed these signals into different frequency bands using finite impulse response filters: 2–4 Hz (delta), 4–8 Hz (theta), 8–13 Hz (alpha), 13–25 Hz (beta), and 25–45 Hz (gamma). We divided these time series into 25-s epochs with a 1-s sliding window. Next, we quantified irregularity and unpredictability using SampEn , and fractality using DFA , . Detailed information on these complexity analyses can be found in our previous research . In earlier studies, embedding dimension m = 2 and tolerance r = 0.1–0.25 SD of the original time series before coarse-graining are often chosen for computing SampEn . To investigate the oscillatory profiles, we employed a value of r = 0.2 SD, whereas to develop our sleep scoring model, we augmented the feature set using three different parameters: r = 0.1 SD, 0.2 SD, and 0.4 SD. Additionally, for MSE, the profile of SampEn across multiple time scales , , we chose scale factor = 1, 2, 4, 8, 16, 32, and 64, with time delays of 7.8, 15.6, 31.3, 62.5, 125, 250, and 500 ms, respectively. To ensure accuracy, it is recommended to use at least several hundred data points for SampEn calculations , . While coarse-graining is typically applied in MSE calculations, a moving average was employed to avoid the loss of time points at longer time scales, enabling the utilization of 3200 time points (128 Hz × 25 s) for the computation of SampEn, independent of the scale. Furthermore, following our previous studies , , we examined not only the SampEn of bb and decomposed time series (normal MSE) but also the SampEn of phase and amplitude modulation in the delta to gamma range (phase and amplitude MSE). In order to avoid discontinuities in the time series, phase SampEn was calculated for the cosine of the phase time series. Additionally, we computed DFA with time windows of n = 3, 4, 7, 11, 18, 29, 46, 73, 116, 184, 290, 459, 726, and 1147 (corresponding to time scale τ = 23, 31, 55, 86, 141, 227, 359, 570, 906, 1438, 2266, 3586, 5672, and 8961 ms, respectively) of standardized bb and the amplitude of narrowband time series. Since each narrowband amplitude exhibited two distinct scaling regions (Table ), we investigated their exponent values, α. The SampEn and DFA described here was computed using a Python module AntroPy ( https://github.com/raphaelvallat/antropy ). Additionally, following the methodology employed in SPINDLE, we utilized EEG spectra and EMG amplitude for deep learning applications. For EEG, bb data from 2-s epochs underwent Fast Fourier Transform (FFT), and adjacent frequencies were averaged to create a 1 Hz step across 24 frequencies (1 to 24 Hz), prepared with a sliding window of 0.125 s. For EMG, FFT was applied to 2-s epochs of EMG data, integrating frequencies from 0.5 to 30 Hz, and replicated 24 times to align with EEG. The logarithm of these values standardized across 24 h were concatenated, resulting in an input matrix of 24 frequencies × 160 time points × EEG/EMG for each epoch. 

To automate sleep scoring, we applied deep learning techniques utilizing complexity features. For the training, validation, and testing phases, data from a total of 72 WT mice were used, supplemented by additional eight WT mice and eight OXKO mice for the final validation. Sleep-wakefulness stages in the training, validation, and test dataset were scored by Ex1 (author N.F., with seven years of experience in sleep research and ten years as a psychiatrist). For the final validation, sleep stages in WT mice were scored by three human experts: Ex1, Ex2 (Y.S., with 14 years of experience in sleep research), and Ex3 (Y.K., with one year of experience in sleep research). OXKO mice sleep stages were scored by Ex1. Unlike the SPINDLE study , we did not label epochs as artifacts but scored all epochs into three stages: WAKE, REM, or NREM. Cataplexy-like episodes were scored as REM stage. For the final validation, Ex1 was blinded to whether the mice were WT or OXKO when scoring the sleep stages. Each sleep stage was required to have a minimum duration of 12 s, with stages shorter than this threshold adjusted to match the preceding or following stages. As described in the Results section, the SAC model consists of three convolutional blocks for feature extraction from TF, MSE, and DFA, with their outputs integrated through fully connected layers (Fig. ). The TF analysis followed the SPINDLE algorithm, processing inputs of 24 frequencies × 160 time points × EEG/EMG through a convolutional block that includes a max-pooling layer with filter size and stride of (2, 3), a convolutional layer with 50 filters, filter size of (3, 3) and stride of (1, 1), and another max-pooling layer with filter size and stride of (2, 2). While SPINDLE’s original study used two EEG channels and one EMG channel, our study trained the model with one EEG and one EMG channel. Meanwhile, for MSE and DFA, four-dimensional inputs were prepared by employing multiple parameters and magnitude rescales. MSE analyses were conducted on 17 types of time series, including bb, EMG, and five narrow bands, each decomposed into three types (normal/phase/amp), using seven temporal scales and three tolerance levels, as previously explained. DFA was applied to a total of seven time series (bb, five narrow band amplitudes, and EMG) across 14 temporal scales. We applied various magnitude rescaling methods, such as standardization across all mice, within each mouse, and normalization excluding 1st, 3rd, 5th, 7th, and 9th percentile edges within each mouse, yielding seven types of magnitude rescaled inputs. Similar to the TF block, the dimensions of EMG were matched with those of EEG for concatenation. These procedures resulted in four-dimensional matrices, with MSE inputs comprising 16 time series × 7 time scales × 7 magnitude rescales × 6 (three tolerances × EEG/EMG), and DFA inputs consisting of 6 time series × 14 time scales × 7 magnitude rescales × EEG/EMG. Local features were extracted using convolutional layers with 50 filters for MSE and 30 filters for DFA, filter size of (2, 2, 2), and stride of (1, 1, 1). The features extracted from TF, MSE, and DFA blocks were integrated through two layers of fully connected networks implementing 50% dropout and batch normalization (with 1000 nodes in the first layer and 500 in the second) and then output through a softmax function for WAKE, REM, and NREM stages. In contrast, following the original study , the SPINDLE model integrated its features through two fully connected layers with 1000 nodes each, implementing only 50% dropout without batch normalization. To address the class imbalance between WAKE, REM, and NREM, we also tested adjusting the class weights (Supplementary Table ). In the SPINDLE study, the HMM algorithm, which accounts for transition probabilities, was employed to refine the stages predicted by the CNN. However, this method might fail to detect specific characteristics, such as SOREM, which are particularly prevalent in mice with abnormal sleep architecture like OXKO mice, due to the differences in transition probabilities compared to WT mice. To counter this, we introduced the RSE method as a constraint technique, which straightforwardly replaces stages shorter than 12 s with the next most probable stage, aligning the minimum duration criteria with expert assessments. Given that REM stages, generally shorter than other stages, often last several tens of seconds , a 12-s threshold is considered reasonable. Table also includes a comparison with FASTER, an unsupervised learning approach that classifies using principal components of EEG/EMG power spectra through non-parametric density estimation clustering. Designed for 8-s epochs, FASTER’s methodology is not compatible with our study, which has a time resolution of 1 s. To align the time resolution, we divided the data into eight time series, each offset by one second, and analyzed them individually before integration. For epochs that FASTER was unable to score, the stage of the preceding epoch was adopted. Since FASTER does not output through a softmax function, constraining methods like RSE or HMM were inapplicable. Furthermore, the feature importance of MSE and DFA shown in Fig. was calculated using drop column importance, which measures the performance decline when a specific feature group is excluded. While the importance could be underestimated due to multicollinearity among features, excluding all features within a single frequency band minimized the impact of multicollinearity. 

To assess the usefulness of each feature in classifying sleep stages, a one-way analysis of variance (ANOVA) was conducted for each feature (Figs. and ). For this analysis, each feature was picked per 25 s from 72 WT mice, and epochs, where the stage did not persist continuously for 25 s, were excluded to also remove stage transitional points. ANOVA was carried out using all data samples collected from the entire 72 mice. Furthermore, the inclusion of each feature in our scoring model was evaluated using the McNemar test, as described in the "Generation of sleep analyzer complex (SAC)" section. Contingency tables were created based on the correctness of each prediction from the two models and the true labels obtained from all folds of the fivefold cross-validation. The chi-squared test was then conducted. The agreement of hypnograms was assessed using the F1 score for each stage, accuracy, and Cohen’s Kappa (Table ). The F1 score is derived as the harmonic mean of precision and recall, indicating high values only when both metrics are high. Thus, this metric ensures a balanced evaluation of both false positives and false negatives in stage classification. The sleep profiles during 24-h, light and dark periods, were subjected to 4-group ANOVA for each profile in the WT mice (Table ). Post-hoc paired t -tests were then conducted among SAC and three experts for profiles showing ANOVA p < 0.01 (with Bonferroni correction applied to the six combinations). As for the paired t -tests in the OXKO mice (Table ), Bonferroni correction was applied for 10 profiles in each of the 24-h, light and dark period. In the comparison between WT and OXKO mice (Table ), Welch’s t -tests were performed, with Bonferroni correction applied for 10 profiles in each row. For the 2-hourly variations, sleep profiles of WT mice (Fig. c) were subjected to 4-group × 12 time points ANOVA. Post-hoc paired t -tests between SAC and experts were conducted for three combinations (SAC-Ex1, Ex2, Ex3) and each time point showing ANOVA p < 0.01 in between scorer or scorer × time interaction (with Bonferroni correction applied to the 12 time points × 3 combinations). As for the OXKO mice (Fig. c), 2-group × 12 time points ANOVA were performed, and post-hoc paired t -tests were conducted for time points showing ANOVA p < 0.01 (with Bonferroni correction applied to the 12 time points). In the comparison between WT and OXKO mice (Fig. d), 2-group × 12 time points ANOVA were conducted, and post-hoc Welch’s t -tests were performed for time points showing ANOVA p < 0.01 (with Bonferroni correction applied to the 12 time points). 

Below is the link to the electronic supplementary material. Supplementary Material 1 

