Keywords

1 Introduction

In day-to-day life, everyone feels stressed either because of high workload or relationship dispute. These high brain activities for a prolonged period of time can lead to chronic stress which can further cause mental disorders like depression or anxiety. Stress can be detected through facial expressions, behavioral patterns, and varying voices, but people can deliberately hide these features which can result in false analysis. Gradually, researchers have shifted their focus on technologies like electroencephalogram (EEG) and electrocardiogram (ECG) as signals come directly through the human brain and heart, respectively.

This paper focuses on EEG and ECG signals which are recorded noninvasively to detect stress. EEG is a common test used for the recording of brain activities. It uses small metal disks known as electrodes that are placed on the scalp, and when brain cells send messages, they pick electrical signals. In this paper, out of the 64 electrode locations, 14 locations are used. The 10–20 system, which is an internationally recognized system to describe the electrode placement on the scalp, is referred in this paper.

The ‘10’ and ‘20’ refer to the actual distance between adjacent electrode locations which is either 10 or 20%, and for this, the brain is divided into four regions—frontal cortex, parietal cortex, temporal cortex, and occipital cortex.

ECG is used to measure the electrical activity of the heart by recording the heart rhythm. ECG waves, as in Fig. 1 consist of P-wave that detects alteration of atria, Q-R-S complex which provides information of alteration of ventricles, and T-wave which shows ventricular repolarization. When a person is in a stressful state, his heart rate changes, causing changes in the ECG pattern [1], and these changes are used to detect stress.

Fig. 1
figure 1

ECG wave pattern

According to the PAD emotional state model proposed by Mehrabian and Russell [2], three numerical dimensions, Pleasure, Arousal, and Dominance, can be used to represent all emotions such as pleasant (joy and happiness) and unpleasant (fear and anger) using Pleasure, energetic(boredom and rage) using Arousal, dominant (anger) and submissive (fear) using Dominance.

2 Literature Review

Lahane and Thirugnanam [3], in their journal, demonstrated how emotion detection can be carried out with the help of the DEAP dataset using the Teager–Kaiser Energy Operator(TKEO) approach with the k-nearest neighbor (KNN), neural network(NN), and other classifiers. This study explains how using TKEO improves feature extraction and proves a better way of emotion detection as compared to other conventional methods. Li et al. [4], in their study, recognized human emotions by EEG signals in two steps; first, it integrates the spatial attributes, frequency attributes, and time attributes of the EEG signals which map these into 2-D images. Then, it builds a series of EEG-MFI sequences to show emotion variation with EEG inputs. Secondly, it deals with the formed images by constructing a hybrid deep NN along with CNN. Kalas [5] in their research paper demonstrates decision tree, SVM classifier, and linear regression model on the patterns obtained by eye blinking via EEG using the data collected by activities like vehicle driving and heavy equipment operation where conciseness plays an important role. Patel et al. [6] use neuroimaging to differentiate between depressed and non-depressed patients and propose ways for treatment. It analyzes the past methodologies and suggests ways for future research. Subhani et al. [7] in their journal use a very famous experimental paradigm Montreal Imaging Stress Task (MIST) that consists of computerized arithmetic challenges. It has three levels—rest, control, and experimental, through which they induce stress among individuals which were then detected by applying ML models—support vector machine (SVM), logistic regression and Naive Bayesian classification on EEG data. Al-Shargie et al. [8] study the effect of mental stress on the prefrontal cortex subregion of the brain to improve the accuracy of mental stress detection using EEG. The result of their studies was that mental stress is subregion specific, and for better accuracy, right ventrolateral PFC is a suitable candidate.

3 Motivation for the Proposed Approach

There has been a lot of research on stress and emotion detection using EEG [9], and separate studies have been done on stress detection using ECG. This paper aims at improving the accuracy of stress detection by making a hybrid model that predicts stress on the basis of both EEG and ECG. Furthermore, this paper refers the Russel’s Circumplex model of affect [2] which provides a promising way to classify stress.

4 Proposed Stress Detection Method (Se.Re.Ne.)

In this paper, an ensemble method to detect stress using EEG and ECG signals (Se.Re.Ne.) has been proposed. Se.Re.Ne. works in four phases—data gathering, data analysis, stress classification, and statistical analysis. Figure 2 represents the block diagram of this work.

Fig. 2
figure 2

Workflow of Se.Re.Ne.

4.1 Data Gathering

