1 Introduction

In today’s world, cognitive performance analysis is critical for preventing various physiological and psychological disorders. Continuous mental load exposure has been shown in neuroscience to affect brain dynamics [1, 2]. Thus, the individual becomes exhausted and mental load-related pressure built which influences their way of life. Different health inconveniences are associated with these cognitive workloads. For instance, it increases the probability of respiratory failure, stroke, heart attack and depression [3, 4]. Clinically, stress has been assessed utilizing subjective methods like interviews and questionnaires [5]. On the other hand, physiological and physical changes have been used as an objective marker for detection of mental workload. For example, physically stress changes blink rate, facial gesture and pupil dilation [6,7,8]. The physiological reaction to stress would be at first reflected on the autonomic nervous system. Balance between parasympathetic and sympathetic branches may get break due to exposure of stress events. Sympathetic branch would be hyper-initiated, while parasympathetic branch would be suppressed. This can bring physiological changes like heart rate variability (HRV), respiration, blood pressure and skin conductance [9,10,11,12]. As indicated by the most recent neuroscience, the human brain is responsible in deciding if a circumstance is undermining and distressing, which makes it prime target of mental load [13]. So, technique based on non-invasive brain signals like electroencephalography (EEG) can be the most suited method to analyze functional changes in the brain.

This paper presents a novel cognitive performance detection technique using EEG signals. High reported accuracy reflects reliability of this method. The paper also presents a novel lead-specific approach for cognitive performance detection. Using this technique, cognitive performance can be estimated by a single lead of EEG recording from frontal lobe of cerebral cortex. The paper is framed as follows: Database utilized in this work is described in Sect. 2. Underlying methodology for this technique is in Sect. 3, results in Sect. 4, discussion in Sect. 5, and a summarized conclusion in Sect. 6.

2 Materials

EEG During Mental Arithmetic Tasks database has been used in this research work [14, 15]. These data are from 36 healthy subjects aged between 18 and 26 years. EEG signals were recorded as per international 10–20 system from the subjects during and before performance of mental arithmetic tasks (performing mental serial subtraction). Mental arithmetic performance is considered as a standardized stress-inducing experimental protocol [16, 17]. Serial subtraction during 15 min is considered to be a psychosocial stress [18]. Moreover, we have used recordings from frontal and anterior frontal lobe of brain (Fp1, Fp2, F3, F4, F7, F8 and Fz) in our research work. Frontal lobe contains most of the dopamine neurons in the cerebral cortex which is associated with decision making, short-term memory tasks, attention and planning. A 10–20 EEG electrode placement is depicted in Fig. 1. To remove artifacts, power line notch filter (50 Hz), low-pass filter and high-pass filter of 0.5 Hz and 45 Hz cutoff frequency were used (sampled at 500 Hz).

Fig. 1
figure 1

10–20 EEG electrode positions

3 Methodology

Filtered EEG signal is decomposed using wavelet transform, and entropy-based features were exacted. Selected features were used for classification using supervised machine learning approach. A flow diagram of underlying methodology is shown in Fig. 2. Details of each step are given in subsequent sections.

Fig. 2
figure 2

Process flow diagram

3.1 Pre-processing

As the available EEG signals were passed through filters as described in Sect. 2, these signals were readily used in our study.

3.2 Stationary wavelet transform (SWT)

SWT is used to study the time-domain EEG signal at various frequency bands. At each decomposition level, SWT carries same temporal information which provides it a time-invariant property. To get rid of repeatability issue, SWT inserts zeroes between taps of the filters, as an alternative to decimation [19]. Due to the data length requirement of SWT and early detection of stress, EEG signal was segmented using a window length of 2047 (2047/500 = 4.094 s, here 500 is sampling frequency). As a mother wavelet, five-order Daubechies have been used and six-level decomposition was done.

3.3 Feature extraction

Productivity of machine learning technique banks the extracted features or attributes. This paper uses entropy-based feature for stress detection. Entropy is a measure of complexity and has promising capabilities in representing brain dynamics [20].

3.3.1 Sample entropy (SEN)

SEN is used for analyzing the complexity of physiological time series signals. SEN is the negative logarithm of the probability that if two time series of length m have distance \(< r\), then two sets of simultaneous data points of \(m+1\) also have distance \(< r\). But it is calculated excluding self-similar patterns as in the case of approximate entropy.

The \({\mathrm{SEN}}(m, r, M)\) of any time series \(<x[n]>\) of length M can be defined as in Eq. (1).

