Next Article in Journal
Spatial-Temporal Dynamic Evolution of Land Deformation Driven by Hydrological Signals around Chaohu Lake
Previous Article in Journal
Optimization of Thermal Control Design for Aerial Reflective Opto-Mechanical Structure
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Autonomous Sleep-Stage Detection Technique in Disruptive Technology Environment

by
Baskaran Lizzie Radhakrishnan
1,†,
Kirubakaran Ezra
2,†,
Immanuel Johnraja Jebadurai
1,
Immanuel Selvakumar
3 and
Periyasami Karthikeyan
4,*
1
Department of Computer Science and Engineering, Karunya Institute of Technology and Sciences, Coimbatore 641114, India
2
Department of Computer Science and Engineering, Grace College of Engineering, Coimbatore 628005, India
3
Department of Electrical and Electronics Engineering, Karunya Institute of Technology and Sciences, Coimbatore 641114, India
4
School of Computer Science and Engineering, RV University, Bengaluru 560059, India
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Sensors 2024, 24(4), 1197; https://doi.org/10.3390/s24041197
Submission received: 21 December 2023 / Revised: 7 February 2024 / Accepted: 8 February 2024 / Published: 12 February 2024
(This article belongs to the Section Biomedical Sensors)

Abstract

:
Autonomous sleep tracking at home has become inevitable in today’s fast-paced world. A crucial aspect of addressing sleep-related issues involves accurately classifying sleep stages. This paper introduces a novel approach PSO–XGBoost, combining particle swarm optimisation (PSO) with extreme gradient boosting (XGBoost) to enhance the XGBoost model’s performance. Our model achieves improved overall accuracy and faster convergence by leveraging PSO to fine-tune hyperparameters. Our proposed model utilises features extracted from EEG signals, spanning time, frequency, and time–frequency domains. We employed the Pz-oz signal dataset from the sleep-EDF expanded repository for experimentation. Our model achieves impressive metrics through stratified-K-fold validation on ten selected subjects: 95.4% accuracy, 95.4% F1-score, 95.4% precision, and 94.3% recall. The experiment results demonstrate the effectiveness of our technique, showcasing an average accuracy of 95%, outperforming traditional machine learning classifications. The findings revealed that the feature-shifting approach supplements the classification outcome by 3 to 4 per cent. Moreover, our findings suggest that prefrontal EEG derivations are ideal options and could open up exciting possibilities for using wearable EEG devices in sleep monitoring. The ease of obtaining EEG signals with dry electrodes on the forehead enhances the feasibility of this application. Furthermore, the proposed method demonstrates computational efficiency and holds significant value for real-time sleep classification applications.

1. Introduction

The twenty-first century is witnessing a significant spurt in patients having sleep-related issues. The growing percentage of sleep-related problems and their grave association with cardiovascular, immunological, metabolic, and cognitive dysfunctions are a severe concern of the present technologically advanced world. Researchers address this trend as a severe public health issue [1]. Among the sleep-tracking approaches, the gold standard for estimating sleep is polysomnography (PSG). Although there are numerous advantages to using PSG in clinical sleep assessment, the high cost limits its accessibility to many people. Furthermore, factors such as an unusual sleeping environment, restricted privacy in the sleep lab, skin irritation due to adhesion from electrodes, multiple leads linked to the person, and crossing wires, could impede sleep. The factors cited above lower the accuracy of sleep recordings [2].
There has been a constant evolution in adopting home-based sleep monitoring systems, particularly in this COVID era [3]. Technology is the critical enabler in designing robust, convenient, and low-cost home-based sleep monitoring systems using single-channel (SC) EEG (dry or wet) [4,5]. In-home-PSG is a valid alternative to in-sleep lab PSG without compromising the gold standard aspect. In-home scenarios, Raspberry Pi (R-Pi) is a popular choice to capture EEG signals; it facilitates designing low-cost and affordable sleep monitoring systems [6,7]. The captured signals are processed and classified as distinct sleep stages using automated sleep-stage classification (ASSC) systems.
In ASSC systems, machine learning is crucial in classifying the sleep stages. Many researchers have presented several methods for ASSC employing single-channel EEG. A reliable and accurate ASSC provides healthcare providers with efficient and meaningful information [8]. Even though single-channel provides cheap ASSC schemes, designing a practical, accurate ASSC remains challenging. The real challenge is to develop an efficient and robust ASSC system that preserves crucial discriminatory information for improved classification accuracy. Consequently, systematic electroencephalogram (EEG) signal handling is mandatory for an efficient automated EEG signal classification [9]. It has led to the development of many computer-based single-channel EEG analysis and classification approaches, discussed in the related work Section 2. The typical ASSC systems using machine learning follow the following workflow:
  • Data collection or extraction;
  • Pre-processing (filtering and removing unnecessary data points);
  • Converting the signal into epochs;
  • Feature extraction;
  • Classification.
Extreme gradient boosting (XGBoost) is a sophisticated, robust, and powerful algorithm for predictive modelling [10]. The versatile nature of XGBoost enables it to be a better candidate for deployment in home-based low-resource scenarios [11,12]. Creating a classification model using XGBoost is very simple but uses multiple hyperparameters. Incorrect hyperparameter settings will result in poor prediction of results. Hyperparameter tuning is inevitable in designing a good-performing model. It is hard to decide on the ideal group of hyperparameters to achieve optimal performance [13]. In a tree-based model like XGBoost, when generating predictions, hyperparameters play the decision variable’s role at every node, and the numeric thresholds are applied to determine whether to move the left or right branch. Hence, this indicates the need to optimise the hyperparameters in order to improve the classification accuracy [14,15]. Particle swarm optimisation (PSO) is a widely used approach to optimise targets using population behaviour. This research proposes the PSO–XGBoost model, which blends swarm intelligence optimisation with XGBoost to improve the EEG signal’s sleep stage detection accuracy. The following are the key contributions of the proposed work:
  • A PSO–XGBoost model is proposed and implemented where PSO is used to optimise the hyperparameters of XGBoost to enrich the overall accuracy during the classification task.
  • To assess the proposed PSO–XGBoost method’s performance, the overall metrics and kappa values in each fold are compared to the existing approaches.
The remainder of this article is structured as follows. Section 2 explains the recent research using single-channel EEG. Section 3 discusses the dataset employed in experiments and the list of features extracted. Section 4 illustrates the experimental details, outcomes, and comparison with the existing works. Section 5 concludes the proposed PSO–XGBoost and its outcome.

2. Related Work

