# A Contribution for the Automatic Sleep Classification Based on the Itakura-Saito Spectral Distance

Eduardo Cardoso, Arnaldo Batista, Rui Rodrigues, Manuel Duarte Ortigueira, Cristina Bárbara, Cristina Martinho, Raul Rato

► To cite this version:

Eduardo Cardoso, Arnaldo Batista, Rui Rodrigues, Manuel Duarte Ortigueira, Cristina Bárbara, et al. A Contribution for the Automatic Sleep Classification Based on the Itakura-Saito Spectral Distance. First IFIP WG 5.5/SOCOLNET Doctoral Conference on Computing, Electrical and Industrial Systems (DoCEIS), Feb 2010, Costa de Caparica, Portugal. pp.373-380, 10.1007/978-3-642-11628-5_41. hal-01060761

HAL Id: hal-01060761

https://inria.hal.science/hal-01060761

Submitted on 17 Nov 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
A Contribution for the Automatic Sleep Classification
Based on the Itakura-Saito Spectral Distance

Eduardo Cardoso¹, Arnaldo Batista¹, Rui Rodrigues², Manuel Ortigueira¹,
Cristina Bárbara³, Cristina Martinho³ and Raul Rato¹

¹Dept. of Electrical Engineering, Faculty of Sciences and Technology –University Nova of Lisbon. Campus de Caparica, 2825-516 Portugal
agb@fct.unl.pt

²Dept. of Mathematics, Faculty of Sciences and Technology –University Nova of Lisbon. Campus de Caparica, 2825-516 Portugal

³Hospital Pulido Valente; Laboratory of Sleep Pathologies of the Pneumology Department.

**Abstract.** Sleep staging is a crucial step before the scoring the sleep apnoea, in subjects that are tested for this condition. These patients undergo a whole night polysomnography recording that includes EEG, EOG, ECG, EMG and respiratory signals. Sleep staging refers to the quantification of its depth. Despite the commercial sleep software being able to stage the sleep, there is a general lack of confidence amongst health practitioners of these machine results. Generally the sleep scoring is done over the visual inspection of the overnight patient EEG recording, which takes the attention of an expert medical practitioner over a couple of hours. This contributes to a waiting list of two years for patients of the Portuguese Health Service. In this work we have used a spectral comparison method called Itakura distance to be able to make a distinction between sleepy and awake epochs in a night EEG recording, therefore automatically doing the staging. We have used the data from 20 patients of Hospital Pulido Valente, which had been previously visually expert scored. Our technique results were promising, in a way that Itakura distance can, by itself, distinguish with a good degree of certainty the N2, N3 and awake states. Pre-processing stages for artefact reduction and baseline removal using Wavelets were applied.

**Keywords:** Sleep Staging; EEG signal processing; AR modelling; Itakura-Saito Distance.

# 1 Introduction

According to the new criteria based on the Rechtschaffen and Kales(R&K) rules, the human sleep is divided in two phases, the rapid eye movement (REM) and the non-rapid eye movement (NREM).sleep [1]. The NREM is divided into three stages, N1, N2 and N3, being N3 the deepest state of sleep. The various states are distinguished on the basis of pattern changes in the electroencephalogram (EEG), electromyogram (EMG) and electro-oculogram (EOG). The depth of non-REM sleep stages are arranged from the lighter to the deepest, as follows: N1, N2 and N3. The awake state is characterized by alpha frequencies (8 – 13Hz), to score an epoch as awake is just
necessary that over 50% of the epoch has alpha rhythm. The REM state has low chin EMG tone, saw-tooth waves, trains of sharply contoured or triangular, often serrated, 2-6 Hz waves maximal in amplitude and symmetrical EOG deflections. The N1 is characterized by mixed frequency activity (4-7 Hz) and low amplitude waves and slow eye movement. Following the N1 is N2 when spindles or K-complexes disassociated with arousals occur. A spindle is a train of distinct waves with frequency 11-16 Hz (most commonly 12-14 Hz) with duration 0.5 seconds, usually maximal in amplitude in central derivations. K-complex is a well-delineated negative sharp wave immediately followed by a positive component standing out from the background EEG, with total duration around 0.5 seconds, usually maximal in amplitude when recorded from frontal derivations. For an arousal to be associated with a K complex, it must begin no more than 1 second after the termination of the K complex. The N3 stage shows waves of frequency 0.5-2Hz and peak-to-peak amplitude higher than 75 µV, when these waves occupy more than 20 to 50% of the 30 seconds epoch, this is scored as N3.

