Classifying Multi-Level Stress Responses From Brain Cortical EEG in Nurses and Non-Health Professionals Using Machine Learning Auto Encoder

Objective: Mental stress is a major problem in our society and has become an area of interest for many psychiatric researchers. One primary research focus area is the identification of bio-markers that not only identify stress but also predict the conditions (or tasks) that cause stress. Electroencephalograms (EEGs) have been used for a long time to study and identify bio-markers. While these bio-markers have successfully predicted stress in EEG studies for binary conditions, their performance is suboptimal for multiple conditions of stress. Methods: To overcome this challenge, we propose using latent based representations of the bio-markers, which have been shown to significantly improve EEG performance compared to traditional bio-markers alone. We evaluated three commonly used EEG based bio-markers for stress, the brain load index (BLI), the spectral power values of EEG frequency bands (alpha, beta and theta), and the relative gamma (RG), with their respective latent representations using four commonly used classifiers. Results: The results show that spectral power value based bio-markers had a high performance with an accuracy of 83%, while the respective latent representations had an accuracy of 91%.


I. INTRODUCTION
Mentally, stress can increase anxiety and depression levels as a result of emotional dysregulation [1], [2].Stress is also associated with a alterations in a person's cognitive abilities, affecting the memory and attention systems.However, stress affects each individual in a different manner, with some people having a higher tolerance for stress, while other's tolerance is low.Because of the potential medical risks from stress, studies on the physiological states induced by stress have increased [3].To induce stress in the laboratory, the Trier Social Stress Test (TSST) [4] and mental arithmetic stress test [5] are commonly used.Once stress is induced, physiological measurements, such as heart rate variability (HRV) [6] and Galvanic Skin Response (GSR) [7] in conjunction with electroencephalograms (EEGs) can be used to study and measure the physiological changes/responses induced by stress.These changes are often correlated with psychological instruments, for example, the Perceived Stress Scale (PSS) [8].
Among multiple physiological measurements, EEG is a widely used non-invasive method due to its excellent temporal resolution and low cost.EEG can also explain more about the underlying brain dynamics which is not attainable with other physiological recordings, such as galvanic skin response (GSR), photoplethysmography signals (PPG) [9] and electrocardiogram (ECG) [10].Lately, EEG headsets are also growing to be commercially available for recording brain activity in an easy to wear fashion [11], [12].Benefits such as portability and wearability of EEG devices have encouraged research towards the core applications of this technology.While EEG signals are popular for extracting prominent bio-markers such as P300 [13], steady-state visual evoked potential (SSVEP) [14].However, it remains a challenge to extract concealed bio-markers such as stress from EEG signals with substantial accuracy.This motivated us towards the study of classifying multi-class stress responses from brain cortical EEG signal.
Recently, extensive research has focused on the identification of stress using EEG-based biomarkers that not only identify stress but also can predict the conditions (or tasks) that cause stress.Multiple studies that focused on how to assess stress-induced in a laboratory or controlled environment used the relative gamma (RG) as a stress bio marker [15]- [18].There was some studies that used a EEG-based thetaFz/alphaPz ratio, called the brain load index (BLI) [19], [20] to detect the stress states.Other features, such as frontal asymmetry [21] and coherence [22], have also been used in EEG studies to detect stress.A few EEG studies utilized machine learning methods, such as linear discriminant analysis (LDA) [15], support vector machine (SVM) [23], k-means clustering [24], and k-nearest neighbors (KNN) [25] to detect stress.Some EEG studies showed a classification performance of up to 90% on a two-level classification [23], [26].The study conducted by [23] showed results with an accuracy of 96% from a two-level classification (resting vs arithmetic test) using SVM, with a sliding window of two seconds and a one-second overlap.While this is an interesting outcome, studies that classify more than two classes are challenging to undertake.
Decreasing the signal-to-noise-ratio in an EEG signal is one of the most main challenges for an EEG data analysis.This could be one of the reasons limiting the capability of classifying more than two levels of a lab induced stress task.This research aims to classify the multiple conditions caused by different lab-induced stress tasks.In this research, we recorded the EEG data of 30 clinically active nurses and 50 non-health professionals while performing 3 different stress-inducing tasks: 1. preparing for a speech 2. delivering a speech and 3. performing an arithmetic task.Machine learning algorithms such as deep neural networks [27], [28], convolution neural networks [29], [30] and ensemble convolution neural networks [31].Among which, auto-encoder neural network have been shown to learn the underlying representation of the given data by reducing the dimensionality of the data [27], [32]- [34].After training in an unsupervised technique, auto encoders have been shown to ignore the noise in the signal in its latent space.Recently, EEG-based studies have utilized auto-encoders in an attempt to increase the classification accuracy.Promising results was obtained in the research by Yin and Zhang [35] as they used a stacked-denoising autoencoder to learn within and across sessions of EEG workload data.They achieved an average accuracy of 95.4 % and 87.4 % for classifying two levels of mental workloads within and across sessions, respectively.Another study by [36] showed a result with an accuracy of 98.99 % using auto-encoder and KNN classifiers for emotional arousal classification.
We hypothesize that by using the latent representation produces by auto encoders can classify mental workload for more than two levels and we will be able to distinguish these differences using the features extracted from an auto-encoder.In this study, we train a deep auto-encoder artificial neural network, with three commonly used EEG features; the brain load index (BLI), the power values of EEG frequency bands (alpha, beta and theta), and the relative gamma (RG).The encoded latent representations of these features, which is a projection of the actual features in a latent space, is then used for classification.To determine the best-performing feature we trained and tested both the EEG feature and their latent representations using seven different classifiers: support vector machines (SVMs) [37], the AdaBoost classifier [38], linear discriminant analyses [39], the ridge classifier [40], Random Forest [41], K-nearest neighbor Classifier and the Deep Belief Networks [42].The results show that the classification accuracy was 83% using the SVM classifier with the power values of EEG frequency bands, and 91% with the latent representation of the same EEG's power feature.This result indicates that the power of the EEG's frequency band in a latent space could be the most suitable feature for classifying the different levels of lab-induced stress.The results suggest that the latent representation of these features, especially the power values, increased the classification accuracy by 8%.In this paper we also separately evaluate the classification performance for nurses and non-health professionals to understand their underlying differences in classification accuracies.

