# Multi-Class Sleep Stage Analysis and Adaptive Pattern Recognition
## 1 Introduction  
Polysomnography (PSG) represents a diagnostical tool of sleep medicine based on biophysiological changes that occur during the sleep. Multimodal data acquired in sleep laboratories form multichannel records that require wire attachments to the patients in most cases. Selected physiological signals are simultaneously monitored by specific sensors [1; 2; 3] and they form time series that are recorded with different sampling frequencies and often combined with videosequences acquired by infra and thermographic imaging cameras. Figure 1(a1,a2) present an example of a multichannel PSG record 5 s long used for diagnosis and classification of sleep disorders either by an experienced neurologist or by an automatic classification model. The segmentation and pattern recognition process is based either on the analysis of the whole set of multimodal and multichannel PSG data or on the processing of data acquired by selected sensors only. The recorded PSG signals include an electroencephalogram (EEG), electro-oculogram(EOG), electrocardiogram (ECG), electromyogram (EMG), sound, movement, and breathing records (Flow), among others. Features detected by specific computational methods [4; 5; 6; 7; 8] are then used to help neurologists to make a diagnosis and propose the appropriate treatment. Sleep features are very specific and there exist many studies proposing machine learning [9; 10] for the automatic detection of sleep stages [11; 12; 13; 14]. A specific interest is devoted to the use of hidden Markov models for automatic sleep staging [15; 16; 17], to the relation between the adjacent sleep segments, and to deep convolutional neural network [18; 19] as well. Figure 2 presents the rapidly growing interest in the PSG data analysis as illustrated by the number of papers registered in the Web of Science (WoS) database. This increase can be observed both in the area of sleep stages classification (Figure 2a) and machine learning for detection of sleep disorders (Figure 2b). The mostly cited papers (according to the WoS) published recently and devoted to PSG include those of sleep stages classification [20] and machine learning for sleep disorders detection [21; 22] with detail comparative reviews of methods and results achieved. Figure 1: Principle of sleep feature classification using a two-layer neural network with sigmoidal and softmax transfer functions presenting (**a1,a2**) a sample record of multichannel data 5 s long recorded with the sampling frequency of 200 and 10 Hz, respectively; (**b**) neural network structure for pattern recognition estimating probabilities of individual classes and evaluating the most probable class for each column vector of input features; and (**c,d**) evaluated and target probabilities (%) of output classes for selected patterns (detail of Figure 3d and \(S2=5\)). Figure 2: The time evolution of number of journal papers devoted to analysis of (**a**) sleep stages and their classification and (**b**) sleep disorders and machine learning according to the Web of Science. The present paper is devoted to the statistical distribution of sleep stages related to age and diagnosis [23] and to their classification, using neural networks [24; 25; 26; 27] with sigmoidal and softmax transfer functions. The mathematical features of each segment are summarized in the pattern matrix and associated with target classes specified by an experienced neurologist. The classification system is presented in Figure 1b. The proposed adaptive process incorporates the prior experience of a neurologist into the decision process using man-machine interaction. The proposed algorithm was applied for the adaptive recognition and classification of sleep stages [20; 28; 29; 30; 31; 32] using both EEG data [13; 33] and PSG signals, using their spectral components for the estimation of sleep features. Sleep scoring assumes the knowledge of the Flow, EMG, and EOG records in addition to EEG signals but they affect EEG records as well.