The five stages of sleep, including their repetition, occur cyclically in a normal subject. The first sleep cycle which ends after the conclusion of the first REM stage, usually lasts for about 100 minutes. Each subsequent cycle lasts longer, as its respective closing REM stage extends in duration. So a subject with a regular sleep can complete five cycles in a typical sleep night. This sleep cycle is variable, influenced by several agents such as sleep deprivation, frequently changing sleep schedules, stress and environment effects. Another factor that affects the sleep cycle is age: during infancy and childhood the percentage of REM sleep is highest, decreasing with age [2]. Figure 1 shows the sleep cycles in childhood, early adulthood and old age [3]. Figure 2 shows the relative distribution of the wake, REM and Slow wave sleep (N3) along age [4]. REM period decreases and stabilizes at around 16 years of age, while the awaking period steadily increases with age. REM sleep is associated with the development of the brain in the early life.

The aim of our work is to contribute to the automatic sleep classification using the EEG signal (C3-A2) signal and the Itakura-Saito [5] spectral distance estimator. A spectral template for the wake state is firstly obtained. This template is then compared with all the spectral representations of all night epochs. Without any further processing a hypnogram is obtained where N2, N3 and wake states are distinguishable. However N1 and REM stages are often indistinguishable, requiring other detection strategies, namely using the EOG. This scoring falls in the category of a continuous unsupervised sleep staging for an all night session.

## 2 -Contribution to Technological Innovation

This paper presents the following main contributions to innovation:

1. An automated process to the calculation of the awake spectrum template based on the spectrogram and the AR modeling. This procedure is adequate for a un-supervised sleep classification scheme.

2. Validation of the ISD as a tool for the Sleep Classification

Implementation of a software tool that incorporates the developed algorithms in a user friendly interface (SleepLab).
# 3 Materials and Methods

Sleep EEG data from Hospital Pulido Valente was used in this work. EEG signals were recorded at a rate of 100Hz. Visual sleep scoring of sleep stages were scored by Hospital experts, according to Rechtschaffen & Kales based on 30-second epochs. These hypnograms stand as our reference.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Reference hypnograms for childhood, early adulthood and old age [3].</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Fig. 2. Wake, REM and deep sleep time along age. [4].</figcaption></figure>
**3.1 Pre-Processing**

We have dealt with signal saturation commonly occurring in continuous EEG recordings by replacing each of these epochs by the previous one, a procedure also used in the visual scoring. Baseline removal was performed through wavelet filtering. Movement artefacts that lead to abnormal signal amplitudes were dealt in the same way as in saturation cases. In all cases the affected epochs were replaced by the previous ones, a procedure also used in the visual scoring.

**3.2 Awake Template Estimation**

An awake template is required for the purpose of the spectral similarity test. Awake epochs were obtained via the power spectrum (Welch method) of each epoch, and then selecting the epochs whose power spectrum peak lie between 8 and 11 Hz, and is above a selected threshold. Due to spindle activity and other EEG components, this power peak must be predominant in order for the epoch classified as awake. An autoregressive (AR) spectral estimation of all the awake classified epochs are calculated, and their mean represents the awake template. Figure 3 represents the power spectrum of the template (solid) and of a sleep epoch (solid) relative to a study patient. The power spectrum of the EEG epochs typically exhibit two main peaks.

<figure><img src="image_4.png" /><figcaption>**Fig. 3.** Spectrum of the obtained EEG awake template (solid) and a sleep epoch for the same patient (dash). See text.</figcaption></figure>

Its relative location and value varies according to the sleep/awake state. The order of the AR model has been estimated based on three factors: the Minimum Description
Length (MDL), the Final Prediction Error (FPE) and the Akaike Information Criterion (AIC). All this factors pointed out to an optimal model order of 6 [6] [7].

## 3.3 Itakura-Saito Distance

This tool [5] [8] is used to compare each EEG epoch with the mentioned template, using their spectra, since the Euclidian distance is inadequate for this case. In this study we have used AR modelling for obtaining the spectra [9][10]. The Itakura-Saito spectral distance (ISD) $d_{IS}$ is defined by the general expression:

$$d_{IS} = \int_{-\pi}^{\pi} \left[ \frac{|X(\omega)|^2}{|S(\omega)|^2} + \log \left( \frac{|S(\omega)|^2}{|X(\omega)|^2} \right) - 1 \right] \frac{d\omega}{2\pi} \quad (1)$$

where $S(\omega)$ is the spectrum of the epoch under study and $X(\omega)$ is the template spectrum. This distance is sensible to the relative spectra amplitudes which can be a benefit since some sleep staging can be performed based on the EEG amplitude, namely the higher amplitudes normally present in the N3. However this becomes drawback if the EEG also has amplitude fluctuations due, for instance, to electrode displacement. To overcome this, we have normalized all the spectra to have unity gain, at zero frequency, being the price paid for this to reduce sensibility to the signal amplitude and therefore decreasing N3 detection rate. After some experimentation we have found that this option produced better results in our cases. Itakura-Saito distance has been used in the context of speech recognition and measures the dissimilarity of two spectra $S(\omega)$ and $X(\omega)$, having the functions peaks a predominant weight in the $d_{IS}$ value, which makes sense in our case where peaks in certain frequency bands define the respective sleep stage.

