Sie sind auf Seite 1von 5

2016 International Conference on Frontiers of Information Technology

Effective Classification of EEG Signals using K-Nearest


Neighbor Algorithm
Umer I.Awan[1], U.H Rajput[2], Ghazaal Syed[3], Rimsha Iqbal[4], Ifra Sabat[5] , M.Mansoor[6]
[1-6]
Faculty of Engineering Science and Technology
Iqra University
Karachi, Pakistan
[3]
mgsyed@iqra.edu.pk

AbstractIn this research paper, an effective approach to classify in conjunction with oriented principal component analysis and
and extract feature vector of different facial expressions and this leads to the fact that this method proves to be more efficient
movements recorded using Non-invasive Electroencephalogram than PCA based classification by a margin of 11% (PCA being
(EEG) device is presented. EEG signals were obtained from 10 84%) [4]. the blind source separation method has also been used
healthy persons between the age group of 18 to 45. Feature vectors to remove artifact in EMG signals [5]. Support vector machine
are based on a new approach that make use of Segmentation and
Selection (SnS) with Root Mean Square (RMS) to extract feature
and double blind source separation method has also been used
vector of EEG activities. The classification is done by using K [6].
nearest neighbor algorithm. The presented S-RMS (Segmentation Researchers have been working on using EEG device to provide
and Selection- Root Mean Square) method provides an accuracy services for the disabled persons, for example control toy car,
of 96.1% and gives better results when compared with others wheel chair. This is being done in greater context for helping
approaches. disabled persons to even move towards a new era of technology
[7]. Bivariate mode decomposition has also been used for
KeywordsEEG, KNN, IEMG, MAVS, RMS, S-RMS; classification [8]. Another method to remove eye blink signals
from EEG is to use CBSS algorithm [9]. SVM has also been
used in conjunction with blind source separation using second
I. INTRODUCTION order blind identification algorithm [10]. The comparison
between blind source separation with recursive least square
The BCI Brain computer interface is a new technology algorithm and it has proven that RLS has better accuracy than
involving the communication between computer and the brain BSS whether EOG reference signals are present or not [11].
of humans without getting in direct contact with the nervous
MAVS and MAVS has also been used to extract feature vector
system of humans. Out of the countless uses of brain computer
from EMG signals out of which MAVS has been found out to
interface most of the uses involve around paralyzed people who
are suffering from neuromuscular disorder. BCI information give better results MAV[12].IEMG has also been used in order
generally is acquired by using electroencephalography to get feature vector from EEG signals[13].
commonly known as EEG [1]. EEG is acquired from the
potentials which flows from millions of neurons present in the In this paper an effective and simple approach to classify
brain of human being. These voltages generated in the process various facial movements is given, the signals are extracted
can be extracted from the scalp of humans by using electrodes from low resolution Emotiv device. Using specific set of EEG
placed on the scalp of human. signals, electronic devices can be controlled such as electronic
cars, electronic wheel chairs, and robotic arms. Feature
These signals are composed of mainly two types one is
extraction has been done by using two different methods which
external noise and the other is the brain activity. The external
are segmented root mean square and graphical plotting of
noise is generated from environment equipment, for example
power line or light. The internal brain activity arises from human signals. Classification was then done by using K nearest
activity such as left smirk, right smirk, clench and others. These neighbor algorithm.
signals are all very low frequency signals of less the 32 Hz. K nearest neighbor algorithm is an algorithm which
There propagation time, however differs from each other as the uses non-parametric approach to classify the signal into
reaction time of these and other expressions is different. Af3, F7, different classes. The answer is based upon the number of votes
F8, AF4 are being used to extract the signals from the brain. from its neighbors which is one of the reasons it is called as
KNN.
Until now various methods have been used for classification of This paper is composed in a way to make it easily
brain signals obtained through electroencephalography and understandable for people who are not at expert level in brain
electromyography. Independent component analysis has been computer interface. After introduction experimental setup is
used in past to classify the different classes of signals [2]. This defined in section II followed by signal processing feature
was done by first differentiating them based upon their extraction, classification process, results and conclusion in
frequency bands. Another method used was by using adaptive sections III, IV, V and VI respectively.
filtration and recursive least square and fast recursive least
square in conjunction with each other the results shows that
FRLS is more efficient then RLS [3]. ICA has also been used

978-1-5090-5300-1/16 $31.00 2016 IEEE 120