II. EXPERIMENT AND METHODOLOGY A. PARTICIPANTS AND INSTRUMENTAL SETUP
Data was collected from 80 participants aged between 18 to 45 years old.Among the participants, there was 30 clinically active nurses and 50 non-health professionals.The participants was screened for medication use, smoking habits, alcohol intake and chronic disease/illness before the experiment.Any participant who did not qualify after the screening process was excluded.The experimentation protocol was approved by the University of Technology Sydney Human Research Ethics Committee (HREC), and all the participants provided informed written consent prior to the experiment.Brain activity was recorded with a 32-channel EEG cap using the NeuroScan EEG system, SynAmps 2 (Compumedics Limited, Victoria, Australia) at a sampling rate of 1000 Hz.The 32-EEG electrodes was placed according to the extended 10-20 international system [43], and the contact impedance was maintained below 5 k .

B. EXPERIMENT DESIGN
The participants performed a modified version of the Trier Social Stress Test (TSST) [44] to elicit a controlled stress response.An EEG was recorded during the TSST, which involved 10-minute resting session, followed by a 10 minute preparation task, where participants was asked to prepare for a short speech.The preparation task was then followed by a 5 minute public speaking task, followed by 5 minutes of a difficult arithmetic task.The EEG recording obtained during the resting session was used as a baseline measurement.

