Monitoring Level of Hypnosis Using Stationary Wavelet Transform and Singular Value Decomposition Entropy With Feedforward Neural Network

Classifying the patient’s depth of anesthesia (LoH) level into a few distinct states may lead to inappropriate drug administration. To tackle the problem, this paper presents a robust and computationally efficient framework that predicts a continuous LoH index scale from 0–100 in addition to the LoH state. This paper proposes a novel approach for accurate LoH estimation based on Stationary Wavelet Transform (SWT) and fractal features. The deep learning model adopts an optimized temporal, fractal, and spectral feature set to identify the patient sedation level irrespective of age and the type of anesthetic agent. This feature set is then fed into a multilayer perceptron network (MLP), a class of feed-forward neural networks. A comparative analysis of regression and classification is made to measure the performance of the chosen features on the neural network architecture. The proposed LoH classifier outperforms the state-of-the-art LoH prediction algorithms with the highest accuracy of 97.1% while utilizing minimized feature set and MLP classifier. Moreover, for the first time, the LoH regressor achieves the highest performance metrics ( $\text{R}^{{{2}}}=0.9$ , MAE = 1.5) as compared to previous work. This study is very helpful for developing highly accurate monitoring for LoH which is important for intraoperative and postoperative patients’ health.


I. INTRODUCTION
P ATIENTS undergoing surgery and mechanical ventilation require sedation for their safety and comfort [1]. Sedation, also called monitored anesthesia care or conscious sedation is mostly used for minor surgical procedures where local anesthesia is not an option. However, for complex and critical procedures, general anesthesia is mostly used. Maintaining and monitoring the optimal level of sedation is very important since both over and under-sedation can have serious results such as severe hypotension, cardiovascular collapse, critical illness neuromuscular abnormalities, and maybe even death if not managed promptly [2]. In the past, several methods have been used to assess the level of sedation for patients in ICU, most of them being based on the subjective behavior of the patient. Different numerical scoring methods such as Richmond Agitation Sedation Scale (RASS) and Ramsay scale are being used in the current level of anesthesia monitoring systems [3]. EEG signal is an electrophysiological monitoring method that records electrical activities and changes in a human brain during different states of consciousness such as sleep and general anesthesia. Hence, EEG is widely used in LoH monitoring systems to estimate cerebral electrical activity. Different algorithms estimate the changes in oscillatory behavior in EEG [4], [5], [6]. Most of these estimations are done in the frequency domain. The signal is transformed into the frequency domain using Fourier Transform. The Bispectral Index (BIS) monitored by Medtronic (Dublin, Ireland) calculates the BIS value by tracking two parameters: The changes in the log ratio of 2 energy bands (Beta Ratio) and the sum of spectrum peaks in two frequency bands (SynchFastFlow) [7]. The BIS values correlate well with the LoH in adult patients undergoing general anesthesia [8], [9]. On the other hand, multiple studies proved that several induction agents were not efficiently tracked by BIS such as ketamine and nitrous oxide [4], [10], [11], [12]. In addition, these monitors have been rarely validated on pediatric patients, and their data have been mostly induced based on adults patients' data [13]. The BIS values in children demonstrate major inconsistencies with the dosages of anesthetics [14]. Studies have revealed that BIS values are changed for pediatric patients and impacted by age group and by injecting a muscle relaxant [15], [16], [17], [18]. The study in [15] suggested that the BIS values of the younger age group (under 5 years) were higher than those of the older age group (5 -12 years) at the same time after introducing the anesthetic agent. It was noticed that after the injection of muscle relaxants, BIS values may decline owing to the frontal EMG components reduction, which affects the monitoring of the level of sedation [18]. Hence, the precision and consistency of BIS monitors for pediatric patients are still under investigation, specifically for toddlers, infants, and neonates [19].
The SEDLine monitor from Masimo (Irvine, CA) estimates the power spectral index (PSI) of various frequency bands along with the interhemispheric synchrony [5]. By utilizing the EEG signal's spectral parameters only, these systems can miss important time-domain information [20]. Previously, many studies proposed LoH systems that have used linear analysis for feature extraction of EEG such as the relative power in the frequency bands (Delta, Theta, Alpha, Beta, and Gamma) of the signal and the beta ratio [6]. From the previous electrophysiological studies, variability in time is exhibited in EEG signals [4], [6].
Different studies in the past [21], [22], [23] have used these non-linear and non-stationary approaches for EEG signal interpretation and prediction of LoH. These include complexity and information content analysis such as Shanon permutation entropy (SPE), Sample Entropy (SampEn) [24], Lempel-Ziv complexity, fractal dimension (Petrosian Fractal Dimension (PFD)), Detrended Fluctuation Analysis, and Phase-Rectified Signal Averaging (PRSA) [21]. Similarly, some of the previously proposed LoH systems were based solely upon the fractal dimension analysis of EEG signals [25], [26]. Petrosian adapted box and Higuchi fractal dimension (HFD) has been used in these systems. Results show an inverse relation between HFD with the level of anesthesia [27]. The previous studies show that despite this information from EEG, none of the systems have reliably been used for the estimation of the LoH index. This is because most of these systems were based on solely temporal or spectral features [21], [25], [26], [27], [28] which is insufficient to predict the BIS values accurately with changes in consciousness. As a result, mostly these systems use a classifier to predict the levels of sedation which has more chances of error in the LoH index as compared to the regressor which requires values to be very precise and has less error tolerance. Spectral features have been extracted using different transforms such as Fourier, continuous [29] and discrete wavelet transforms (DWT) [20]. EEG features extraction from fast Fourier Transform (FFT) results only in spectral features and since FFT is a linear transform, it does not perform well for non-stationary signals like EEG. Non-linear transforms especially DWT have shown some promising results [11] since it estimates both spectral and temporal features of EEG, hence no loss of time-domain information as was the case in FFT. However, DWT is subject to the problem of translational invariance [30], [31]. It is due to the time-variant property of DWT which means that the transform of the EEG signal and shifted version of EEG is not time-shifted versions of each other which is a problem in non-stationary signals.
This study aims to develop an accurate estimation of the LoH index and LoH state. In the previous studies [32], [33], [34], [35], although the LoH classification algorithms have predicted the LoH state very accurately, this still does not solve the problem for the LoH indexes which are on the borderline of the LoH states. As a result of these values, the LoH state can be misinterpreted and result in inaccurate drug administrating during different states which can cause serious inter-operative and postoperative health conditions [36]. To avoid such scenarios and predict the LoH accurately, this study proposes a combination of a Multi-Layer Perceptron (MLP) classifier and regressor. The continuous regression values computed by the proposed algorithm are referred to as the Level of hypnosis (LoH) Index. Moreover, to overcome these problems of denoising and translational-invariance in DWT and computational complexity, this study proposes a novel LoH monitoring system for both adult and pediatric systems based on SWT and a deep learning-based feed-forward neural network. By using the Stationary Wavelet Transform (SWT), not only both spectral and temporal information is extracted but also the translational-invariance problem is solved. Fig. 1 describes the proposed LoH algorithm for predicting the states of anesthesia and the LoH Index.
This work is based on a comparative study of feed-forward network-based classifier and regressor which use a balanced feature matrix of spectral, temporal, and fractal features. The EEG data used here comprises 95 patients including both adult and pediatric patients undergoing general anesthesia for their surgeries. The level of anesthesia was defined from the LoH Index depending on patients" subjective behavior and the doctor's judgment. The proposed feed-forward network for the LoH system is compared with different ML models and previously proposed systems.
This paper is organized as follows: The patients' EEG recordings databases are described in Section II. Section III describes the proposed features of the LoH estimation system. Section IV elaborates on the deep learning-based approach for classification and regression. Section V summarizes the LoH system results and discusses the performance of the proposed system on one patient as a case study. Finally, Section VI concludes the paper.