$$\begin{aligned} \text {SEN}(m, r, M) = -\log \left[ \frac{A^m}{B^m} \right] \end{aligned}$$
(1)

where \(A^m\) and \(B^m\) are probability of two sequences coinciding for \(m+1\) and m points. SEN requires tuning of two key parameters, tolerance (r) and embedding dimension (m). If r is chosen too small, it will result in many vectors that are similar failing to match. On the other hand, when r is too large, \({\mathrm{SEN}}(m, r, M)\) loses its discriminating power. It is often chosen to be between 0.05 to 0.25 times the standard deviation of the time series data. In this work, it is selected to be 0.2 times standard deviation of EEG segment. m is picked to be 1 or 2; we have used m = 2. The advantages of this entropy are [21, 22]: (i) it can be used for shorter series of noisy data and is able to differentiate large variety of systems, (ii) it performs much better than the approximate entropy as self-matches are not counted, which reduces the bias, and (iii) the entropy values are more in tuned across different lengths.

3.3.2 Renyi’s entropy (REN)

REN is useful for estimating the spectral complexity of a time series signal. The REN with total spectral power \(p_i\) and order \(\alpha \) , where \( \alpha \ge 0\) and \( \alpha \ne 1\), is defined as [23]:

$$\begin{aligned} \text {REN}(\alpha ) = \frac{1}{1-\alpha } \log {\Bigg (}\sum _{i=1}^{n}p_{i}^{\alpha }{\Bigg )} \end{aligned}$$
(2)

REN with order \( \alpha = 1\) is analogous to Shannon’s entropy and \( \alpha \ge 2\) provides a lower bound of REN so \( \alpha = 2, 3\) has been used in this work. The significant advantages of REN are [22]: (i) this entropy changes by an additive constant during re-scaling of the variables, and (ii) it is independent of the density functions.

3.4 Handling imbalanced data

Handling imbalanced data is an issue in machine learning. This circumstance arises when a few kinds of data distribution remarkably influence the instance space over other data distributions. In our study, instances of resting stage were more compared to that of EEG during mental task. We have used adaptive synthetic sampling (ADASYN) approach to handle this imbalanced data issue. ADASYN works on the concept of adaptively generating minority data samples based to their distribution [24]. ADASYN has ability to adjust its decision boundary to focus on the minority instances, and it also reduces the learning bias introduced by the original imbalance data. Thus, after applying ADASYN both the classes have comparable number of instances.

3.5 Feature selection

Performance of a supervised machine learning algorithm predominantly depends on separability of the chosen attributes or features. In this work, applicability of the feature was evaluated on the grounds of Fisher score (F-score). F-score of the \(i^{th}\) feature is calculated as in Eq. (3) [19].

$$\begin{aligned} F^i=\frac{\sum _{k=1}^c n_k (\mu _k^i - \mu ^i)^2}{(\sigma ^i)^2} \end{aligned}$$
(3)

where \(\sigma ^i\) and \(\mu ^i\) are standard deviation and mean of complete data, respectively, and \(\mu _k^i\) is mean of \(k^{th}\) class, for \(i^{th}\) feature. c is the number of class and number of instances in \(k^{th}\) class is \(n_k\). Most discriminating feature will have highest value of \(F^i\). Similarly, top 40 features are ranked and listed in Table 1 based on their F-score. It is noticeable that out of 40, 15 features are from same lead (F4) of EEG signal. This observation has motivated us in proposing lead-specific approach for stress detection.

3.6 Classification

Classification is the process in machine learning to predict the class of given data points. To fit a suitable classifier, the data for classification is fed to supervised classifiers [25].

3.6.1 K-nearest neighbors (KNN)

KNN is a nonparametric, instance-based, lazy learning technique for pattern classification based on finding the closest training set. KNN is simple to understand and easy to implement for both binary and multi-class classification. Being a nonparametric and using instance-based learning method KNN needs no assumptions for its implementation, and it responds rapidly to change in the data. Due to its lazy learning approach, it stores the training data and wait for testing data. During testing, it classifies the data point based on stored training data. Euclidean (E) and Mahalanobis (M) distances are two distance metrics utilized in this work.

3.6.2 Support vector machines (SVM)

Estimating a boundary for classification is simple for linearly distinguishable data, but during actual implementations data are nonlinear. To solve this, SVM uses a kernel trick to transform the data to a higher-dimension space where they can be comparatively separable. The kernel used in this work is a Gaussian radial basis function. The goal of SVM is to find a hyperplane, which can result in a more accurate classification of data.

4 Results