Sleep researchers have proposed diverse approaches to automate sleep scoring (sleep stage classification). Several signal processing methods and machine learning algorithms extract meaningful information from EEG signals. Generally, the performance of the machine learning approach depends on the extracted features from the data. According to the literature, time-domain, frequency-domain, and time–frequency-domain features are commonly extracted from the data and fed into the classifiers for detecting the specific sleep stages [16]. Based on the approaches, the existing works related to single-channel are grouped and presented in this section.
Various studies have highlighted the value of extracting characteristics from the EEG signal’s ensemble empirical mode decomposition (EEMD) domain. The EMD converts the nonlinear and non-stationary nature of the EEG signal into a finite set of intrinsic mode functions (IMFs). The EEMD method makes every IMF physically meaningful by quantifying the instantaneous amplitude and frequency. In [17,18,19], the authors extracted statistical moment and adaptive-noise-based features from the EMD domain. They used the classifiers Adaboost, Bagging, and RUSboost and achieved an accuracy of 90.11%, 90.69%, and 83.49%, and kappa values of 0.89, 0.89, and 0.84, respectively. In a similar approach proposed in [20], the authors obtained statistical, nonlinear, and time-domain features from the subbands of the EMD domain of the raw EEG signal. Then, the XGBoost model was trained and tested using the extracted features and attained 92.2% accuracy and 0.88 kappa.
A hidden Markov model (HMM)-based refinement has been employed and tested by some researchers to enhance the prediction accuracy of the sleep stage. Jiang et al. designed a scheme employing HMM-based refining to discover the sleep stage change probability and the classifier’s confusion matrix to train the random forest (RF) classifier. The sub-bands like δ (delta), θ (theta), α (alpha), σ (sigma), β (beta), γ (gamma), and K-complex characteristic waves are the typical components of EEG signals. Different sub-band waves in the EEG correspond to varying stages of sleep. This study decomposed the EEG signal into eight sub-bands and seven IMFs from the EMD domain. The statistical features are computed from the raw EEG, and the statistical, spectral, and fractal features are extracted from both the sub-bands and IMFs. After HMM refinement, the five-class classification using an RF classifier achieved an overall accuracy of 88.3% and 0.81 kappa [21]. A similar method proposed in [22] used nonlinear, cepstral, wavelet, time, and auto-regressive features using an RF classifier and obtained an accuracy of 81.86% and 0.74 kappa, respectively.
Researchers use a tunable-Q factor wavelet-transform (TQWT), a data-adaptive and flexible signal decomposition approach to process oscillatory signals. The authors of [23] decomposed the signal into six sub-bands with the help of TQWT. Next, statistical moment features are extracted from the sub-bands, fed into the Bagging classifier, and attained an accuracy of 78.95% and 0.82 kappa. The author, Hassan et al. [24], proposed an RF-based sleep stage classification system. First, they extracted spectral features from the EEG signal decomposed using TQWT. Next, the spectral features were fed into the RF classifier and achieved 91.50% accuracy and 0.86 kappa in five-stage classification.
A hybrid signal decomposition approach comprising EEMD and TQWT is proposed in [25]. First, the raw signals are decomposed using EEMD, and only the first two IMFs are selected. Then, the selected IMFs and the raw signal are decomposed by employing TQWT. TQWT offers the option to change the Q value in their filters to make the components more focused in the appropriate frequency bands. The first two IMFs have more fluctuation; hence, they possess more information that is valuable for classification. The most crucial EEG information with the most significant magnitude can be collected from the first four wavelet components. A total of 20 features were extracted: five statistical features from the four selected bands. Finally, the classification was performed using the bagging classifier and achieved an accuracy of 89.37% and 91.29% using the sleep-EDFx and sleep-EDF datasets [25].
More recently, researchers extracted features only from the sub-bands δ (delta), θ (theta), α (alpha), σ (sigma), β 1 (beta 1), β 2 (beta 2), γ 1 (gamma 1), γ 2 (gamma 2), and K-complex waves of EEG signals [26,27,28]. The authors employed this scheme because, during N2 and SWS sleep, the dominant waves are σ and δ . Similarly, in W and REM, the dominant waves are α and β , whereas in N1, the dominant wave is θ . Furthermore, in [27], authors mentioned that γ (30–49.5 Hz) wave impacts the classification of sleep stages and that the absence of the γ wave leads to a notable decline in performance. Additionally, after 60 years of age, the α wave slows down, and the β wave rises with age but falls beyond the age of 60 [26].
The stacking method proposed by Zhou et al. used sub-band and age features since slow-wave components vary significantly according to age [26]. Similarly, in [27], the authors used all the sub-bands mentioned above except K-complex and achieved an overall accuracy of 98.4% and 0.92 kappa using the random forest algorithm. The SVM-based sleep stage classification method proposed in [28] decomposed the signal data (EEG) into six sub-band ( l o w δ , h i g h δ , θ , α , σ , β ) waves and local extrema. Then, statistical characteristics were extracted from each sub-band. The classifier produced 90.2% overall accuracy and 0.85 kappa.

3. Proposed Technique

A reliable automated sleep stage classification system employing a single-channel EEG input is proposed in this work. Figure 1 depicts the schematic details of the proposed PSO–XGBoost system architecture. First, the input signal is filtered and segmented as 30 s epochs. Next, features are extracted from every 30 s epochs and the sub-band ( δ ,   θ ,   α ,   σ ,   β ,   γ and K-complex) epochs. The participants’ age is considered as one feature because recent studies reveal that α signals and β signals significantly differ based on a subject’s age and gender [26,27]. Furthermore, in EEG signals, low frequencies decrease, and high frequencies increase for an age group of 20–60. Moreover, for ages greater than 60, low frequencies increase. The proposed system employs PSO-based hyperparameter optimisation to enhance sleep stage classification accuracy. The PSO-based hyperparameter optimisation is a one-time process that selects the best hyperparameter set for XGBoost. The steps for selecting the best hyperparameters are elaborated in Section 3.6. The proportion of sleep stages in the data is unequal; hence, it is an unbalanced classification. The class-balancing strategy is used to handle the unbalanced classification.

3.1. Data Extraction

This study used the EEG data from the public Sleep-EDF Expanded (SEDFEx) database. SEDFEx is a widely utilised database in the sleep research domain. Most of the proposed single-channel sleep classification systems in the literature used the SEDFEx database [16]. This study employed the SEDFEx database to fairly compare and validate the suggested approach to previous studies. This database possesses 197 EEG (Pz-Oz electrode and Fpz-Cz electrode), EOG (horizontal), chin EMG, and events marked by an event marker from whole-night sleep PSG recordings. Every participant recorded their two nights of sleep. Among the 197 recordings, 153 belonged to the sleep cassette (SC) experiment. The SC experiment participants had no sleep-related disorders. The remaining 44 recordings belonged to the sleep telemetry (ST) experiment. The ST experiment participants had mild sleep difficulty; hence, their sleep was recorded after temazepam and placebo intake. All the recordings were sampled at 100 Hz (i.e., 100 data points per second). Every recording was named using a pattern SC4ssNEO-PSG.edf or ST7ssNJ0-PSG.edf. In this pattern, ss represents the subject number, and N denotes the night of recording.
The sleep technicians manually scored whole sleep stages using the Rechtschaffen and Kales method and stored them in the *Hypnogram file [29,30]. Every recording was named using a pattern SC4ssNEO-Hypnogram.edf. These hypnograms (sleep stages) comprise distinct sleep stages like W, REM, N1, N2, N3, N4 and ? W represents wake; REM denotes rapid eye movement sleep; N1 to N4 signifies non-rapid eye movement (NREM) sleep; the symbol “?” illustrates ungraded epochs. The proposed method combined the NREM stages N3 and N4 as slow-wave-sleep (SWS) as per the American Academy of Sleep Medicine (AASM) [31] guidelines. Ten healthy subjects’ PSG recordings from a sleep cassette experiment that do not have unreported events and movements were used for the experiments; the summary of selected EEG recordings used in the proposed experiments is presented in Table 1. The number of total sleep stages in the selected recording was 10,600.

3.2. Pre-Processing

The proposed study selected the Pz-Oz EEG channel since it has been utilised extensively in the literature. This bipolar channel’s signal produced greater accuracy when compared with the Fpz-Cz channel [22,27]. An artefact like eye movement is quite common in recording electrodes positioned in the back of the brain. Further, a portion of γ waves during wake and sleep stages substantially impacts sleep stage classification [32,33]. Hence, the EEG data used in the experiments are filtered using a bandpass filter. The bandpass filter is configured with a hamming window and a lower and upper passband edge of 0.5 to 49.5 Hz [27]. Subsequently, the EEG recordings are converted into 30 s epochs without any overlap. Next, the stages N3 and N4 have been renamed as slow-wave stages (SWS) for all the used EEG recordings based on the AASM manual [31]. The excess W stages are trimmed at the start and end of each PSG file used.
All the participants in the SEDFx database are adults; hence, the α wave range is altered to 9–11 Hz. Again, the posterior head’s β wave falls between 13 and 20 Hz but gradually rises to 20 to 30 Hz during the REM stage. Therefore, the β wave is split into two parts: β 1 wave (13–20 Hz) and β 2 wave (20–30 Hz) to better distinguish between the W and REM stages [26]. Additionally, the γ 1 wave is split into γ 1 (30–40 Hz) wave and γ 2 (40–49.5 Hz) wave based on the approach presented in [27]. They demonstrated that the γ wave significantly impacts the classification of sleep stages. This work agrees with earlier research [16] for the remaining wave ranges, which are recorded in Table 2. The data were normalised to mitigate the amplitude difference between different subjects.

3.3. Feature Extraction

It is a significant step for identifying essential features in data to enhance the performance of a machine learning algorithm. From the Pz-oz channel, 51 features were extracted from statistical, time, and frequency domains. The age of the participants was counted as one of the features because the α , β , and δ signals significantly differ concerning age. Finally, a total of 52 features were used for the experiments. In this work, X(m) denotes the Pz-Oz channel signal in a 30-s epoch with 3000 data points based on the sampling rate of 100 Hz. The Section 3.3.1, Section 3.3.2 and Section 3.3.3 describe the features used in this work.

3.3.1. Time-Domain Features