II. EEG DATABASE
The EEG dataset used in this study includes the data from a research study conducted by the Technical University of Munich (TUM) and a clinical study at Children's Hospital Lahore [37], [38]. The data recorded consists of 115 patients including both adult and pediatric (age: 5 months -67 years, weight: 6 -90 kg) undergoing general anesthesia for surgeries. EEG recordings were sampled at 256 S/sec and the BIS values were updated every 1 sec. The children's database includes the EEG data and the expert anesthesiologists' feedback on patients' LoH during surgery.
The value of the reference BIS scale from the dataset ranges from 0 to 100 and is divided generally into 4 levels depending upon the state of anesthesia the patient is in. The states of anesthesia were divided into four different levels namely, awake (75 to 100), light (40 to 75), moderate (25 to 40), and deep (0 to 25) anesthesia. The state was selected very carefully depending upon the anesthesiologist's judgment or BIS values, the patient's subjective behavior, weight, age, and anesthetic agent delivery protocol. Fig. 2 shows the block diagram for the proposed LoH feature extraction engine utilizing temporal, fractal, and SWTbased spectral features. The EEG signal sampled at 256S/s is processed to extract important features which are correlated with the patient's state of anesthesia. Preprocessing is important before feature extraction since it removes DC offset, noise, and other artifacts from the signal. EEG signal is filtered using a bandpass filter (BPF) with cutoff frequencies at 0.5 -60 Hz since no proper neural activity in EEG related to the conscious level is observed above this frequency range and most of the artifacts are traced in the higher frequency region of EEG. As a result of this BPF, the higher and lower frequency muscle artifacts and skeletal muscle activation (EMG) are minimized from the EEG signal.