DOI 10.1109/FIT.2016.28
II. EXPERIMENTAL SETUP Signals were preprocessed using band-pass and notch filter, to
In this study Emotiv EPOC+ was used to gather the make sure that the feature extraction is good enough to get
electroencephalography signals. The EEG signals were taken at reliable results, normalization was done on the signals.
the rate of 128 samples per second and filtered between the
range of 0.1 to 32 Hz using notch and band pass filters to get
accurate signals free from noise. We have used 14 electrodes
on the scalp of humans, according to international 10-20 system
as shown in the fig 1 including two reference electrodes P3 and
P4 namely CMS and DRL. Channels were as followed: AF3,
F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8 and AF4
(these are the names of the locations of electrodes as per 10-20
b international electrode system) as shown in Fig. 1.
Figure 2 Right Smirk Signal
Electroencephalography signals also known as EEG signals
were obtained from 10 healthy persons from the age group
between 18 to 45 years old at different time. Before recording
the signals, all of them were made to go through a training
program which includes to let their eyes closed and letting their
body relax. After which different samples were recorded,
including Right smirk, Left smirk, Clench, and no Action,
shown in Fig 2, Fig 3, Fig 4 and Fig 5 respectively. In whole
process they all were sitting in idle position. 50 samples were Figure 3 Left smirk signal
taken for each subject 25 of them were treated as training
samples and another 25 were treated as test sample of each
action and each person. 12 of these people were in an empty
dark room while the samples were being recorded and 12 others
were in empty room with optimum lightings. To even further
check the results one person was present in class full of
students. The table is presented below for the recorded signals.

Table 1 Training and trials


Class Actions Training Trails Test Trails Figure 4 Clench Signal

C1 Left Smirk 25 25
C2 Right Smirk 25 25
C3 Clench 25 25
C4 Idle 25 25

Figure 5 No action

These Fig 2, Fig 3, Fig 4 and Fig 5 are the waveforms for four
states including left smirk, right smirk, clench and idle, taken as
raw data which were then processed to get the results.

IV. FEATURE EXTRACTION


The conventional RMS method was used with the SnS
method to develop a feature vector.
A. Root mean square method
After the normalization process, EEG trail was passed
Figure 1 International 10-20 B electrode system through band pass filters to receive signal with low noise levels
so that it can help us distinguish between the different samples.
III. SIGNAL PRE-PROCESSING The next step in feature extraction was to take the RMS value
The EEG samples were obtained on different times, which of sample tests of data and plotting it on Matlab and seeing the
can lead to problems regarding the values of the samples, differences between the waves of the above mentioned facial

121
expressions. The formula used for taking the mean of the data the mean of the signals. But this can further be enhanced by
is as follows: finding the slope as well that is why MAVS was used instead
of MAV. To find the MAVS below mentioned formula was
used:
(1)

 (3)
This equation leads us to the point where we took our Results obtained are given in the table 4.
decision for using F7 electrode as shown in Fig 1 for left smirk
D. Integrated-EMG
and right smirk, and F3 electrode as shown in Fig 1 for clench
signals. Fourth method used to obtain feature vector is
Integrated EMG. IEMG works on the area under the curve of
B. S RMS the rectified EMG signals. Formula for IEMG is as followed
In this method the result of previous used method was and results of IEMG are explained in table 5.
further improved by doing the segmentation of the output. This
was done by chopping of the complete waveform in equal
(4)
segments and RMS of only those segments was calculated
which had maximum EEG amplitude using findpeaks function
on Matlab. After careful analysis of the data. As seen in Fig. 6, V. CLASSFICATION AND RESULTS
X-Axis denotes time and Y-Axis denotes amplitude, this We have used K nearest neighbor algorithm to classify
method not only reduced the processing cost in term of power EEG signals. In order to classify signals the first thing KNN
but also in term of time as well. After segmentation once again need is the distance between vectors and it is calculated by
RMS value of the data is calculated and this RMS value is then using the following formula
taken as feature vector. After getting the feature vector this led  (5)
us to the point where training of the signals initiates. This will be done 4 times as there are four different signals
present. Based upon the distance of test signal to the predefined
signals, KNN will cast one vote to the favor of the least distance
between test and one of the predefined signals.