The morphological properties can be represented using the features extracted from the time domain. The time-based characteristics extracted in our study are presented below.
Statistical features: Moments represent a set of statistical parameters that are used to measure any distribution. Time series moments of the first to fourth order mean (average), variance (how uniformly the values are distributed around the mean), skewness (represents the shape of a distribution), and kurtosis (determines whether a distribution is peaked or flat) initially extracted [16]. Their mathematical representation is given in Equations (1)–(4).
x ¯ = i = 1 i = M x i M
X v a r = 1 M i = 1 i = M ( x i x ¯ ) 2
X s k e w = 1 M i = 1 M ( x i x ¯ ) 3 ( X v a r ) 3 / 2
X k u r t = 1 M i = 1 M ( x i x ¯ ) 4 X v a r ( x ) 2
Additional time-domain features: The additional statistical features, viz absolute additional time-domain features: The additional statistical features, viz absolute maximum value (AMV), root mean square (RMS), zero-crossing rate (ZCR), Hjorth mobility (HM), Hjorth complexity (HC), and detrended fluctuation analysis (DFA) are extracted. AMV is defined as the greatest possible point in every epoch. RMS measures the magnitude of a group of selected signals. The rate at which a signal transitions from positive to zero to negative and vice versa is known as the ZCR. Both RMS and ZCR are measured using Equations (5) and (6).
X R M S = 1 M i = 1 M x i 2
ZCR is defined as the rate of signal sign changes (positive to negative and vice versa); it can be defined as
X Z C R = 1 M 1 i = 1 M 1 R < 0 ( x ( m ) x ( m 1 ) )
where x ( m ) represents a signal size M and 1 R < 0 is the indicator function that is described as
1 R < 0 ( s ) : = 1 , if s < 1 0 , if s 0
HM parameter represents the power spectrum’s mean frequency, and HC represents the frequency change [34]. Both HM and HC are computed using Equations (8) and (9).
X H M = X v a r ( d x d t ) X v a r ( x )
X H C = X H M ( d x d t ) X H M ( x )
The sequence connectivity of a signal is analysed by DFA. Then, we applied band-pass filters to separate δ (0.5–4 Hz), θ (4–8 Hz), α (9–11 Hz), σ (12–15 Hz), β 1 (14–20 Hz), β 2 (20–30 Hz), γ 1 (30–40 Hz), γ 2 (40–49.5 Hz), and K-complex (0.5–1 Hz) waves from each epoch. After dividing the nine sub-bands, the energy feature was calculated for every epoch using Equation (10). Similarly, the peak-to-peak amplitude was also extracted [27].
X E n e r g y = i = 1 M | x i | 2

3.3.2. Frequency-Domain (FD) Features

Power spectral density (PSD) explains how the signal’s power is spread over the frequency. The squared value of the signal is used to calculate the power and measured in energy per frequency. Similarly, PPA is estimated from every sub-band [35]. These features are versatile features that are used to describe variations in EEG data. The following are the features obtained from the nine sub-bands.
  • Power features: ( δ p o w e r , θ p o w e r , α p o w e r , σ p o w e r , β 1 p o w e r , β 2 p o w e r , γ 1 p o w e r , γ 2 p o w e r and K c o m p l e x p o w e r ).
  • PPA features: ( δ a m p , θ a m p , α a m p , σ a m p , β 1 a m p , β 2 a m p , γ 1 a m p , γ 2 a m p and K c o m p l e x a m p ).

3.3.3. Time-Frequency Domain (TFD) Features

Because EEG signals are non-stationary, their properties change over time. The following are the TFD features extracted.
Entropy and complexity feature: Entropy-based approaches measure the signal’s irregularity and impurity. The following are the entropy measures extracted entropy, permutation entropy (PE), spectral entropy (SPE), singular value decomposition entropy (SVDE), and sample entropy (SE). Equation (11) is used to obtain the entropy.
X E n t r o p y = i = 1 M P i L m ( P i )
where P i represents the probability of the ith sample, and M is the count of samples [36]. PE provides a quantification measure of the complexity of an EEG signal by considering the order of relationships among the values of a signal and extracts a probability distribution from the EEG patterns. SPE measures the signal’s spectral power distribution. The SVDE quantifies the data’s dimensionality. SE estimates the randomness of EEG data without having any prior knowledge about it [16].
Next, the Lempel–Ziv complexity (LZC) and maximum and minimum distance (MMD) are extracted. LZC is utilised to evaluate the complexity of EEG signals [37]. MMD calculates the distance among the maximum and minimum signal samples in every subwindow, where Δ x m and Δ y m are the x-axis and y-axis deviations of the maximum as well as minimum signal samples in the mth window, respectively [38]. MMD is represented using Equation (12)
X M M D = i = 1 M Δ x m 2 + Δ y m 2
Fractal Features: The fractal dimension describes the behaviour of random-shaped signals by defining the measure of self-similarity on a given signal. This study included the Petrosian fractal dimension (PFD), Katz fractal dimension (KFD), Higuchi fractal dimension (HFD), and Hurst exponent (HE).
PFD turns a signal into a binary sequence and then calculates the fractal dimension [39]. The Equation (13) represents PFD.
X P F D = l o g 2 M l o g 2 M + l o g 2 ( M + 0.4 K )
KFD finds the distance (maximum) between any two points from the samples using the sum and average of the Euclidean distances in the consecutive data points of the signal [40]. KFD is represented in Equation (14).
X K F D = l o g 2 M l o g 2 M + l o g 2 ( d / L )
HFD stands for an approximation of the box-counting dimension of a signal graph. HE measures the time series’ long-term memory, i.e., the amount by which the series deviates from a random walk. The scalar denotes a time series’ relative proclivity to regress completely to the mean or a cluster in a particular direction [41].
The studies [26,42] show that EEG slow-wave components significantly differ based on the age group. Hence, the age feature is also incorporated into the feature set. Finally, a total of 52 features were extracted and are listed in Table 2.

3.3.4. Feature Shifting

The discrete data points in the EEG signals create a time sequence. That ordering generates a dependency between adjacent data points, giving more information to the classifier and improving prediction accuracy [43]. The studies [44,45] use this approach in deep learning models. This work takes a different approach to shift the features in time. The extracted 51 features are shifted one time-step forward and one time-step backward. Mathematically, let S t m = { X t m , , X m , , X t + m } X m is a sequence of 2m + 1 neighbouring data points, that is m data points from the past and m future data points. Distributing across every data point in S t k aggregating 2m + 1 outputs creates a vector size of V(2m + 1). Finally, V(2m + 1) is fed into the classifier [43]. All the extracted 52 features, except ‘age’, are shifted forward and backward at one time. Eventually, the proposed model used 3 × 51 = 153 + 1 (age feature) = 154 features. Figure 2 shows this approach. And the impact of age future in the classification performance is shown in the Supplementary Materials. This approach boosted the overall accuracy by 3% to 4% without much computation.

3.4. XGBoost

XGBoost is a popular algorithm for classification tasks. The input x j is used to make the prediction y ^ j , and it is represented in Equation (15).
y ^ j = m λ m x j m
The hyperparameters are the undetermined parts that are unknown and need to be learned from data. XGboost contains three classes of hyperparameters, namely general parameters (GP), booster parameters (BP), and learning task parameters (LTP) [10]. The model training involves finding the best hyperparameter λ for the DS ( t r ) and its labels y j . The objective function given in Equation (16) measures how well the model fits DS ( t r ) .
o b j ( λ ) = L ( λ ) + Ω ( λ )
where L is the loss during training, and Ω is the term that represents regularisation. The classification task here is a multi-class classification. Hence, ‘ m l o g l o s s ’ given in Equation (17) is used as a choice of error for the classifier.
L = 1 M j = 1 M k = 1 N y j , k l o g ( p j , k )
here, M denotes the count of training samples from the dataset DS , p j indicates the prediction by XGBoost, y j represents the actual label, and N signifies the number of output classes. Regularisation helps to control the overfitting issue, and it is defined in Equation (18).
Ω ( f ) = γ T + 1 2 λ i = 1 T ω i 2
where γ and λ represent tunable parameters, T signifies the number of leaves in a tree, and ω implies a score vector on the leaves. The XGBoost model optimises the objective function utilising an additive training procedure, i.e., the latter phase’s optimisation method relies on the preceding stage’s outcomes [10,14]. The XGBoost model’s tth objective function can be redefined by considering multi-class log loss (17) and regularisation (18) into (16).
o b j ( t ) = L ( t ) + Ω ( f t ) + C
where L ( t ) represents the ‘ m l o g l o s s ’ term of the tth round’, Ω ( f t ) represents the regularisation at the tth round’, and C is the constant term.

3.5. Particle Swarm Optimisation (PSO)

PSO is one of the population-based optimisation approaches inspired by bird flocking. In each iteration, until the ultimate optimum is detected, every particle in a swarm interacts with different particles to identify and revise its current global optimum [46]. PSO has been demonstrated to be efficient and robust in the diverse optimisation of real-world problems except for sleep stage detection [47]. For machine learning models, choosing the appropriate hyperparameter configuration directly impacts the model’s performance [48]. Hyperparameter tuning using PSO comprises these elements:
  • Tunable hyperparameter λ , ( λ 1 , λ 2 , , λ n );
  • Dataset DS ;
  • Model M ;
  • Score function F .
The parameter tuning job entails optimising a hyperparameter λ so that the model M trained in a dataset DS with hyperparameters P maximises some score function F . This is represented in Equation (20).
m a x λ F ( λ ) , F ( λ ) = s c o r e ( M ( DS ) )
To estimate the best hyperparameter configuration, accuracy is used as a scoring function.

3.6. PSO–XGBoost Classification