III. EEG FEATURES EXTRACTION
The preprocessed EEG signal is then supplied as an input to the feature extraction engine where different types of discriminating features from the signal are extracted and then a feature vector is formed. There are three types of features in the feature vector: spectral (frequency domain), temporal and fractal. This feature vector is then fed into the Feed Forward Neural Network architecture to classify the LoH states and estimate the LoH Index. These features (spectral, fractal, and temporal) are explained below in detail:

A. Singular Value Decomposition Entropy (SvdEn)
SvdEn finds the complexity and predictability of the bio signals by estimating the number of attributes that are necessary to characterize the signal. Thus, SvdEn is very helpful in the case of non-stationary signals such as EEG. The attributes of the EEG are associated with the regularity and information of the signal and hence the regularity acts as a function of attributes of the EEG [39]. Higher SvdEn values relate to more complex and less regular EEG signals [27] which is an indicator that for the given state, more attributes of the signal are required. SvdEn is calculated as follows: Suppose the input signal is [x1, x2, . . . . . . . . . , x N ]. The delay vector set is constructed as: where 'r' is the embedding dimension and 't' is the delay for the delay vector calculation. In this proposed work, values are set to t = 2 and r = 15. After the delay vector construction, the embedding space is calculated by: For estimating the normalized singular values of Y, singular value decomposition is performed on Y which results in the singular spectrum σ 1 , σ 2 , . . . . . . , σ M . The normalization of the singular spectrum is done as: where 'M' is the number of singular values in the singular spectrum.