III. DATA PROCESSING
The EEG's data processing was performed using EEGLAB [45], a toolbox in MATLAB (Mathworks Inc, USA).Raw EEG data was filtered using a 1 Hz high-pass and a 50 Hz low-pass infinite impulse response (IIR) filter.IIR is a recursive filter, which computes the current output by using current and previous inputs and also the previous outputs.By utilising previous input and previous output signals, IIR filters execute filter structure with feedback, this enables the filtering to work with fewer coefficients and thus work faster [46].After filtering, the data was down-sampled to 250 Hz.Subsequently, an artifact subspace reconstruction (ASR) [47], [48] was applied to remove noisy channels and line noises.After the ASR, the data was re-referenced to a common average.An independent component analysis (ICA) [49] was then applied to decompose the data into independent components (ICs).The ICs related to eye movement, muscle activity; other noise was selected using a function in EEGLAB called IClabel [50] and ICs which had 90% likelihood of eye movements and muscle activity was removed.After the rejection of the bad components, dipole fitting [51], [52] was applied to the dataset in order to obtain the residual variance, and any component with a residual variance greater than 10% was also removed.After preprocessing the data, we found that 5 participants (3 belong to nurse group and 2 belong to non-health professional group) had unacceptable levels of noise in the data; therefore, data from these participants was excluded.Hence, subsequent analysis focused on the remaining 75 participants.
In the resultant data, a baseline correction was made by deducting the mean of the baseline data from the speech task, the preparation task, and the difficult arithmetic data.The EEG data of each task was divided into 1-second windows.An average value of alpha (7-13 Hz), beta (13-39 Hz) and theta (4-7 Hz) power values was computed for each window, which resulted in 600 data points for the baseline, 600 data points for the preparation task, 300 data points for the difficult arithmetic task and 300 data points for the speech task for each participant.Therefore, in total there was 600 x 75 data points for the baseline, 600 x 75 data points for the preparation task, 300 X 75 data points for the mental arithmetic task and 300 x 75 data points for speech task.

IV. FEATURE EXTRACTION METHOD
Stress levels can change at different times during the task (e.g.beginning of the task, during the task, and at the end of the task).To understand which time window can be best classified, we divided the EEG data of each task into 3-time windows.As explained in section III, the baseline task contained 600 data points, which was divided into 1-200, 200-400 and 400-600 data points, and likewise for the preparation task.For the speech and mental arithmetic task, the first time window contains 1-200 data points, the second time window contains 100-300 data points, and the third time window contains 100-300 data points.Figure 1 shows the partitioning of the data per task.The time window 2 and 3 for speech and mental arithmetic are the same, however,for easy refereeing and consistency of the windows throughout the paper for the tasks, we used this notation.

A. EEG POWER VALUES AT CENTRAL POSITIONS: FZ, CZ AND PZ CHANNELS
The alpha (7-13 Hz), beta (13-39 Hz) and theta (4-7 Hz) power values for the Fz, Cz, and Pz channels was extracted using Welch's method [53] using the EEGLab toolbox [45] for each time-window.Later, an auto-encoder of latent representations of size 50 was trained using each time-window, resulting in three trained auto-encoders.The architecture is shown in Figure 2.

B. EEG RELATIVE GAMMA (RG) AT CENTRAL CHANNELS: FZ, CZ AND PZ CHANNELS
The relative gamma is measured based on the complementarity of the fast and slow brain rhythms.The change in gamma oscillations in relation to the slow rhythms (4-23 Hz) play a complementary function to the fast rhythms [17].The RG values 1 (as in equation 1) was computed from all the central channels (Fz, Cz and Pz) as features.The data was divided into three time-windows, similar to the power values.Figure 3   Studies on cognitive loads suggest that stress may increase the alpha activity in the right prefrontal cortex [21], [54].The brain load index, which is the ratio of the frontal theta and the parietal alpha activities, is based on the theory that the increased cognitive stress increases the frontal theta activity and decreases the parietal alpha activity [55].Thus, we used the brain load index (as in equation 2 ) as a feature.The data was divided into three time-windows, and each time-window was trained and tested by a 5-fold cross-validation using four classifiers.(2)

D. AUTOENCODER FOR LATENT REPRESENTATION
An auto-encoder is an unsupervised neural network which applies back propagation to make the output of the network similar to the input [44].Given a signal X , an encoder network Z = f (X ) converts X input to Z latent representation, and decoder network X prime = g(Z ) produces a reconstruction of the inputs X .
The weights of the neural network are learned by minimizing the following loss function equation 3.
where N is the total number of input points, x i is the i th input and x i is the i th node output.
By limiting the number of hidden units, more features in the data will be revealed.Figure 2 shows the structure of the auto-encoder.We trained an auto-encoder that was constituted by 50 hidden (latent) neurons.The root mean square error was used as a loss function, and the stochastic gradient descent algorithm was used as an optimizer.Each of the three features, namely, the power values, the RG and the brain load index, was used to train three different auto-encoders.Each of the three auto-encoders was trained separately.Later, the latent representations was extracted from these neural networks and used as features for the classification.

V. MACHINE LEARNING CLASSIFIERS
We used four different classifiers to analyse the classification's performance on both the original features and their latent representations.The following four classifiers was shown to be capable of classifying highly non-linear data [56]- [58].