This section describes the proposed PSO–XGBoost method for single-channel EEG signal classification. This study optimises the XGBoost classifier’s accuracy using PSO to estimate the best hyperparameters (from the GP and BP classes) as shown in Figure 3.
Let λ be the hyperparameter set representing every possible hyperparameter of a model M . λ is partitioned into multiple subsets λ = { λ 1 , λ 2 , , λ n } , where n is the number of hyperparameters needed to train M . For every λ j , where 1 ≤ jn, distinct possibilities related to the same hyperparameter type are available for selection. One value is usually selected from every subset and assigned to M . M is trained and accuracy is measured.
In the PSO-based approach, the complete list of hyperparameter combinations refers to the search space. Particles (referred to as individuals) are navigating into hyperdimensional exploration space. The change of particle positions inside the exploration space depends on the victory of other particles. Therefore, changes in the position of particles inside the swarm are inspired by its neighbouring particles’ expertise. Moreover, the exploration activities of a particle are influenced by other particles inside the swarm. As a result, creating that social behaviour can be referred to as a stochastic process, i.e., particles return towards earlier successful regions in the swarm space. The possibilities count in search space is the product of the number of values in every hyperparameter group j = 1 m z j , where z j is the size of hyperparameter subset λ j [49,50]. The search process is continued till meeting termination criteria. All the particles traverse in S till achieving the termination criterion [14,51,52]. The detailed algorithm for the best hyperparameter estimation using PSO is as follows.
  • The search space for PSO is initialised. It is bounded by the maximum and minimum values of the hyperparameters. The search space is n-dimensional with n as the number of hyper-parameters to be optimised.
  • Inside the search space, m particles are generated randomly. Each particle is a vector of length n. Every particle k in the exploration space (search space) S has a position (location) ( P ) and velocity ( V ) characteristics. The position describes a set of hyperparameters ( P k ) of M , and the velocity defines every particle’s traverse path in the search space over every dimension (hyperparameter). P k is depicted as P k = { P k 1 , P k 2 , …, P k n } , where P k d represents the position of the particle in a dimension d, 1 ≤ d ≤ n, n is the number of dimensions. V k is represented as V k = { V k 1 , V k 2 , …, V k n } , where V k d refers to the velocity of the particle in a dimension d, 1 ≤ dn.
  • The inertia and learning (cognitive and social) parameters of PSO are set. The velocity vector of each particle is set to zero. The best positions of the individual particles (local best) are assigned as current positions.
  • For each particle in the set, the model M is trained and accuracy is measured. The particle with high accuracy is assigned as the global best particle. The best positions of the individual particles are updated based on their corresponding model accuracy. In a particle search space, each particle contains information regarding the local best ( P l b ) and global best ( P g b ) position. In each iteration, every particle is compared to its P l b and P g b . On finding a better solution, the P l b and ∥ or P g b are updated.
  • The velocity of each particle is updated. Then particles are moved to new positions through the updated velocity.
    V k d j + 1 = ω V k d j + c 1 r 1 ( P l b k d j P k d j ) + c 2 r 2 ( P g b k d j P k d j )
    P k d j + 1 = P k d j + V k d j + 1
    where V k d j represents the j th particle’s velocity in d during the iteration j. P k d j denotes the j th particle’s position in d during iteration j. P l b k d j indicates the achieved position of the particle in d during iteration j. P g b k d j specifies the best solution achieved in the search space till the j th iteration in d. The other variables, ω , r 1 and r 2 , c 1 and c 2 are inertia weight, random numbers and social and cognitive parameters, respectively.
  • The process is repeated from Step 4 until the stopping criterion is met. In this work, the maximum number of iterations has been selected as the stopping criterion.
  • The global best particle gives the best hyper-parameter set for the model ( M ) .

4. Experiment

4.1. Experimental Setup

The entire experiments of this paper were implemented and tested using the Python 3.6.3 environment. The MNE Python library was used to accomplish preprocessing and converting the data into 30 s epochs [53]. The Optunity Python was used to perform hyperparameter optimisation for PSO implementation [54].
The model’s training employs the subject-independent strategy to emphasise the significance of generalisation and model robustness. After combining all the subject data listed in Table 1, features were extracted for processing. The features extracted from the EEG signal were divided into training and testing data using a stratified-k-fold CV to assess the model’s performance. It ensures training and test sleep stages have the same proportion of the stages as available in the dataset. Implementing a target variable provides the cross-validation outcome, a near approximation of generalisation error. In our experiments, the value of k was set to ten; hence, the data was split into ten parts (nine parts used for training and the one left used for testing) [55]. During the data stratification, every fold included the balanced proportions of five classes (W, N1, N2, SWS, and R), which helps to avoid selecting a specific training and testing test. Two experiments were carried out. The default hyperparameter setting of the XGBoost classifier was employed in the first experiment. Next, the second experiment used the PSO-optimised hyperparameters.
The XGboost’s hyperparameters classes GP and BP were tuned to put our proposed approach into action. GP relates to the type of booster used, and we considered ‘ g b t r e e ’ and ‘ d a r t ’ based on the objective (multiclass classification). BP depends on the type of booster selected. The PSO uses all the parameters related to the tree booster. While using the ‘ d a r t ’ booster, XGBoost uses dropouts, leading to evaluating some trees alone; hence, ‘ n t r e e _ l i m i t ’ was used in the predict function. LTP decides the learning environment. The LTP parameters ‘ o b j e c t i v e ’ and ‘ e v a l _ m e t r i c ’ correspond to the learning objective. For ‘ o b j e c t i v e ’, we used ‘ m u l t i s o f t m a x ’ (multiclass) and its mandatory parameter ‘ n u m _ c l a s s ’ was set to 5 (count of output classes). For ‘ e v a l _ m e t r i c ’, we used ‘ m l o g l o s s ’ during training–testing and ‘ m u l t i s o f t p r o b ’ was used for the ROC curve. In order to design the best fitness function, classification accuracy was considered. Therefore, the particle having a better fitness value produces good accuracy during classification [14,51,52].

4.2. Performance Evaluation

Indeed, observing the classification performance on a validation set is an excellent way to obtain feedback on the developed classifier. It is also an invaluable tool for comparing two distinct models. Our ultimate goal is to create a better, more accurate model that assists in making better decisions in real-world scenarios. Researchers widely adopted the stratified K-fold cross-validation (CV) technique in multi-class classification to estimate the error rate. The data were arbitrarily partitioned into ten balanced proportions (K = 10), with each class represented in roughly the same proportions as the complete dataset. As a result, the learning operation was repeated ten times on distinct training sets. Eventually, an overall error estimate was calculated by averaging the ten error estimates. It enables us to lower the bias rate with random samples. The CV accuracy ( C V A c c ) implies the k individual accuracies [55].
C V A c c = 1 K j = 1 K A c c j
where K represents the count of folds, and A c c j describes the calculated accuracy in each fold.
In a multi-class classification scenario, metrics like accuracy or precision/recall do not give us a complete view of the classifier’s performance. Cohen’s kappa ( κ ) statistic is an excellent metric for handling multi-class and imbalanced-class issues [56,57].
κ = P o P e 1 P e
The observed agreement is P o , whereas the projected agreement is P e . It essentially informs how well the classification algorithm performs compared to a classifier that guesses at random depending on the frequency of every class. Kappa is never greater than or equal to one. As per the Landis et al. method, the κ value of 0 shows no agreement, κ range 0.21–0.40 indicates fair, κ range 0.41–0.60 represents moderate, κ range 0.61–0.80 indicates substantial, and κ range 0.81–1 signifies a nearly ideal agreement [56]. The receiver operating characteristic (ROC) study is a primary tool for diagnostic accuracy in clinical medicine, and assesses and presents all possible combinations of specificity and sensitivity. The area under the curve (AUC) is a performance criterion for issues in classification at diverse threshold levels. The degree of separability is explained by AUC, while ROC explains the probability curve. It shows how well the model can differentiate across classes [58].

4.3. Experiment 1: Classification Using Default Hyperparameters