A. Training Process :
We trained our classifier by providing training sets of all four
classes which are left smirk, right smirk, clench and normal
state. To achieve the best possible value K cross validation
method is used. Training sets present were 25 so the value of
K was set in between 0-25 with the interval of 1.
B. Testing Process:
Test samples which were 25 samples for each action per
person were tested. The results of the classification are given in
the matrix below,
Figure 6 SRMS plot
Fig. 6 shows the output of SRMS signals of three different Table 2 Training Classification Accuracy using S-RMS method
classes and two test signals. Analyzing the signals, it can clearly
Test Left Right Clench Idle
be observed that test signal 1 is of left smirk and test signal 2 is Subject Smirk Smirk
of right smirk. 01 96% 100% 88% 96%
02 100% 100% 92% 88%
03 84% 84% 80% 100%
C. Mean Avereage Value Slope 04 100% 100% 100% 96%
Third method applied to get the feature vector is 05 92% 96% 96% 100%
MAVS. which is mean absolute value slope in order to find 06 100% 100% 100% 100%
07 96% 84% 100% 100%
MAVS. First thing which we need was to find the MAV of the 08 100% 100% 100% 100%
signals and then then their slope was obtained. Formula for 09 96% 100% 100% 93%
finding MAV is as follows: 10 100% 100% 92% 96%



(2)

MAV is the absolute value of the mean of the signals which was
used to find the feature vector as it gives the absolute value of

122
Table 3 TRAINING CLASSIFICATION ACCURACY USING RMS METHOD Classification accuracies of SRMS in Table 2, RMS in
Test Left Right Clench Idle Table 3, MAVS and IEMG in Table 4 and 5 respectively are
Subject Smirk Smirk
01 80% 84% 76% 80%
shown comparatively in Table 6. We have come to the point
02 76% 84% 92% 84% that without using segmented RMS best possible value is 84%
03 84% 84% 76% 68% and in worst case its value is 75%, After implementing
04 98% 68% 80% 84% Segmented RMS this algorithm can classify signals at an
05 92% 84% 76% 80% average of 96.1 % in normal conditions. In optimum conditions
06 80% 80% 80% 76% its efficiency is around 98%.
07 88% 84% 58% 80% On the other hand, in the worst case scenario when a
08 88% 84% 76% 80% person is under immense pressure and facing health issues
09 84% 88% 80% 72% accuracy is still 87% (keeping in mind test subject 3 was facing
10 100% 62% 80% 84% some dire pressure due to unemployment and he was also
having fever on the day of test). While using IEMG gives an
Table 4 TRAINING CLASSIFICATION ACCURACY USING MAVS METHOD average efficiency of 71.3%. Efficiency output of IEMG is
Test Left Right Clench Idle
ranging from 62% to 79%. On the other hand, MAVS was better
Subject Smirk Smirk
01 72% 68% 80% 76% than IEMG but certainly not as good as RMS and SRMS with
02 80% 84% 84% 80% an average efficiency of 80.4%. We should keep in mind that
03 88% 80% 84% 44% even the best result without performing segmentation is 84%
04 84% 72% 80% 80% while after performing the worst result is 87% while in
05 76% 72% 96% 80% optimum condition it is 98% while the average result is 96.1%.
06 76% 88% 88% 80%
07 80% 84% 80% 92% VI. CONCLUSION
08 84% 80% 76% 96% In this paper we have proposed a method to classify
09 68% 76% 96% 84% EEG signals using SRMS (segmented root mean square)
10 96% 100% 80% 68% method for feature extraction and then classifying with the help
of KNN algorithm. The classifier accuracy we have received is
Table 5 TRAINING CLASSIFICATION ACCURACY USING IEMG METHOD
Test Left Right Clench Idle 96.1%. To cross validate this result we have also used the
Subject Smirk Smirk classifier on simple RMS, MAV and IEMG values and used
01 56% 68% 80% 56% KNN on them. This gives us the classification accuracy of
02 72% 68% 60% 80% 80.2%, 80.4% and 71.3% respectively. The facial expressions
03 64% 52% 72% 60% are EOG and EMG signals which have significant impact on
04 60% 76% 72% 84% EEG signals. The best thing is that the signals on which this
05 76% 72% 80% 60% classifier is made up on are easy to do and are basic with almost
06 84% 80% 56% 96% every human having complete command on them.
07 60% 72% 88% 64% The data set we initially made using 5/14 channels on the
08 80% 52% 80% 96% scalp. However, after studying the effects of the signals on
09 88% 68% 56% 84%
10
different actions on different channels F7 was used for idle as
72% 84% 68% 80%
well as left and right smirk while F3 was used for clench
Table 6 COMPARATIVE ANALYSIS USING RMS, S-RMS, IEMG & MAVS
signals.
Test Accuracy Accuracy Accuracy Accuracy These results are best suited where we need results of high
Subject (RMS) (MAVS) (IEMG) (SRMS) accuracy in quick successions such as mechanical control where
01 80% 74% 65% 95% accuracy is required. Car driving, wheel chair control can be its
02 84% 82% 70% 95% future possible uses.
03 78% 74% 62% 87%
04 75% 78% 73% 99%
05 83% 78% 72% 96%
06 79% 83% 79% 100% REFERENCES
07 78% 84% 71% 95%
08 82% 100% 76% 84%
[1] J.R. Wolpaw, et al., Brain Computer Interface Technology: A review of
09 81% 97% 74% 81%
the first international meeting, IEEE Transactions on Rehabilitation
10 82% 97% 71% 86% Engineering, vol. 8, no.2, June, 2000, pp. 164-173.
[2] S. Boudet, L. Peyrodie, Ph. Gallios and Ch. Vasseur, A global approach
for automatic artifact removal for standard EEG record, proceeding for
the 28th IEEE EMBS Annual international Conference New York City,
USA, Aug-30-Sept3, 2006, pp. 5719-5722.