A. SUPPORT VECTOR MACHINE
A support vector machine (SVM) [37] performs classification by finding the hyper-plane that maximizes the boundary between multiple classes.The EEG data we used in this study was highly non-linear and was separable using an N-dimensional hyper-plane.However, the SVM used a non-linear kernel function to project the EEG data into a different space making it possible to perform the linear separation.

B. ADABOOST
An AdaBoost [38] combines multiple classifiers (base estimators) to build strong classifiers.This study used 10 decision tree classifiers as base estimators.In each iteration, the AdaBoost trains its base estimators using randomly selected training subsets.It then assigns the weight to the trained base estimators in each iteration based on their accuracy.This process is iterated until all of the training data fits with good accuracy, or until it reaches the maximum number of estimators.In this study we used a maximum of 50 estimators.

C. LINEAR DISCRIMINANT ANALYSIS
A linear discriminant analysis (LDA) [39] is a dimensionality reduction technique which reduces the dimensions of the given data by removing the redundant features.An LDA transforms the features from a higher dimensional space to a lower dimensional space.This is achieved by maximizing the variance between the classes and minimizing the variance within the classes.An LDA estimates the probability that new data belongs to each class based on the mean and variance of the new data point.The performance of LDAs in this study also explains the separability of the distributions of multiclass EEG data.

D. RIDGE CLASSIFIER
Similar to the SVM, a ridge classifier [40] defines a hyperplane that can best separate the classes.However, the ridge parameter in this algorithm allows it to work on data that are not completely linearly separable.This study attempts to compare the performance of an SVM and a ridge classifier to understand if the learning of ridge parameters contributes to the classification.

E. RANDOM FOREST CLASSIFIER
Random forest builds an ensemble of decision trees and combines the results of all the decision trees to get a more accurate prediction [41].Each decision tree contains branches and nodes.At each node in the decision tree, a random set of features are regarded to decide the most beneficial split.Each decision tree is trained on each of the subsets.The final prediction is computed by averaging the prediction from all decision trees combined.In this study we used a Random forest classifier with 100 decision trees.

F. K-NEAREST NEIGHBORS (KNN) CLASSIFIER
K-nearest neighbors (KNN) classify data based on the similarity measures (e.g., Euclidean distance) [59].k is the number of nearest neighbors that will be considered to predict the class of a new data point.For example, to classify a new test data point x 1 , KNN algorithm first finds k closest points to x 1 and then classify x 1 by preponderance of its k neighbors.In this study, we used k = 5 and minkowski [60] as a distance measure.

G. DEEP BELIEF NETWORK (DEEP BF)
Deep belief network [42] is a form of the deep neural network, which contains several layers of connected neurons.The training process is done in a greedy layer-wise fashion, where the weights are learned to abstract the hierarchical features from the data.Promising results were obtained when Deep BF networks were used for EEG classification [61], [62].However, these existing studies either use EEG signals containing notable biomarkers such as P300 or use the Deep BF for binary-level classification.In this study, we also trained Deep BF networks to understand their ability to classify a multi-level stress task.

VI. PERFORMANCE METRICS A. T-DISTRIBUTED STOCHASTIC NEIGHBOR EMBEDDING
To explain the variance-covariance structure of the original features and the latent features we analysed the data using a T-distributed stochastic neighbor embedding (TSNE) [63].A TSNE transforms similarities in the data to joint probabilities and minimizes the Kullback-Leibler [64] divergence between the joint probabilities of the low-dimensional embedding and the high-dimensional data.In this study we analyzed the TSNE by setting the perplexity to 10% for 5000 iterations with a learning rate of 10 3 .