This experiment used the XGBoost model with the default hyperparameter values except for ‘ o b j e c t i v e ’ and ‘ n u m c l a s s ’. The ‘ o b j e c t i v e ’ and ‘ n u m _ c l a s s ’ parameters used ‘ m u l t i : s o f t m a x ’ and five, respectively, based on the target classes count. The classifier’s performance was measured using stratified K-fold CV, prediction accuracy, f1-score, precision, recall, and kappa. Table 3 shows the hyperparameter set and the default values used in the experiment. The ‘ b o o s t e r ’ parameter values can be ‘ g b t r e e ’ and ‘ d a r t ’. Both boosters ‘ g b t r e e ’ and ‘ d a r t ’ were tested separately. The ‘ d a r t ’ booster achieved a higher accuracy level than g b t r e e . When using ‘ g b t r e e ’ as a booster, it uses a bunch of additional parameters presented in Table 3. This experiment considered the default values for the additional parameters related to the ‘ d a r t ’ booster. As shown in Table 4, the XGBoost classifier achieved a mean, maximum, and minimum accuracy of 84.5 % ,   84.9 % , and 83.4 % , respectively. This experiment achieved an accuracy level of some existing research works that used the sleep-EDFx repository’s Pz-Oz channel [19,22]. Additionally, the achieved classification accuracies provide a reference to improve the capability of the proposed PSO–XGBoost model. The mean confusion matrix from the 10-folds are presented in Figure 4. Figure 5 represents the multi-class logloss of the classifier during training and testing. The classifier’s error during training and testing is presented in Figure 6. Finally, the class-wise accuracy between different sleep stages is depicted in Figure 7 using the receiver operating characteristic graph.
In the default hyperparameter experiment, even though the classifier achieved decent results, it suffers from classification errors. Figure 6 and Figure 7 show that the classifier failed to draw a correct boundary between classes. Hence, there is an increased classification error between sleep stages. Figure 4 shows the misclassification rate between sleep stages (W, N1, N2, SWS, and REM). When classifying sleep stage W, the classifier ends up classifying as N1 (15.4), N2 (11), and REM (6.8). The misclassification rate between W and N1 is high compared to the other sleep stages. Similarly, the classifier faces issues in detecting sleep stage N1 from N2 (24) and REM (35.4); here, error percentage is very high. Additionally, the classifier encounters an issue when classifying N2 with N1 (18.5), SWS (17.7), and REM (12.5). Again, when classifying SWS with N1 (11) and N2 (10.5), the error percentage is less. Finally, the misclassification count between REM vs. N1 (26.6) is very high. Even though the classifier is trained with the essential features extracted from different domains, it fails to make a clear boundary between the classes. It can be improved by creating an optimal model with suitable hyperparameters.

4.4. Experiment 2: Classification Using PSO Optimised Hyperparameters

The proposed PSO–XGBoost classification approach improves the XGBoost classification method by automatically optimising the hyperparameters using PSO. This experiment aims to find the effectiveness of this methodological improvement using the sleep-EDFx repository’s Pz-Oz channel. The training dataset is utilised for training the proposed PSO–XGBoost classifier. The PSO–XGBoost classifier’s accuracy is tested with the test samples at the end of the optimisation procedure. The achieved average accuracy is 95.4%, which is an increase in accuracy over the XGBoost classifier’s output (using a ‘ d a r t ’ booster). The PSO–XGBoost results are shown in Table 5; the classifier achieved mean, maximum, and minimum accuracies of 94.0 % , 95.0 % , and 93.0 % , respectively. The results exhibit the PSO–XGBoost classifier’s ability to subdue the gap between the lower and the better class accuracy while preserving high overall accuracy. The mean confusion matrix from the 10-folds is presented in Figure 8. Figure 9 represents the multi-class logloss of the classifier during training and testing. The classifier’s error during training and testing is presented in Figure 10. Finally, the class-wise accuracy between different sleep stages is depicted in Figure 11 using the receiver operating characteristic graph. In the optimal hyperparameter experiment, Figure 10 and Figure 11 show significant improvement in the error rate and classification error. Similarly, Figure 8 shows that the classifier has improved its decision boundary between the sleep stages. After tuning the model with optimal hyperparameters, the misclassification rate reduced between W and N1 (3.1), N2 (1.4), and REM (1.1). Similarly, the misclassification error decreased between N1 and N2 (3.7), SWS (0), and REM (2.5). Here, the misclassification rate of SWS becomes zero, which is a considerable achievement. The misclassification rate declined between N2 with N1 (8.6), SWS (11.9), and REM (6.6). Again, when classifying SWS with N1 (0), N2 (6.9), and REM(0), the error percentage reduced a lot. Finally, the misclassification count between REM vs. W (0), N1 (3.5), N2 (3.6), and SWS (0.0) has dropped when compared with experiment 1. The experiment 2 results reveal a significant improvement in overall accuracy and a notable reduction in error rate. Tuning the model parameters using PSO positively impacts the results and creates a better model.
According to sleep-stage classification literature [16], a considerable amount of work either implemented upsampling or downsampling of the whole dataset to balance sleep class categories. This approach procedure might produce less generalisation ability and overfitting. Even though this approach improves performance to some degree, it is improper. This work upsampled only the training data to address the class imbalance problem. It could assist the classifier in improving the accuracy of less-represented sleep stages.
The minute inter-class difference is always common in the EEG signals. The PSO–XGBoost approach used the advantage of adjacent epoch information with the current epoch using feature shifting. It facilitated the classifier to detect classes more accurately. The confusion matrix Figure 8 clearly visualises it.
As stated in Section 2, some studies implemented the signal decomposition approaches such as EMD [17,18,19], TQWT [23,24], and the hybrid approach [25]. Though these works achieved decent classification results, they are computationally intensive. The PSO–XGBoost approach conducts the signal decomposition using sub-bands. It can be achieved using a digital filter and is computationally less intensive. Also, recent works demonstrated that extracting features from the sub-bands contributes significantly to a better classification outcome [26,27,28].
The outcomes of the experiments (Table 4 and Table 5) present the mean accuracy, f1-score, precision, recall, and kappa using the stratified 10-fold CV from XGBoost and PSO–XGBoost. According to the nature of the classification task, the multi-class logloss played a vital role in choosing the best model. PSO–XGBoost subdued logloss, as shown in Figure 9, which is lesser than those obtained using the default parameter values represented in Figure 5. PSO–XGBoost reduced the validation errors in Figure 10 that are lesser than the validation errors when using default hyperparameter values in Figure 6. Although the XGBoost with default hyperparameters showed better classification prediction performance for the sleep-EDFx dataset, the accuracy rate is not fair enough. Therefore, the proposed PSO–XGBoost is capable of providing a solution with minimised error rates and logloss. In our experiments, PSO presented more optimal parameter values for XGBoost. The classification summary of both XGBoost with default hyperparameters and PSO–XGBoost is presented in Figure 4 and Figure 8. Figure 8 clearly shows that the percentage of false negatives significantly reduced after optimisation.
Generally, for the larger dataset, when the search space is more extensive, the computational cost of PSO is high. Because it requires training and testing multiple classifiers, PSO’s fitness function becomes slow. However, this can be solved with distributed PSO.
The performance achieved by the ‘ d a r t ’ booster method for classifying sleep stages rests in the following: First, the input features are extracted for classification. Second, the most relevant features derived from the EEG signal are based on the processing method. The characteristic patterns of EEG in varying frequency ranges have a high correlation with sleep stages. For this specific reason, features were also extracted from the signal sub-bands δ (delta), θ (theta), α (alpha), σ (sigma), β 1 (beta-1), β 2 (beta-2), γ 1 (gamma-1), γ 2 (gamma-2), and K-complex. It allows the design of more accurate single-channel sleep monitoring systems for automatic sleep stage detection [26,27].
Accurate identification of the sleep stage from an EEG signal is essential for diagnosis and medication. The proposed PSO–XGBoost model classifies the sleep stages from an EEG signal with a mean accuracy level of 95.4%. The AU–ROC curve counts on the PSO–XGBoost classifier’s performance in a classification task. This result improved the ROC AUC and F-measure of PSO–XGBoost; it achieved better accuracy than the existing classification methods listed in Table 6. The mean κ value and κ value from each fold during experiment 1 and experiment 2 are presented in Table 4 and Table 5. Table 5 reveals an increased agreement level in PSO–XGBoost. Also, the proposed PSO–XGBoost achieved a better κ value among the existing works [17,18,19,20,21,23,24,25,26,27,28], which as shown in Table 6.
The proposed PSO–XGBoost method helps to create a detection strategy based on repeating patterns. It can also be utilised on data collected after the primary classification system has been developed. The extracted features are robust enough to detect different sleep stages beyond the classifier’s training patterns. However, there is small discrimination in detecting the correct N2 stage from N1 and SWS since these stages have a shallow difference (Figure 8). In terms of estimating the prediction error using a 10-fold CV, the EEG data set shows that a 10-fold CV error has negligible bias. The estimated bias was little and further reduced with more training samples. Although the features are generated independently of sleep stages, a classifier with an average zero error and an average CV error near zero is possible.
Database variability is a common concern in medical research and development. For instance, two distinct systems have simultaneously monitored identical physiological variables. Hence, the data produced by both systems would differ due to the typical signal-to-noise ratio. In light of this, handling data from one of the two systems may be challenging for a learning model that has only been exposed to examples from the other. For this reason, an ML model’s generalization abilities should be assessed in a more expansive scenario, specifically by considering two or more independent data sources concerning a single task, with the data being kept separate from the model’s development and parameterisation process. To solve this problem, the proposed models’ performance is evaluated separately using different databases. Table 7 depicts the performance of proposed approaches in other databases. Ten records from each database have been used for this experiment.

4.5. Model Deployment