123
[3] P. A. Babu, Dr. K. V. S. V. R. Prasad, Removal of ocular artifacts
from EEG signals by Fast RLS algorithm using Wavelet Transform
International Journal of Computer Applications. Vol. 21, no. 4, May
2011,,
[4] S. Park, H. Lee, S. Choi, ICA+OPCA for artifact-robust classification
of EEG data, IEEE XI11 workshop on neural network for signal
processing, pp. 585-594, 2003.
[5] J. Gao, P. lin, Y. Tang, P. Wang, Online EMG artifacts removal from
EEG based on blind source separation, Informatics in Control,
Automation and Robotics (CAR), 2010 2nd International Asia
Conference, 6-7 March 2010, pp. 28-31.
[6] G. Bartlets, L.C. Shi, B.L. Lu, Automatic artifact removal from EEG
- a mixed approach based on double blind source separation and
support vector machine 2010 Annual International Conference of the
IEEE Engineering in Medicine and Biology, Aug. 31 2010-Sept. 4
2010, pp. 5383-5386.
[7] R. Barea, L. Boquete, M. Mazo and E. Lopez, System for assisted
mobility using eye movement based on electrooculography, IEEE
Transaction on Neural Systems and Rehabilitation Engineering, vol.
10, no. 4, December 2002, pp. 209-218.
[8] C. Park., D. Loonie,P. Kidmose, M. Ungstrup & D.P. Mandic, (2011).
Time-frequency analysis of EEG asymmetry using bivariate empirical
mode decomposition. IEEE Transactions on Neural Systems and
Rehabilitation Engineering, 19(4), 366-373.
[9] I. Shoker, S. Sanei, M. A. Latif, Removal of eye blinking artifacts
from eeg incorpxorating a new constrained bss algorithm, engineering
in medicine and biology society, 2004. iembs '04. 26th annual
international conference of the ieee, san francisco, ca, 1-5 sep 2004,
pp. 909-912.
[10] L. Shoker, S. Sanei, J. Chambers, Artifact removal from
electroencephalograms using a hybrid BSS-SVM algorithm, IEEE
Signal Processing Letters (Volume 12, Issue 10 ), Oct. 2005, pp. 721-
724
[11] W. Qi, EOG Artifacts Removal in EEG Measurements for Affective
Interaction with Brain Computer Interface, Intelligent Information
Hiding and Multimedia Signal Processing (IIH-MSP), 2012 Eighth
International Conference, Piraeus, 18-20 July 2012, pp. 471-475
[12] A. Phinyomark, C. Limsakul, & P. Phukpattaranont (2009). A novel
feature extraction for robust EMG pattern recognition. arXiv preprint
arXiv:0912.3973.
[13] A. Phinyomark, A. Nuidod, P. Phukpattaranont, & C. Limsakul,
(2012). Feature extraction and reduction of wavelet transform
coefficients for EMG pattern classification. Elektronika ir
Elektrotechnika, 122(6), 27-32.

124

Das könnte Ihnen auch gefallen