B. Fractal Features
To completely understand and measure the nonlinear dynamics of nonstationary signals such as EEG, linear analysis such as Fourier or wavelet analysis is not enough. During different states of anesthesia, the spatially dispersed changes in electrocortical activity cause fluctuations in the EEG signal which can be seen as varying in these states. These changes in EEG can be modeled by estimating the fractal dimensions of the signal [31]. The fractal dimension of EEG is an estimate of the complexity and self-affinity of the time domain EEG signal. Two fractal dimensions estimations have been proposed: 1) Higuchi Fractal Dimension: HFD calculates the fractal dimension of EEG directly in the time domain without embedding the signal in the phase space. It works well with shorter epochs for nonstationary signals. Moreover, HFD is also resistant to noise, and artifacts and can be computed in real-time. HFD is not very computationally complex and very fast compared to other fractal dimensions [40]. These advantages led us to prefer HFD over other fractal algorithms. It is calculated as follows; For an input original series [x1, x2, x3, . . . ., x N ]. Then new 'k' series are reconstructed using the original series as: where m = 1,2,3,. . . .. k. After the series is constructed from the previous equation, the length of each constructed series L(m,k) is computed using the: The average length of the series is then calculated by: This process of estimation of the average length of the series is repeated k times for each k from 1 to k. Then curve of ln(L(k)) versus ln(1/k) is plotted and the slope of the line which best fits the curve is calculated using the least square method. The estimated slope of the line is the HFD value. Fig. 4 shows the fractal dimension of the EEG signal computed using HFD against the reference BIS values.
2) Katz Fractal Dimension: The KFD measures the complexity of EEG by estimating its spatial information, convolutedness, and space-filling tendency. It is an algorithmic approximation of the box dimension of the EEG signal over a defined scale [39].
The calculation of KFD is done in the following steps: First, the sum of the Euclidean distance between successive points of the sample in the signal is calculated as: where L is the Euclidean distance and 'i' is the point in each sample of the signal. The average of this distance is calculated as 'a'. After this, the planar extent of the signal is estimated. The planar extent or the diameter of the waveform is the  farthest distance between the starting point and any other point in the sample 'j'.
Finally, the KFD of the EEG signal is estimated as: where n = L/a, the total number of steps in the EEG sample.
The correlation of the spatial information and space-filling tendency of EEG with the BIS values can be seen in Fig. 5.