There is tremendous growth in home-based health systems [3]. Home-based devices are capable of delivering several advantages to a diverse user group. For example, in-home sleep monitoring can be employed in remote locations or rural areas where it is more difficult to access traditional healthcare providers. This might result in fewer hospital trips or primary care providers, saving expenditures. Also, continuous monitoring is feasible at a lower cost in a home environment. The senior generation and rural people may benefit the most from this technology.
We have deployed the PSO–XGBoost classifier on the Rasberry Pi-3 B model to verify its ability to generate features for the test data and classify sleep stages. Figure 12 depicts the variation in feature extraction time for different numbers of epochs using with and without feature selection. The mRMR feature selection approach selected 21 of the 51 features applying the mRMR technique. As depicted in Figure 12, the processing time increased in Rasberry Pi as the epochs increased. The proposed model’s post-deployment accuracy and kappa measures slightly reduced accuracy from 1% to 2%. This evaluation was performed using only SEDFx data.

5. Conclusions

Enhancing sleep-stage detection accuracy is a critical issue in automated sleep-stage classification systems. Multi-class classification issues like sleep-stage classification can effectively harness the power of PSO–XGBoost. This study presented an efficient automated sleep-stage detection approach using a PSO–XGBoost model. The Pz-Oz channel data of the SEDFx repository is used to visualise a single-channel EEG system. Features are extracted from every 30-s epoch and nine sub-bands from the Pz-Oz raw EEG signal. Next, the features are shifted in time (one step forward and backwards) to include the temporal relation between data points. A sleep-stage classification model is built using XGBoost. Then, PSO is employed to explore the optimal hyperparameters adaptively. It outperformed the existing approaches when compared with the overall classification performance. The proposed model has the following advantages. It just needs a single-channel EEG. PSO–XGBoost’s overall classification performance facilitates clinicians in precisely detecting and monitoring sleep stages. The feature shifting process is not computationally intensive and contributed to the overall accuracy improvement of 3% to 4%. The significant advantage of the PSO–XGBoost model is that it can support resource-constrained real-time in-home sleep monitoring systems. This study’s shortcoming is that to improve generalisation, the model needed to be extensively trained using data from several databases.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/s24041197/s1, Table S1: Performance of particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) using stratified-10-fold (with optimal hyperparameters) using age feature; Table S2: Performance of particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) using stratified-10-fold (with optimal hyperparameters) without age feature.

Author Contributions

B.L.R.: writing, original drafting, implementation, and validation. K.E.: conceptualisation, methodology, supervision. I.J.J.: resources, data processing, and formal analysis. I.S.: resources and technical improvements. P.K.: formal analysis and supervision. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
PSOParticle swarm optimisation
AASMAmerican Academy of Sleep Medicine
EEGElectroencephalogram
REMRapid eye movement
NREMNon-rapid eye movement