Dataset used in Se.Re.Ne. is DREAMER [10] dataset which is made from EEG and ECG signals recorded during audio and visual stimuli used to entice specific emotions. Signals from 23 individuals were documented with their self-evaluation scores in the category of Valence, Arousal and Dominance [11] for each of the 18 clips shown. For EEG signals, theta, alpha, and beta power spectral density (PSD) for each electrode [12] was taken. For preprocessing, the dataset was stored in a ‘.mat’ format which had to be converted to a suitable format of ‘.csv’ for evaluation, and the emotional features from the dataset, namely Valence and Arousal, were used to classify stress using the Russell’s Circumplex model of affect which uses a 2D plane to classify various emotions on the basis of Valence and Arousal. Stress is described at the top-left quadrant of Russell’s plane with Valence represented at X-axis and Arousal represented at Y-axis. So, values of Valence and Arousal are taken as 2 and 4, respectively (on a scale of 5), and stress classification is done according to the conditions shown in Fig. 3.

Fig. 3
figure 3

Criteria for stress classification

After applying the proposed stress detection method, the data were divided into two classes—stressed (7979 data points or values) and not stressed (32,017 data points or values).

Due to this uneven distribution, upsampling of data was required to make the dataset even for both classes. Figure 4 shows the data points for target attribute before and after the sampling.

Fig. 4
figure 4

Data point distribution before and after sampling

4.2 Feature Extraction for Se.Re.Ne.

Feature extraction is done by using the correlation method in this paper, and results of which are represented in Table 1. It was observed that variation in age did not correlate with change in the stress class. Also, out of two ECG channels and 14 channels of EEG signals which were considered for this paper positions of which are shown in Fig. 5, EEG_7, EEG_10, and ECG_0 have a negative correlation with stress showing that these attributes are inversely related to stress. The negative correlation of Valence with stress is in alignment with our approach of lesser the value of Valence, more stressed the person will be.

Table 1 Correlation with stress
Fig. 5
figure 5

EEG electrode positions selected for Se.Re.Ne.

The following 14 EEG channels are considered in this paper.

4.3 Stress Classification

Many algorithms for mood analysis have been proposed, but to date, to the best of our knowledge, none of the algorithms has been used to detect stress. In this paper, we use two methods to detect stress.

The first method uses KNN [13], a lazy and non-parametric algorithm that is required for nonlinear EEG data. The value of k was taken as ‘7’ for stress classification by hit and trial.

The second method uses DT, a white box type statistical algorithm used for classification. It is a non-parametric algorithm and does not rely upon the probability distribution theory. Attribute selection is done on the basis of measures such as the Gini index.

$${\text{Gini}}\left( G \right) = 1 - \mathop \sum \limits_{i = 1}^{m} Pi^{2}$$
(1)

where pi is the probability that a tuple in G belongs to Class Ci and is estimated by |Ci, G|/|G|.

For each attribute, the possible binary split is considered on the basis of the maximum Gini index which will be there after splitting. A part of the decision tree of height 2 is shown in Fig. 6.

Fig. 6
figure 6

Decision tree of depth 2

4.4 Results Using the Proposed Method

Statistical analysis of the proposed stress classification method (Se.Re.Ne.) is conducted to get the results as in Table 2.

Table 2 Classification results

The ROC curve shown in Fig. 7 also helps to identify better algorithms [14] on the basis of the area under the curve (AUC). The area under the curve tests separation of data into two class labels. The more the area, preferable the result and better the algorithm. So, this plot helps us to identify DT as a better algorithm as compared to KNN which is also proved by the statistical results in Table 2.

Fig. 7
figure 7

ROC curve

5 Conclusion

In this paper, Se.Re.Ne., an ensemble method to detect stress using EEG and ECG signals, has been proposed. The proposed method works in four phases of data gathering, data analysis stress classification, and finally statistical analysis. Se.Re.Ne. records both audio and video signals to entice emotions along with self-evaluation scores. The correlation method is used to observe the variation in signals. Se.Re.Ne. stress classification is done using two methods KNN and decision trees. Results obtained through statistical analysis show that Se.Re.Ne. using KNN detects stress with a precision of 0.87, recall of 0.71, f1-score 0.78, and total accuracy of 68%, whereas Se.Re.Ne. using decision tree detects stress with a precision of 0.85, recall of 0.84, f1-score 0.84, and total accuracy of 75%. Hence, evaluation proves that extreme stress conditions Se.Re.Ne. detects using EEG and ECG signals with decision tree better than KNN, whereas normal stress condition Se.Re.Ne. detects using EEG and ECG signals with KNN better than decision tree.