<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Archiving and Interchange DTD v2.3 20070202//EN" "archivearticle.dtd">
<article xml:lang="EN" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="methods-article">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Bohr. Iam.</journal-id>
<journal-title>BOHR International Journal of Internet of things, Artificial Intelligence and Machine Learning</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Bohr. Iam.</abbrev-journal-title>
<issn pub-type="epub">2583-5521</issn>
<publisher>
<publisher-name>BOHR</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.54646/bijiam.2022.03</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Methods</subject>
</subj-group>
</article-categories>
<title-group>
<article-title>Deep learning analysis for estimating sleep syndrome detection utilizing the twin convolutional model FTC2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name><surname>Cvetko</surname> <given-names>Tim</given-names></name>
<xref ref-type="corresp" rid="c001"><sup>&#x002A;</sup></xref>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name><surname>Robek</surname> <given-names>Tinkara</given-names></name>
<xref ref-type="corresp" rid="c001"><sup>&#x002A;</sup></xref>
</contrib>
</contrib-group>
<aff><institution>Gimnazija Bre&#x017E;ice</institution>, <addr-line>Bre&#x017E;ice</addr-line>, <country>Slovenia</country></aff>
<author-notes>
<corresp id="c001">&#x002A;Correspondence: Tim Cvetko, <email>cvetko.tim@gmail.com</email></corresp>
<corresp id="c002">Tinkara Robek, <email>tinkara.robek@gmail.com</email></corresp>
</author-notes>
<pub-date pub-type="epub">
<day>07</day>
<month>03</month>
<year>2022</year>
</pub-date>
<volume>1</volume>
<issue>1</issue>
<fpage>15</fpage>
<lpage>21</lpage>
<history>
<date date-type="received">
<day>09</day>
<month>10</month>
<year>2021</year>
</date>
<date date-type="accepted">
<day>04</day>
<month>02</month>
<year>2022</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x00A9; 2022 Cvetko and Robek.</copyright-statement>
<copyright-year>2022</copyright-year>
<copyright-holder>Cvetko and Robek</copyright-holder>
<license xlink:href="https://creativecommons.org/licenses/by-nc-nd/4.0/"><p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</p></license>
</permissions>
<abstract>
<p>Manual sleep stage scoring is frequently performed by sleep specialists by visually evaluating the patient&#x2019;s neurophysiological signals acquired in sleep laboratories. This is a difficult, time-consuming, and laborious process. Because of the limits of human sleep stage scoring, there is a greater need for creating automatic sleep stage classification (ASSC) systems. Sleep stage categorization is the process of distinguishing the distinct stages of sleep and is an important step in assisting physicians in the diagnosis and treatment of associated sleep disorders. In this research, we offer a unique method and a practical strategy to predict early onset of sleep disorders, such as restless leg syndrome and insomnia, using the twin convolutional model FTC2, based on an algorithm composed of two modules. To provide localized time-frequency information, 30-second-long epochs of electroencephalogram (EEG) recordings are subjected to a fast Fourier transform, and a deep convolutional long short-term networks neural network is trained for sleep stage categorization. Automating sleep stage detection from EEG data offers a great potential to tackle sleep irregularities on a daily basis. Thereby, a novel approach for sleep stage classification is proposed, which combines the best of signal processing and statistics. In this study, we used the PhysioNet Sleep European Data Format (EDF) database. The code evaluation showed impressive results, reaching an accuracy of 90.43, precision of 77.76, recall of 93,32, F1 score of 89.12, and the final mean false error loss of 0.09. All the source code is available at <italic><ext-link ext-link-type="uri" xlink:href="https://github.com/timothy102/eeg">https://github.com/timothy102/eeg</ext-link>.</italic></p>
</abstract>
<kwd-group>
<kwd>sleep stage classification</kwd>
<kwd>algorithm design</kwd>
<kwd>onset detection</kwd>
<kwd>convolutional neural networks</kwd>
<kwd>signal processing</kwd>
<kwd>recurrent neural networks</kwd>
<kwd>Fourier transform</kwd>
<kwd>CEEMDAN</kwd>
<kwd>preprocessing</kwd>
</kwd-group>
<counts>
<fig-count count="2"/>
<table-count count="0"/>
<equation-count count="1"/>
<ref-count count="17"/>
<page-count count="7"/>
<word-count count="4212"/>
</counts>
</article-meta>
</front>
<body>
<sec id="S1" sec-type="intro">
<title>Introduction</title>
<p>Sleep classification is crucial for our day-to-day functioning and prevention of diseases, such as obesity, type 2 diabetes, and different psychiatric disorders that may develop in association with the shortage of sleep. Maintaining a healthy sleep schedule is significant for obtaining our natural circadian rhythm and the normal course of sleep. This must include rapid eye movement (REM) and non-REM phases. NREM is specified by slow-wave activity (delta power). REM phase is characterized by the eye movements that we track with electrooculogram (EOG), low muscle tone that we track with electromyogram (EMG), low amplitude waves, and generally mixed frequency electroencephalogram (EEG). It is also a stage where dreams occur. The brain is as active during REM as during wakefulness, only in different parts (correspondingly, the pre-frontal cortex, which is responsible for judgment and decision-making, is deactivated during both phases). The REM state is initialized by the neurons located in the brainstem. The process of recording sleep in laboratories to examine its structure (mainly in terms of slow-wave activity) is known as polysomnography. Polysomnograms can show the diagnostics of various disorders during sleep. They are commonly used for identifying disorders such as obstructive sleep apnea, excessive daytime sleepiness, and insomnia. Polysomnograms record numerous types of information: EEG (for recording brain waves), EOG (for recording eye movements), EMG (for recording the electrical activity of muscle surfaces), and EKG (electrocardiogram). Combining the gathered data allows us to identify the individual&#x2019;s stage of sleep. To recognize sleep apnea, it is also required to record snoring, nasal and oral airflow, movement of the abdomen and chest, and pulse oximetry. There are multiple types of waves measured in EEG which tell whether the person is asleep or awake and what stage they are in. Alpha activity (frequency: 8&#x2212;13 Hz) is present in the occipital cortex when a person is resting with their eyes closed and goes away when they wake up or fall asleep. Theta activity (4&#x2212; 7 Hz) is the most common frequency during sleep. Delta activity is known as slow-wave activity (0.5&#x2212; 2/4 Hz) with higher amplitudes and is mostly present in the frontal areas of the cortex. Sleep spindles (11&#x2212;16 Hz) normally indicate stage 2 of NREM sleep, with a duration of 2&#x2212;3 seconds. K complexes are most common in stage 2 of NREM. Their amplitude is not specified, and the time span must be at least 0.5 s. Sleep stages are regulated by individual neurotransmitters.</p>
<p>Wakefulness is a heterogeneous state, maintained by neurotransmitters such as acetylcholine, serotonin, norepinephrine, histamine, dopamine, hypocretin, and glutamate. NREM is initialized by GABA and adenosine, while acetylcholine sends signals for REM onset. Interactions between neurotransmitters determine the behavioral states at any given time. During sleep, they define muscle tone, eye movements, and EEG activity. The same neurotransmitter can have opposite effects during wakefulness and sleep and in different brain regions. The preoptic area of the brain (anterior hypothalamus) is known to act as a sleep center, while the posterior hypothalamus acts as a wakefulness center. Electrical stimulation of the preoptic area, therefore, has the ability to initiate sleep. Apart from the objective reasons for not sleeping long enough (the recommended 8 h, for obtaining full sleep cycles), there are also multiple sleeping disorders present in today&#x2019;s society. Sleeping disorder is usually a composition of multiple neurological modifications that may be caused by external or internal factors. These factors include our lifestyle, genetics, associated diseases, and psychiatric disorders. Disordered sleeping is alarmingly common in modern society. In the field of various disorders, the most common persist to stay the following: insomnia, sleep-disordered breathing (obstructive sleep apnea, hyper-ventilation), central disorders of hypersomnolence (narcolepsy, idiopathic hypersomnia, Kleine&#x2013;Levin syndrome), circadian rhythm disorders, parasomnias (sleepwalking, terrors, sleep eating disorders, sleep enuresis), and sleep-related movement disorders (restless leg syndrome, periodic limb movement disorder). Insomnia and other disorders that result in trouble sleeping are often associated with multiple chronic health conditions. They have an impact on blood pressure and blood sugar levels; therefore, they put us at risk of coronary diseases and metabolic imbalances. Middle-aged/older population and obese individuals are at greater risk of developing these issues. In addition, sex also plays a role in developing some sleeping disorders&#x2014;males are more likely to develop obstructive sleep apnea, while women are predisposed to insomnia. The first step for identifying problems with sleep is by clinical approach with Epworth Sleepiness Scale (ESS) (<xref ref-type="bibr" rid="B1">1</xref>). Insomnia can arise as chronic insomnia or in a short-term form. Its typical symptoms are problems initiating or maintaining sleep, non-restorative sleep, and waking too early, which result in daily distress. These issues occur due to the brain&#x2019;s arousal systems that are not turning off. It is diagnosed in a laboratory with polysomnography. It can be a cause for endothelial dysfunction, oxidative stress, inflammation, hypertension, and even stroke in severe cases. Normally, it is treated with continuous positive airway pressure (CPAP).</p>
<p>We intend to use these findings along with the FTC2 model for sleep staging predictions to predict the onset of sleep syndromes. We firmly believe that these methods strongly correlate with modern sleep issues, thus enhancing the medical procedure and diagnosis.</p>
</sec>
<sec id="S2">
<title>Methodology</title>
<p>For the purpose of this study, we have used the following methods: CEEMDAN, fast Fourier transform (FFT), convolutional neural networks, long short-term networks (LSTM), Savitzky&#x2013;Golay filter, and Welch power spectrum.</p>
</sec>
<sec id="S3">
<title>Event detection during sleep</title>
<p>Although detecting periods of raised or lowered activity during sleep is an appealing task, it is rather interesting to detect transient, short signals. Furthermore, we can identify events such as QRS complexes in the ECG or EEG, events such as slow waves (single waves of around 0.5&#x2212;2 Hz with a high amplitude of about 75 &#x03BC;V), sleep spindles, and other sleep-related events during sleep (transient waxing and waning events of about 0.5&#x2212;2 s duration and 15&#x2212;50 &#x03BC;V maximal amplitude). For the sake of this study and simplicity, we do not distinguish between slow waves, K-complexes, and slow oscillations, but instead group them all together.</p>
<sec id="S3.SS1">
<title>Detailed description of the methodology</title>
</sec>
</sec>
<sec id="S4">
<title>CEEMDAN preprocessing</title>
<p>We used the complete ensemble empirical mode decomposition with adaptive noise (CEEMDAN) as a noise-aided EMD approach for the preprocessing. In recent years, a number of signal processing approaches have been created. The FFT is the foundation of standard signal processing methods. However, this approach cannot concurrently yield time domain and frequency domain evaluated findings. Many time-frequency analysis approaches, such as the Wigner-Ville distribution (WWD), have been used to diagnose vibration signals (<xref ref-type="bibr" rid="B2">2</xref>). This approach computes the analytic signal corresponding to the input signal, constructs a weighted kernel function, then analyses the kernel using a discrete Fourier transform (DFT). According to Boashash and Black (<xref ref-type="bibr" rid="B3">3</xref>), when evaluating the analytic signal needed by the algorithm, the time domain definition implemented as a finite impulse response (FIR) filter is more practical and efficient than the frequency domain definition. The wavelet transform (<xref ref-type="bibr" rid="B4">4</xref>, <xref ref-type="bibr" rid="B5">5</xref>) utilizes the FFT to extract frequency-based wavelets. One of the most potent signal processing techniques for defect diagnostics is empirical mode composition. The intrinsic mode function is derived from a signal&#x2019;s local characteristic timings and can deconstruct the signal into a series of full and nearly orthogonal components [intrinsic modal functions (IMFs)]. The IMFs represent the signal&#x2019;s inherent oscillation mode and act as basic functions, which are defined by the signal rather than by predetermined kernels. As a result, it is a self-adaptive signal processing approach ideal for nonlinear and nonstationary processes, as well as for defect feature extraction in spiral-bevel gears. According to Yao and Han (<xref ref-type="bibr" rid="B5">5</xref>), CEEMDAN has been demonstrated to be a successful approach for evaluating nonstationary signals that are followed by high noise. The raw vibration signal is first decomposed using the CEEMDAN technique to get a set of IMFs. Based on the correlation coefficient, the IMFs that incorporated the most defect information were chosen as the ideal IMFs. Following that, the optimum IMFs&#x2019; permutation entropy values are computed. The overlapping parameter approach is used to optimize the two main parameters, embedding dimension and delay time, in order to achieve correct permutation entropy values. The support vector machine (SVM) is employed as the classifier for failure mode detection in order to check the sensibility of the permutation entropy features, and the diagnostic accuracy can validate its sensibility.</p>
<sec id="S4.SS0.SSS1">
<title>FTC2 model architecture</title>
<p>The standard practice for image recognition, computer vision, and more is deep convolutional neural networks. Models like LeNet (<xref ref-type="bibr" rid="B6">6</xref>), AlexNet (<xref ref-type="bibr" rid="B7">7</xref>), ImageNet (<xref ref-type="bibr" rid="B8">8</xref>), and more work exclusively on 2D data. They are also referred to as 2D CNNs. With the same idea in mind, 1D CNNs have been developed. Despite the obvious fact that the 1D CNNs apply a 1D kernel to data, they also have some advantages. 1D CNNs don&#x2019;t require heavy matrix operations (nor at the forward pass or the backpropagation). Potentially, what this means is that they are, compared to their 2D counterparts, computationally less complex and can run on CPU hardware.</p>
<p>The FTC2 is passed through a leaky rectified linear unit for nonlinearity purposes (<xref ref-type="fig" rid="F1">Figure 1</xref>). The input signal then passes a max-pooling layer with the stride of 2, following that is the batch normalization layer, and finally the bidirectional layer. Each twin structure contains three such blocks. The outputs of the convolutional-LSTM blocks are then concatenated across axis 1 in order to be finally passed through a fully connected 64-unit dense layer. We use the softmax activation to receive the final scores for each sleep stage. The CNN consists of three different-sized filters with the idea in mind that small filters extract temporal information and large filters extract frequency information. The idea behind using variable filter widths originates from the signal processing field to have a trade-off between extracting time domain and frequency domain characteristics (<xref ref-type="bibr" rid="B9">9</xref>). This allows you to benefit from both temporal domain and frequency domain data in the classification process. The feature map generated from the 1D concatenated output from the twin convolutional blocks is intertwined with LSTM units to capture the complex context dependencies between the inputs and the targets.</p>
<fig id="F1" position="float">
<label>FIGURE 1</label>
<caption><p>A schema of the FTC2 architecture.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="bijiam-2022-03-g001.tif"/>
</fig>
</sec>
<sec id="S4.SS0.SSS2">
<title>Utilizing the Conv-1D and the bidirectional LSTM</title>
<p>The Conv-LSTM network combines the best of both worlds. One-dimensional convolutional layers handle spatial data using a kernel to train a set of filters that best represent the hyperplane and the LSTM, which encodes temporal inputs using cell state memory. To put it differently, Conv-LSTM predicts the future state of a cell given vectors on a spatial grid and past states of neighbors. Convolutional-LSTM layer works by passing the 1D kernel over a set of training points, and its result, a.k.a feature map, is passed onto the LSTM cell. In this project, instead of using the typical LSTM cell, we used a bidirectional recurrent neural network. Put simply, this was enabled due to the limitations of LSTM having the limitation of being restricted from processing previous input state. Given the inputs x = x0, xN, which are one-dimensional data of a 30-second clip, which should assure stability and little overlap, these inputs are passed into the twin architecture.</p>
</sec>
<sec id="S4.SS1">
<title>Loss calculation</title>
<p>Sleep stage classification encounters the class imbalance issue that we have addressed accordingly. Such imbalance will have had a severe tendency to bias the better-represented part of the dataset. To alleviate this, we have taken both the extended mean false error (MFE) and the mean squared false error (MSFE) for multiclass classification:</p>
<disp-formula id="S4.Ex1">
<mml:math id="M1">
<mml:mrow>
<mml:mi>M</mml:mi>
<mml:mi>F</mml:mi>
<mml:mi>E</mml:mi>
<mml:mmultiscripts>
<mml:mo rspace="2pt">=</mml:mo>
<mml:mprescripts/>
<mml:mi>L</mml:mi>
<mml:none/>
</mml:mmultiscripts>
<mml:mfrac>
<mml:mi>q</mml:mi>
<mml:mrow>
<mml:mfrac>
<mml:mn>1</mml:mn>
<mml:mi>N</mml:mi>
</mml:mfrac>
<mml:mi mathvariant="normal">&#x03A3;</mml:mi>
<mml:mmultiscripts>
<mml:mi>C</mml:mi>
<mml:mprescripts/>
<mml:mrow>
<mml:mpadded width="+3.3pt">
<mml:mi>i</mml:mi>
</mml:mpadded>
<mml:mo rspace="5.8pt">=</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
<mml:none/>
</mml:mmultiscripts>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mi>x</mml:mi>
<mml:mmultiscripts>
<mml:mo>-</mml:mo>
<mml:mprescripts/>
<mml:mi>i</mml:mi>
<mml:none/>
</mml:mmultiscripts>
<mml:mover accent="true">
<mml:mi>x</mml:mi>
<mml:mo stretchy="false">^</mml:mo>
</mml:mover>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
<mml:msup>
<mml:mi/>
<mml:mn>2</mml:mn>
</mml:msup>
</mml:mrow>
</mml:mfrac>
</mml:mrow>
</mml:math>
</disp-formula>
</sec>
<sec id="S4.SS2">
<title>Unsupervised method for detecting onsets of sleep syndromes</title>
<p>Syndromes in question are restless leg syndrome (RLS), rapid eye movement (REM), sleep behavior disorder, insomnia, sleep apnea, and narcolepsy. In an attempt to detect these complex syndromes through EEG data, we have come up with the following sections.</p>
<sec id="S4.SS2.SSS1">
<title>Restless leg syndrome</title>
<p>Lisuride, a dopaminergic medication, showed a rise in alpha, a decrease in beta, and delayed actions on brain function as evaluated by computerized EEG. It was proposed that reverse EEG abnormalities might play a role in the pathophysiology of RLS. Changes in alpha activity generate long-lasting alpha arousal responses throughout the transition from alertness to sleep stage 1, and they continue to increase during sleep stage 2. This malfunction is most likely caused by a hereditary susceptibility of the EEG alpha rhythm and disinhibits the diencephalospinal dopamine pathway, mostly during sleep but also during alertness. Disinhibition creates a foundation for PLM activation, as well as unsettling feelings in the brainstem, and a need to move, as well as motor restlessness in the cerebral cortex, most notably in the legs. All of these factors contribute to severe insomnia. Forced deviations from alpha to theta or beta activity are undesirable in RLS patients, and resting EEGs indicate a dopamine receptor-specific &#x201C;individual sensitivity.&#x201D; This vulnerability is reduced following lisuride with appropriate CEEG adjustments.</p>
<p>We have designed an unsupervised statistical inference model for approximating the restless leg syndrome in EEG. First, the Savitzky&#x2013;Golay filter was applied to each 30-second window with the goal of smoothing the data, that is, increasing the accuracy of the data without altering the signal trend. Convolution is performed by fitting consecutive subsets of neighboring data points with a low-degree polynomial using the linear least squares approach. The data were then subjected to an orthogonal discrete Fourier transform to decompose functions based on space or time into functions based on spatial or temporal frequency. At last, the final RLS score is computed by applying the sigmoid activation function to the Fourier-transformed data.</p>
</sec>
<sec id="S4.SS2.SSS2">
<title>Sleep apnea</title>
<p>Carbon dioxide may accumulate in the circulation during sleep owing to pauses in breathing. Chemoreceptors detect it when it reaches a crucial threshold. These receptors provide a signal to the brain, causing the sleeping individual to wake up and breathe in air. As a result, a change in sleep phases occurs, causing fluctuations in the activity level of distinct frequency bands of the EEG signal. As a result, as compared to a full-b and EEG signal, more identifiable characteristics can be maintained in frequency band-limited signals for apnea diagnosis. As a result, instead of analyzing full-b and EEG data for apnea event identification, features of band-limited signals are utilized. EEG signal is partitioned into five frequency bands (<xref ref-type="bibr" rid="B10">10</xref>), namely, delta (0.25&#x2212;4 Hz), theta (4&#x2212;8 Hz), alpha (8&#x2212;12 Hz), sigma (12&#x2212;16 Hz), and beta (16&#x2212;40 Hz). Spectral filtering is done in the FFT domain to achieve this division.</p>
<p>To attain a relative score for approximating sleep apnea possibility, we have adopted the method proposed in ref. (<xref ref-type="bibr" rid="B6">6</xref>). This suggested technique introduces a subject-specific classification framework based on features for the categorization of apnea and non-apnea occurrences. The feature is considered to be the inter-b and energy ratio of a band-limited EEG signal, which is believed to have discriminating characteristics for apnea and non-apnea episodes. Energy contents in various frequency bands alter dramatically during sleep apnea compared to non-apnea occurrences.</p>
</sec>
<sec id="S4.SS2.SSS3">
<title>REM behavior sleep disorder</title>
<p>Despite what was presented in the study by Krizhevsky et al. (<xref ref-type="bibr" rid="B8">8</xref>), we have come about a rather simple, but clever, way of detecting the REM instability score. A relative score was calculated by using a greedy algorithm for the longest continuing sequence (<xref ref-type="bibr" rid="B10">10</xref>) to obtain a value that should correspond to the disturbance of REM sleep in an individual.</p>
</sec>
<sec id="S4.SS2.SSS4">
<title>Narcolepsy</title>
<p>Patients with narcolepsy had lower alpha power, greater delta and theta power during alertness, and higher alpha and beta power during REM sleep, according to Deng et al. (<xref ref-type="bibr" rid="B11">11</xref>). The former two groups also had reduced sleep efficiency and a greater percentage of positivity for REM-related symptoms than the other two groups. In light of this, we integrated the REM instability score and the acquired frequency range with wavelet transform on the initial and final 10% of sleep, suggesting worse sleep-to-wake transitions or vice versa.</p>
</sec>
<sec id="S4.SS2.SSS5">
<title>Insomnia</title>
<p>Insomnia is a sleep condition characterized by an inability to fall or stay asleep for as long as desired.</p>
<p>Following the previous work, a picture was generated with the MNE Python library by Mohd Maroof Siddiqui, Geetika Srivastava, and Syed Hasan Saeed in their study (<xref ref-type="bibr" rid="B11">11</xref>) (<xref ref-type="fig" rid="F2">Figure 2</xref>). Because the majority of EEG signals are constrained within the range of 25 Hz, each clipped signal is now preprocessed and then run through the Hanning window low-pass filter to remove the high-frequency components that eventually suggest noise. Hence, the filter is based on the FIR filter design of order 200 with a cutoff frequency of 25 Hz with the shape of the Hanning window. At this stage, we adopt a method for extracting frequency length windows via the Welch power spectrum (<xref ref-type="bibr" rid="B12">12</xref>). This score, obtained with softmax and the REM instability score, was combined for the insomnia score.</p>
<fig id="F2" position="float">
<label>FIGURE 2</label>
<caption><p>Polysomnography plot for a single patient.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="bijiam-2022-03-g002.tif"/>
</fig>
</sec>
<sec id="S4.SS2.SSS6">
<title>Sleep depth</title>
<p>Given a great sleep stage classifier, we concluded to not only move in the direction of detecting abnormalities but also to quantify sleep depth. First, the raw records are pushed through a Savgol filter to noise filtering. Furthermore, a FFT has given us a distribution of frequencies. At this stage, we evaluated the FFT distribution to obtain the sleep depth score along with the REM instability score.</p>
<table-wrap position="float" id="T1">
<table cellspacing="5" cellpadding="5" frame="hsides" rules="groups">
<thead>
<tr>
<td valign="top" align="left">Syndromes</td>
<td valign="top" align="center">RLS</td>
<td valign="top" align="center">REM<break/> disorder</td>
<td valign="top" align="center">Apnea</td>
<td valign="top" align="center">Narcolepsy</td>
<td valign="top" align="center">Insomnia</td>
<td valign="top" align="center">Sleep<break/> depth</td>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" align="left">Total</td>
<td valign="top" align="center">177983</td>
<td valign="top" align="center">6674</td>
<td valign="top" align="center">8899</td>
<td valign="top" align="center">4449</td>
<td valign="top" align="center">48945</td>
<td valign="top" align="center">164738</td>
</tr>
<tr>
<td valign="top" align="left">Percent</td>
<td valign="top" align="center">7.80</td>
<td valign="top" align="center">0.29</td>
<td valign="top" align="center">0.41</td>
<td valign="top" align="center">3.0</td>
<td valign="top" align="center">22</td>
<td valign="top" align="center">74.0</td>
</tr>
<tr>
<td valign="top" align="left">NHCS percent</td>
<td valign="top" align="center">7&#x2212;10</td>
<td valign="top" align="center">0.5&#x2212;1</td>
<td valign="top" align="center">0.5</td>
<td valign="top" align="center">3&#x2212;7</td>
<td valign="top" align="center">10&#x2212;30</td>
<td valign="top" align="center">66</td>
</tr>
</tbody>
</table></table-wrap>
</sec>
</sec>
</sec>
<sec id="S5">
<title>Experimental results</title>
<sec id="S5.SS1">
<title>Data</title>
<p>The PhysioNet Sleep-EDF dataset was utilized for the objectives of this study. The sleep-edf database comprises 197 PolySomnoGraphic sleep recordings from the whole night, including EEG, EOG, chin EMG, and event markers. Some recordings additionally include information about breathing and body temperature. The Sleep-EDF dataset comprises two studies, namely, one on the effects of age on sleep in healthy people (SC, Sleep Cassette) and the other on the effects of temazepam on sleep (ST, Sleep Telemetry). The dataset contains sleep recordings of whole-night polysomnograms (PSGs) with a sampling rate of 100 Hz. EEG (from the Fpz-Cz and Pz-Oz electrode sites), EOG, chin EMG, and event markers are all included in each record. Fewer records frequently include oro-nasal respiration and rectal body temperature. The hypnograms (sleep phases; 30-second epochs) were identified manually by well-trained personnel in accordance with the Rechtschaffen an Kales standard. Each level was assigned to a distinct class (stage). The classes include W, REM, N1, N2, N3, N4, and M. Data syndrome comparison was done according to Schensted (<xref ref-type="bibr" rid="B13">13</xref>).</p>
<table-wrap position="float" id="T2">
<table cellspacing="5" cellpadding="5" frame="hsides" rules="groups">
<thead>
<tr>
<td valign="top" align="left">Dataset</td>
<td valign="top" align="left">W</td>
<td valign="top" align="left">N1</td>
<td valign="top" align="left">N2</td>
<td valign="top" align="left">N3-N4</td>
<td valign="top" align="left">REM</td>
<td valign="top" align="left">Total</td>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" align="left">Sleep-EDF-13</td>
<td valign="top" align="left">8285</td>
<td valign="top" align="left">2804</td>
<td valign="top" align="left">17799</td>
<td valign="top" align="left">5703</td>
<td valign="top" align="left">7717</td>
<td valign="top" align="left">42308</td>
</tr>
<tr>
<td valign="top" align="left">Sleep-EDF-18</td>
<td valign="top" align="left">65951</td>
<td valign="top" align="left">21522</td>
<td valign="top" align="left">96132</td>
<td valign="top" align="left">13039</td>
<td valign="top" align="left">25835</td>
<td valign="top" align="left">222479</td>
</tr>
</tbody>
</table></table-wrap>
<p>It is worth noting that the sleep stages in PhysioNet&#x2019;s Sleep-EDF database are not normally distributed. There is a significantly higher number of W and N2 stages than others that cause class imbalance. We have discussed this in loss calculation.</p>
<p>The model was trained for 20 epochs. We used the Adam optimizer to minimize the MFE loss with a batch size of 16 and a learning rate alpha = 0.001. We also added the L2 regularization penalty with beta = 0.001 to mitigate the overfitting. For this goal, we used Python as the programming language and TensorFlow as the framework.</p>
<p>By employing the Conv-1D and the bidirectional LSTM twin network, we have successfully taken advantage of the temporal and spatial components of the signal processing nature. To reduce the class imbalance problem, we adopted the weighted MFE loss.</p>
<table-wrap position="float" id="T3">
<table cellspacing="5" cellpadding="5" frame="hsides" rules="groups">
<thead>
<tr>
<td valign="top" align="left">Accuracy</td>
<td valign="top" align="left">Precision</td>
<td valign="top" align="left">Recall</td>
<td valign="top" align="left">F1-score</td>
<td valign="top" align="left">Final MFE</td>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" align="left">90.43</td>
<td valign="top" align="left">77.76</td>
<td valign="top" align="left">93.32</td>
<td valign="top" align="left">89.12</td>
<td valign="top" align="left">0.09</td>
</tr>
</tbody>
</table></table-wrap>
</sec>
</sec>
<sec id="S6">
<title>Conclusion and future work</title>
<p>In this study, we have successfully proposed a new deep learning approach to the challenging problem of sleep stage classification that is essential for further analysis of the human brain activity. We utilized a two-part convolutional-LSTM block along with a multilayer perceptron to classify sleep stages from EEG data with the accuracy of. By incorporating a vastly important CEEMDAN preprocessing method, we build a more stable and noise-free variant of our data, which enabled building an end-to-end trainable model for not only classifying sleep stages but also detecting the early onset of frequently occurring sleep syndromes. Our algorithm takes advantage of both the spatial and temporal dimensions of signal processing, as well as the statistical analysis to come up with a score that represents the sleep stage the most. As a limitation, we would like to add that no data are known to bare diluted patients. For future work, given proper data, we would like to do a follow-up. In the future, we intend to extend this using multimodal polysomnography to enhance the model&#x2019;s performance and usability. Following our work, we will investigate how these syndrome predictions/scores align with actual scores and will hopefully serve as a professional service for automatic sleep stage and syndrome onset detection.</p>
</sec>
</body>
<back>
<ref-list>
<title>References</title>
<ref id="B1"><label>1.</label><citation citation-type="journal">Available online at: <ext-link ext-link-type="uri" xlink:href="https://epworthsleepinessscale.com/about-the-ess/">https://epworthsleepinessscale.com/about-the-ess/</ext-link></citation></ref>
<ref id="B2"><label>2.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Qian</surname> <given-names>S</given-names></name> <name><surname>Chen</surname> <given-names>D</given-names></name></person-group>. <article-title>Decomposition of the Wigner-Ville distribution &#x0026; time-frequency distribution series.</article-title> <source><italic>IEEE Trans Signal Process.</italic></source> (<year>1994</year>) <volume>42</volume>:<fpage>2836</fpage>&#x2013;<lpage>42</lpage>. <pub-id pub-id-type="doi">10.1109/78.324750</pub-id></citation></ref>
<ref id="B3"><label>3.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Boashash</surname> <given-names>B</given-names></name> <name><surname>Black</surname> <given-names>P</given-names></name></person-group>. <article-title>An efficient real-time implementation of the Wigner-Ville distribution.</article-title> <source><italic>IEEE Trans Acoust Speech Signal Process.</italic></source> (<year>1987</year>) <volume>35</volume>:<fpage>1611</fpage>&#x2013;<lpage>8</lpage>. <pub-id pub-id-type="doi">10.1109/TASSP.1987.1165070</pub-id></citation></ref>
<ref id="B4"><label>4.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Inoue</surname> <given-names>K</given-names></name> <name><surname>Takajo</surname> <given-names>A</given-names></name> <name><surname>Maeda</surname> <given-names>M</given-names></name> <name><surname>Matsuoka</surname> <given-names>S</given-names></name></person-group>. <article-title>Tuning method of modified wavelet transform in human sleep EEG analysis.</article-title> <source><italic>Proceedings of the 2007 International Conference on Control, Automation &#x0026; Systems.</italic></source> (<year>2007</year>). p. <fpage>2784</fpage>&#x2013;<lpage>9</lpage>. <pub-id pub-id-type="doi">10.1109/ICCAS.2007.4406842</pub-id></citation></ref>
<ref id="B5"><label>5.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Yao</surname> <given-names>X</given-names></name> <name><surname>Han</surname> <given-names>J</given-names></name></person-group>. <article-title>COVID-19 detection via wavelet entropy &#x0026; biogeography-based optimization, COVID-19: prediction, decision-making, &#x0026; its impacts.</article-title> (<year>2021</year>) <volume>60</volume>:<fpage>69</fpage>&#x2013;<lpage>76</lpage>. <pub-id pub-id-type="doi">10.1007/978-981-15-9682-7-8</pub-id></citation></ref>
<ref id="B6"><label>6.</label><citation citation-type="journal"><collab><italic>Deep Convolutional Neural Networks for Image Classification.</italic></collab> (<year>2021</year>). Available online at: <ext-link ext-link-type="uri" xlink:href="https://www.researchgate.net/figure/Architecture-of-LeNet-5-LeCun-et-al-1998-fig2-317496930">https://www.researchgate.net/figure/Architecture-of-LeNet-5-LeCun-et-al-1998-fig2-317496930</ext-link> <comment>(accessed 3 May, 2021)</comment>.</citation></ref>
<ref id="B7"><label>7.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Cohen</surname> <given-names>MX.</given-names></name></person-group> <source><italic>Analyzing Neural Time Series Data: Theory &#x0026; Practice.</italic></source> <publisher-loc>Cambridge, MA</publisher-loc>: <publisher-name>MIT press</publisher-name> (<year>2014</year>).</citation></ref>
<ref id="B8"><label>8.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Krizhevsky</surname> <given-names>A</given-names></name> <name><surname>Sutskever</surname> <given-names>I</given-names></name> <name><surname>Hinton</surname> <given-names>GE</given-names></name></person-group>. <article-title>ImageNet classification with deep convolutional neural networks.</article-title> In: <person-group person-group-type="editor"><name><surname>Pereira</surname> <given-names>F</given-names></name> <name><surname>Burges</surname> <given-names>CJC</given-names></name> <name><surname>Bottou</surname> <given-names>L</given-names></name> <name><surname>Weinberger</surname> <given-names>KQ</given-names></name></person-group> <role>editors</role>. <source><italic>Advances in Neural Information Processing Systems.</italic></source> <publisher-loc>Red Hook, NY</publisher-loc>: <publisher-name>Curran Associates Inc</publisher-name> (<year>2012</year>). p. <fpage>1097</fpage>&#x2013;<lpage>105</lpage>.</citation></ref>
<ref id="B9"><label>9.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Jiang</surname> <given-names>L</given-names></name> <name><surname>Tan</surname> <given-names>H</given-names></name> <name><surname>Li</surname> <given-names>X</given-names></name> <name><surname>Chen</surname> <given-names>L</given-names></name> <name><surname>Yang</surname> <given-names>D</given-names></name></person-group>. <article-title>CEEMDAN-based permutation entropy: a suitable feature for the fault identification of spiral-bevel gears.</article-title> <source><italic>Shock Vib.</italic></source> (<year>2019</year>) <volume>2019</volume>:<fpage>1</fpage>&#x2013;<lpage>13</lpage>. <pub-id pub-id-type="doi">10.1155/2019/7806015</pub-id></citation></ref>
<ref id="B10"><label>10.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Saha</surname> <given-names>S</given-names></name> <name><surname>Bhattacharjee</surname> <given-names>A</given-names></name> <name><surname>Fattah</surname> <given-names>S</given-names></name></person-group>. <article-title>Automatic detection of sleep apnea events based on inter-b &#x0026; energy ratio obtained from multi-b &#x0026; EEG signal.</article-title> <source><italic>Health Technol Lett.</italic></source> (<year>2019</year>) <volume>6</volume>:<fpage>82</fpage>&#x2013;<lpage>6</lpage>. <pub-id pub-id-type="doi">10.1049/htl.2018.5101</pub-id></citation></ref>
<ref id="B11"><label>11.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Deng</surname> <given-names>J</given-names></name> <name><surname>Dong</surname> <given-names>W</given-names></name> <name><surname>Socher</surname> <given-names>R</given-names></name> <name><surname>Li</surname> <given-names>L</given-names></name> <name><surname>Li</surname> <given-names>K</given-names></name> <name><surname>Fei-Fei</surname> <given-names>L</given-names></name></person-group>. <article-title>ImageNet: a large-scale hierarchical image database.</article-title> <source><italic>Proceedings of the 2009 IEEE Conference on Computer Vision &#x0026; Pattern Recognition.</italic></source> (<year>2009</year>). p. <fpage>248</fpage>&#x2013;<lpage>55</lpage>. <pub-id pub-id-type="doi">10.1109/CVPR.2009.5206848</pub-id></citation></ref>
<ref id="B12"><label>12.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Ferri</surname> <given-names>R</given-names></name> <name><surname>Rundo</surname> <given-names>F</given-names></name> <name><surname>Silvani</surname> <given-names>A</given-names></name> <name><surname>Zucconi</surname> <given-names>M</given-names></name> <name><surname>Bruni</surname> <given-names>O</given-names></name> <name><surname>Ferini-Strambi</surname> <given-names>L</given-names></name><etal/></person-group> <article-title>REM sleep EEG instability in REM sleep behavior dis- order &#x0026; clonazepam effects.</article-title> <source><italic>Sleep.</italic></source> (<year>2017</year>) <volume>40</volume>. <pub-id pub-id-type="doi">10.1093/sleep/zsx080</pub-id></citation></ref>
<ref id="B13"><label>13.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Schensted</surname> <given-names>C</given-names></name></person-group>. <article-title>Longest increasing &#x0026; decreasing subsequences.</article-title> <source><italic>Can J Math.</italic></source> (<year>1961</year>) <volume>13</volume>:<fpage>179</fpage>&#x2013;<lpage>91</lpage>. <pub-id pub-id-type="doi">10.4153/CJM-1961-015-3</pub-id></citation></ref>
<ref id="B14"><label>14.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Sasai-Sakuma</surname> <given-names>T</given-names></name> <name><surname>Inoue</surname> <given-names>Y</given-names></name></person-group>. <article-title>Differences in electroencephalographic find- ings among categories of narcolepsy-spectrum disorders.</article-title> <source><italic>Sleep Med.</italic></source> (<year>2015</year>) <volume>16</volume>:<fpage>999</fpage>&#x2013;<lpage>1005</lpage>. <pub-id pub-id-type="doi">10.1016/j.sleep.2015.01.022</pub-id></citation></ref>
<ref id="B15"><label>15.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Siddiqui</surname> <given-names>M</given-names></name> <name><surname>Srivastava</surname> <given-names>G</given-names></name> <name><surname>Saeed</surname> <given-names>S</given-names></name></person-group>. <article-title>Diagnosis of insomnia sleep disorder using short time frequency analysis of PSD approach applied on EEG signal using channel ROC-LOC.</article-title> <source><italic>Sleep Sci.</italic></source> (<year>2016</year>) <volume>9</volume>:<fpage>186</fpage>&#x2013;<lpage>91</lpage>. <pub-id pub-id-type="doi">10.1016/j.slsci.2016.07.002</pub-id></citation></ref>
<ref id="B16"><label>16.</label><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Zhao</surname> <given-names>L</given-names></name> <name><surname>Yang</surname> <given-names>H</given-names></name></person-group>. <article-title>Power spectrum estimation of the welch method based on imagery EEG.</article-title> <source><italic>Appl Mechan Mater.</italic></source> (<year>2013</year>) <volume>278-280</volume>:<fpage>1260</fpage>&#x2013;<lpage>4</lpage>.</citation></ref>
<ref id="B17"><label>17.</label><citation citation-type="journal"><collab>Centers for Disease Control and Prevention [CDC].</collab> (<year>2021</year>). Available online at: <ext-link ext-link-type="uri" xlink:href="https://www.cdc.gov/nchs/nvss/index.html">https://www.cdc.gov/nchs/nvss/index.html</ext-link> <comment>(accessed May 4, 2021)</comment>.</citation></ref>
</ref-list>
</back>
</article>