References

  1. Lane, J.M.; Qian, J.; Mignot, E.; Redline, S.; Scheer, F.A.; Saxena, R. Genetics of circadian rhythms and sleep in human health and disease. Nat. Rev. Genet. 2022, 24, 4–20. [Google Scholar] [CrossRef]
  2. Burgdorf, A.; Güthe, I.; Jovanović, M.; Kutafina, E.; Kohlschein, C.; Bitsch, J.Á.; Jonas, S.M. The mobile sleep lab app: An open-source framework for mobile sleep assessment based on consumer-grade wearable devices. Comput. Biol. Med. 2018, 103, 8–16. [Google Scholar] [CrossRef]
  3. Gaiduk, M.; Seepold, R.; Martínez Madrid, N.; Ortega, J.A. Digital health and care study on elderly monitoring. Sustainability 2021, 13, 13376. [Google Scholar] [CrossRef]
  4. Lucey, B.P.; Mcleland, J.S.; Toedebusch, C.D.; Boyd, J.; Morris, J.C.; Landsness, E.C.; Yamada, K.; Holtzman, D.M. Comparison of a single-channel EEG sleep study to polysomnography. J. Sleep Res. 2016, 25, 625–635. [Google Scholar] [CrossRef]
  5. Grosselin, F.; Navarro-Sune, X.; Vozzi, A.; Pandremmenou, K.; De Vico Fallani, F.; Attal, Y.; Chavez, M. Quality assessment of single-channel EEG for wearable devices. Sensors 2019, 19, 601. [Google Scholar] [CrossRef]
  6. Kuziek, J.W.; Shienh, A.; Mathewson, K.E. Transitioning EEG experiments away from the laboratory using a Raspberry Pi 2. J. Neurosci. Methods 2017, 277, 75–82. [Google Scholar] [CrossRef]
  7. Arif, R.; Wijaya, S.K.; Prawito; Gani, H.S. Design of EEG data acquisition system based on Raspberry Pi 3 for acute ischemic stroke identification. In Proceedings of the 2018 International Conference on Signals and Systems (ICSigSys), Bali, Indonesia, 1–3 May 2018; pp. 271–275. [Google Scholar]
  8. Pombo, N.; Garcia, N.; Bousson, K. Classification techniques on computerized systems to predict and/or to detect Apnea: A systematic review. Comput. Methods Programs Biomed. 2017, 140, 265–274. [Google Scholar] [CrossRef]
  9. Lee, P.L.; Huang, Y.H.; Lin, P.C.; Chiao, Y.A.; Hou, J.W.; Liu, H.W.; Huang, Y.L.; Liu, Y.T.; Chiueh, T.D. Automatic sleep staging in patients with obstructive sleep apnea using single-channel frontal EEG. J. Clin. Sleep Med. 2019, 15, 1411–1420. [Google Scholar] [CrossRef]
  10. Chen, T.; Guestrin, C. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd ACM Sigkdd International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar]
  11. Dhillon, N.S.; Sutandi, A.; Vishwanath, M.; Lim, M.M.; Cao, H.; Si, D. A Raspberry Pi-based traumatic brain injury detection system for single-channel electroencephalogram. Sensors 2021, 21, 2779. [Google Scholar] [CrossRef]
  12. Whetman, P. Xgboost. Hackaday. 2019. Available online: https://hackaday.com/2019/08/22/build-a-fungus-foraging-app-with-machine-learning/ (accessed on 20 December 2023).
  13. Huang, C.; Li, Y.; Yao, X. A survey of automatic parameter tuning methods for metaheuristics. IEEE Trans. Evol. Comput. 2019, 24, 201–216. [Google Scholar] [CrossRef]
  14. Jiang, H.; He, Z.; Ye, G.; Zhang, H. Network intrusion detection based on PSO–XGBoost model. IEEE Access 2020, 8, 58392–58401. [Google Scholar] [CrossRef]
  15. Haidar, A.; Verma, B.K.; Haidar, R. A Swarm based Optimization of the XGBoost Parameters. Aust. J. Intell. Inf. Process. Syst. 2019, 16, 74–81. [Google Scholar]
  16. Boostani, R.; Karimzadeh, F.; Nami, M. A comparative review on sleep stage classification methods in patients and healthy individuals. Comput. Methods Programs Biomed. 2017, 140, 77–91. [Google Scholar] [CrossRef]
  17. Hassan, A.R.; Bhuiyan, M.I.H. Automatic sleep scoring using statistical features in the EMD domain and ensemble methods. Biocybern. Biomed. Eng. 2016, 36, 248–255. [Google Scholar] [CrossRef]
  18. Hassan, A.R.; Bhuiyan, M.I.H. Computer-aided sleep staging using complete ensemble empirical mode decomposition with adaptive noise and bootstrap aggregating. Biomed. Signal Process. Control 2016, 24, 1–10. [Google Scholar] [CrossRef]
  19. Hassan, A.R.; Bhuiyan, M.I.H. Automated identification of sleep states from EEG signals by means of ensemble empirical mode decomposition and random under sampling boosting. Comput. Methods Programs Biomed. 2017, 140, 201–210. [Google Scholar] [CrossRef]
  20. Liu, C.; Tan, B.; Fu, M.; Li, J.; Wang, J.; Hou, F.; Yang, A. Automatic sleep staging with a single-channel EEG based on ensemble empirical mode decomposition. Phys. A Stat. Mech. Appl. 2021, 567, 125685. [Google Scholar] [CrossRef]
  21. Jiang, D.; Lu, Y.n.; Yu, M.; Yuanyuan, W. Robust sleep stage classification with single-channel EEG signals using multimodal decomposition and HMM-based refinement. Expert Syst. Appl. 2019, 121, 188–203. [Google Scholar] [CrossRef]
  22. Ghimatgar, H.; Kazemi, K.; Helfroush, M.S.; Aarabi, A. An automatic single-channel EEG-based sleep stage scoring method based on hidden Markov model. J. Neurosci. Methods 2019, 324, 108320. [Google Scholar] [CrossRef]
  23. Hassan, A.R.; Subasi, A. A decision support system for automated identification of sleep stages from single-channel EEG signals. Knowl.-Based Syst. 2017, 128, 115–124. [Google Scholar] [CrossRef]
  24. Hassan, A.R.; Bhuiyan, M.I.H. A decision support system for automatic sleep staging from EEG signals using tunable Q-factor wavelet transform and spectral features. J. Neurosci. Methods 2016, 271, 107–118. [Google Scholar] [CrossRef]
  25. Huang, Z.; Ling, B.W.K. Joint ensemble empirical mode decomposition and tunable Q factor wavelet transform based sleep stage classifications. Biomed. Signal Process. Control. 2022, 77, 103760. [Google Scholar] [CrossRef]
  26. Zhou, J.; Wang, G.; Liu, J.; Wu, D.; Xu, W.; Wang, Z.; Ye, J.; Xia, M.; Hu, Y.; Tian, Y. Automatic sleep stage classification with single channel EEG signal based on two-layer stacked ensemble model. IEEE Access 2020, 8, 57283–57297. [Google Scholar] [CrossRef]
  27. Memar, P.; Faradji, F. A novel multi-class EEG-based sleep stage classification system. IEEE Trans. Neural Syst. Rehabil. Eng. 2017, 26, 84–95. [Google Scholar] [CrossRef]
  28. Seifpour, S.; Niknazar, H.; Mikaeili, M.; Nasrabadi, A.M. A new automatic sleep staging system based on statistical behavior of local extrema using single channel EEG signal. Expert Syst. Appl. 2018, 104, 277–293. [Google Scholar] [CrossRef]
  29. Kemp, B.; Zwinderman, A.H.; Tuk, B.; Kamphuisen, H.A.; Oberye, J.J. Analysis of a sleep-dependent neuronal feedback loop: The slow-wave microcontinuity of the EEG. IEEE Trans. Biomed. Eng. 2000, 47, 1185–1194. [Google Scholar] [CrossRef] [PubMed]
  30. Goldberger, A.L.; Amaral, L.A.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation 2000, 101, e215–e220. [Google Scholar] [CrossRef] [PubMed]
  31. Berry, R.B.; Brooks, R.; Gamaldo, C.; Harding, S.M.; Lloyd, R.M.; Quan, S.F.; Troester, M.T.; Vaughn, B.V. AASM scoring manual updates for 2017 (version 2.4). J. Clin. Sleep Med. 2017, 13, 665–666. [Google Scholar] [CrossRef]
  32. Cantero, J.L.; Atienza, M.; Madsen, J.R.; Stickgold, R. Gamma EEG dynamics in neocortex and hippocampus during human wakefulness and sleep. NeuroImage 2004, 22, 1271–1280. [Google Scholar] [CrossRef] [PubMed]
  33. Montgomery, S.M.; Sirota, A.; Buzsáki, G. Theta and gamma coordination of hippocampal networks during waking and rapid eye movement sleep. J. Neurosci. 2008, 28, 6731–6741. [Google Scholar] [CrossRef]
  34. Hjorth, B. EEG analysis based on time domain properties. Electroencephalogr. Clin. Neurophysiol. 1970, 29, 306–310. [Google Scholar] [CrossRef]
  35. Michielli, N.; Acharya, U.R.; Molinari, F. Cascaded LSTM recurrent neural network for automated sleep stage classification using single-channel EEG signals. Comput. Biol. Med. 2019, 106, 71–81. [Google Scholar] [CrossRef] [PubMed]
  36. Sabeti, M.; Katebi, S.; Boostani, R. Entropy and complexity measures for EEG signal classification of schizophrenic and control participants. Artif. Intell. Med. 2009, 47, 263–274. [Google Scholar] [CrossRef]
  37. Pregowska, A.; Proniewska, K.; van Dam, P.; Szczepanski, J. Using Lempel-Ziv complexity as effective classification tool of the sleep-related breathing disorders. Comput. Methods Programs Biomed. 2019, 182, 105052. [Google Scholar] [CrossRef] [PubMed]
  38. Gharbali, A.A.; Najdi, S.; Fonseca, J.M. Investigating the contribution of distance-based features to automatic sleep stage classification. Comput. Biol. Med. 2018, 96, 8–23. [Google Scholar] [CrossRef] [PubMed]
  39. Şen, B.; Peker, M.; Çavuşoğlu, A.; Çelebi, F.V. A comparative study on classification of sleep stage based on EEG signals using feature selection and classification algorithms. J. Med. Syst. 2014, 38, 18. [Google Scholar] [CrossRef]
  40. Esteller, R.; Vachtsevanos, G.; Echauz, J.; Litt, B. A comparison of waveform fractal dimension algorithms. IEEE Trans. Circuits Syst. I Fundam. Theory Appl. 2001, 48, 177–183. [Google Scholar] [CrossRef]
  41. Di Matteo, T. Multi-scaling in finance. Quant. Financ. 2007, 7, 21–36. [Google Scholar] [CrossRef]
  42. Satapathy, S.K.; Bhoi, A.K.; Loganathan, D.; Khandelwal, B.; Barsocchi, P. Machine learning with ensemble stacking model for automated sleep staging using dual-channel EEG signal. Biomed. Signal Process. Control 2021, 69, 102898. [Google Scholar] [CrossRef]
  43. Timplalexis, C.; Diamantaras, K.; Chouvarda, I. Classification of sleep stages for healthy subjects and patients with minor sleep disorders. In Proceedings of the 2019 IEEE 19th International Conference on Bioinformatics and Bioengineering (BIBE), Athens, Greece, 28–30 October 2019; pp. 344–351. [Google Scholar]
  44. Seo, H.; Back, S.; Lee, S.; Park, D.; Kim, T.; Lee, K. Intra-and inter-epoch temporal context network (IITNet) using sub-epoch features for automatic sleep scoring on raw single-channel EEG. Biomed. Signal Process. Control 2020, 61, 102037. [Google Scholar] [CrossRef]
  45. Mehra, D.; Tiwari, A.; Joshi, D. Investigating neural correlates of locomotion transition via temporal relation of EEG and EOG-recorded eye movements. Comput. Biol. Med. 2021, 132, 104350. [Google Scholar] [CrossRef] [PubMed]
  46. Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95-International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; Volume 4, pp. 1942–1948. [Google Scholar]
  47. Gaing, Z.L. A particle swarm optimization approach for optimum design of PID controller in AVR system. IEEE Trans. Energy Convers. 2004, 19, 384–391. [Google Scholar] [CrossRef]
  48. Yang, L.; Shami, A. On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing 2020, 415, 295–316. [Google Scholar] [CrossRef]
  49. Engelbrecht, A.P. Computational Intelligence: An Introduction; John Wiley & Sons: Hoboken, NJ, USA, 2007. [Google Scholar]
  50. Melgani, F.; Bazi, Y. Classification of electrocardiogram signals with support vector machines and particle swarm optimization. IEEE Trans. Inf. Technol. Biomed. 2008, 12, 667–677. [Google Scholar] [CrossRef] [PubMed]
  51. Gu, K.; Wang, J.; Qian, H.; Su, X. Study on Intelligent Diagnosis of Rotor Fault Causes with the PSO–XGBoost Algorithm. Math. Probl. Eng. 2021, 2021, 9963146. [Google Scholar] [CrossRef]
  52. Clerc, M.; Kennedy, J. The particle swarm-explosion, stability, and convergence in a multidimensional complex space. IEEE Trans. Evol. Comput. 2002, 6, 58–73. [Google Scholar] [CrossRef]
  53. Gramfort, A.; Luessi, M.; Larson, E.; Engemann, D.A.; Strohmeier, D.; Brodbeck, C.; Parkkonen, L.; Hämäläinen, M.S. MNE software for processing MEG and EEG data. NeuroImage 2014, 86, 446–460. [Google Scholar] [CrossRef]
  54. Claesen, M.; Simm, J.; Popovic, D.; Moor, B. Hyperparameter tuning in python using optunity. In Proceedings of the International Workshop on Technical Computing for Machine Learning and Mathematical Engineering, Toronto, ON, Canada, 10–12 January 2014; Volume 1. [Google Scholar]
  55. Zeng, X.; Martinez, T.R. Distribution-balanced stratified cross-validation for accuracy estimation. J. Exp. Theor. Artif. Intell. 2000, 12, 1–12. [Google Scholar] [CrossRef]
  56. Landis, J.R.; Koch, G.G. The measurement of observer agreement for categorical data. Biometrics 1977, 33, 159–174. [Google Scholar] [CrossRef]
  57. Berthomier, C.; Drouot, X.; Herman-Stoïca, M.; Berthomier, P.; Prado, J.; Bokar-Thire, D.; Benoit, O.; Mattout, J.; d’Ortho, M.P. Automatic analysis of single-channel sleep EEG: Validation in healthy individuals. Sleep 2007, 30, 1587–1595. [Google Scholar] [CrossRef]
  58. Metz, C.E. Receiver operating characteristic analysis: A tool for the quantitative evaluation of observer performance and imaging systems. J. Am. Coll. Radiol. 2006, 3, 413–422. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Proposed particle swarm optimisation combined with extreme gradient boosting (PSO–XGBoost) sleep-stage classification system architecture.