In the proposed machine learning model, classification using supervised learning approach has been used. During this work, tenfold cross-validation has been used. This is a preferred method because it gives model the opportunity to train on multiple train–test splits. It gives a better indication of how well model will perform on unseen data. Performance is analyzed in terms of classification accuracy (Ac%) and area under the receiver operating characteristic curve (AUC). The proposed work has been analyzed in: multi-lead approach (MLA), where features extracted from 7 different EEG leads (Fp1, Fp2, F3, F4, F7, F8 and Fz) from frontal and anterior frontal lobe of brain were used based on their ranking, and lead-specific approach (LSA), where features extracted only from F4-lead EEG signal were used.

4.1 Multi-lead approach (MLA)

Distance metric (DM), number of features (N) and number of neighbor (K) are three key parameters which affect the performance of KNN. So, we have analyzed our work with the variation of these parameters in Table 2 and in Fig. 3.

Table 1 Top 40 features for cognitive performance detection

For SVM using Gaussian kernel, number of feature (N) and kernel scale \((\gamma )\) are key parameters. To tune these parameters, we have analyzed the proposed technique with the variation of N and \((\gamma )\); this is shown in Table 3 and in Fig. 4.

The proposed technique has highest accuracy of 94.00% at \(\gamma = 2.25\). Comparing Tables 2 and 3, it is evident that SVM has greater potential for stress detection compared to KNN.

4.2 Lead-specific approach (LSA)

Table 1 enlists the top 40 features for stress detection. It was observed that out of 40, 15 features were from lead F4. It represents frontal lobe of cerebral cortex; it is portion of brain responsible for decision making, projecting future consequences, concentration, planning and emotional expression [26, 27]. For investigating the ability of stress detection using a single lead of EEG signal, features extracted from lead-F4 were used separately in this section. We have presented the results with variation of key parameters of KNN in Table 4 and in Fig. 5. To tune the parameters of SVM, we have analyzed the proposed technique with the variation of N and \((\gamma )\); this is shown in Table 5 and in Fig. 6.

Table 2 MLA: result using KNN as classifier
Fig. 3
figure 3

MLA: Ac% at different values of K and N using KNN

Table 3 MLA: result using SVM as classifier
Fig. 4
figure 4

MLA: Ac% at different values of kernel scale (\(\gamma \)) and N using SVM

Table 4 LSA: result using KNN as classifier
Fig. 5
figure 5

LSA: Ac% at different values of K and N using KNN

The proposed technique has achieved accuracy of 93.50% at \(\gamma = 1.75\) using features extracted from F4 lead of EEG signal. This shows ability of the proposed technique to detect stress using single lead of EEG signal.

5 Discussions

In Table 6, the proposed technique is compared with existing state-of-the-art methods related to cognitive performance. Stimuli that alter an organism’s environment are responded by multiple systems in the body. Thus, cognitive performance can be measured through various bio-signals like EEG, ECG, GSR and others. Apart from EEG, to present effectiveness of our proposed technique it has been compared with other bio-signals in Table 6.

Table 5 LSA: result using Gaussian SVM as classifier

Neurological studies have proved that mental load affects the brain dynamics and these changes are reflected in EEG signal recorded from cerebral cortex [27, 38]. Many models have been created by researchers for cognitive performance detection utilizing EEG signals. Vanitha et al. [28] have proposed a technique for stress detection using EEG signal which uses Hilbert Huang transform (HHT) for relevant attribute identification in time–frequency domain. SVM was used as a classifier, and they have achieved an accuracy of 89.07 %. Hou et al. [29] have proposed a technique using fractal dimension, statistical features and SVM as a classifier. Using their technique four levels of stress can be recognized with an average accuracy of 67.06%, three levels of stress can be recognized with an accuracy of 75.22%, and two levels of stress can be recognized with an accuracy of 85.71%. Jebelli et al. [30] have proposed a method for identification of stress among workers at building site utilizing EEG signal. Frequency- and time-based attributes from EEG signals were determined utilizing fixed and sliding windowing approaches. At last, authors applied few supervised learning methods to perceive worker’s stress while they are work at site. The outcomes demonstrated that the fixed windowing approach and the Gaussian SVM yielded the most elevated accuracy of 80.32%. Xin et al. [31] have proposed a procedure for stress state assessment by an improved SVM. This technique increases the accuracy from 73.79 to 81.38% and decreased the running time from 1973.1 to 540.2 sec. Al-shargie et al. [32] have proposed a technique for mental stress quantification using EEG signal. They have used wavelet transform for time-frequency decomposition of the signal. Mean of the absolute values of the wavelet coefficient in every sub-band and the average energy and power were calculated, and with the help of SVM they have achieved a maximum accuracy of 94%. But, in their work twelve healthy adults with an age ranges from 20 to 24 years participated which is less compared to the proposed work which includes data from 36 healthy subjects aged between 18 and 26 years. Also, the number of features used in this proposed work is less (40) compared to a total of 840 features for each subject in each recording phase. Along with MLA, the proposed technique presents a novel approach (LSA) for stress detection using single EEG lead. Martinez et al. [20, 33] have used entropy-based features, decision tree and SVM for classification respectively in [20, 33]. But its reported accuracy is comparatively less.

