Novel Algorithm for Feature Extraction and Classification of EEG signals

DOI : 10.17577/IJERTV4IS120299

Download Full-Text PDF Cite this Publication

Text Only Version

Novel Algorithm for Feature Extraction and Classification of EEG signals

Mangala Gowri S G1

Assistant Professor

Cyril Prasanna Raj P2

Dean of R & D

Badarinarayan K S3





Bangalore, India

Bangalore, India

Bangalore, India

Abstract- This paper aims in developing an algorithm for feature extraction by using Discrete wavelet transform (DWT).Feature extraction from Electroencephalogram (EEG) signal for emotion recognition provides an adequate information. In this paper DWT is used to extract significant features representing emotion in Brain Computer Interface (BCI) in EEG signals. The EEG signals are acquired in real time using Neurosky Mind wave sensor and processed in real time using wavelets for feature extraction. For a given EEG signal brain waves are identified from DWT Spectrum. These brain waves quantify emotions. The proposed algorithm based on DWT, is modeled in Matlab and it is validated using 10 different EEG samples. Features such as energy are found to identify the intensity level of different bands of EEG signal .The best results were obtained by using Bior 5.5 wavelet for signal decomposition and to obtain the accurate frequency bands.

Keywords: Electroencephalogram, Emotion recognition. Discrete wavelet transform, Feature extraction, Bior 5.5


    Brain-computer interfaces (BCI) are a system that allows the user to translate brain activities into a set of commands for the computer to understand to control any computer application or Neuro prosthesis [6]. Several methods are existing to detect brain activity such as magneto encephalography (MEG), Functional Magnetic Resonance Imaging (FMRI) and Electroencephalogram EEG).

    But EEG signals have rapid response time and are inexpensive method relative to other methods, so it is widely used to monitor brain activity in BCI research.

    In 2025, widespread applications will use brain signals as an important source of information. Routine applications in professional context, personal health monitoring, and medical treatment. [1].The upcoming future where humans and information technology are seamlessly and intuitively connected by integrating various biosignals, from brain activity. Game, health, education, and lifestyle companies will be associated to brain and other biosignals to develop

    applications and electronic gadgets for a wider community. People will want to monitor their brain states to provide them with reliable estimates of their mental capacity and performance level. But the EEG has rapid response time and is inexpensive method relative to other methods, so it is mostly used in the BCI research. The aim of human computer interaction (HCI) is to improve the interactions between human and computers. Because most computers lack understanding of users emotions, sometimes they are unable to respond to the users needs automatically and correctly. However human emotion plays a vital role in perception, cognition and social behavior [2].

    The EEG signals are recorded as a weak potential by placing the electrodes on the scalp and analyze to establish a BCI system. The recorded EEG signals are processed offline to extract features and classify emotions. In this work EEG signals are recorded in real time and processed using wavelets to extract significant features for emotion analysis. The Fig.1 shows the block diagram for BCI.

    Fig. 1 Basic BCI Block Diagram

    From the BCI signal analysis, it is observed that, EEG signal has been acquired from the scalp of the brain using EEG acquisition set-up. The acquired raw EEG signal is pre- processed. Preprocessing in EEG signal is to remove the baseline and performing its average of the signal from the original signal. The noise free EEG signal is analyzed by using wavelet transform to extract all the fundamental frequency components of EEG signal i.e. alpha, beta, gamma, delta and theta. The frequency sub band separation of EEG signal for emotion classification is based only on the decomposition of the signal to certain levels. This is followed by feature extraction from these sub bands. Classification of emotions is carried out on the basis of these features. Wavelets and Neural Networks are used for Classification and Detection of brain waves as they provide distinct features. However, selection of appropriate multilevel decomposition of brainwave signals in identifying the prominent features from the EEG signal provides a scope for development of Novel Algorithm.


    There are many methods for feature extraction and classification which is analyzed and adopted by different authors. In [2] EEG data base has been collected for four emotional states by giving an external stimulus that is by movie elicitation which is designed for acquiring subjects. Different Classifiers are used for statistical features in time domain and frequency domain. K-NN algorithm, Multilayer Perceptron and SVM are used as classifiers.

    The Authors in [3] have developed a new feature extraction method for a user-independent emotion recognition system namely HAF-HOC from electroencephalograms (EEGs) is considered. Novel filtering procedure is used for the feature extraction Hybrid Adaptive Filtering (HAF), for an efficient extraction of the emotion-related EEG-characteristics was developed by applying Genetic Algorithms for six distinct emotions , is considered by providing a higher classification rates upto 85.17 percent.

    The Author in [4] has analysed the EEG signals for 4 different participants from the dataset.The extracted data set is then decomposed into different subbands with the help of wavelet transform using matlab.Author has analysed the EEG signals for 4 different participants from the dataset.The extracted data set is then decomposed into different subbands with the help of wavelet transform using matlab.Different frequency ranges of EEG signals such as alpha, beta, gamma, theta &delta for classifying two classes of emotions named as High arousal (HA) and Low arousal (LA) are considered. In

    [5] EEG signals from 62 channels of 20 subjects is collected between the age group between 21-39 years.In [6] an optimal EEG-based emotion recognition algorithm based on spectral features and neural network classifiers is proposed. Wavelet transform and Gabor based spectral functions were implemented for classifying the EEG signals. Neural network classifiers such as improved particle swarm optimization (IPSO) and probabilistic neural network (PNN) are developed to determine an optimal nonlinear decision boundary between the extracted features from the six basic emotions like sadness , happiness , anger, fear , disgust and surprise.In [7] EEG signals are classified using two emotions (i.e., positive

    and negative) by giving an external stimulus. The power spectrum features, are analysed with an accuracy rate of about 85.41% by using SVM Classifier. In [8] it is proposed with two emotions happy and sad for the classification using EEG signals. The experimental results indiacte that the gamma band of about 100 Hz is suitable for EEG based emotion classification,with an accuracy of 93.5% to 6.7% and 93.0% to 6.2 %. In [9] Varun Bajaj proposes the new features based on multiwavelet transform for classification of human emotions from electroencephalogram (EEG) signals. The EEG signal measures electrical activity of the brain, which contains lot of information related toemotional states. The proposed features are based on multiwavelet transform of EEG signals with Morlet wavelet kernel function of MC-LS- SVM has provided a better classification accuracy for classification of emotions. In [10] A modified adaptive filtering algorithm for signal preprocessing is proposed in this system for removing the noise and artifacts in EEG signal. The adaptive neuro fuzzy inference system is also proposed for classifying and analyzing the emotions based on the features selected. In [11].The efficacy of extracted features for classifying five types of emotional states relax, mental task, memory related task, pleasant, and fear. For this purpose support vector machine classifier was employed to classify the five emotional states by using salient global features. In case of statistical features the overall accuracy was obtained 54.2%, which is improved for FFT features of 55.00% and the highest accuracy was obtained by DWT features which was 60.15%.In [12] EEG data was collected by showing and playing different audio-video stimuli to acquire the proper emotions. For classification of data LDA Classifier was used with an classification rate of 84.37% for happiness and for relaxed state it is 92.70%.

    From the analysis, above all the related works. In this paper, a novel algorithm for feature extraction and emotion classification is proposed, modeled and developed based on DWT. An experimental setup is developed for capturing brain activity of 10 students when they were really excited during the cultural fest conducted in our College. Real samples were extracted from the students, when they were happy and excited.


    Fig. 2 Overall Proposed Block Diagram

    From the proposed block diagram, EEG samples are acquired by using the Neurosky Mind wave EEG headset.

    The Neurosky Mindwave sensor is a low cost single-electrode EEG headset, and it has been proven effective in detecting users mental states.


    The NeuroSky Mind Wave is a device for monitoring the electrical signals generated by neural activity in the brain. This headset was launched in 2010/11 and has been designed to identify and monitor electric signals generated by neural activity in the brain, which has been used to research ADHD, Alzheimers and Cognitive Stress. The Mind Wave consists of a headband, with a sensor arm containing the EEG electrode which rests on the forehead above the eye (FP1 position in accordance with the American Electroencephalographic Societys (1994) 10-20 system of electrode placement). The device consists of eight main parts, ear clip, flexible ear arm, battery area, power switch, adjustable head band, sensor tip, sensor arm and inside think gear chipset.


    Mind wave sensor basically works with think gear technology. NeuroSky Think Gear ASIC Module (AM) is the worlds most popular EEG technology. Together with a dry electrode, it senses the faint signal from the human brain, filters out extraneous noise and electrical interference and converts to digital to power games, apps, toys, and research. Think Gear is the technology inside every NeuroSky product or partner product that enables the device to interface with the wearers brainwaves. It includes:

    • The sensor that touches the forehead

    • The contact and reference points located on the ear pad, and

    • The onboard chip that processes all of the data

      Fig. 3 Think gear chip

      The above figure shows the Think gear chip. Both the raw brainwaves and the eSense Meters (Attention and Meditation) are calculated on the Think Gear chip. The calculated values are output by the Think Gear chip, through the headset, to a PC.Types of data output from Think Gear chips: Raw sampled wave values (128Hz or 512Hz, depending on hardware), Signal poor quality metrics, and eSense Attention and Meditation meter values, EEG band power values for delta, theta, alpha, beta, and gamma


        The principle of operation is quite simple. Two dry sensors are used to detect and filter the EEG signals. The sensor tip detects electrical signals from the forehead of the brain. At the same time, the sensor picks up ambient noise generated by human muscle, computers, light bulbs, electrical sockets and other electrical devices. The second sensor, ear clip, is a grounds and reference, which allows think gear chip to filter out the electrical noise .The device measures the raw signal, power spectrum (alpha, beta, delta, gamma, theta), attention level, mediation level and blink detection. The raw EEG data received at a rate of 512 Hz. Other measured values are made every second. Therefore, raw EEG data is a main source of information on EEG signals using Mind Wave


      The single dry sensor and reference pick up potential differences (voltages) on the skin at the forehead and the ear. The two are subtracted through common mode rejection to serve as a single EEG channel, and amplified 8000x to enhance the faint EEG signals. The signals are passed through analog and digital low and high pass filters to retain signals generally in the 1-50Hz range. After correcting for possible aliasing, these signals are ultimately sampled at 128Hz or 512Hz. Each second, the signal is analyzed in the time domain to detect and correct noise artifacts as much as possible, while retaining as much of the original signal as possible, using NeuroSky's proprietary algorithms. A standard FFT is performed on the filtered signal, and finally the signal is rechecked for noise and artifacts in the frequency domain, again using NeuroSky's proprietary algorithms. The acquired EEG signal which is in the format of .xls is loaded to the MATLAB workspace and converted to .csv format for further processing. The formatted EEG dataset is analysed by using wavelet transform to extract all the fundamental frequency components of EEG signal i.e. alpha, beta, gamma, delta and theta. EEG frequency bands which relate to various brain states. The aggregate of these electric voltage fields create an electrical reading which electrodes on the scalp are able detect and record. The prominent features from the EEG signal are extracted by using multiwavelets and with the help of these features the different emotions are classified and detected by using a novel algorithm with the help of Neural Networks.


    The experimental Setup for acquiring the EEG Signal is shown below in Fig. 4

    Fig. 4 Flow diagram of Experimental Setup

    The above experimental setup shows the mindwave sensor which is made available to wear on any subject for acquiring the EEG data on the scalp of the subject, with all the proper settings and its totally harmless, then corresponding EEG signal will be displayed on the computer via bluetooth.

    Fig. 5 EEG Signal Acquisition Setup

    In the above EEG acquisition setup, the subject is made to wear the mindwave sensor on her scalp. Brainwaves are tiny electrical impulses released when a neuron fires in the brain. Neuroskys brain-computer interface technology works by monitoring these electrical impulses with a forehead sensor. The neural signals are the input to think gear chip, which is interpreted. The measured electrical signals and calculated interpretations are then displaying as output digital messages to the system, allowing to see the brainwaves on the screen. The analysis of any subject depends on the attention and meditation, which gives an affect on the brainwaves and the visualize to acquire the signal will be displayed on the computer via bluetooth.

    Fig. 6 EEG acquisition by Neurosky Mind wave

    The EEG signal which is displayed in the visualizer can be loaded into excel sheet in the form of samples by using python code. The reason behind using python code is to interface the mindwave sensor with the PC. Since python is a scripting language which is very efficient to interface the hardware evice with the computer. The language provides constructs intended to enable clear programs on both a small and large scale. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. The Fig.

    7 shows the algorithm flowchart of python code for interfacing the mind wave sensor with the computer

    Fig. 7 Algorithm flowchart of python code

    Thus the EEG Signal Loaded in the Excel Sheet contains Sample set for each and every Bands of EEG that is Alpha, Beta, Gamma, Detla and theta in separate columns which is shown in Fig. 8

    Fig. 8 EEG samples with all five bands of subject 1




      When the input data to an algorithm is too large to be processed and it is suspected to be redundant then it can be transformed into a reduced set of features (also named features vector). This process is called feature extraction EEG feature extraction is done by using wavelet transform. But there are multiple wavelets available in the wavelet family therefore a suitable wavelet has to be chosen for the efficient extraction of different feature of EEG. EEG features mainly contains the different frequency bands they are:

      • Alpha

      • Beta

      • Gamma

      • Theta

      • Delta

      Wavelet transforms has the advantages of time frequency localization, multi-rate filtering, and scale-space analysis. Wavelet transform uses a variable window size over the length of the signal. The DWT is often introduced in terms of its recovery transform:

      After 8 level decomposition the coefficients which lies in the suitable frequency bands off EEG only those coefficients are selected and they represents the different frequency bands of EEG.

      k= = 2

      x(t) = d(k, l)2¯ (2

      t l) (1)

      Here k is related to a as: a = 2k; b is related to l as b = 2k l; and d (k,l) is a sampling of W(a,b) at discrete points k and l.


      A biorthogonal wavelet is a wavelet where the associated wavelet transform is invertible but not necessarily orthogonal. Among the different wavelets bior 5.5 has been chosen for the EEG feature extraction. The properties of Bior wavelet are discussed below

      Let fk and gk belongs to H then fk and gk are said to be biorthogonal if

      (, ) = (2)

      In order to construct two sets of wavelets that is

      , = 22(2 ) (3)

      , = 22(2 ) (4)


      To construct (3) and (4) g, h, gbar, hbar filters are needed. The two decomposition sequences are gn and hn and two sequences to act as a reconstruction sequences If C1 is a data set, then it can be decomposed as

      = (5)

      0 1


      Fig. 10 Flow chart for EEG feature extraction

      The Fig. 11 shows the 8-level decomposition tree. Table I describes the frequency range of extracted bands in EEG by using wavelet transform.

      0 = 1 (6)


      For reconstruction

      1 = 0 + 0 (7)



      The condition for the perfect reconstruction is

      = (1)+1


      = ()+1 (8)

      The scaling function is defines as

      () = 2 (2 )


      () = 2 (2 ) (9)


    The different bands of raw EEG signal are extracted by using bior 5.5 wavelet functions. The flowchart of the DWT algorithm is as shown in the Fig. 10 The algorithm flow chart for EEG feature extraction contains the following steps:

    1. Collecting the Raw EEG signal from the EEG acquisition set up.

    2. Raw EEG signal is converted into CSV format that is comma separated values in the Excel sheet.

    3. Load the signal into the MATLAB platform.

    4. Set the sampling frequency (fs)

    5. Use bior 5.5 wavelet for decomposition and reconstruction of a signal to extract the frequency components. Bior 5.5 at 8 levels is used for the decomposition.

    Fig. 11 8- level DWT

    DWT successfully analyses the multi-resolution signal at different frequency bands, by decomposing the signal into approximation and detail information. The method for frequency band separation is implemented in MATLAB 2013.EEG requires feature extraction from the acquired signal in specific frequency range of delta, theta, alpha, beta, and gamma. After a first level decomposition, two sequences representing the high and low resolution components of the signal are obtained. The low-resolution components are further decomposed into low and high resolution components. After a second level decomposition, seven more decompositions are done as CA1, CA2, CA3, CA4, CA5, CA6, CA7 and CA8 are the approximate coefficients and CD1,CD2,CD3,CD4, CD5, CD6, CD7 and CD8 are the

    detailed coefficients obtained after successive decomposition. The multi-resolution analysis, using five levels of decomposition, yields five separate EEG sub-bands. The main objective of the proposed method of is Wavelet Transform the division of the original EEG signals into different frequency bands.

    Table I. Decomposition of EEG signals with the sampling frequency of 500 Hz

    From the extracted bands of EEG that is Alpha, Beta, Gamma, Delta and Theta some additional features such as energy properties were found which is tabulated in the below Table II.


    Energy is defined as the square root of the average squared instantaneous signal values and it can be calculated by using the formula.


    In this section, we evaluate the performance of EEG analysis for feature extraction using Bior5.5. First the performance


    =1 1 2


    measures the quality of the wavelet used for feature extraction. The Fig.12 shows the extracted frequency bands of EEG in time domain by using Bior 5.5 wavelet and Fig.14. shows the frequency spectrum of EEG bands. Also it is found that precision and quality of the waveform is good by using Bior 5.5 wavelet. Also the frequency bands of EEG lies in the suitable bands as shown in the Fig.13.

    Fig.12. EEG frequency band (time-domain)

    Fig.13 Maximum frequency occurrence of EEG bands

    Fig. 14 EEG frequency band (frequency-domain)

    Where N is the number of samples and x is the input signal. The calculated energy of each bands of EEG are Alpha, Beta, Gamma, Theta, Delta of Real 1 subject is shown in the below Table II. It is found that gamma band has higher energy than compared to any other bands. Because the gamma band is high frequency band and its frequency per amplitude is high. Since theta and delta are low frequency bands they found to be having lesser energy.

    Table II: Calculated energy of different EEG bands

    Name of the subjects

    Calculated Energy of different EEG bands






    Real 1






    The average energy level graph is shown in Table II for Real 1 subject. Fig.15, represents the Energy level graph of EEG bands.

    Fig. 15 Energy level chart for EEG bands


    We are greatful to R&D center, MSEC, Bangalore for extending the resources in carrying this research work entitled as Novel algorithm for feature extraction and Classification of EEG signals. We are also thankful in acknowledgeing VTU, Belagavi as this paper is a part of research.


    In this work, Discrete wavelet ransform (DWT) algorithm is proposed for EEG feature extraction, by using a Bior 5.5 wavelet, for classifying the EEG signals. Bior 5.5 wavelet is considered to be a better wavelet, compared to other filters in terms of the frequency bands and precision. So EEG signal acquisition is done using mind wave sensor. Further this work can be implemented using neural network for classification and can be proposed for developing a Brain Computer Interface System.


  1. A Documentary Copy The Future in Brain/Neural-Computer Interaction Horizon 2020, © 2015 Graz University of Technology.

  2. XW Wang, D Nie, and BL Lu, EEG-Based Emotion Recognition Using Frequency Domain Features and Support Vector Machines,Neural Information Processing, Lecture Notes in Computer Science. Springer vol. 7062, pp. 734-743, 2011.

  3. Panagiotis C, Petrantonaki and Leontios J. Hadjileontiadis , Emotion recognition from the brain signals using hybrid adaptive filtering and higher order crossing analysis,IEEE transactions on affective computing, Vol. 1, no. 2, july-december 2010.

  4. Mandeep Singh, Mooninder Singh and Surabhi Gangwar, Feature Extraction from EEG for Emotion Classification, IJITKM Volume 7,

    Number 1, December 2013 pp. 6-10

  5. Murugappan and Subbulakshmi Murugappan,Human Emotion Recognition Through Short Time Electroencephalogram (EEG) Signals Using Fast Fourier Transform (FFT), 2013 IEEE 9th International Colloquium on Signal Processing and its Applications, 8 – 10 Mar.2013, Kuala Lumpur, Malaysia

  6. S.Nasehi and H. Pourghassem, An optimal EEG-based emotion recognition algorithm using gabor features, WSEAS Transactions on Signal Processing, vol. 8, pp. 87-99, July 2012.

  7. Noppadon Jatupaiboon, Setha Pan-ngum, Pasin Israsen,Emotion Classification using Minimal EEG Channels and Frequency Bands,10th International Joint Conference on Computer Science and Software Engineering (JCSSE),2013

  8. Mu Li and Bao-Liang Lu_Senior Member, Emotion Classification Based on Gamma-band EEG IEEE, 31st Annual International Conference of the IEEE EMBS Minneapolis, Minnesota, USA, September 2-6, 2009.

  9. Varun Bajaj, Ram Bilas Pachori Human Emotion Classification from EEG Signals using Multiwavelet Transform International Conference on Medical Biometrics, 2014.

  10. R.Malathi Ravindran, Classification of Human Emotions from EEG Signals using Filtering and ANFIS Classifier,2nd International Conference on Current Trends in Engineering and Technology, ICCTET ,IEEE Conference Number 33344,Coimbatore, India. July 8, 2014.

  11. Tazrin Ahmed, Monira Islam, Mohiuddin Ahmad, Human Emotion Modeling Based on Salient Global Features of EEG Signal Proceedings of 2013 2nd International Conference on Advances in Electrical Engineering (ICAEE 2013).

  12. Bharti W. Gawali, Shashibala Rao, Priyanka Abhang, Pramod Rokade and S.C. Mehrotra, Classification of EEG signals for different emotional States, Department of CS and IT, Dr. B.A.M.University, Aurangabad, Maharashtra, India.

Leave a Reply