C. Spectral Features
Conventionally FFT has been used mostly for the analysis of EEG signals for proposed LoH algorithms [6], [32]. Since the frequency band of 0.5 -60 Hz contains very useful information for the prediction of the state of anesthesia.
However, since EEG is a nonstationary complex signal and has a broad frequency spectrum, estimating the frequency features only through the FFT results in the loss of key time-domain information due to its linear nature. To solve this problem, wavelet transforms (WT) come into play. The WT is a localized transform in frequency and time (space), and this helps it to extract information from the EEG in both space and frequency domain which was not possible with FFT. Using the WT on EEG helps estimate the signal into different scaling components at various levels [29]. The DWT on the EEG decomposes the signal using a wavelet function and then computes different wavelet coefficients depending upon the levels of decomposition for EEG [34]. Generally, 5 levels of decomposition are selected since there are six frequency regions in the 0.5 -60 Hz EEG spectrum. At each level, two coefficients (approximation and detailed coefficients) based on level and location (space) are estimated. The signal is passed through high pass and low pass filters to estimate approximation and detailed coefficients of each level. Nevertheless, DWT has a problem with translation invariance since it is a spatial variant transform. It means that the DWT of the shifted EEG signal is not equal to the shift in the DWT of the unshifted EEG signal. Hence even with the periodic signal extension, the DWT of the shifted EEG signal is not the shifted version of the DWT of EEG. This mainly is due to the critical sub-sampling of the EEG in the DWT. Critical sub-sampling discards every second coefficient at each level to enforce implicit time-frequency uncertainty of the wavelet analysis. This results in small shifts in the EEG waveform which causes large changes in the coefficient values and fluctuations in the energy distribution at different levels. Hence, variations in the reconstructed EEG from the coefficients are observed. Moreover, the problem of aliasing also arises here since the wavelet coefficients of all the levels (including the noise band) are not utilized for the reconstruction of EEG by Inverse DWT.
It is therefore desirable to use a transform that is better at denoising the signal, removing the spatial variant property, and aliasing. This work proposes the SWT for the spectral features' extraction of the EEG signal. SWT has three major advantages over DWT: (i) SWT is translationally invariant, so even if the EEG signal is shifted, the estimated coefficients will not vary. (ii) SWT outperforms DWT in edge detection and denoising. (iii) Compared to the DWT which required the discrete input signal to have a size of power of 2, SWT does not have this limitation [34]. SWT solves the problem of translational invariance since it is different from DWT in terms of decimation and shift-invariance making it better at denoising, change detection, and feature extraction [30]. The coefficients for SWT are computed as follows: where x (t) is the input EEG signal, d i,k are the SWT wavelet coefficients at the decomposition level 'i' an space 'k' and i,k (t) is the mother wavelet function. The mother wavelet chosen for the SWT is Daubechies wavelet 'db4'.
By using SWT, the EEG signal is convolved with low pass and high pass filters just like in the DWT, but no decimation is involved in estimating the wavelet coefficients. Five levels of decomposition for SWT are chosen. After thresholding, the detailed coefficients are extracted while the low-frequency and high-frequency components are separated. The approximation coefficients, threshold data from the detailed coefficients, and the remaining EEG signal are labeled as noise. Fig. 6 shows the block diagram for the SWT coefficients estimation at different levels for the LoH algorithm. There is no decimation required for wavelet coefficients at any level rather the filter coefficients (high aw pass) are up-sampled by a factor of 2 ( j−1 ) in the jth level of the algorithm. As a result, the output value of each decomposition level in SWT contains an equal number of samples as in the input.
The wavelet coefficients obtained by SWT are used to compute the energy of the five bands of the EEG signal. Since we filtered the EEG in the 0.5 -60 Hz frequency range, the EEG signal is decomposed into 5 frequency bands with each band representing different activities in certain regions of the brain during each state of LoH. These bands include the following: 1) delta band ( ) (0.4-4 Hz).
3) alpha band (α) (8-16 Hz). 4) beta band (β) (16-32 Hz). 5) gamma band (γ ) (32-60 Hz). The Energy of the bands of frequency calculated from SWT is defined as: where CD is the detailed wavelet coefficient calculated from SWT at each decomposition level. Fig. 7 shows the spectral changes in EEG for the four different states of anesthesia. Different types of actions occurring in the human brain are depicted by the above-selected spectral bands. When the patient is awake, the EEG signals exhibit irregular activity of low amplitude and fast oscillations [41] as shown in Fig. 7(a). The theta band is important in the prediction of the light state of anesthesia as shown in Fig. 7(b). During the moderate state of anesthesia, the delta and alpha bands coexist as can be seen in Fig. 7(c). This stage is suitable for performing surgical procedures. The state of deep anesthesia is characterized by slow EEG activity [41] which is in the delta frequency region as shown in Fig. 7(d). The features for the proposed LoH algorithm are selected by assigning a feature significance score to each feature and then selecting the highest-scoring features. The feature significance score method used in this study depends on the average scores of the Pearson Correlation Coefficient (PCC) and Maximum Relevance -Minimum Redundancy (MRMR) PCC for the individual features. The feature significance scores of the features having the highest correlation with BIS are described in Table I. The SWT_Energy are the spectral energies of the five bands of the EEG signal described previously while the DWT_Energy refers to energy computed using the DWT.
From Table I, the results of the feature significance scores demonstrate that the proposed combination of SWT-based spectral band energies, KFD, HFD, and SvdEn outperform the scores of other features. Moreover, the scores also help us in selecting the highest correlated features with the BIS values which will be used in the proposed LoH estimation algorithm. The box plots of the eight highly correlated features for the estimation of states of anesthesia in the LoH monitoring system can be visualized in Fig. 8.
Age-related changes in the EEG coherence and power spectrum during general anesthesia in children are observed in the form of an age-varying coherogram and spectrogram. These age-related changes in the EEG could reflect underlying neurodevelopmental processes that occur over childhood and adolescence, including synaptogenesis, neural pruning, and the maturation of neural circuits. We observed significant changes in the EEG structure during anesthesia-induced unconsciousness over the first year of life. In infants (less than 1 year old), the EEG consisted mainly of slow oscillations. The rise in EEG power over the first several years of life, followed by a decline in the adolescent years, is most consistent with previous pediatric EEG studies during wakefulness, sleep, and anesthesia [42]. Similarly, in previous studies of infants receiving general anesthesia, we noticed that alpha-beta oscillations started to appear at approximately 5 months of age but did not become coherent until approximately 1 year of age [42], [43].
IV. DEEP LEARNING Various machine learning and deep learning-based approaches for estimating the LoH have been proposed in the literature [24], [35], [44], [42], [43], [44], [45], and [46]. By utilizing the Bagged Tree ML algorithm [20], the highest classification accuracy achieved was 95% while using a   [46]. There is no way of knowing what is happening in these convolutional layers for feature extraction of the EEG signals. Hence, this model exhibits poor performance during state transitions. The shift in the states is often unstable and the changes in the brain activities are not observed by the CNN-based models which results in low accuracy of these systems. This paper presents a novel EEG-based LoH algorithm by utilizing deep learning with fully optimized hyperparameters. There are three layers in general in a deep neural network namely: input, hidden, and output layers, and the output of the previous layer is processed by the next layer. In addition, there is no such thing as the best network rather different variations of hidden layers and a varying number of neurons along with other hyperparameters need to be checked to find the best network architecture suited for a specific task. The nonlinear function used in the neurons is called the Activation Function and is one of the most important parameters in neural network model tuning. In this work, the SoftMax function is used for multiclass logistic classification while the Sigmoid function is used for two-class regression. The optimizer used in our proposed network is Adam (a stochastic gradient descent method). In this work, we propose an MLP network, a type of feedforward neural network, for predicting the LoH Index and states of LoH. Fig. 9 describes the working of the MLP network starting from network initialization to training and testing the model along with all the steps involved in it. The EEG dataset was divided randomly into a 70/30 ratio for the training and testing of the trained model. 70% of the data was used for training and validation of the model while the remaining 30% was used for the testing of the network. We propose a 3-layered MLP network with input, output, and 3 hidden layers with 128 nodes each. The input layer is set to 8 nodes since it is equal to the number of the features in the feature matrix. Since the goal is to achieve high classification accuracy, low error (Mean Absolute Error and Mean Squared Error) on regression and to compare the results of both class-based LoH with the LoH Index-based LoH algorithm, the network architecture is modified slightly for both scenarios. For classification, the dataset used is already classified into 4 states of anesthesia depending upon the sedation level. The output nodes used in this setting are 4 since the proposed LoH algorithm must classify 4 LoH states.
Moreover, the activation function is set to "Softmax" for the output layer. In the case of predicting the LoH Index, a regression approach is used. Instead of classes in the dataset, the BIS values are provided as target values of the network. The "Sigmoid" activation function is used for the output layer of the network. For the training of the network, the learning rates are varied from 0.01 to 0.00001 along with changes in batch sizes of 25, 32, 64, and 128 to estimate the best model. Each model is trained with different epoch sizes ranging from 50 to 300 for smoothening the training and test accuracy curves.
Different deep learning regularization techniques such as L1/L2 and Dropout regularization were applied to the network for avoiding the overfitting of the model on the EEG dataset. To reduce the complexity of the model, regularization techniques are used in deep learning [36]. It penalizes by adding the penalty term to the loss function of the network. The L1 regularization works by minimizing the absolute value of the weights. Since L1 regularization has the advantage of being robust to outliers as compared to L2, we used L1 regularization. Fig. 10 describes the visual comparison of the change in the architecture of the neural network with and without dropout regularization. While the dropout works by changing Fig. 10.
A visual comparison of Neural network architecture with and without the application of the Dropout regularization resulted in increased accuracy and low regression errors. the network architecture itself rather than modifying the cost function. Hence, it results in the training of different neural networks which eventually means a different fit for each model resulting in the reduction of overfitting. The dropout rate for our network is set to 0.3.

