You are on page 1of 2

Proceedings of TOBI Workshop IV

Sion, Switzerland, 2013

Using Random Forests for Classifying Motor Imagery


EEG
1

D. Steyrl1, R. Scherer1, G. R. Mller-Putz1

Institute for Knowledge Discovery, University of Technology, Graz, Austria

Correspondence: R. Scherer, University of Technology, Graz, Austria. E-mail: reinhold.scherer@tugraz.at

Abstract. We applied Random Forest (RF) classifiers on electroencephalographic (EEG) data of right hand vs.
feet motor imagery (MI) and achieved a cross-validation classification accuracy of 79% on average over 10
participants. Furthermore, we used the intrinsic Gini Index (GI) based feature rating mechanism of the RF
classifiers to find most discriminative features and compared them to the differences in the event related
desynchronization/synchronization (ERD/S) maps between the classes. We found mu and beta band measured at
position C3 most important for classification, which is in line with current state of knowledge.
Keywords: BCI, EEG, ERD/S, Motor Imagery, Random Forests, Feature ranking

1. Introduction
One crucial issue to achieve good on-line performance in sensory motor rhythm (SMR) Brain-Computer
Interfaces (BCI) is the selection of the most discriminative oscillatory components. In this work we study the
usefulness of the Random Forests (RF) ensemble classifier for classifying electroencephalographic (EEG) motor
imagery (MI) data. RF classifiers are interesting because in other areas they achieve high classification
accuracies and they have a built in feature rating mechanism, which can be useful for checking the validity of the
selected features. Furthermore, RF are robust against outliers and can handle high dimensional input variables. In
this work, we perform offline analysis of right hand vs. feet MI data and compare the feature rating results with
event related desynchronization /synchronization (ERD/S) maps.

2. Material and Methods


2.1. Random Forests Classifier and Feature Rating with Gini Index
A RF classifier is an ensemble of many decision trees. Each decision tree contributes a vote for a majority
decision about the class membership of an ensemble classifiers input. An ensemble classifiers accuracy
depends on two things: High accuracy of the individual tree, and low correlation between the trees [Breiman,
2001]. For RF classifiers, the correlation can be decreased by using randomness during the training of the
classifier. The randomness is introduced through an individual bootstrap sample of the training data for each tree
and through an individual random feature subset for each split in each tree. Decision trees split up the training
trials into subsets which should be as pure as possible. The purity is measured with the Gini Index (GI)
[Breiman, 1983]. The GI is a measure of statistical dispersion and is zero if all class labels in a subset are the
same and one if all class labels in a subset are uniformly distributed. The ratio between GI before and after the
split is calculated and that feature is chosen which decreases that ratio at most. As there are many different
decision trees in a RF classifier the average decrease in GI among all trees caused by a feature can be calculated.
High average decrease means that this feature is often found to be the best selection to produce pure subsets,
which is equivalent to the statement that this feature contains information about the class membership and is
therefore important [Breiman, 2001].
2.2. Paradigm and Data Processing
EEG recorded by a standard cue-based paradigm with 4 s time periods of right hand and feet MI was
analyzed [Mller-Putz, 2010]. Laplacian derivations of the positions C3, Cz and C4, according to the
international 10-20 system, were divided into overlapping (0.5 s) windows with a length of 1 s. A fast Fourier
transform (FFT) was applied to each window. We limited the frequency range from 5 to 40 Hz at a frequency
resolution of 1 Hz. Absolute values of the 108 frequency bins (36 freq. at 3 channels) were used as features for
the RF classifiers. Classifiers settings: 1000 trees, the bootstrap samples size was equal to the number of
training trials, 10 random features for each split in each tree. We used artifact free trials (up to 80 per class;
visual inspection) of a participant, to calculate 10x10 fold cross-validation (CV) accuracies for each time
window and each participant independently. Further, we calculated the GI based feature ratings, and the ERD/S
time/frequency maps for each class [Pfurtscheller, 2001]. To validate whether features GI ratings and differences
in ERD/S maps relate, we computed the correlation coefficients between the GI ratings and the significant
differences of ERD/S maps. Significant means where the 99% confidence intervals of the ERD/S maps values
did not overlap.

89

Proceedings of TOBI Workshop IV

Sion, Switzerland, 2013

3. Results
The CV results and the correlation coefficients of each participant are presented in Table 1. Figure 1 shows
one example of the calculated maps and the average GI feature rating over all participants.
Table 1. Peak cross-validation accuracies of RF classifiers and correlation coefficients between RF classifiers feature
rating and significant (99% confidence interval) differences of ERD/S time/frequency maps of the classes right hand vs.
feet (n.s. not significant).
Participant
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10
Mean
RF
94%
70%
75%
86%
91%
64%
70%
85%
74%
80%
79%
Corr. coeff. (p<0.001)
0.45
n.s.
n.s.
0.34
0.16
0.44
n.s.
0.17
0.12
0.71
0.34

Figure 1. 1a) GI rating map for right hand vs. feet MI of participant S10. Each time segment was individually analysed. 1b)
difference of ERD/S time/frequency maps between right hand and feet MI for participant S10. 1c) average GI
ranking average over all participants. Note: Color coding of the maps is not compareable, because the color was
normalized to the maximum value of the respective map.

4. Discussion
RFs were successfully applied to EEG data for single trial classification of MI. We computed an average
peak accuracy of 79%. For comparison DSLVQ achieved 81% [Mller-Putz, 2010]. The training of the classifier
and the calculation of the ratings was reasonable fast with about 1 s per classifier. The time for classifying one
sample was less than 0.05 s. The top rated features for MI were in average the frequencies in the mu and in the
beta band of channel C3 (Fig. 1c). Moreover, in average there were important features on the ipsilateral side
(C4), which is in line with literature [Pfurtscheller, 1997, 2001]. Although there is a noticeable similarity
between the GI rankings (Fig. 1a) and the differences of ERD/S maps (Fig. 1b), the computed correlation
coefficients (Tab. 1) were low. A possible cause is that significant differences of ERD/S maps were rather spots
than sustained due to the low resolution of the maps and the assessment of ERD/S differences to certain
frequencies can slight vary between ranking and difference maps due to the dissimilar calculation methods (FFT
vs. band passing).
Summing up, Random Forests classify motor imageries in EEG and are able to find neurophysiological
reasonable features. We are currently working on an online study using RFs and first results are promising.
References
Breiman L, Friedman J H, Olshen R A, Stone C J, CART: Classification and Regression Trees. Wadsworth: Belmont, CA, 1983.
Breiman L, Random Forests, Kluwer Academic Publishers, Machine Learning, 45: 5-32, 2001.
Mller-Putz G R, Scherer R, Pfurtscheller G, Neuper C, Temporal coding of brain patterns for direct limb control in humans. Frontiers in
Neuroscience: 4-34, 2010.
Pfurtscheller G, Neuper C, Motor imagery activates primary sensorimotor area in humans, Neuroscience Letters 239: 65-68, 1997.
Pfurtscheller G, Neuper C, Motor imagery and direct brain-computer communication, Proceeding IEEE, 89 no. 5: 11231134, 2001.

90

You might also like