Feature extraction in EEG signals

Kalaivaani Natarajan
5 min readJun 16, 2020

--

An end to end guide on extracting the features from EEG signals using various techniques like Fast Fourier Transform(FFT),Discrete Wavelet Transform (DWT).

Developed by Anu Maria Babu, Bullepalli Bhulakshmi Devi, Kalaivaani Natarajan, Sadaf Shaikh, Medha Tiwari, Dr.Arpit Baradwaj, Dhivya Acharya

INTRODUCTION

We come across features in deep learning but what does the feature mean? Feature represents a distinguishing property, a recognizable measurement, and a functional component obtained from a section of a pattern. Feature Extraction can lead to various types of advantages such as:

  • Minimize the loss of important information from the given signal
  • Overfitting the risk reduction
  • Improves the Visualization of Data
  • Simplify the data needed to describe it accurately which in-turn reduces the complexity of implementation

Then what is mean by EEG? An Electroencephalogram(EEG) is the test used used to evaluate the electrical activity of the brain,which are in the form of signals. EEG signals has been the subject of several fields, mainly because of its ability to yield an objective mode of recording brain activities which in-turn used in brain-computer interface researches with application in medical diagnosis.

EEG(Electroencephalogram)

There are a variety of methods used to extract the feature from EEG signals, among these methods are Fast Fourier Transform (FFT), Wavelet Transform(WT), Time Frequency Distribution (TFD), EigenVector methods(EM), Auto Regressive methods (ARM) and so on. Among these methods we have used Fast Fourier Transform(FFT) and Discrete Wavelet Transform (DWT).

Stages of EEG signal processing

In this article, I will describe how to apply the above mentioned Feature Extraction techniques using Deap Dataset. The python code for FFT method is given below.

First and foremost step is to import the libraries that are needed

import numpy as np
import pickle as pickle
import pandas as pd
import math
import pyeeg as pe
from sklearn import svm
from sklearn.preprocessing import normalize
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import AdaBoostRegressor

import os
import time

The data that is being fed into the machine learning model is splitted in the following way:

training dataset: (468480, 70) (468480, 4)
testing dataset: (78080, 70) (78080, 4)
validation dataset: (78080, 70) (78080, 4)

FEATURE EXTRACTION TECHNIQUES

Fast Fourier Transform (FFT)

This is one of the technique that employs mathematical tools to analyse EEG data. The characteristics of the EEG signal is computed with the help of power spectral density (PSD) estimation to represent the sample EEG sample signal. The characteristics waveforms of EEG spectrum is contained in four frequency bands. PSD can be calculated using the Fourier transforming estimated autocorrelation sequence that is found by nonparametric methods.

One among the non parametric methods include Welch’s method. First data windowing is applied, thus producing the modified periodograms. The sequence of information is expressed as

Information Sequence

iD is the starting point of ith sequence. L of length 2M data segments are formed.

Output periodogram

U gives normalization factor of the power and i s is chosen such that

w(n) is the window function. The average of these modified periodograms gives Welch’s power spectrum that is given below,

The accuracy of the FFT technique is 84%

Wavelet Transform (WT)

WT is again classified into Discrete Wavelet Transorm (DWT) and Continuous Wavelet Tranform (CWT). WT is mainly used in recognition and diagonistic field. It just compresses the time varying biomedical signals to few parameters. EEG signal is not stationary it varies with time, for such type of signals WT is the suitable technique.

Discrete Wavelet Transform (DWT)

DWT has evolved to address the weakness of CWT that is the scaling and translation parameter changes continuously. DWT is defined in the base of multiscale representation. Each scale represents the unique thickness of EEG signal. The multiresolution decomposition of EEG data is as follows,

Decomposition of DWT

Each step has digital filters they are,g(n) and h(n).g(n) is discrete mother wavelet, it is high pass in nature and h(n) is low pass in nature.The number of steps depends on EEG data component with dominant frequency. Each step gives two, one is detail about the signal (D) and the other is approximation of the signal (A). A becomes the output of the next step.

Relation between WTs and h

H(z) is filter’s h z-transform. The complementary z-transform of high pass filter is as follows,

There are a lot of advantages in this method because of precisely describing the features of the signal segment within specified frequency domain and localized time domain.

Hope the article was insightful. Feedbacks are welcomed.

BIBLIOGRAPHY

https://github.com/tongdaxu/EEG_Emotion_Classifier_DEAP

--

--