Eeg Mouse:a Machine Learning-based Brain Computer Interface

—The main idea of the current work is to use a wireless Electroencephalography (EEG) headset as a remote control for the mouse cursor of a personal computer. The proposed system uses EEG signals as a communication link between brains and computers. Signal records obtained from the PhysioNet EEG dataset were analyzed using the Coif lets wavelets and many features were extracted using different amplitude estimators for the wavelet coefficients. The extracted features were inputted into machine learning algorithms to generate the decision rules required for our application. The suggested real time implementation of the system was tested and very good performance was achieved. This system could be helpful for disabled people as they can control computer applications via the imagination of fists and feet movements in addition to closing eyes for a short period of time. I. INTRODUCTION Brain-Computer Interface (BCI) is a device that enables the use of the brain's neural activity to communicate with others or to control machines, artificial limbs, or robots without direct physical movements [1-4]. As computerized systems are becoming one of the main tools for making people's lives easier and with the ongoing growth in the BCI field, it is becoming more important to understand brain waves and analyze EEG signals. Electroencephalography (EEG) is the process of measuring the brain's neural activity as electrical voltage fluctuations along the scalp as a result of the current flows in brain's neurons [5]. The brain's electrical activity is monitored and recorded, in typical EEG tests, using electrodes that are fixed on the scalp [6]. BCI captures EEG signals in conjunction with a specific user activity then uses different signal processing algorithms to translate these records into control commands for different machine and computer applications [7].


I. INTRODUCTION
Brain-Computer Interface (BCI) is a device that enables the use of the brain's neural activity to communicate with others or to control machines, artificial limbs, or robots without direct physical movements [1][2][3][4].As computerized systems are becoming one of the main tools for making people's lives easier and with the ongoing growth in the BCI field, it is becoming more important to understand brain waves and analyze EEG signals.Electroencephalography (EEG) is the process of measuring the brain's neural activity as electrical voltage fluctuations along the scalp as a result of the current flows in brain's neurons [5].The brain's electrical activity is monitored and recorded, in typical EEG tests, using electrodes that are fixed on the scalp [6].BCI captures EEG signals in conjunction with a specific user activity then uses different signal processing algorithms to translate these records into control commands for different machine and computer applications [7].BCI was known for its popular use in helping disabled individuals by providing a new channel of communication with the external environment and offering a feasible tool to control artificial limbs [8].A variety of BCI applications were described in [9] including the control of devices using the translation of thoughts into commands in video games and personal computers.BCI is a highly interdisciplinary research topic that combines medicine, neurology, psychology, rehabilitation engineering, Human-Computer Interaction (HCI), signal processing and machine learning [10].
In our previous research [11][12][13] we proposed many systems that could efficiently discriminate between executed (or imagined) left and right fist (or feet) movements.In this work, we integrated these systems into one hybrid application that is based on the imagined fists and feet movements.

II. LITERATURE REVIEW
The translation approach used to transform EEG signal patterns into machine commands reflects the strength of BCI applications.In [14], the authors recorded EEG signals for three subjects while imagining either right or left hand movement based on a visual cue stimulus.They were able to classify EEG signals into right and left hand movements using a neural network classifier with an accuracy of 80% and concluded that this accuracy did not improve with increasing number of sessions.
The authors of [15] used features produced by Motor Imagery (MI) to control a robot arm.Features such as the band power in specific frequency bands (alpha: 8-12Hz and beta: 13-30Hz) were mapped into right and left limb movements.In addition, they used similar features with MI, which are the Event Related Resynchronization and Synchronization (ERD/ERS) comparing the signal's energy in specific frequency bands with respect to the mentally relaxed state.
The combination of ERD/ERS and Movement-Related Cortical Potentials (MRCP) was proven to improve the classification of EEG signals as this offers an independent and complimentary information [13,16].The authors of [17]presented an approach for the classification of single trial MRCP using a discrete dyadic wavelet transform and Support Vector Machines (SVMs) and they provided a promising classification performance.
A single trial right/left hand movement classification is reported in [18].The authors analyzed both executed and imagined hand movement EEG signals and created a feature vector consisting of the ERD/ERS patterns of the mu and beta rhythms and the coefficients of the autoregressive model.Artificial Neural Networks (ANNs) is applied to two kinds of testing datasets and an average recognition rate of 93% is achieved.
A three-class BCI system was presented in [19] for the translation of imagined left/right hands and foot movements into commands that operates a wheelchair.This work used many spatial patterns of ERD on mu rhythms along the sensory-motor cortex and the resulting classification accuracy www.ijacsa.thesai.orgfor online and offline tests was 79.48% and 85.00%, respectively.The authors of [20] proposed an EEG-based BCI system that controls hand prosthesis of paralyzed people by movement thoughts of left and right hands.They reported an accuracy of about 90%.
In [21], a hybrid BCI control strategy is presented.The authors expanded the control functions of a P300 potential based BCI for virtual devices and MI related sensorimotor rhythms to navigate in a virtual environment.Imagined left/right hand movements were translated into movement commands in a virtual apartment and an extremely high testing accuracy results were reached.The Daubechies, Coiflet and Symmlet wavelet families were applied in [22]to a dataset of MI to extract features and describe right and left hand movement imagery.The authors reported that the use of Linear Discriminate Analysis (LDA) and Multilayer Perception (MLP) Neural Networks (NNs) provided good classification results and that LDA classifier achieved higher classification results of up to 88% for different Symmlet wavelets.The authors of [23]used the discrete wavelet transform (DWT) to create inputs for a NNs classifier and the authors reported a very high classification accuracy of 99.87% for the recognition of some mental tasks.

III. THE PROPOSED SYSTEM
The main idea of the current work is to use a wireless EEG headset such as the one designed by NeuroSky [24] as a remote control for the mouse cursor of personal computers and the computer applications.As depicted in Fig. 1, the captured EEG signals have to be pre-processed to filter out the unwanted content and then the content of interest has to be represented using some features that can be inputted into machine learning algorithms.The outcome of this process is a collection of decision rules that can be translated, as required, into PC commands.

A. Eeg Data
The PhysioNetEEG dataset [25] is used in this work.It consists of more than 1500 one or two minutes-duration EEG records obtained from 109 healthy subjects.Subjects were asked to execute and imagine different tasks while 64 channels of EEG signals were recorded from the electrodes that were fitted along the scalp.
In the records of the dataset that are related to the current research, each subject performed the following tasks:  Three two-minute experimental runs of imagining moving both fists or both feet while the top or bottom side of a computer screen is showing a target.
The obtained EEG signals were recorded according to the international 10-20 system as seen in Fig. 2. For this work, we created a subset for 100 subjects including 8 runs per subject.

B. Preprocessing
Only channels C3, C4, and Cz were used in our work for two reasons:(1) It is reported in [6] that most EEG channels represent redundant information and (2), it was concludedin [26,27] that the neural activity that is mostly correlated to the fists movements is almost exclusively contained within these channels as depicted in Fig. 2.
The authors of [28] showed thatEEG signals are noisy and non-stationary signals that have to be filtered to get rid of the unnecessary content.Hence, the channels C3, C4, and Cz were filtered, using a band-pass filter (0.5-50 Hz),for the purpose of removing the DC shifts and minimizing the presence of filtering artifacts at epoch boundaries.
In [29], it was stated that EEG signals are usually masked by physiological artifacts that produce huge amounts of useless data.Eye and muscle movements could be good examples of these artifacts that constitute a challenge in the field of BCI research.The Automatic Artifact Removal (AAR) toolbox [30] was used to process our EEG subset.
A MATLAB script was written to analyze the filtered EEG signals and it was found that a subject imagines opening and closing a fist (or both fists/feet) and keeps doing this for 4.1 seconds then he takes a rest for the duration of 4.2 seconds.This means that each two-minute EEG run includes 15 events that are separated by a short neutral period where the subject relaxes.As the Physionet dataset was sampled at 160 samples per second, each vector includes 656 samples of the original recorded EEG signal.And because we used the available records for 100 subjects, our subset included 18000 vectors representing imagined left fist, right fist, both fists, and both feet movements.An additional 1500 vectors were extracted from the one-minute baseline run (with eyes open) and another 1500 vectors from the one-minute baseline run with eyes closed.So, the total number of extracted samples (events) was 12000 samples.www.ijacsa.thesai.org

A. The Discrete Wavelet Transform
The Wavelet transform analysis was used in a wide range of research topics within the field of signal processing.Based on a multi-resolutions process, the wavelet properties of a scalable window allow pinpointing signal components.These properties of dilation and translation enable the extraction of all components for every position by creating different scales and shifted functions (in time domain) of a signal [31,32].As a result, wavelet finer and large scaling, permit all information of the signal (the big picture), while small scales shows signal details by zooming into the signal components.
For discrete data, such as the datasets used in the current work, the Discrete Wavelet Transform (DWT) is better fit for analysis.It was shown in [33] that a suitable wavelet function must be used to optimize the analysis performance.A large selection of DWT mother wavelets, such as the Daubechies, Symmlet, and Coif let, is available to be used in our work [22].But the Coif let(Coif) family of wavelet functions provided the best classification performance in our previous work [11].So, we decided to calculate the Coif lets wavelets Coif1-Coif5 in this work.
As shown in Fig. 3, the main purpose of the DWT is to decompose the recorded EEG signal into multi-resolution subsets of coefficients: a detailed coefficient subset(cD i ) and an approximation coefficient subset (cA i ) at theleveli.So, at the first decomposition level we obtain cD 1 and cA 1 then the first approximation cA 1 can be transformed into cD 2 and cA 2 at the second level, and so on.For our experiments, the decomposition level was set to generate four level details.All EEG signals in the subset were sampled at 160Hz.So, the wavelet transformation of each record at four levels results in four details: cD 1 (40-80Hz), cD 2 (20-40Hz), cD 3 , and cD 4 (5-10Hz), and a single approximationcA 4 (0-5Hz).As explained in [11], the details cD 2 , cD 3 and cD 4 provided proper representation for the activities of interest.So, we decided to extract the vectors of features from these details only.

B. Amplitude Estimators
Many amplitude estimators for neurological activities were defined mathematically in [34] and some of them were selected based on our previous results obtained in [11].
If we assume that the n th sample of a wavelet decomposed detail at level i is D i (n), then the following features can be defined: In our experiments, we applied the Coifletswavelets Coif1 to Coif5 for each one of the channels C3, C4, and Cz of an EEG record.This process was repeated for each event in our dataset of 12000 vectors.
Then, all estimators were calculated using (1) through ( 6) for the details cD 2 , cD 3 and cD 4 of each instance.At the end of these calculations, 9 features of each estimator (3 channels 3 details) were generated for each Coiflets wavelet.These features were numerically represented in a format that is suitable for use with SVMs and NNs algorithms [35,36] as described in the next section.
V. MACHINE LEARNING SVMs and NNs learning algorithms were used in [13,14,22,23,37] and provided excellent classification performances.A detailed description of SVMs and NNs can be found in [36].The MATLAB NN toolbox was used for all the training and testing experiments.The training experiments were handled with the aid of the back-propagation learning algorithm [38].
SVM experiments were carried out using the "MySVM" software [39].SVM can be performed with different kernels and most of them were to provide similar results for similar applications [6].So, the Anova-Kernel SVM was used in this work.
As shown on Fig. 4, NNs and SVMs classifiers were created with 9 inputs, representing features of one estimator.
The SVM classifier has one output node representing the target function: closed eyes/opened eyes.The NN classifier has one output node that has five possible classes: opened eyes, left fist, right fist, both fists, and both feet.Both classifiers were integrated such that the NN classifier is only enabled when the eyes are open.
In SVM, each of the degree and gamma parameters were varied from 1 to 10 and the number of hidden layers for the neural network was varied from 1 to 20.At each specific number of hidden layers (or a specific degree-gamma pair), 80% of the samples (9600 events) were randomly selected and used for training and the remaining 20%for testing.This process was repeated 10 times, and in each time the datasets were randomly mixed.For each specific configuration, the average accuracy was calculated for the ten training-testing pairs.A huge number of training and testing experiments were carried out.Table I and Table II list the best average accuracies with their associated classifier configurations.It can be noted that the use of a SVMs classifier of gamma = 9 and degree = 6 with inputs that were generated by a Coif4 wavelet and MAV features provided the optimum classification performance of an accuracy of 74.97%.In addition, a NNs classifier of 15 hidden layers with inputs that were generated by a Coif2 wavelet and IEEG features provided an accuracy of 71.6%.These are very promising results as they were obtained while most of the available data are for imagined movements.

VI. REAL TIME IMPLEMENTATION
A simple software interface was designed as show in Fig. 5.This software reads streams of EEG signals from a test EEG record or from an EEG mouse (if available).
The system extracts the features needed for the SVM and NN decision rules and provides near-real time actions.The default configurations of this system are to translate the "closing eyes for 2s" activity into a mouse click and the www.ijacsa.thesai.orgimagined left/right fists, both fists, and both feet movements into computer cursor movements as seen in Fig. 6.These configurations can be reprogrammed to run different computer applications instead of simple cursor movements.

Fig. 1 .
Fig. 1.A block diagram for the suggested system


One-minute baseline run with eyes open. One-minute baseline run with eyes closed. Three two-minutes experimental runs of imagining moving theright or left fists while the left or right side of a computer screen is showing a target.

Fig. 3 .
Fig. 3.The multi-resolution decomposition of a sample EEG signal.

TABLE I .
OPTIMUM CLASSIFICATION RESULTS ACHIEVED USING DIFFERENT COIFLETSWAVELETS WITH SVMS.