## 4 Results

Figure 4 shows a patient hypnogram expert scored (blue) and the Itakura-Saito Spectral (ISD) distances obtained as described above (green). The ISD has not been processed, besides a 4 coefficient moving average filter. We confirm that the awake states follow the hypnogram therefore validating our template.

Stages N2 and N3 are also detected. REM is also detected although with lesser accuracy. This patient, as most of the others, exhibit only a few N1 epochs being therefore not possible to fully assess the ISD to detect this state. It is also patent that the ISD plot allows for the evaluation of the way the sleep state continuously progress from stage to stage, unlike the visual scoring that produces discrete stage transitions. Figure 5 shows the mean and standard deviation of the ISD values for each visual scored stage, for the same patient. As expected ISD is lower in the awake state and higher in the N3 state. N1 and REM stages are similar spectral wise, which can be seen in this figure.
<figure><img src="image_5.png" /><figcaption>**Fig. 4.** Visually scored hypnogram (blue) and ISD automatic scoring (green). See text.</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>**Fig. 5.** Mean and standard deviation of the ISD for each visually scored stage. See text.</figcaption></figure>

A software tool named *SleepLab* was developed in *Matlab* [11] to streamline the data pre-processing, template estimation and Itakura-Saito distance. The user interface is shown in Figure 6. Other versions of the Itakura distance are also obtained for comparison purposes. This platform is opened to future developments as *ICA (Independent Component Analysis)* to remove the EOG artifacts, and sleep spindle detection. This is an open platform that will include newer developments.
<figure><img src="image_7.png" /><figcaption>**Fig. 6.** A screen-shot of the user interface. The *Save* button exports all the results and models for comparison and statistical studies.</figcaption></figure>

# 5 Conclusions and Future Work

Continuous EEG signal analysis for automatic sleep classification is a difficult task. This kind of signal is typically affected by the usual artifacts related to the patient unpredictable movements and possible electrode displacements during the sleep period. We have introduced an automatic procedure to obtain the awake template using the spectrogram of all the night's epochs, which is computationally very efficient and essential for the ISD calculation. We have used the ISD formulation (distortion measure) which we have found to produce better results than the gain-optimized Itakura-Saito distortion measure generally used [4]. It is still unclear which of the distortion measures better suits the sleep scoring via EEG signal analysis, and we intend to continue the research in order to differentiate and assess the different spectral distances measures for this task. In this work the ISD produced automatic hypnograms that could detect the awake, N2 and N3 states. The assessment of the N1
is compromised by the fact that this state is relatively rare among the tested patients. The REM is identical to the N1, spectral wise, and therefore requires other features to be automatically detected, namely the EOG.

We also intend to submit the *ISD* obtained results to a Neuro-Fuzzy classifier, as this seems to be an obvious step to follow. Furthermore, we plan to use the EOG as a classifier of the REM stage and apply further artifact removing techniques such as ICA. EMG chin activity is planned to be introduced as an important indicator of sleep deepness.

## References

1. Akaike, H.: Power spectrum estimation through autoregressive model fitting. In: Annals of the Institute of Statistical Mathematics. vols. 21, pp. 407--419 (1969)

2. Ebrahimi, F., et al.: Assessment of Itakura Distance as a valuable feature for computer-aided classification of sleep stages. In: Conference Information: 29th Annual International Conference of the IEEE-Engineering-in-Medicine-and-Biology-Society. Vols. 1-16, pp. 3300--3303 (2007)

3. Estrada, E., Nazeran, H. and Nava, P.: Itakura Distance: A useful similarity measure between EEG and EOG signals in computer-aided classification of sleep stages. In: 27th Annual International Conference of the IEEE-Engineering-in-Medicine-and-Biology-Society. Vols. 1-7, pp. 1189--1192 (2005)

4. Gray, R., et al.: Distortion Measures for Speech Processing. In: IEEE Transactions on Acoustics, Speech and Signal Processing. vol. 28, pp. 367--376 (1980)

5. Iber, C., et al.: The American Academy of Sleep Medicine Manual for the Scoring of Sleep and Associated Events (2007)

6. Kandel, E., Schwartz, J. and Jessell, T.: Principles of Neural Science (2001)

7. Kay, S.: Modern Spectral Estimation: Theory and Application (1999)

8. Nicolau, M, et al. : Why we sleep : the evolutionary pathway to the mammalian sleep. In: Progress in Neurobiology. Vols. 62, pp. 379--406 (2000)

9. Rechtschaffen, A. and Siegel, J.: Sleep and Dreaming. In: Principles of Neuroscience (2000)

10. Soong, F. and Sondhi, M.: A Frequency-Weighted Itakura Spectral Distortion Measure and Its Application to Speech Recognition in Noise. In: IEEE International Conference Acoustics, Speech and Signal Processing. Vols. 12, pp. 625--628 (1987)

11. Matlab Signal Processing Tollbox. Inc, Matworks.