International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 Classification of EEG Signal for Imagined Left and Right Hand Movement for Brain Computer Interface Applications Indu Dokare1, Naveeta Kant2 1 Department Of Electronics and Telecommunication Engineering, V.E.S. Institute Of Technology, Mumbai, India indu_dokare@yahoo.co.in 2 Department Of Electronics and Telecommunication Engineering, V.E.S. Institute Of Technology, Mumbai, India shashinaveeta@rediffmail.com ABSTRACT Brain Computer Interface (BCI) is a device which provides a non muscular communication channel between the brain and the environment. It provides an alternate communication channel for people who suffer from severe motor disabilities. The electroencephalogram (EEG) represents an efficient technique to measure and record brain electrical activity. The intent of the user can be recorded using EEG and further it is translated into the device commands. This paper gives the results of experiment performed using Discrete Wavelet Transform (DWT) for feature extraction of EEG signal for motor imagery. Further, these features has been classified into left and right hand movement using Support Vector Machine (SVM) classifier. Keywords: Brain Computer Interface (BCI), Electroencyphalography (EEG), Motor Imagery, Support Vector Machine(SVM). 1. INTRODUCTION A Brain Computer Interface (BCI) is a non muscular communication and/or control system that allows real-time interaction between the human brain and external devices. A BCI translates brain signals of a BCI user proportional to his/her intent into a desired output. The desired output could be used to control external devices like a speller, a wheelchair, a robotic arm, a neural prostheses and so on. BCI systems represent a communication means for those people who are unable to express their intents to the external world after a severe neuromuscular disorder caused by diseases such as amyotrophic lateral sclerosis, spinal cord injury, brainstem strokes etc.[1],[3],[12],[13]. Electroencephalography (EEG) is widely used method for measuring the brain activity in BCI other than Positron Emission Tomography (PET), Magneto encephalography (MEG), Functional Magnetic Resonance Imaging (fMRI)[1],[13]. Brain activity in the cortex changes while moving a limb or even contracting a single muscle(for any physical activity). Brain oscillations are typically categorized according to specific frequency bands (delta: 0.5- 4 Hz, theta: 4–8 Hz, alpha: 8–12 Hz, beta: 12–30 Hz, gamma: > 30 Hz) [7]. Sensorimotor rhythms comprises mu (8-12 Hz) and beta rhythms. Sensorimotor rhythms (SMR) refers to oscillations in brain activity recorded from somatosensory and motor areas[1],[13]. Mu and beta rhythms are associated with the cortical areas which are directly connected to the brain‟s normal motor output channels. Movement or preparation for movement is typically accompanied by a decrease in mu and beta rhythms, particularly contralateral to the movement[14]. This decrease has been labeled as event-related desynchronization (ERD). Its opposite, rhythm increase, event-related synchronization (ERS) occurs after movement and with relaxation. Furthermore, the most relevant for BCI use is that, ERD and ERS do not require actual movement, they occur also with motor imagery (i.e. imagined movement)[1],[6]. The brain activity from somatosensory and motor areas are recorded using 10-20 electrode system of EEG [7],[12],[13].The electrodes placed in this area are C3, Cz and C4. Recorded signals from these electrodes reflects the motor activity of the person like hand movements, foot movements tongue movement etc. The main issue involved in the motor imagery pattern recognition process is to successfully estimate, visualize and represent the ERD/ERS phenomenon in a feature vector. Many feature extraction techniques have been used for feature Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 extraction such as band power, power spectral density, Auto Regressive (AR), Adaptive Auto Regressive (AAR) models etc. [5],[6]. Wavelet transform has emerged as one of the superior technique in analyzing non-stationary signals like EEG. In this experiment Discrete Wavelet Transform (DWT) has been used as a tool for feature extraction of EEG signal. The extracted features has been classified in right hand and left hand movement using Support Vector Machine (SVM). The dataset used in this experiment were obtained from BCI Competition II, dataset III provided by Department of Medical Informatics, Institute for Biomedical Engineering, University of Technology Graz. The dataset used consists of C3,Cz and C4 electrode signals for imagined right and left hand movements. The electrodes C3 and C4 are considered for analysis eliminating the electrode Cz, since it does not provide relevant information on imagined left/right hand movement [9]. Figure 1 shows the steps carried out for the analysis. The analysis was carried out using MATLAB tool. EEG Signal Electrode C3, Cz, C4 Signal Pre-processing the Signal Feature extraction using Discrete Wavelet Transform Feature Classification using SVM Left Hand Movement Right Hand Movement Figure 1 Block diagram showing steps of analysis 2. METHODOLOGY 2.1 Wavelet transform The wavelet transform is a tool which decomposes an input signal of interest into a set of elementary waveforms, called "wavelets" and provides a way to analyze the signal by examining the coefficients (or weights) of these wavelets. For analyzing the non-stationary signals like EEG, time–frequency methods such as wavelet transform is the most suitable method to be used. The Discrete Wavelet Transform (DWT) analyzes the signal at different frequency bands with different resolutions by decomposing the signal into a coarse approximation and detail information performing multiresolution analysis. DWT employs two sets of functions, called scaling functions and wavelet functions, which are associated with low pass and high-pass filters respectively. Signal Ca1 Ca2 Ca3 Ca4 Cd1 Cd2 Cd3 Cd4 Figure 2 Decomposition of the signal in four levels Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 The decomposition of the signal into different frequency bands is simply obtained by successive high-pass and low-pass filtering of the time domain signal[8]. These decomposed bands are called as sub bands. The output of the low-pass filter gives the approximation coefficients, while the high pass filter gives the detail coefficients. As shown in the figure 2 Ca 1 is the approximation coefficient and Cd1 is the detail coefficient at first level of signal decomposition. Selection of appropriate wavelet and the number of levels of decomposition is very important in analysis of signals using DWT. The number of levels of decomposition is chosen based on the dominant frequency components of the signal. The levels are chosen such that those parts of the signal that correlate well with the frequencies required for classification of the signal are retained in the wavelet coefficients. 2.2 Support Vector Machine (SVM) Support Vector Machines are finding many uses in pattern recognition and classification tasks. Support Vector Machine (SVM) classifies data by finding the best hyperplane that separates all data points of one class from those of the other class. The best hyperplane for an for an SVM means the one with the largest margin between the two classes. Margin means the maximal width of the slab parallel to the hyperplane that has no interior data points. The data points closest to the hyper plane are called the support vectors ; these points are on the boundary of the slab. A further important concept in SVM is the transformation of data into a higher dimensional space for the construction of optimal separating hyperplane. SVM perform this nonlinear mapping into a higher dimensional feature space by means of a kernel function and then construct a linear optimal separating hyperplane between the two classes in the feature space. Some commonly used kernels include Gaussian, Radial Basis Functions, and Polynomials. 3. EXPERIMENTAL RESULT AND DISCUSSIONS 3.1 Dataset The data set used in this experiment has been obtained from BCI Competition II, dataset III provided by Department of Medical Informatics, Institute for Biomedical Engineering, University of Technology Graz [9],[10],[11]. This dataset was recorded from a normal subject (female, 25y). The subject sat in a relaxing chair with armrests. The task was to control a feedback bar by means of imagined left or right hand movements. The order of left and right cues was random. The EEG recording was made using a G.tec amplifier and a Ag/AgCl electrodes. Three bipolar EEG channels (anterior „+‟, posterior „-„) were measured over C3, Cz and C4 as shown in figure 3. 1 2 3 5 cm C3 1 Cz 2 C4 3 Figure 3 Electrode positions Figure 4 Timing scheme The experiment consists of 7 runs with 40 trials each. Each trial is of 9s length. All runs were conducted on the same day with several minutes break in between. The first 2s was quite, at t=2s an acoustic stimulus indicates the beginning of the trial and a cross “+” was displayed for 1s; then at t=3s, an arrow (left or right) was displayed as cue as shown in figure 4. At the same time the subject was asked to move a bar into the direction of a the cue. The EEG was sampled with 128Hz, it was filtered between 0.5 and 30Hz. The trials for training and testing were randomly selected. This experiment consists of total 280 trials. Among this 140 trials were given as training data and remaining 140 trials as testing data. From the Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 given dataset the electrodes C3 and C4 were considered for analysis. The electrode Cz was eliminated since it did not provide relevant information on imagined left/right hand movement. 3.2 Feature Extraction In this experiment the signal has been decomposed in 4 levels using discrete wavelet transform. The approximate coefficient Ca4 and each level detail coefficients Cd4, Cd3, Cd2 and Cd1 were used as a features for classification. The sampling frequency was 128Hz. The frequency ranges of each band is shown in table 1. The size of coefficients Ca 4, Cd4, Cd3, Cd2 and Cd1 are 50, 50, 98, 194 and 386 respectively with Daubechies 2 (db2). Table 1: Wavelet coefficients and frequency range after 4 level decomposition Wavelet coefficients Frequency Range (Hz) Cd1 Cd2 Cd3 Cd4 Ca4 32-64 16-32 8-16 4-8 0-4 Figure 5 shows training signal for a trial from 3s to 9s length followed by the wavelet coefficients. Figure 5 Training signal and its wavelet coefficients 3.3 Feature Classification Support Vector Machine has been used as a classifier in this experiment. The kernel function used was Radial Basis Function. The classifier was trained using training data and the parameters of SVM were set using 5 fold cross validation. Then, the testing data was applied to the classifier and classification accuracy was determined as a performance measure parameter of the classifier. Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 The different follows. wavelet coefficients were used as the features and the classification accuracy was determined as Classification Accuracy (%) 1) The wavelet coefficients at all decomposition level Ca4, Cd4, Cd3, Cd2 and Cd1 were used as a feature vector and were classified into two classes left/right hand movement using Support Vector Machine classifier. Figure 6 shows the testing classification accuracy using different wavelet families. 90 80 70 60 50 40 30 20 10 0 db2 db4 Sym2 Sym4 Coif2 coif4 All Wavelet Coefficients as a feature vector Figure 6 Classification accuracy of all wavelet coefficients as a feature vector using different wavelet families 2) The feature vector consisting of all coefficients forms a large dimension vector. Hence, to reduce the feature vector dimension detail coefficients Cd2 and Cd3 were only considered. The coefficient Cd2 and Cd3 has frequency range 16-32 Hz and 8-16 Hz respectively which comes in the range of mu band and beta band. The testing classification accuracy using different wavelet families was determined and plotted as shown in Figure 7. Classification Accuracy (%) 90 80 70 db2 60 db4 50 sym2 40 sym4 30 coif2 20 coif4 10 0 Wavelet coiefficients Cd2 and Cd3 as a feature vector Figure 7 Classification accuracy of detail coefficients Cd2 and Cd3 as a feature vector using different wavelet families Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 3) The feature vector dimension was also reduced by determining the statistical parameters of the all wavelet coefficients like : i. Maximum of wavelet coefficients of each sub band ii. Minimum of wavelet coefficients of each sub band iii. Mean of wavelet coefficients of each sub band and iv. Standard deviation of wavelet coefficients of each sub band Figure 8 shows the testing classification accuracy for this feature vector. Classification Accuracy (%) 90 80 db2 70 db4 60 Sym2 50 40 Sym4 30 Coif2 20 coif4 10 0 Statistical parametesr of all coefficients as a feature vector Figure 8 Classification accuracy of statistical parameters of all coefficients as a feature vector using different wavelet families 4) Statistical parameters like maximum, minimum, mean and standard deviation of detail coefficients Cd2 and Cd3 were determined and these features are fed to the classifier. Testing classification accuracy was estimated and plotted as shown in figure 9. Classification Accuracy (%) 90 80 70 db2 60 db4 50 sym2 40 30 sym4 20 coif2 10 coif4 0 Statistical parameters of wavelet coefficients Cd2 and Cd3 as a feature vector Figure 9. Classification accuracy of statistical parameters of detail coefficients Cd2 and Cd3 as a feature vector using different wavelet families Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 Table 2: Classification accuracy for different feature vectors Feature Vector 4. Wavelet Families db2 db4 sym2 sym4 coif2 coif4 Ca4,Cd4, Cd3, Cd2 and Cd1 70 69.28 70 68.57 67.8 67.14 Cd2 and Cd3 68.57 70.7 68.57 69.29 68.57 69.29 Statistical parameter of all Coefficients 70.72 70 70.7 66 64.28 69.28 Statistical parameter of Cd2 and Cd3 71.42 68.57 71.4 70.7 68.7 69.28 CONCLUSION In this paper results of experiment for BCI Motor Imagery using discrete wavelet transform as a feature extraction tool and support vector machine as a feature classifier has been discussed. The aim of this experiment was to discriminate between left hand and right hand imagined movement. EEG signals were decomposed upto level four using discrete wavelet transform. For the analysis different wavelet families like Daubechies 2, Daubechies 4, Symlet 2, Symlet 4, Coiflet 2 and Coiflet 4 were used. Different cases of using wavelet coefficients as features for classification were evaluated and the results are summarised in table 2. In the first case, all wavelet coefficients Ca4, Cd4, Cd3, Cd2 and Cd1 were used as features, in the second case wavelet coefficients Cd2, Cd3 were considered and in the third and the fourth cases maximum, minimum, mean and standard deviation of the first and the second cases coefficients were considered respectively. The classification accuracy ranges from 66% to 71.42%. Maximum classification accuracy was estimated when the statistical parameters of coefficients Cd2 and Cd3 were used as the features for classification. Further, the work on determining the wavelet coefficients whose frequency correlates with the signal frequency of this motor imagery is under progress. In addition the experiments for comparison purposes using different classification methods are currently under progress. References [1] Wolpaw J R, Birbaumer N, McFarland D J, et al. “Brain-computer interface for communication and control,” Clinical Neurophysiology, vol. 113, 2002, pp. 767-791. [2] Wolpaw J R, Birbaumer N, Heetderks W, et al. “Brain-computer interface technology: a review of the first international meeting,” IEEE Trans Rehab Eng, vol. 8, 2000, pp. 161-163. [3] Jonathan R.Wolpaw,"Brain–computer interfaces as new brain output pathways", J. Physiology 579.3, 2007, pp 613– 619. [4] Saeid Sanei and J.A. Chambers, "EEG signal processing" A Textbook, John Wiley & Sons Ltd, 2007. [5] Boyu Wang, Chi Man Wong, Feng Wan, Peng Un Mak, Pui In Mak, and Mang I Vai, "Comparison of Different Classification Methods for EEG-Based Brain Computer Interfaces: A Case Study”, IEEE, International Conference on Information and Automation, 2009. [6] Ali Bashashati, Mehrdad Fatourechi, Rabab K Ward, Gary E Birch,”A survey of signal processing algorithms in brain–computer interfaces based on electrical brain signals", J. Neural Engg. 4, 2007, R32– R57. [7] Ramaswamy Palaniappan,"Biological Signal Analysis" A textbbok, 2010, Ramaswamy Palaniappan and Ventus Publishing ApS. [8] Robi Polikar, AWavelet Tutorial Part IV- Multiresolution Analysis: The Discrete Wavelet Transform, Rowan University. [9] http://www.bbci.de/competition/ii/ [10] Boyu Wang, Chi Man Wong, Feng Wan, Peng Un Mak, Pui In Mak, and Mang I Vai, Comparison of Different Classification Methods for EEG-Based Brain Computer Interfaces: A Case Study”, IEEE, International Conference on Information and Automation, 2009, pp 1416-1421. [11] M. A. Hassan, A.F. Ali, M. I. Eladawy, “Classification of the Imagination of the Left and Right hand Movements using EEG" IEEE, CIBEC'08, 2008. [12] Andrea Kubler, Boris Kotchoubey, Jochen Kaiser, Wolpaw J. R., Birbaumer N., "Brain -Computer CommunicationUnlocking the Locked In" Psychological Bulletin, American Psychological Association Inc., Vol. 127, No. 3, 2001, pp 358-375. Organized By: Vivekanand Education Society's Institute Of Technology International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org ISSN 2319 - 4847 Special Issue for International Technological Conference-2014 [13] Indu Dokare, Naveeta Kant, " A Study of Bain Computer Interface System", International Journal of Engineering Research & Technology (IJERT), Vol. 2 Issue 3, March - 2013. [14] Dennis J. McFarland, Laurie A. Miner, Theresa M. Vaughan, and Jonathan R. Wolpaw,"Mu and Beta Rhythm Topographies During Motor Imagery and Actual Movements", Brain Topography, Volume 12. Number 3, 2000,pp177-186. Organized By: Vivekanand Education Society's Institute Of Technology