Fig. 6
figure 6

LSA: Ac% at different values of kernel scale (\(\gamma \)) and N using SVM

Galvanic skin response (GSR) is a strategy to quantify the electrical conductance of the skin as it fluctuates with change ambiance around a person. At the point when an individual is stimulated or energized, the moisture levels in the skin fluctuate; hence, its electrical conductance changes. This is because of the reason that sweat glands are commanded by the sympathetic nervous system. So as to quantify the electrical resistance, a consistent voltage should be applied and the skin conductance can be determined with the use of Ohm’s law. A GSR amplifier applies a little voltage through the skin which can’t be felt by people, but can be recognized after amplification. Many researchers have used GSR signal for developing technique for stress detection. Villarejo et al [34] have planned and assembled a pressure sensor dependent on GSR and commanded by ZigBee. It was tried on 16 grown-ups and was discovered that GSR can distinguish the various conditions of every client with an accuracy of 76.56%. Dehzangi et al. [35] have proposed GSR-based distracted driving recognition utilizing continuous and discrete decomposition and wavelet packet transform. They utilize two deconvolution strategies to break down raw signal into the phasic and tonic parts. Result shows that it has an accuracy of 92.2% using ensemble bagged classifier on 74-dimension attribute space. Kurniawan et al. [36] have proposed a technique for stress detection using GSR and speech signal. They investigated different methods for estimating stress using four classifiers: K-means, SVM, GMM and decision tree. Using speech attributes only, SVM outperformed other classifiers reaching 92% accuracy. Accuracy of classifier trained on GSR-based attributes was less.

Table 6 Comparison of the proposed technique with existing state-of-the-art methods

The sinoatrial node (SAN), situated in the wall of the right atrium, fires the electrical impulses, controlled by central and autonomous nervous system (ANS). The physiological reaction to stress would be at first reflected on the ANS. Balance between parasympathetic and sympathetic branches may get break due to exposure of mental load [39]. Sympathetic branch would be hyper-initiated, while parasympathetic branch would be suppressed [39]. These data would be transmitted to the cardiovascular movement, which could be estimated by ECG signals. Using this idea, many researchers have utilized ECG and HRV for automated stress detection [40]. He et al. [11] have proposed a system for real-time detection of stress utilizing a convolutional neural network (CNN). Due to the benefit of CNN in programmed feature learning, this system exacts and identifies stress from HRV signal. They have utilized short time window (10 s) for identification of stress and have achieved a detection error rate of 17.3%. Munla et al. [37] have used ECG signal of the driver to extract HRV-based features. After HRV analysis, several parameters are extracted to build a vector of features for the classification phase. Results indicate that using their technique stress could be predicted with an accuracy of 83.00% using SVM-RBF classifier.

The proposed technique shows better and comparable performance compared to existing state-of-the-art methods involving cognitive performance analysis. This work also proposed a lead-specific approach for mental cognitive performance estimation using a single EEG lead recorded from frontal portion of brain. As per the literature reviewed, it is a novel approach for cognitive performance estimation. This approach can further be utilized for designing continuous mental load monitoring system as wearing a complete 10–20 EEG lead system for long duration can be uncomfortable and disturbing.

Future Scope: Following are future scope for research in this field.

  • Effect of noise and various filters can be studied [41].

  • Optimization of key parameters of classifiers can be done.

  • With availability of a larger standard database, more generic model can be built.

  • Emotional state of the subjects can be analyzed.

6 Conclusion

In this work, a novel methodology for cognitive performance detection has been proposed which uses short-duration EEG signal (4.094 s). The proposed strategy work in two modes: MLA, where 7 EEG signals from frontal and anterior frontal lobe of brain were utilized, and a novel LSA, where EEG signal from a single lead (F4) was utilized for cognitive performance estimation. The proposed technique shows better accuracy in both the modes of operation. Using short and single-lead EEG signal makes this method suitable for designing long-duration mental load monitoring systems.