VII. COMPUTATIONAL AND TIME COMPLEXITY
In this study we classified multi-level stress, using features extracted from AutoEncoder neural network and these features are then used for classification by Support Vector Machine (SVM).For training a Support Vector Machine classifier the time complexity is between O(n 2 ) and O(n 3 ), where n is the number of training instances [65].The minimum time complexity O(n 2 ), is possible when the classification boundary is explicit in the dataset.AutoEncoder is trained using the backpropagation algorithm, which involves forward propagation and backward propagation.Run-time complexity of a forward computation for layer k with n k neurons of a neural network can be defined as O(n k ) [66].In this study, we used an autoencoder neural network with 8 layers (4 layers for encoding and 5 layers for decoding).The time complexity for one feedforward pass of an AutoEncoder with 4 encoding layers is O(ij + jk + kl), where i, j, k and l are the number of neurons in each encoder layer and feedforward pas of 4 layer decoder is O(ab + bc + cd), where a, b, c and d are the number of neurons in each decoder layer.the time complexity for a backward pass of an AutoEncoder with 4 encoder layers is O(lk + kj + ji) and for 4 decoder layers is O(dc + cb + ba).In this study we used 100 neurons in the input layer, followed by 50 neurons in each of the 3 encoder layers.The decoder contains 3 layers with 50 neurons each and 100 neurons in the last layer.

A. CLASSIFICATION RESULTS
Seven different classifiers was trained and tested in a 5-fold cross-validation method.Table 1 shows the classification accuracy of the support vector machine, the AdaBoost classifier, the LDA, the ridge classifiers, Random Forest, K-Nearest neighbor and Deep belief network.In this paper we present only the accuracy results of the above classifiers on the third time-window data (200-300 seconds data), which showed better performance compared to the first and second timewindows.Refer to the appendix for detailed results for each time-window.We also trained the four classifiers using raw amplitude of EEG data extracted from the Fz, Cz, and Pz channels.The classification accuracy was found to be 30%, and therefore was discarded for further analysis.
As shown in Table 1, the support vector machine algorithm outperformed the AdaBoost, LDA, ridge classifiers, Random Forest, K-Nearest neighbor and Deep belief network.The support vector machine, when trained on the alpha, beta, and theta power values, obtained a classification accuracy of 83%, and when trained using its corresponding latent features, the performance increased by 8%.The support vector machine also showed performance increases when trained on RG and BLI.However, the comparative power values showed significant differences in the classifications.Figure 5 and 6 shows the precision score and f-score obtained for 7 classifiers for the latent features.

B. T-DISTRIBUTED STOCHASTIC NEIGHBOR EMBEDDING
To understand the local structural data differences between the feature and their latent features, we applied the TSNE algorithm on the best performing features, i.e. the alpha, beta, and theta power values and their latent features.

C. LATENT REPRESENTATIONS FOR BLI, RG AND THE POWER VALUES FEATURES
Table 2 shows the mean and standard deviation of all the 6 features (power values, relative gamma (RG), brain load index (BLI) and their respective latent values).

IX. NURSE AND NON HEALTH PROFESSIONAL GROUP
In order to understand the classification accuracy of different groups of participants, we analyzed the EEG data of 30 clinically active nurses.Table 3 shows the classification accuracies of the support vector machine, AdaBoost classifier, linear discriminant, the ridge classifiers, Random Forest, K-Nearest neighbor and Deep belief network.Table 4 shows the classification accuracies of 7 classifiers on the controller data (nonhealth professional group).

