An automatic sleep disorder detection based on EEG cross-frequency coupling and random forest model

Objective. Sleep disorders are medical disorders of a subject’s sleep architecture and based on their severity, they can interfere with mental, emotional and physical functioning. The most common ones are insomnia, narcolepsy, sleep apnea, bruxism, etc. There is an increased risk of developing sleep disorders in elderly like insomnia, periodic leg movements, rapid eye movement behavior disorders, sleep disorder breathing, etc. Consequently, their accurate diagnosis and classification are important steps towards an early stage treatment that could save the life of a patient. Approach. The electroencephalographic (EEG) signal is the most sensitive and important biosignal, which is able to capture the brain sleep activity that is sensitive to sleep. In this study, we attempt to analyze EEG sleep activity via complementary cross-frequency coupling (CFC) estimates, which further feed a classifier, aiming to discriminate sleep disorders. We adopted an open EEG database with recordings that were grouped into seven sleep disorders and a healthy control. The EEG brain activity from common sensors has been analyzed with two basic types of CFC. Main results. Finally, a random forest (RF) classification model was built on CFC patterns, which were extracted from non-cyclic alternating pattern epochs. Our RFCFC model achieved a 74% multiclass accuracy. Both types of CFC, phase-to-amplitude and amplitude–amplitude coupling patterns contribute to the accuracy of the RF model, thus supporting their complementary information. Significance. CFC patterns, in conjunction with the RF classifier proved a valuable biomarker for the classification of sleep disorders.


Introduction
Electroencephalography (EEG) is the basic modality in sleep research, providing a non-invasive way to study brain dynamics in relationship to sleep [1].Adult sleep is composed of non-rapid-eye-movement (NREM) and rapid-eye-movement (REM) brain states, which alternate almost every 90 min.Additionally, the NREM state is divided into four sleep stages, NREM1-4 [2].Sleep is regulated by the circadian rhythm, which is an internal timer mechanism that maintains regular sleep timetable, hormone secretion and sustained oscillations in body temperature [3].Normal sleep runs for four or five cycles, including a passing from the four NREM stages and the state REM sleep.
Sleep disorders, no matter what the cause is, affect 50-70 million Americans spanning all ages and socioeconomic classes [4].This tremendous number of affected population can be characterized as a public healthy epidemic.This may be primarily due to an intrinsic problem that affects the sleep-wake cycle or secondarily due to a medical condition [5].Primary sleep disorders are divided into dyssomnias, which are further subdivided into intrinsic, extrinsic and circadian or parasomnias, which are subdivided into arousal disorders, sleep-wake transition disorders, parasomnias associated with REM Sleep and a fourth category of parasomnias [6].
The definition and distinction of those sleep stages are based upon the estimation of rhythmic neural oscillations during sleep that demonstrate different patterns [7].The sleep stages provide a substrate to study how brain rhythms are related to cortical activity patterns and how this correlation varies across arousal levels [8].Advanced signal processing techniques support a more detailed exploration of brain oscillations during sleep, which further advances our understanding of the related overcoming limitations of traditional quantification approaches, like how many minutes a person spent in each sleep stage, percentage of REM sleep compared to the total sleep time, or ratio-based sleep variables.Detection of sleep oscillations can be realized under visual inspection of oscillation events [9], automatic event detector algorithms like K-complexes [10], spectral analysis techniques [11,12] and CFC estimates [13].
Interactions between activities with different frequency content and time scales have been widely explored in neuroscience to define a physiological biomarker, e.g.mild cognitive impairment [14], in mild traumatic brain injury [15], in sleep [13,16], etc. Neural activities with different frequency content have origin in cell population of different size and spatial orientation, while their interactions, named CFC, have been widely explored over the last years [8,17].CFC refers to interactions that can occur between brain rhythms with different frequency content, between different signals or within the same signals that capture brain activity of brain areas, respectively [17,18].CFC has been adopted in studies that attempt to explore how information propagates across brain areas indicative of distinct neurophysiological functions [18][19][20][21][22].In general, three basic types of CFC exist: phase synchronization (phase-phase CFC [23,24]), PAC [14,15,21,22] and AAC [13,25].
In the current study, we adopt our framework, first presented in a single-sensor automatic sleep stage classification with high accuracy based on various types and estimators of CFCs (Dimitriadis et al 2018).We aim to develop the first model for an accurate sleep disorder detection, based on EEG sleep activity with the incorporation of two types of CFC, the PAC and AAC.We hypothesize that the strength of CFC will be sensitive in different sleep stages across sleep disorders.As a proper classifier, we employ random forest (RF), which has proved efficient in many clinical problems [26].Our first attempt focuses on non-CAP patterns.