V. RESULTS AND DISCUSSION
Different evaluation metrics are used to determine the accuracy and efficiency of the proposed model. These metrics were mainly divided into two types depending on classification and regression. For regression analysis, three statistical parameters including mean absolute error (MAE), mean squared error (MSE), and R-square value is used. According to [47], R-square and symmetric mean absolute percentage error (SMAPE) are the only two regression scores having strict real number values. These values are within the range in the [0,1] interval for R-square and [0,2] for SMAPE. The comparison of both [47] shows that R-square is more informative and truthful than the SMAPE. It estimates a high value only when the regression analysis correctly predicts true values from the ground truth group. MAE is a model evaluation parameter used for regression models. It is the mean of the absolute values of the predictions on the test set for all the instances in the test dataset. MSE is a risk function related to the expected value of squared error loss. It is often used with MAE and R-square values and hence estimates the variance of the estimator (LoH Index in this case).
For evaluating the performance of the multiclass classification, a confusion matrix or error matrix between the observed and predicted state of anesthesia is analyzed. By using the true positives/negatives and false positives/negatives, the evaluation parameters including the accuracy, sensitivity, specificity, and R-score are calculated. In a confusion matrix, the number of true and false predictions are summarized by each class and their count values. In this study, we started with small batch size and epoch along with varying the layers of the neural network. The training started with a batch size of 16 and the number of hidden layers was set to 2 with a very low learning rate of 0.0005. Since the EEG signal features vary with time, and to obtain improved accuracy and performance, the parameters were changed and optimized constantly. Therefore, the MLP network provides us the chance to optimize and vary layer architecture, epoch, batch size, learning rate, and kernel size.    Table III shows the comparison of the regression results from the proposed MLP regressor with other machine learning and deep learning algorithms for the LoH Index. The MLP network performs well in predicting the LoH Index with a very high correlation coefficient, R-Square, and low MSE. The proposed LoH algorithm is also compared with different ML classifiers and classification models to estimate how the proposed LoH model is superior to the others. Fig. 11 shows this comparison of classification metrics with other ML/DL models. The MLP network with the input feature matrix of a combination of SWT-based spectral, temporal, and fractal features outperforms all the other models with the highest classification accuracy of 97.1% and the lowest MAE (regression) of 3.53.
The proposed LoH classifier and regressor are verified using three case studies of three different patients from an EEG database. The selected case study in Fig. 12 (a) is a patient (a 20-year-old male with a 75.5 kg weight). The EEG was recorded for 25 minutes and 30 seconds just a little before and after the surgical procedure. At 10:50:00 A.M, the EEG recording for the patient started. At 10:52:00 A.M, the patient was injected with Propofol, and afterward, it was followed by intubation after 4 minutes. The two anesthesiologists present in the operation theatre declared the patient state as light LoH during the period of 10:53:25 A.M to 11:00:17 A.M. Around 11:05:04 A.M, it was observed by the anesthetists that the patient is not able to breathe on his own and the intubation was done around that time. The patient lost the ability to do motor actions but was not paralyzed at that time. However, the heart rate and pulse vitals were stable during this period. The moderate state of LoH was estimated by the anesthesiologists for the period of 11:00:20 A.M. to 11:50:44 A.M. As soon as the surgery was completed, the supply of anesthetic agents was cut off. At 11:53:00 A.M the patient was observed moving. A series of the stimulus was given to the patient from 11:54:25 A.M to 12:00:15 P.M. and the responses were observed at 12:01:00 P.M. During this time, the proposed LoH algorithm classified the patient in light LoH, despite the values of the reference BIS were on the borderline of moderate state. This case of the borderline values could have resulted in an extra dosage of anesthesia while the patient was in a moderate state instead of a light state.
The proposed LoH regressor highlighted the true LoH Index for these borderline values which helped the anesthesiologists to estimate the actual state of anesthesia and avoided them giving the extra dosage of anesthetic agents to the patient. Within 1 to 2 minutes around 11:55:03 A.M., it was concluded by the anesthesiologists that the patient has entered the light LoH. At 11:59:19 A.M. the extubation was done and after several minutes, the EEG recording was stopped, and the patient was shifted from the operation theatre to the postoperation room.
The second case ( Fig. 12 (b)) is a 10 years old male patient and his surgical process was herniotomy. His case belonged to the ASA-2 category with a surgery duration of 25 minutes. The recording was started at 10:10:00 A.M and the patient was induced with Propofol and the muscle relaxant at 10:14:28 A.M. The mask was placed on the patient's face to make him inhale the Sevoflurane and Isoflurane gasses. Within 1-minute, the patient entered the light LoH state and was intubated at 10:17:05 A.M. Both of the anesthesiologists declared the moderate LoH state of the patient at 10:19:49 A.M. As the patient was 10 years old and healthy kid, the stimulus was often given to tear his muscles, which created spikes in our recorded EEG. These disturbed values were misclassified by our proposed algorithm. The gasses were turned off at 11:19:14 A.M. and the patient started to gain consciousness. He was declared to be in the light LoH state by the anesthesiologists at 11:20:41 A.M. The surgery was completed at 11:21:54 A.M. and the patient was giving responses at that time. The tube was taken out at 11:23:10 A.M. We recorded the EEG data until 11:26:02 A.M. and then the patient was taken into the post-operation room.
The third case (Fig. 12 (c)) is for a 2.6 years old male patient who had an Orchidopexy operation. The recording started at 9:30:00 A.M when the patient was moved to the OT. He was induced with Propofol at 9:39:07 A.M., and afterward, he was in the light LoH state. At 9:41:18 A.M., the muscle relaxant was injected which was followed by intubation after 9 minutes. The two anesthesiologists concluded the moderate LoH state of the patient at 9:50:52 A.M after observing all essential parameters. The patient's position was changed to inject caudal at 9:51:20 A.M, which resulted in a false prediction. The surgeons started the incision at 9:58:11 A.M. During the surgery, the headset was unintentionally moved which was interpreted as the LoH light state by our proposed LoH estimation algorithm at 11:36:09 A.M. The gasses were turned off when the surgery was finished at 11:37:29 A.M and the patient was announced to be in the light LoH state by the anesthesiologists. The extubation was done at 11:39:39 A. M  TABLE IV  COMPARISON OF THE RESULTS OF REGRESSION AND CLASSIFICATION METRICS OF THE PROPOSED ALGORITHM  WITH STATE-OF-THE-ART LOH SYSTEMS FOR ESTIMATION OF STATES OF ANESTHESIA AND LOH INDEX and the patient started giving responses. The EEG data was recorded until 11:42:06 A.M., after which the patient was shifted to the post-operation room. During the entire EEG recording, there were two criteria used for evaluating the LoH. Firstly, for setting the reference states of anesthesia, the judgment of anesthesiologists based on their observations of patients' behavior and vitals was used as a gold standard. Secondly, a BIS monitor was used to record the BIS values of the patient in each state. The proposed MLP classifier and regressor output are in the agreement with the reference states and BIS values as estimated by the anesthesiologist and the BIS monitor. The LoH Index and the anesthesia states predicated by the proposed LoH algorithm closely follow the trend of the reference values (both LoH Index and state).
The proposed MLP-based LoH algorithm is also compared with the previous state-of-the-art LoH algorithms in Table IV. The comparison shows that the four states of anesthesia and the LoH Index are predicted with very high classification accuracy and low regression errors.
Our regression scores in Table IV are significantly better than the previous methods as discussed below [48], [49]. The proposed algorithm predicts both the states of anesthesia and the continuous LoH Index very accurately. The critical problem of borderline values of BIS values is solved since the MLP regressor predicts LoH Index with the lowest MAE and MSE while achieving the highest K-score of 0.91. The proposed MLP classifier can help the anesthesiologist with an accurate estimate of LoH while for the borderline values of the LoH Index, the MLP regressor predicts the continuous LoH Index with very low errors. Hence reducing the postoperative and intraoperative health risks for the patients.

VI. CONCLUSION
This paper presents a deep learning-based MLP network for the accurate estimation of the level of hypnosis during surgical procedures. The algorithm predicts the 4 states of anesthesia as well as the LoH Index in real-time from the EEG signal. The LoH algorithm is based upon a balanced combination of 8 SWT-based spectral, temporal, and fractal features. The proposed algorithm achieves the highest reported classification accuracy of 97.1% for 4 states prediction while keeping the mean squared error to 4.21 which is also the minimum reported for the predicted LoH Index.