Figure 1. Proposed particle swarm optimisation combined with extreme gradient boosting (PSO–XGBoost) sleep-stage classification system architecture.
Sensors 24 01197 g001
Figure 2. Backward and forward time-shifting of features.
Figure 2. Backward and forward time-shifting of features.
Sensors 24 01197 g002
Figure 3. Tuning extreme gradient boosting (XGBoost) hyperparameters using particle swarm optimization (PSO).
Figure 3. Tuning extreme gradient boosting (XGBoost) hyperparameters using particle swarm optimization (PSO).
Sensors 24 01197 g003
Figure 4. Extreme gradient boosting (XGBoost) mean confusion matrix using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Figure 4. Extreme gradient boosting (XGBoost) mean confusion matrix using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Sensors 24 01197 g004
Figure 5. Extreme gradient boosting (XGBoost) multi-class logloss using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Figure 5. Extreme gradient boosting (XGBoost) multi-class logloss using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Sensors 24 01197 g005
Figure 6. Extreme gradient boosting (XGBoost) multi-class classification error using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Figure 6. Extreme gradient boosting (XGBoost) multi-class classification error using stratified 10-fold cross-validation (CV) (without optimal hyperparameters).
Sensors 24 01197 g006
Figure 7. Extreme gradient boosting (XGBoost) receiver operating characteristic to sleep stages (without optimal hyperparameters).
Figure 7. Extreme gradient boosting (XGBoost) receiver operating characteristic to sleep stages (without optimal hyperparameters).
Sensors 24 01197 g007
Figure 8. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) mean confusion matrix using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Figure 8. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) mean confusion matrix using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Sensors 24 01197 g008
Figure 9. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) multi-class logloss of using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Figure 9. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) multi-class logloss of using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Sensors 24 01197 g009
Figure 10. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) multi-class classification error of using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Figure 10. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) multi-class classification error of using stratified-10-fold cross- validation (CV) (with optimal hyperparameters).
Sensors 24 01197 g010
Figure 11. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) receiver operating characteristic to sleep stages (with optimal hyperparameters).
Figure 11. Particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) receiver operating characteristic to sleep stages (with optimal hyperparameters).
Sensors 24 01197 g011
Figure 12. mRMR selected vs. handcrafted features extraction time in Raspberry Pi.
Figure 12. mRMR selected vs. handcrafted features extraction time in Raspberry Pi.
Sensors 24 01197 g012
Table 1. List of selected subject recordings.
Table 1. List of selected subject recordings.
SubjectRecordingsAgeSexRecord Length
0SC4001E0, SC4002E0 *33Female22:05:00
2SC4012E026Female23:45:00
3SC4031E026Female23:30:00
5SC4051E028Female22:41:00
6SC4061E031Female23:05:00
11SC4011E026Male23:21:00
12SC4012E026Male23:45:00
13SC4131E027Male23:27:00
18SC4182E028Male23:41:00
* Two recordings selected from the same subject.
Table 2. List of extracted features.
Table 2. List of extracted features.
Features
1Age27 θ 4–8 Hz
2mean28 α 9–11 Hz
3median29 σ 12–15 Hz
4absolute maximum value30 β 1 14–20 Hz
5variance31 β 2 20–30 Hz
6skewness32 γ 1 30–40 Hz
7kurtosis33 γ 2 40–49.5 Hz
8root mean square340.5–1 Hz K-complex
9peak-to-peak amplitude35power of δ
10entropy36power of θ
11permutation entropy37power of α
12spectral entropy38power of σ
13singular value decomposition entropy39power of β 1
14sample entropy40power of β 2
15Katz fractal dimension41power of γ 1
16Higuchi fractal dimension42power of γ 2
17number of zero-crossings43power of K-complex
18detrended fluctuation analysis44amplitude of δ
19Hurst exponent45amplitude of θ
20maximum minimum distance46amplitude of α
21Lempel–Ziv complexity47amplitude of σ
22Hjorth Mobility48amplitude of β 1
23Hjorth complexity49amplitude of β 2
24power spectral density50amplitude of γ 1
25Petrosian fractal dimension51amplitude of γ 2
26 δ 0.5–4 Hz52amplitude of K-complex
Table 3. Hyperparameters of extreme gradient boosting (XGBoost) (Experiment1).
Table 3. Hyperparameters of extreme gradient boosting (XGBoost) (Experiment1).
HyperparameterDefault Configuration
b a s e _ s c o r e 0.5
b o o s t e r gbtree’, ‘dart
c o l s a m p l e _ b y l e v e l 1
c o l s a m p l e _ b y n o d e 1
c o l s a m p l e _ b y t r e e 1
g a m m a 0
l e a r n i n g _ r a t e 0.1
m a x _ d e l t a _ s t e p 0
m a x _ d e p t h 3
m i n _ c h i l d _ w e i g h t 1
n _ e s t i m a t o r s 100
n u m _ c l a s s 5
o b j e c t i v e m u l t i : s o f t m a x
r a n d o m _ s t a t e 0
r e g _ a l p h a 0
r e g _ l a m b d a 1
s c a l e _ p o s _ w e i g h t 1
s u b s a m p l e 1
s a m p l e _ t y p e *uniform’, ‘weighted
n o r m a l i z e _ t y p e *tree’, ‘forest
r a t e _ d r o p *0.0
o n e _ d r o p *0
s k i p _ d r o p *0.0
*—additional parameter used by ‘ d a r t ’ booster.
Table 4. Performance of extreme gradient boosting (XGBoost) using stratified-10-Fold cross-validation (CV) (without optimal hyperparameters).
Table 4. Performance of extreme gradient boosting (XGBoost) using stratified-10-Fold cross-validation (CV) (without optimal hyperparameters).
FoldAccuracyF1-ScorePrecisionRecallKappa
10.8450.8440.8460.8450.806
20.8480.8470.8480.8480.810
30.8340.8320.8320.8340.792
40.8570.8560.8570.8570.821
50.8490.8490.8500.8490.811
60.8430.8430.8430.8430.803
70.8560.8560.8570.8560.820
80.8470.8460.8470.8470.808
90.8360.8360.8360.8360.795
100.8340.8340.8350.8340.792
Mean0.8450.8440.8450.8450.806
Table 5. Performance of particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) using stratified-10-fold (with optimal hyperparameters).
Table 5. Performance of particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) using stratified-10-fold (with optimal hyperparameters).
FoldAccuracyF1-ScorePrecisionRecallKappa
10.9570.9560.9570.9570.946
20.9590.9590.9590.9590.949
30.9630.9630.9630.9630.954
40.9510.9510.9510.9510.939
50.9450.9450.9460.9450.932
60.9520.9520.9520.9520.940
70.9640.9640.9640.9640.955
80.9440.9430.9440.9440.930
90.9450.9450.9460.9450.932
100.9610.9610.9610.9610.951
Mean0.9540.9540.9540.9540.943
Table 6. Performance of the particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) and existing approaches.
Table 6. Performance of the particle swarm optimization combined with extreme gradient boosting (PSO–XGBoost) and existing approaches.
Dataset: Sleep-EDF, Channel: Pz-oz
AuthorYearClassifiers5-Class %Kappa
Hassan [17]2016Adaboost90.1-
Hassan [18]2016Bagging90.6-
Hassan [24]2016Randiom Forest91.50.861
Hassan [19]2017RUSBoost83.40.840
Hassan [23]2017Bagging94.30.943
Seifpour [28]2018SVM90.20.870
Jianga [21]2019Random Forest88.30.817
Ghimatgar [22]2019Random Forest81.80.740
Zhou [26]2020Stacking91.20.864
Liu [20]2021XGBoost92.20.877
Zeo [25]2022Bagging89.3-
Proposed Work-PSO–XGBoost95.40.943
Table 7. Performance of proposed approach in SEDFx, DREAMS, and SHHS.
Table 7. Performance of proposed approach in SEDFx, DREAMS, and SHHS.
Proposed ApproachDatabaseChannel5-Class %Kappa
PSO–XGBoostSleep-EDFxFpz-Cz92.10.90
PSO–XGBoostSleep-EDFxPz-Oz95.40.94
PSO–XGBoostDREAMSCz-A180.30.75
PSO–XGBoostSHHSC4-A178.80.74
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Radhakrishnan, B.L.; Ezra, K.; Jebadurai, I.J.; Selvakumar, I.; Karthikeyan, P. An Autonomous Sleep-Stage Detection Technique in Disruptive Technology Environment. Sensors 2024, 24, 1197. https://doi.org/10.3390/s24041197

AMA Style

Radhakrishnan BL, Ezra K, Jebadurai IJ, Selvakumar I, Karthikeyan P. An Autonomous Sleep-Stage Detection Technique in Disruptive Technology Environment. Sensors. 2024; 24(4):1197. https://doi.org/10.3390/s24041197

Chicago/Turabian Style

Radhakrishnan, Baskaran Lizzie, Kirubakaran Ezra, Immanuel Johnraja Jebadurai, Immanuel Selvakumar, and Periyasami Karthikeyan. 2024. "An Autonomous Sleep-Stage Detection Technique in Disruptive Technology Environment" Sensors 24, no. 4: 1197. https://doi.org/10.3390/s24041197

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop