# Determination of the two most discriminative directions of the cursor movement imagery tasks

**Visit for more related articles at**Biomedical Research

## Abstract

The brain computer interface (BCI) researchers have tried to investigate the most discriminative imagery tasks to control BCI devices. In this study, we seek to determine the two most discriminative directions of the cursor movement imagery EEG data among up/down/right/left movement imagery directions. The training and testing EEG data sets were recorded from three healthy human subjects in one week of delay. The motor imagery features were extracted using common spatial patterns (CSP), which is one of the most popular algorithms in the BCI community. Then, the features were classified by using the k-nearest neighbor (k-NN), support vector machine (SVM) and linear discriminant analysis (LDA) algorithms. The achieved results showed that imagination of up-right and down-left cursor movement imagery tasks were the two most discriminative directions among the other task pairs.

## Keywords

EEG, Brain computer interface, Common spatial patterns, Classification, Discriminative cursor movement imagery

## Introduction

For improving performance of brain computer interface (BCI) applications it is important to utilize discriminative imagery tasks. To do so, researchers have used various kinds of imagery tasks; either they are directly related to specific BCI application or not [1-3]. Cursor movement imagery applications have gained much attention by BCI community. In an EEG-Based cursor movement study, Kus et al. have chosen separable mental tasks that were not directly interrelated to BCI application but were easily detected [4]. They navigated a cursor along a computer rendered 2-D maze into three directions of left, right and up. To do so, the five participants of the experiment were given the instruction to imagine the continuous opening and closing of left/right hand for left/right cursor movement and to imagine gripping an object with both feet for up cursor movement. In BCI Competition 2003 [5] Data Set Ia (a healthy subject) and Data Set Ib (a paralyzed subject) were provided to researchers in order to categorize the trials in the test set into cursor up or cursor down. Some achieved high classification accuracy (CA) results were obtained by Kayikcioglu and Aydemir [6] as 92.15%, Wang et al. [7] as 91.47% and Sun and Zhang [8] as 90.44% on Data Set Ia. On the other hand the obtained CA results on Data Set Ib were pretty low such as 59.1% [9], 58.9% [6] and 54.4% [10].

No previous studies have examined the most discriminative directions of the cursor movement imagery tasks. In this study, we seek to determine the two most discriminative directions of the cursor movement imagery among up/down/right/left computer cursor movement imagery EEG data. To investigate this, the EEG data sets were acquired from three healthy human subjects in age group of between 24 and 29 years old in two sessions on different days. The motor imagery features were extracted using common spatial patterns (CSP), which is one of the most popular algorithms in the BCI community. Then, the extracted features were classified by using three commonly used classification algorithms including, k-nearest neighbor (k-NN), support vector machine (SVM) and linear discriminant analysis (LDA). The obtained results showed that imagination of up-right and down-left cursor movement imagery tasks are the two most discriminative directions. Following in the paper, in Materials and Methods Section, first, the EEG-based BCI data set is introduced and then common spatial patterns is mathematically explained as feature extraction method. In the last parts of this section, the three classifiers used in this study are briefly defined. The EEGbased BCI data sets are classified by these classifiers and the results are provided in tables and figures in Section 3. Finally, Section 4 presents the conclusion and discussion of the paper.

## Materials and Methods

In the following subsections, first, the used data set is described, then, the parts of proposed method are described in detail.

*Data set description*

In this study the Brain Quick EEG System (Micromed, Italy) was used to acquire EEG signals. The brain activity was sampled by 256 Hz and filtered between 0.1 and 120 Hz. Additionally, a 50 Hz notch filter was used to eliminate line noise. 18 EEG electrodes (**Table 1**) were located according to the International 10–20 System and they were referenced to the electrode Cz. All the electrode impedances were kept below 5 kΩ. Because EOG and EMG artifacts were strong on the Fp1, Fp2, O1 and O2 electrodes, they were not selected for the analysis. The data acquisition equipment is given **Figure 1**.

Channel Number | Channel Name |
---|---|

1 | Fp2 |

2 | Fp1 |

3 | F4 |

4 | F3 |

5 | F8 |

6 | F7 |

7 | Fz |

8 | T4 |

9 | T3 |

10 | C4 |

11 | C3 |

12 | T6 |

13 | T5 |

14 | P4 |

15 | P3 |

16 | Pz |

17 | O1 |

18 | O2 |

**Table 1:** List of electrodes

EEG signals were collected from three healthy male adults (subjects A, B and C aging 24, 24 and 29 years old, respectively) on two different offline sessions with about one week interval. Each trial began with a 2 sec delay and lasted for 10 sec. At the beginning, the target appeared in one of four possible positions (up, left, down and right) on the middle edge. After the target entered on the screen, a cursor appeared in its center and the subject had to perform a motor imagery task corresponding to the target for 8 sec. Each trial ended with a beep sound.

While the first session trials were used as a training set, the second session trials were used as the testing set. **Table 2 **shows the total number of considered trials for each subject. Both the training and testing sets consisted of equal number of trials for each class. The trial signals in both training and testing sets were assigned as follows: T1=cursor up, T2=cursor right, T3=cursor down and T4=cursor left. For further information about the data set, please refer to [3].

Subject | Number of training set trials | Number of test set trials |
---|---|---|

A | 140 | 152 |

B | 148 | 152 |

C | 148 | 152 |

**Table 2:.** Total number of the considered trials.

*Feature extraction: common Spatial Patterns*

We extracted the features by applying the CSP, which is one of the most popular and well-known feature extraction method in motor-imagery BCI studies [11,12]. The method of CSP gives spatial filters which maximize the variance of one class while minimizing the variance of the other class at the same time [13]. It is worthwhile to mention that to compute optimal CSP all channels (except Fp1, Fp2, O1 and O2) were considered and leave-one-out cross-validation (LOOCV) technique were used. The normalized spatial covariance matrix of an EEG trial calculated as follows:

where D denotes a trial which is CxS matrix (C is the number of channels and S is the number of samples). Trace is the sum of the diagonal elements of (DDT). The spatial covariance matrix was calculated by averaging over the trials of each class. Then, two resultant matrices (one is for first class, the other is for second class) were summed and a composite covariance matrix MC was obtained as:

MC can be factored into its eigenvectors as:

where EC is the matrix of eigenvectors and λC is the diagonal matrix of eigenvalues. Then, a whitening transformation (W), which equalizes the variances in eigenspace, was calculated as follows:

W was used to transforms the average covariance matrices as

Then, K1 and K2 share common eigenvectors and the sum of corresponding eigenvalues for the two matrices are always equal to 1, such that

where I is the identity matrix. Finally, a projection matrix P=(UTW)T, where the columns P-1 are the common spatial patterns and can be seen as time-invariant EEG source distribution vectors. With the projection matrix the decomposition of a trial D was calculated as follows:

Since the sum of the corresponding eigenvalues is always one, the variances of first and last rows of are suitable features for classification. In this study, we calculated the variances of the first and the last rows as features.

*Classification algorithms*

In this study we calculated the classification accuracy, which was defined as the percentage of the number of trials classified correctly over the size of the data set, by three commonly used classifiers including k-NN, LDA and SVM. Due to the fact that they are all well-known classifier algorithms, we only gave the considered properties of them. For the k-NN classifier, Euclidean distance metric and LOOCV technique were used to determine the best value of k so as to maximize the classification performance. k value was searched in the interval between 1 and 25 with step size of 1.

For the LDA classifier, the main objective was to solve the problem:

where x is feature vector. Vectors w and w0 are determined by maximizing the interclass means and minimizing the interclass variance. For the SVM classifier, the most commonly used radial basis function kernel was utilized. This kernel function was specified by the scaling factor σ. The most suitable σ value was searched in the interval between 0.1 and 2.0 (step size of 0.1) with the same validation procedure used in the k-NN classifier. To implement the k-NN, LDA and SVM algorithms, knnclassify, classify and svmclassify (with svmtrain) functions were used from the MATLAB R2014a Bioinformatics Toolbox, respectively.

In LOOCV technique, the training phase is performed using D-1 trials, where D is the total number of trials, and the validation is carried out using the excluded trial. If this trial is misclassified an error is counted. This is repeated D times, each time excluding a different trial [14]. The most suitable CSP was searched in the interval between 1 sec and 8 sec (with step size of 0.25 sec). The flowchart of the training procedure is given in **Figure 2**. For each two-task pair this flowchart procedure was applied. After determining the best case of cross validation accuracy (CVA) with trained classifier parameter and selected time interval (T) the testing procedure was applied as given in **Figure 3**. According to this process, first, for corresponding classifier features were extracted by using determined T parameter. Then, the features were classified by trained classifier and testing set labels were calculated. Finally, classifier performance was evaluated by comparing the calculated labels with actual labels.

## Results

The calculated CA results for the k-NN, SVM and LDA algorithms were given in **Table 3, Table 4 and Table 5**, respectively. In the tables calculated the most suitable time intervals were given under the each CA result in seconds. Additionally, the average CA results were calculated and they were given at the last columns of the tables. As seen in the tables, the highest CA results were obtained for discriminating of T1/T2 tasks of Subject A as 97.37% SVM classifier. Additionally, the highest CA results were obtained for discriminating of T3/T4 tasks of Subject B and Subject C with k-NN classifier as 71.05% and 69.74%, respectively. On the other hand, in considering the averages of classification accuracies of all subjects showed that T1/T2 tasks have great discriminative potential among the other task pairs. They were calculated for k-NN, SVM and LDA classifiers as 76.31%, 74.56% and 71.05%, respectively. However, for both the k-NN and SVM classifiers results T1/T3 tasks and for LDA classifier result T2/T4 and T3/T4 tasks seem to have less discriminative potential among the other task pairs.

Task | Subject A | Subject B | Subject C | Average |
---|---|---|---|---|

T1/T2 | 96.05 (T=1.25) |
68.42 (T=5.25) |
64.47 (T=3.00) |
76.31 |

T1/T3 | 65.79 (T=1.00) |
60.53 (T=1.00) |
61.84 (T=2.00) |
62.72 |

T1/T4 | 89.47 (T=1.25) |
64.47 (T=2.75) |
68.42 (T=4.75) |
74.12 |

T2/T3 | 80.26 (T=1.00) |
60.53 (T=6.75) |
65.79 (T=7.75) |
68.86 |

T2/T4 | 72.37 (T=1.00) |
61.84 (T=5.75) |
63.16 (T=5.75) |
65.79 |

T3/T4 | 64.47 (T=7.75) |
71.05 (T=6.25) |
69.74 (T=7.25) |
68.42 |

**Table 3:** Results of k-NN classification.

Task | Subject A | Subject B | Subject C | Average |
---|---|---|---|---|

T1/T2 | 97.37 (T=1.25) |
65.79 (T=6.00) |
60.53 (T=3.00) |
74.56 |

T1/T3 | 57.89 (T=1.50) |
60.53 (T=3.25) |
60.53 (T=2.25) |
59.65 |

T1/T4 | 92.11 (T=1.50) |
63.16 (T=5.50) |
63.16 (T=5.00) |
72.81 |

T2/T3 | 81.58 (T=1.00) |
60.53 (T=1.00) |
65.79 (T=7.75) |
69.30 |

T2/T4 | 60.53 (T=1.00) |
60.53 (T=5.50) |
63.16 (T=3.75) |
61.41 |

T3/T4 | 60.53 (T=3.75) |
65.79 (T=7.75) |
64.47 (T=7.75) |
63.60 |

**Table 4:** Results of SVM classification.

Task | Subject A | Subject B | Subject C | Average |
---|---|---|---|---|

T1/T2 | 96.05 (T=1.25) |
55.26 (T=1.25) |
61.84 (T=3.50) |
71.05 |

T1/T3 | 61.84 (T=1.00) |
57.89 (T=1.75) |
56.58 (T=3.00) |
58.77 |

T1/T4 | 90.79 (T=1.25) |
56.58 (T=7.50) |
61.84 (T=8.00) |
69.74 |

T2/T3 | 65.79 (T=1.00) |
60.53 (T=1.00) |
64.47 (T=5.25) |
63.60 |

T2/T4 | 53.95 (T=5.00) |
55.26 (T=8.00) |
59.21 (T=7.75) |
56.14 |

T3/T4 | 53.95 (T=1.75) |
57.89 (T=3.00) |
56.58 (T=7.75) |
56.14 |

**Table 5:** Results of LDA classification.

Overall, while the best single case was achieved by SVM classifier as 97.37% for T1/T2 tasks, the worst single cases were obtained by LDA classifier as 53.95% for both T2/T4 and T3/T4 tasks.

## Conclusions

In this paper, we investigated to determine the two most discriminative directions among the up/down/right/left computer cursor movement imagery EEG data. The results showed that the imagination of T1/T2 and T3/T4 cursor movement tasks were the two most discriminative directions among other task pairs. These results showed that instead of up-down or left-right tasks, the unrelated tasks (up/down-left/ right tasks) are more discriminative and have higher CA results. Therefore, it might be mentioned that the imagination of unrelated movement tasks could be provide much better BCI performance.

Another good attribute of the proposed method was the EEG signals (training and testing data sets) were collected on two different sessions with about one week interval. This was crucial to prove the robustness and applicability of the proposed feature extraction method due to the fact that it provided discriminative features both in training and testing sets. **Figure 4** shows entire feature vectors of T1 and T2 tasks extracted from the training and testing sets of Subject A when T was selected as 1.25 sec. The best CA result was obtained with those of features as 97.37% by using SVM classifier as given in the **Table 4**. Horizontal and vertical axes of this feature space are *values of the variance of the first row of Z and the values of the variance of the last row of Z*, respectively. Plus points stand for trials of T1 (cursor up) movements, and circle points stand for the trials of T2 (cursor right) movements. It is worthwhile to mention that the variances at the horizontal axis are much bigger than the vertical axis, which was provided by CSP algorithm. The achieved results also showed that it is not necessary to use whole recorded EEG data in order to categorize the trials.

## Discussion

Utilizing of the most discriminative imagery tasks is very crucial to achieve high performance BCI applications. To do so, based on the results reported by some EEG based BCI studies, researchers have chosen or sought unrelated tasks, which are not directly related to BCI application but can be easily detected, to achieve high performance. In such a study, researchers chosen feet/hand movement motor imagery tasks in order to use them for yes/no responses [15]. In another work, the most discriminative task pair were sought among 12 cognitive tasks including resting task, counting, letter composing, geometrical figure rotation, mathematical adding, left fingers movement, right fingers movement, left arm movement, right arm movement, letter-cued silent word generation, letter-cued silent names generation and mentally reciting a poetry [16]. In another approach, which is slightly related with this paper, participants of the experiment were given the instruction to imagine the continuous opening and closing of left/right hand for left/right cursor movement and to imagine gripping an object with both feet for up cursor movement [17]. It is worthwhile to mention that BCI systems are more practical in use and realistic when they can be able to discriminate EEG signals which are recorded in different sessions on different days and if the mental tasks are directly related to BCI application. In this paper, we concluded that T1/T2 and T3/T4 cursor movement tasks were the two most discriminative tasks. As a result, it can be said that among other pairs, T1/T2 and T3/T4 pairs of cursor imagery tasks can be easily applied to perform higher accuracy BCI applications. We verified this conclusion by recording the EEG signals on two different sessions with about 1 week interval.

## Acknowledgements

The authors would like to thank all the researchers who are associated with the data acquisition and processing of the data set. This work was supported by The Scientific and Technological Research Council of Turkey (TUBITAK), Project No: EEEAG-215E155.

## References

- Boudria Y, Feltane A, Besio W. Significant improvement in one-dimensional cursor control using Laplacian electroencephalography over electroencephalography. Journal of Neural Engineering 2014; 11: 035014
- Kayagil TA, Bai O, Henriquez CS, Lin PA. Binary Method for Simple and Accurate Two-Dimensional Cursor Control from EEG with Minimal Subject Training. Journal of Neuro Eng and Rehabilitation 2009; 6: 1-16.
- Aydemir O, Kayikcioglu T. Decision Tree Structure Based Classification of EEG Signals Recorded During Two Dimensional Cursor Movement Imagery. Journal of Neuroscience Methods 2014; 229: 68-75.
- Kus R, Valbuena D, Zygierewicz J, Malechka T, Graeser A, Durka P. Asynchronous BCI Based on Motor Imagery with Automated Calibration and Neurofeedback Training. IEEE Transactions on Neural Systems and Rehabilitation Engineering 2012; 20: 823-835.
- https://www.bbci.de/competition/ii
- Kayikcioglu T, Aydemir O. A Polynomial Fitting and k-NN Based Approach for Improving Classification of Motor Imagery BCI Data. Pattern Recognition Letters 2010; 31: 1207-1215.
- Wang Y, Zhang Z, Li Y, Gao X, Gao S, Yang F. BCI competition 2003—Data set iv: An algorithm based on CSSD and FDA for classifying single-trial EEG. IEEE Trans Biomed. Eng 2004; 51: 1081–1086.
- Sun S, Zhang C. Assessing features for electroencephalographic signal categorization. Acoust Speech Signal Process 2005; 5: 417-420.
- Ting W, Guo-Zheng Y, Bang-Hua Y, Hong S. EEG feature extraction based on wavelet packet decomposition for brain computer interface. Measurement 2008; 41: 618-625.
- Bostanov V. BCI competition 2003—Data sets Ib and IIb: Feature extraction from event-related brain potentials with the continuous wavelet transform and the t-value scalogram. IEEE Trans Biomed. Eng 2004; 51: 1057–1061.
- Lee KY, Kim S. Designing discriminative spatial filter vectors in motor imagery brain-computer interface. International Journal of Imaging Systems and Technology 2013; 23: 147-151.
- Grosse-Wentrup M, Buss M. Multiclass common spatial patterns and information theoretic feature extraction. IEEE Transactions on Biomedical Engineering 2008; 55: 1991-2000.
- Ramoser H, Müller-Gerking J, Pfurtscheller G. Optimal spatial filtering of single trial EEG during imagined hand movement. IEEE Transactions on Rehabilitation Engineering 2000; 8: 441-446.
- Aydemir O, Kayikcioglu T. Wavelet Transform Based Classification of Invasive Brain Computer Interface Data. Radioengineering 2011; 20: 31-38.
- Müller-Putz GR, Pokorny C, Klobassa DS, Horki P. A single-switch BCI based on passive and imagined movements: toward restoring communication in minimally conscious patients. International journal of neural systems 2013; 23: 1250037.
- Dobrea MC, Dobrea DM. The selection of proper discriminative cognitive tasks—A necessary prerequisite in high-quality BCI applications. IEEE Applied Sciences in Biomedical and Communication Technologies ISABEL 2009. 2nd International Symposium on (pp. 1-6).
- Kus R, Valbuena D, Zygierewicz J, Malechka T, Graeser A, Durka P. Asynchronous BCI based on motor imagery with automated calibration and neurofeedback training. IEEE Trans Neural Syst Rehabil Eng 2012; 20:823–835.