Material
For the purpose of our study, we downloaded allnight polysomnography (PSG) recordings from the well-known database: 'The CAP Sleep Database' of 'PhysioBank' (https://physionet.org/physiobank/database/capslpdb/) [27,28].This study is a collection of 108 PSG recordings that include seven groups with sleep disorders and a normal healthy one that did not present any medical, neurological or psychiatric disorder.The approval of the study has been registered in the Sleep Disorders Center of the Ospedale Maggiore of Parma, Italy [27,28].In addition, the clinical information for the whole cohort can be found in the excel file called 'gender-age.xlsx' .Welltrained sleep expert neurologists manually scored the sleep recordings based on the Rechtschaffen and Kales rules, classifying epochs as sleep stages 1-4, wake, REM sleep and movement artifacts [29].Cycling alternating pattern (CAP) was determined based on the Terzano rules (phase-A subtypes include A1, A2 and A3) [27].
In our study, we analyzed non-CAP epochs by removing epochs related to CAP.An epoch is characterized as either a CAP sequence or a non-CAP.A CAP sequence is composed of a succession of CAP cycles.A CAP cycle is composed of a phase A and the following phase B (figure 1).All CAP sequences begin with a phase A and end with a phase B. Each phase of CAP is 2-60 s in duration.The absence of CAP for 60 s is scored as non-CAP.An isolated phase A, (that is, preceded or followed by another phase A but separated by more than 60 s), is classified as non-CAP.The phase A that terminates a CAP sequence is counted as Figure 1.Algorithmic steps for PAC estimation.Using an epoch of 30 s length recorded at the P4-O2 sensor from the first subject with periodic leg movements during the NREM3 stage (A), we showed the phase-to-amplitude coupling between δ and α1 rhythms.The time series presented in (A) was firstly bandpass filtered using a zero-phase-order filter into a low-frequency δ (0.5-4 Hz) component, where its envelope via Hilbert transform was also extracted (B), and secondly into a high-frequency α1 (8-13 Hz) component, where its envelope was extracted via Hilbert transform (C).We then filtered the amplitude of the envelope high-frequency α1 (D) within the δ frequency range (0.5-4 Hz).This algorithmic step is important because it will provide us with the δ modulation within the lower α1 amplitude.(E) Subsequently, we performed the Hilbert transformation at both the δ-filtered signal and the δ-filtered within the lower-α amplitude, extracting the related phase dynamics and, finally, their phase consistency with iPLV.The phase differences of those two-phase time series are illustrated in (F) and will then enter into the iPLV estimator to quantify the strength of PAC coupling between δ and α1 rhythms.Consequently, the aforementioned CFC-PAC analysis will determine how the phase of the lower-frequency component modulates the amplitude of the high-amplitude component.non-CAP.This transitional phase A bridges the CAP sequence to non-CAP.Furthermore, it should be noted that the EEG recordings were sampled at 100 Hz, 256 or 512 Hz.The waveforms (contained in the .edffiles of the database) include at least three EEG channels (F3 or F4, C3 or C4 and O1 or O2, referred to A1 or A2), electrooculogram (two channels), EMG (electromyogram) of the submentalis muscle, bilateral anterior tibial EMG, respiration signals (airflow, abdominal and thoracic effort and SaO2) and EKG.Additional traces include EEG bipolar traces, according to the 10-20 international system (Fp1-F3, F3-C3, C3-P3, P3-O1 and/or Fp2-F4, F4-C4, C4-P4, P4-O2).
We selected subjects with the same setup of EEG sensors and with frequency sampling of either 256 or 512 Hz, considering that it is an important parameter in signal processing analysis.In our work, we excluded epochs annotated as movement artifacts.Table 1 summarizes the number of subjects per sleep disorder with their gender distribution and mean age.

Signal processing
To reduce the effects of artifacts, we performed a combination of fast independent component analysis (ICA) and maximum overlap discrete wavelet transform (MODWT).Fast ICA was applied to the whole set of EEG sensors, giving an equal number of independent components with a characteristic topology and time course.Traditional artifact correction analysis based on ICA classifies an independent component as artifact or not.In the former case, researchers zeroed the whole component and the corresponding time course was considered as artifact.However, in most studies, an independent component does not reflect an artifact in the wholetime course.As a result, setting it equal to zero leads to the elimination of the true brain activity.For that reason, every independent component time series was decomposed via wavelet Narco1-narco5 nfle1-nfle40 plm1-plm10 rbd1-rbd22 sdb1-sdb4 transform and only subcomponents related to an artifact were deleted.Finally, the rest of wavelets subcomponents were reconstructed, giving rise to a clean independent component time series, which is then projected back to the original space.We adopted maximal overlap discrete wavelet transform to decompose every time source related to an independent component and especially Daubechies wavelets.We followed this wavelet-driven decomposition every 5 s and by employing a semi-supervised technique of estimating entropy, kurtosis and skewness, we assisted in the process of zeroing (or not) wavelet subcomponents.We collected entropy, kurtosis and skewness across epochs of 5 s and sensor time series independently per subject and then we estimated the z-score for each of the three second order statistics.A z-score of at least greater that 2 in one of the three adopted statistics is an indication of an artefactual epoch.
We visually inspected every case to further evaluate this classification.Then, cleaned wavelet subcomponents were reconstructed to the original time series.The cleaned time courses of the independent component were projected back to the original recording EEG space.The whole approach was repeated independently on the studied frequency bands.Finally, we downsampled the PSG recordings with a frequency sampling rate of 512 Hz or 256 Hz, in order to meet the lowest frequency sampling in the cohort, while subjects with 100 Hz were excluded from further analysis.We selected the following common EEG sensors provided by the cohort as a common template: P4-O2, F4-C4, C4-P4 (three bipolar) and C4-A1 (one monopolar).The number of participants that were used in our study with the related sleep disorder are provided in table 2.
Scores are provided by experts with the following annotations: Sleep stage (W = wake, S1-S4 = sleep stages, R = REM, MT = body movements).In our study, we focused on S1-S4 and REM sleep stages.

CFC estimations 2.3.1. PAC CFC
The most studied CFC in the literature is PAC [30].In most studies, PAC was estimated between the phase of the slower rhythm and the amplitude of the faster oscillation.Here, we followed a different analytic approach, which was first presented in our previous works including an EEG sleep study [13,14].
The PAC analytic approach for a single EEG P4-O2 sensor is described below.
Let x(i sensor , t) be the EEG time series acquired at the i sensor th recording site, and t = 1, 2, ….T denotes the sample points.Given a band-passed filtered signal of x(i sensor , t), PAC is estimated between the phase of the lower-frequency (LF) oscillations and the amplitude of the higher-frequency (HF) ones.The following equations give a full representation of the complex transformations of both (LF) z LF (t) and (HF) oscillations z HF (t) extracted via the Hilbert transform (HT[.]) = A HF (t) e iφ HF (t) . ( This step gives rise to two time series that capture the envelope A HF (t) and the instantaneous phase φ qLF (t) dynamics.The next step involves the band-pass filtering of the HF oscillations A HF (t) within the range of LF oscillations and the resulting signal is Hilberttransformed to extract its phase-dynamics component φ ′ LF-HF (t): The aforementioned equation reflects the HFoscillations amplitude modulated by the phase of the LF-oscillations.The resulting time series are employed to estimate PAC, by means of the phaselocking (or synchronization index) technique.
PLV is defined as follows: iPLV is defined as follows: iPLV ranges between 0 and 1, with higher values indicating stronger comodulating PAC interactions.Figure 1 illustrates every step of the CFC-PAC analysis, where a time series of 30 s length was adopted from the first subject with periodic leg movements (PLMs) during the NREM3 stage at the P4-O2 sensor.PAC estimations are examined between the LF and HF oscillations, which correspond to δ and α 1 brain rhythms, respectively.The original time series is presented in figure 1(A).The LF version of the original signal, along with the trace of its instantaneous phases ϕ δ (t) are depicted in figure 1(B).The corresponding HF version of the initial signal, along with the trace of its envelope A α1 are depicted in figure 1(C).Figure 1(D) shows the low-pass filtered, within δ frequency range, version of the previous envelope (i.e. the A α1 , δ(t) signal).The saw-like trace corresponds to its instantaneous phases ϕ ′ α1 (t).The ϕ δ (t) and ϕ ′ α1 (t) traces have been plotted aligned in figure 1(E), forming the resulting instantaneous phasedifferences, as shown in figure 1(F).This resulting sequence, representing phase-differences ∆ϕ(t), enters in equation (2) and will be integrated across time by averaging directional vectors e i∆ϕ(t) in the complex domain.The length of the original time series should be long enough, so that the iPLV index results into a reliable estimation of PAC.
In the present study, we estimated PAC for a total of (7 × 6)/2 = 21 cross-frequency pairs per epoch.

Amplitude-to-amplitude CFC
AAC is estimated between the Hilbert envelopes of band-pass filtered time series and by adopting a correlation coefficient to quantify their coupling.In figure 2, the algorithmic steps for the estimation of the AAC are illustrated.Figure 2(A) depicts the same trace as the one used in figure 1(A), while figures 2(B) and (C) illustrate the band-pass filtered traces and the related envelopes extracted via Hilbert transform for the LF δ (0.5-4 Hz) and the HF α 1 (13-20 Hz), respectively.Figure 2(D) shows the common representation of those envelopes' traces.The Pearson's correlation coefficient between every pair of the derived envelope time series was estimated to express the associations between specific frequency pairs.The AAC is computed as follows: where n is the sample size, x i y i are the individual sample points indexed with i and x = 1 n n i=1 x i is the sample mean (similarly for y).
Here, we took the absolute values of Pearson's correlation coefficient.In the present study, we estimated PAC for a total of (7 × 6)/2 = 21 cross-frequency pairs per epoch.

Feature selection
Our analytic plan extracts an important set of features tailored to CFC.We estimated CFC with both estimators across every pair of frequencies and separately for every epoch.Consequently, we averaged the CFC values across epochs of the same sleep stage independently for every subject.The total number of features is: 5 {number of sleep stages} × 2 {number of connectivity estimators} × 21 {possible pair of fre-quencies} = 210.This set of features was then fed into our RF model.

RF model and experimental setup 2.5.1. RF
The RF classifier is an ensemble learning method, used extensively in classification and regression tasks [31].The methodology basically involves the construction of a group (called 'forest') of decision trees as follows: each tree in the 'forest' is built on a different training set (called bootstrap sample), drawn randomly from the original training data.A randomly selected variable subset (from the original variable set) is used (during the construction of each decision tree) in order to establish the best split at each node.Once the RF model has been trained and all trees in the forest are constructed, their decisions are combined through majority voting (classification) or averaging (regression).Then, these decisions are used in the prediction of unknown cases.
The RF algorithm provides an internal estimator of a constructed model's generalization error, called out-of-bag (OOB) error.The estimation of the OOB error involves each decision tree in the model as follows: a portion of the original data cases (around 1/3) do not participate in the training of each tree and instead, are utilized as 'test' data, being predicted by the constructed tree.The OOB error estimate is the averaged prediction error for each training case, using only the trees that do not include that case in their bootstrap sample.For more details on the RF algorithm and its underlying notions, we refer for example to [26] and [32].

Experimental setup
In all RF models trained in our experiments, the following parameter setup was used: the number of trees for each model was empirically set based on the OOB error estimate.Following this approach, in all cases, the number of trees was set to 1000.For each RF model and for each node split during the growing of a tree, the number of variables used to determine the best split was set to the default √m (m = total number of features in the dataset).In addition, the RF classifier has its own built-in feature selection method, which was used in order to select the most important features in every RF model.Consequently, only the selected feature subsets were utilized for the training of the final RF models.Finally, a ten-fold crossvalidation scheme was applied in all experiments for the training of the classifier.It is worth mentioning that the code for our RF-related experiments was written in R, version 3.6.3(www.r-project.org/).Then, the in-house software MATLAB 2019B was used for the estimation of the CFC estimates.

CAP: background and short review
As CAP, we characterize sequences of distinct electrocortical events from the background EEG activity that recur up to 1 min intervals.The existence of CAP may enhance sleep disturbance, instability or both.The appearance of CAP can be spontaneous or in conjunction with sleep disorders, such as e.g.sleepdisordered breathing and PLM activity.A CAP cycle is composed of a phase A and the following phase B. A CAP sequence is composed of a succession of CAP cycles.CAP sequence has evolved theoretically to encapsulate both sleep maintenance and sleep fragmentation.Phase A is further characterized by subtypes of CAP called A1, A2 and A3.A1 refers to brain's attempt to maintain sleep related to slow wave activity.Subtypes A2 and A3 CAP constitute an arousal central nervous system that is activated when sleep becomes too unstable or the preservation attempt fails [27].An index of the quality of sleep is the CAP rate, which is the percentage of the total sum of minutes related to CAP divided by the total sum of NREM sleep.In the present study, we focused on the analysis of non-CAP epochs.For that reason, we estimated the (1 − CAP rate) to report the percentage of NREM time analyses in our study.

CAP rates across sleep disorders
Table 3 summarizes the group mean values of (1 − CAP rates).It is obvious that (1 − CAP rates) related to the seven sleep disorders deviate from the healthy control group.

Performance of RF model with CFC features
Our RF model achieved a high performance of 74% for the P4-O2 EEG sensor, with a macro-average precision of 83.7%, a macro-average recall of 59.1% and a macro-average F-score of 64.9% (table 4).The rest of the EEG sensors performed worse compared to the optimal scenario: F4-C4 (56%), C4-P4 (56%) and C4-A1 (64%) (see supplementary tables 1-3 (available online at stacks.iop.org/JNE/18/046064/mmedia)).Table 5 summarizes the confusion matrix of the RF model for the P4-O2 sensor.Finally, the confusion matrices for the other three sensors are presented in the supplementary material of the study (supplementary tables 4-6).

The complementarity of PAC-AAC CFC
Figures 3-8 report selected features extracted with both CFC estimators (PAC and AAC) and across sleep stages from P4-O2 sensor.Figure 3 illustrates the seven features related to the AAC across the sleep stages.Figures 4-8 demonstrate the 28 selected features from the PAC independently per sleep stage.It is evident that PAC contributes the highest portion of selected features.However, both types encapsulate complementary information under the framework of CFC.The major frequency modulators across sleep stages were δ, θ and α.Interestingly, AAC features were distributed across all sleep stages with the exception of REM.

The importance of sleep stage 4
We ran our RF model independently for every sleep stage with the main aim to rank the importance of sleep stages.Our findings ranked sleep stage 4 as the most informative, compared to the other ones for the sleep disorder classification with an accuracy of 62%.

Discussion
In • We kept NREM 3 and NREM 4 as single sleep stages without attempting to merge them [33].• We adopted an ICA and MODWT [34] to denoise the EEG recordings from eye movements and muscle activity.• We estimated two different connectivity estimators per frequency pair and for every epoch (one phase-to-amplitude: PAC and one amplitude-toamplitude: AAC).• We used a dataset that includes subjects covering seven sleep disorders and a healthy group.• We analyzed only non-CAP epochs.
Previous studies have attempted to either characterize PAC CFC patterns in sleep disorders or to discriminate sleep disorders using the same dataset.None of the studies discussed below denoised the original EEG traces.

EMD and focused CFC PAC estimated at every CAP phase
A recent work reported for the very first time that PAC patterns of δ phase modulate α and low-β amplitude in sleep disorders for the three CAP phases [35].They adopted modulation index as a proper PAC estimator reporting the group-averaged PAC values for the two cross-frequency pairs.This study showed how PAC patterns differed across the three CAP phases at every sleep disorder and also how they differed at every CAP phase across sleep disorders.However, the authors focused only on PAC CFC estimates and only on two cross-frequency pairs without reporting any classification performance.They extracted frequency-dependent signature using an adaptive filtering called EMD.

A non-validated discrete wavelet transform (DWT) approach for detecting sleep disorders
Another work analyzed the same dataset using discrete wavelet transform and related features were extracted [36].Nonetheless, the authors reported their findings probably by averaging across both epochs and sleep stages with no statistical comparisons between sleep disorders.Moreover, there is no information about the common EEG sensors, from which they estimated and averaged the waveletbased features.No classification performance has been reported.No information is given regarding the treatment of CAP non-CAP epochs.

A four-class sleep disorder detection model based on EMD and high-order statistics
The third study decomposed every time source into frequency-dependent time courses using EMD, as in the first study [37].The analysis focused on 20 healthy subjects, 20 REMs, 20 PLMs, and 20 patients with apnea from the same dataset.For every EEG time source, EMD returns a data-driven set of IMFs.Every IMF has a characteristic temporal pattern with a specific frequency profile that can be assigned to wellknown brain frequencies.The authors reported that their analysis revealed nine IMFs, from which highorder statistics have been estimated, like Shannon Entropy, Spectral Entropy, Skewness and Kurtosis and the first order statistic standard deviation.Then, they followed a classification approach reporting high     performance (93%) between the three sleep disorders and the healthy control group for features related to IMF8.However, they did not report how and where the whole methodology was applied, which sensor they analyzed, as well as how they managed the different epochs and the sleep stages.Brain frequencies can couple between each other via different but complementary mechanisms.The basic CFC mechanisms are phase-to-amplitude (PAC) and amplitude-to-amplitude envelope correlation (AAC) [38,39].The first CFC mechanism, called PAC, quantifies how the phase of the slow frequency modulates the amplitude of the HF.The explanation of the existence of such a mechanism and how slow oscillations can couple faster brain frequencies in many brain areas is on the conduction velocities of cortical neurons.Slower frequencies activate more neurons in large brain volumes associated with large changes of membrane potential [40].This practically means that in longer temporal windows, a larger portion of spikes linked to upstream neurons can coexist [41].There is evidence that PAC exists between every possible pair of mammalian brain frequencies from 0.025 Hz up to 500 Hz [42] and in sleep [13,43].A complementary CFC mechanism to PAC is the AAC, which captures the temporal covariation between the envelopes of the slower and the faster frequencies [44].This approach is temporally less precise, but important to capture CFC mechanisms in many cases and especially in sleep [13].In our study, we identified that the P4-O2 EEG sensor provided the highest accuracy among the four common EEG sensors.NREM 4 was also the most informative sleep stage following a classification process independently for every sleep stage.Our analysis supported the notion of analyzing NREM 3 and 4 separately.The conclusion is that the combination of PAC and AAC in NREM 4 estimated over parieto-occipital brain area provided the most powerful sleep disorder detection model so far in the literature.It is known that consolidation processes rely on the interactions between characteristic brain oscillatory activity of NREM sleep: slow oscillations, spindles and ripples [45].A recent study measured intracranial EEG activity during sleep from epileptic patients.They reported PAC between 0.5-1.25 Hz (slow oscillation range) and 12-16 Hz (spindle range) within the Cz sensor.Their findings were also evaluated from intracranial recordings from hippocampus, providing a link of PAC estimates between EEG sensor activity and intracranial findings.PAC estimates revealed the hierarchical role of slow oscillations, spindles and ripples during NREM [45,46].Both studies [45,46] evaluated the existence of PAC as a brain connectivity pathway within specific brain areas, while they validated a clear link between sensor and source brain activity.
To the best of the authors' knowledge, the current study provided the best performance of a sleep disorder detection model in the literature.Our analysis involved the estimation of two CFC mechanisms among many frequency pairs within four common EEG sensors and across five sleep stages.The RF model served as a natural multiclass classifier and not as an one-versus-all classification approach.This work is another support of CFC existence during sleep [13].We further proved that sleep disorders altered both types of CFC mechanisms, while PAC estimator was more informative compared to AAC, supplying our RF model with more features.Figure 3 illustrates the seven features related to the AAC across the sleep stages, while figures 4-8 demonstrate the 28 selected features from the PAC independently per sleep stage.In the future, we will adopt the same strategy tailored to the three CAP phases in conjunction with complementary CAP related features like the CAP rates, which is the ratio of the durations in secs between NREM CAP sleep and total NREM sleep [47].
This study provides evidence that two basic CFC are sensitive to detect alterations of nested oscillations across sleep disorders in various sleep stages.We reported important findings of the existence of a multiplex nature of brain oscillations in sleep that is altered due to specific disorders.Additionally, PAC and AAC showed that they capture complementary information in relation to CFC mechanisms.Here, our study focused on the estimation of CFC within sensors and only in non-CAP epochs.Further analysis is important to explore CFC patterns between EEG sensors and also in CAP epochs.We aim to explore the aforementioned scenarios in a complementary study with the same dataset.Additionally, the classification performance of CFC patterns should be compared also with various CAP-related features to further validate their importance in an accurate sleep disorder detection model.Moreover, a relationship between CFC patterns and CAP rates should be reported.
One of the limitations of this study comes from the restrictions of the current database in terms of the imbalance of participants across sleep disorders.Sleep EEG features and especially brain connectivity are sensitive to sex and age parameters [48].CFC has not yet demonstrated its sensitivity on age and sex during sleep.Carefully reading the confusion matrix tabulated in table 4, one can make the conclusion that the misclassified subjects varied across age and also sex.Age range of misclassified PLM, REM behavior disorder and insomnia subjects range from 48 up to 70 years.We assume that a database of subjects with no sleep pathology across the lifespan would have eliminated any doubt about the sensitivity of our model over a misbalanced dataset with age.More subjects are needed to further cross-validate our model, while a high-density EEG sleep recording of subjects with sleep disorders would support the source localization of brain activity in virtual brain areas to explain current findings with CFC.
With respect to the imbalanced nature of the dataset and the selection of the classification algorithm, we would like to note that the decision to employ RF in order to build the classification model in our study was based on the fact that after preliminary observations, RF outperformed all other algorithms that were used in our initial experiments.
It is important to mention here that our analysis is based on the hypnograms created by experts and also on the distinction between CAP and non-CAP epochs.Data-driven characterization of our model includes the artifact correction, the estimation of CFC-based features and also the classification approach with RF.To make this approach fully automated, we have to apply an automatic sleep stage classification algorithm [26] and an automatic characterization of the CAP epochs.
An important sub-class of sleep disorders is sleeprelated movement disorders.Within this category, the following clinical conditions are included: periodic limb movement disorder, restless leg syndrome, sleep-related leg cramps, and bruxism [49].In clinical practice, an expert visualizes EMG activity of the anterior tibialis to detect epochs of limb movements.If EMG activity overcomes the threshold of 8 µV at rest with a duration between 0.5 and 10 s, then this epoch is characterized as limb movement [49].According to ICSD-3 of the American Academy of Sleep Medicine, the diagnostic criteria for PLMs are: the detection of more than 15 periodic limb movements per hour in adults and more than five periodic limb movements per hour in children that cause in both cases strong sleep problems [50].In the present study, we aimed to apply a common analytic framework across sleep disorders using EEGbased characteristics.It is well-known that periodic limb movements in sleep alter EEG activity via the arousal response, going from autonomous activation to alterations of EEG activity across the frequency range [51].
We intend in a future study to investigate CFC patterns in CAP epochs and also before and during the occurrence of K-complexes and sleep spindles.The comparison of the potential findings of such a study with findings presented here on non-CAP epochs and especially their complementarity will shed light on the importance of EEG modality and CFC patterns, on the understanding of sleeps disorders, as well as on their correct classification.

Conclusion
In the present study, we reported for the very first time a machine learning approach of an automatic classification system of sleep disorders, based on EEG modality and complementary cross-frequency system.The whole analysis focused on non-CAP epochs from NREM stages and also on REM stage.Our system succeeded a performance of 74% to correctly classify a subject across seven sleep disorders and a healthy control group.Further exploratory studies are needed, including the repetition of the same analysis also on CAP epochs including also alternative CFC estimators.It would be interesting to also compare the importance of EEG-based analysis in comparison to CAP-related features and also during specific epiphenomenon, such as K-complexes and sleep spindles.

Figure 2 .
Figure 2. Algorithmic steps for AAC estimation.Illustrating an epoch of 30 s length recorded at P4-O2 sensor from the first subject with periodic leg movements during the NREM3 stage (A), we showed the amplitude-to-amplitude coupling between δ and α1 rhythms.To estimate δ-α1 AAC, the raw signal was band-pass filtered into both (B) a low-frequency δ (0.5-4 Hz) and (C) a high-frequency α1 (13-20 Hz) components.The envelopes of those quantities were also extracted via Hilbert transform.Their Hilbert envelopes were demonstrated in conjunction with their band-pass filtered time course (B), (C).(D) We then presented into a common plot the envelopes of the bandpass δ (4-8 Hz) and α1 (13-20 Hz).The AAC was estimated on these time series using equation (5).

Table 1 .
Demographics of the sleep disorder dataset.

Table 2 .
A summarization of the indexes of the selected subjects per group.

Table 4 .
Precision, recall, F-score and accuracy performance of the RF model for the P4-O2 EEG sensor.

Table 5 .
Confusion matrix of the RF model based on the selected features extracted from P4-O2.