X. DISCUSSION
This study hypothesized that using the latent representations of bio-markers such the brain load index, the relative gamma and the power values of the EEG frequency bands (alpha, beta and theta) can improve the classification performance for 3 types of lab induced stress as compared to the traditional bio-markers.These bio-markers when projected in a latent space using a trained deep auto-encoder neural network, has created a better feature representation for classification.When tested these latent feature using four different classifiers, we observed that the latent features was able to classify the better in comparision to the actual bio-markers.
This research showed that the use of an auto-encoder allowed for prediction of changes across the averaged EEG central reference points.In this paper, the results obtained by combining the data from both control (non-nurse) participants, and nurses, in the experiment achieved an accuracy of 91 % when using the latent representation learned from the support vector machine.The accuracy increased to 91 % with the latent representations of the power values, in comparison to 83 % achieved with the actual power values.Disentangling the learning of feature extraction and classification, using our proposed framework has shown to increase the accuracy in classifying multi-level stress activity.The result of the SVM with the latent representation of BLI, also achieved a high accuracy of 80.7 %.These results suggest that the SVM with latent representation is a suitable and efficient classifier for addressing the changes of brain activity associated with various stress levels.Fig 6 shows the precision score when a latent representation is used for classification, and Fig 5 shows the f-score.The auto encoder neural network, when trained using an unsupervised algorithm, has been shown to extract the features of the power values, which resulted in improved classification performance.Studies [67]- [69] show that using the auto encoder neural network reduces the noise in the input data and extracts the essential features by projecting them into the latent space.These studies and the classification accuracy in this study suggest that the auto encoder removed the noise in the power values and extracted the features that increased the classification accuracy.he features extraction and classification algorithm are performed using only 3 central channels (Fz, Cz and Pz).This makes it feasible to use on a wearable EEG device.The proposed model can identify different stress-level conditions from the EEG data with high accuracy for both nurses and the control groups.To further enhance the accuracy, we will study the differences in brain dynamics under various stress-level conditions in a future study.
The classification of raw EEG data into 4 conditions (baseline, preparation, speech and arithmetic task) achieved an accuracy of 30%.In addition to artifacts, one major cause of this low accuracy could be the highly nonstationary and nonlinear dynamics of the recorded EEG data.Since the EEG data was recorded separately in stages (baseline, preparation, speech and arithmetic task), the issues of user variability, circadian variability, and task variability become more pronounced, and they induced shifts in the statistical properties in the data, leading to poor generalizations in the trained model.The proposed model uses features such as Brain Load index (BLI), Relative Gamma (RG) and power values (alpha, beta and theta of central channels) which are extract from 3 central channels (Cz, Fz and Pz).However, for some of the EEG datasets, it is essential to understand the features using EEG activity from all the channels.It still remains unexplored up to what degree the proposed architecture can learn to extract efficient features from all channel EEG activity.
Latent representation produced by auto-encoder has shown to extract the concealed bio-markers of stress.These latent representation has shown to provide features that are beneficial for further classification.By employing our proposed approach, various EEG datasets could be used to understand the feature representation.Additionally, using AutoEncoder with long-short term memory (LSTM) cells [70] can assist to understand the underlying temporal dynamical representation that can explain the variance in the EEG data.In the future, we aim to study the underlying temporal dynamics of multi-level stress from EEG data using AutoEncoder with LSTM cells.The proposed model can also be investigated in the direction of detecting stress level in real-time, which might be a potential application for therapeutic strategy.

XI. CONCLUSION
In summary, this paper demonstrated that the most suitable feature to detect stress are the power values of the alpha, theta and beta frequencies.For identifying the four conditions, an average classification accuracy of 83 % was achieved using the SVM with a power value of 91 % with the latent representation of the power value.Furthermore, the results also demonstrated the viability of an autoencoder for increasing the classification accuracy, since the latent representations of the features might encapsulate the features.

FIGURE 1 .
FIGURE 1. Division of data for different tasks.EEG recorded during baseline (resting session) and preparation task was divided into 3 time windows (time window 1 for first 200 seconds ≈ 200 data points, time window 2 for 200 to 400 seconds ≈ 200 data points, time window 3 for 400 to 600 seconds ≈ 200 data points).For speech and mental arithmetic tasks the first time window contains 0-200 seconds ≈ 200 data point, and time window 2 and time window 3 are the same which contain 100 to 300 seconds ≈ 200 data points.

FIGURE 2 .
FIGURE 2. Auto encoder neural network, which receives alpha, beta and theta values.

FIGURE 3 .
FIGURE 3. Mean RG for channel Fz, Cz and Pz across all participants for each condition.
Fig 4 shows the mean BLI across all the participants for each condition.BLI = Theta(Fz)/Alpha(Pz)

FIGURE 4 .
FIGURE 4. Mean BLI for channel Fz, Cz and Pz across all participants for each condition.

FIGURE 5 .
FIGURE 5. F-score for the classification using latent features.

FIGURE 6 .
FIGURE 6. Precision score for the classification using latent features.

FIGURE 8 .
FIGURE 8. Latent representation of alpha, beta and theta in TSNE 2 dimensions.

Figure 7 and
Figure7and Figure8show the TSNE representations of the alpha, beta and theta power values and the latent features, respectively.This visualization explains the separability of the classes in to 2 kinds of features (original features and their latent features).

TABLE 2 .
Mean and standard deviation of latent features.

TABLE 3 .
Accuracy of 7 different classifiers, trained on the nurse data to classify baseline, arithmetic, preparation and speech task.

TABLE 4 .
Accuracy of 7 different classifiers, trained on the controller data to classify baseline, arithmetic, preparation and speech task.