Keywords

1 Introduction

Electroencephalography (EEG) is a method of measuring the synchronous activity of neurons [4]. A characteristic feature of EEG signals is the presence of rhythms (waves) defined as structures with a characteristic frequency range and repeatable shape. They are associated with the state of patient activity. There are five basic types of brain waves. In the presented study two of them were applied: alpha and beta waves. Alpha waves (8–12 Hz) are activities occurring during a state of relaxation, detectable especially in occipital lobe, responsible for visual information processing. Beta waves are low amplitude activities occuring in the 12–30 Hz range.Beta waves are reflected primarily in the frontal lobe and represent poorly synchronised work of neurons specific to everyday, typical cortical activity. A single EEG study is carried out usually in the period between several minutes to several hours. It may serve as a diagnosis tool (coma, epilepsy, sleep disorders, monitoring the patient during the operation) or might be helpful in studies of neurological and functional properties of the brain. EEG is also used in the study of schizophrenia and personality disorder tests [4, 5]. Modern applications of EEG are also dedicated to the construction of brain-computer interfaces (BCI) and applying them to supporting not only disabled people, but also users of computer games.

The term brain-computer interface appeared in the 1970s [25], but the recent development of technology has made practical realisations of the BCI idea possible. A brain-computer interface [26] is “a communication system that does not depend on the brain’s normal output pathways of peripheral nerves and muscles.” So, the BCI is a system of direct communication between man and machine without nervous and muscular way, allowing user to control devices without verbal or physical (muscular) interaction [16].

The primary objective of BCI systems is to enable communication for paralyzed people suffering from so-called closing syndrome [20, 26]. The BCI is also successfully applied in treatment of patients with neurological diseases [23]. A popular application of BCIs is also neurofeedback therapy [9, 17] supporting the process of learning, concentration, and treatment of attention deficit hyperactivity disorder [6]. It is becoming increasingly popular to use BCIs for entertainment in computer games controlled by brain waves [22, 24]. The construction of BCI is a complex task, because signal needs to be preprocessed, reduced and classified accroding to particular features selected depending on the type of BCI. What is more, differences between individuals need to be taken into account. Online analysis requires well-prepared signal, adjusted classifier parameters [27], incompleteness data handling [19].

Among the BCI systems based on EEG signals one can distinguish systems based on different paradigms. The presented study is concentrated on the brain-computer interfaces based on ERS / ERD. These interfaces use the phenomenon of brain waves oscillation coming from the vicinity of the sensorimotor cortex by imagining the movement of various body parts (for example limbs, tongue, thumb). Applied phenomenon is based on Event-related synchronization (ERS) and Event-related desynchronisation (ERD) [18, 26].

The aim of the paper is to compare EEG data classification with classical supervised learning algorithm with ANOVA analysis and neural networks. The analysis is perform for the needs of the BCI based on the motor imagery paradigm. The BCI used in the study was constructed based on the ERD/ERS ratio and the LDA algorithm. Data gathered during BCI sessions were then analyzed offline using ANOVA and neural networks. The classification efficiency comparative study was also performed.

The rest of the paper is structured as follows. The Sect. 2 is dedicated to the process of the EEG data analysis for the purpose of BCI based on the motor imagery paradigm. It covers all stages of the analysis including data preprocessing consisting in signal filtering and preparing, feature extraction related to the ERD/ERS ratio and supervised data classification with LDA algorithm. The Sect. 3 describes details of the BCI used in the study whereas Sect. 4 presents the performed experiment details. Section 5 presents data analysis results. It covers both ANOVA analysis and neural networks classification and analysis. Summering discussion is presented in Sect. 6.

2 Analysis of EEG Data

Analysis of EEG data is a complex process composed of several steps. These steps depend on the purpose of the analysis, but in the case of Brain-Computer Interfaces one can distinguish such steps as signal preprocessing, features extraction and classification leading to obtaining a control signal.

2.1 Data Preprocessing

Preprocessing is a necessary stage of EEG data analysis. It covers such stages as artifact elimination, frequency filtration and spatial filtration. All preprocessing steps are performed to raise the signal-to-noise ratio and strengthen the EEG signal which has relatively low amplitude.

A serious problem limiting the quality of the EEG signals are artifacts, which are unwanted signals of non-cerebral origin. Artifacts in the signal can be misleading. During the EEG signal recording one can distinguish several types of artifacts. Depending on their origin, they can be divided into two groups: technical artifacts related to the registration signal and biological artifacts originating from the person examined. They all can cause different shape artefacts.

Detection and correction of artefacts is carried out under the preliminary signal processing. Digital EEG measurement allows for frequency filtering and appropriate selection of the EEG assembly, which makes it easier to interpret low quality signal. However, the total elimination of artefacts is not possible.

Among the most commonly used for artifacts eliminating methods one can find Principal Component Analysis (PCA) [3, 11] and Independent Component Analysis (ICA) [7], which are used primarily for solving the problem of muscle artifacts. The PCA method decomposes the signal into uncorrelated components [12]. However, for separarion of similar amplitude artifacts, the ICA method is applied. It decomposes the signal into mutually independent components. However, applying the ICA might cause loss of part of the EEG signal [8], especially if removed artefacts are similar to those of the EEG signal [2].

2.2 Feature Extraction

Feature extraction is dedicated to extracting certain characteristics of the EEG signal [10]. Feature extraction in BCIs based on the Motor Imagery Paradigm rests on the calculation of the ERD/ERS value [21]. Calculation of ERD/ERS in the time domain for a given frequency band.

2.3 Classification

Linear Discriminant Analysis (LDA) is the basic classifier applied to the tested BCI. It implements so called allocation of feature space [15]. LDA is a method applied to both feature reduction and classification [1]. The LDA method is based on searching of new coordinates that will be used to project and explain the data. The idea is to distinguish class membership. The new coordinates should be defined to maximise the between-class scatter and minimise the within-class scatter. In the LDA method new components may not be orthogonal.

In the classification task associated with the division of the feature space, it is assumed that each category is represented in the feature space by a certain limited set of standard features (characteristics) [28]. Another strategy is to identify the separating surface. Usually, such surfaces are N-dimensional hyperplanes, where N is the number of features used. For the purposes of classification, in addition to determining the best direction of projection a to maximise the distance between the projected averages for classes (regarding component variances), class separating hyperplanes need to be indicated.

3 BCI Construction

The brain-computer interface applied in the study was based on the motor imagery (MI) paradigm. This paradigm is based on the so called pre-motor potential or readiness potential which might be detected for about a second before the body movement [14]. This potential, however, is weak and multiple averaging of the set of EEG movement signals is needed to see it.

Sensorimotor rhythms applied in the MI-based BCI are \(\mu \) (8–12 Hz) and \(\beta \) (18–26 Hz) EEG rhythm. The maximum amplitude value of these rhythms appear in the sensorimotor cortex at the rest stage. Research shows [7] that a person does not need to perform a move, its imagery is enough.

During the study event-related EEG responses were gathered. Event-related synchronisation (ERS) and event-related desynchronisation (ERD) are analyzed in the form of the ERD/ERS ratio. Changes in this ratio result from changes in the activity of a neuron population and are characterised by a short-term change of power in certain EEG frequency bands. Changes of ERD and ERS may occur simultaneously in different areas of the cortex and might be analysed as a function of both time and frequency.

Due to a very good time resolution of electroencephalography one can observe changes occurring in the brain at different stages of the body movement: preparation to move, execution of movement and return to a resting state.

Due to the fact that single signals are too weak to detect significant changes frequently used multiple repeats are needed for averaging the results and to improve the classification [13].

Construction of the BCI applied in the study was based on the motor imagery of the left and right hand. The BCI was designed in OpenVibe environment connected with a 21 channel EEG amplifier - Mitsar EEG 201.

The signal was gathered from ten electrodes: C3, C4, FC3, FC4, C5, C1, C2, C6, CP3, CP4 placed in a special EEG cap to keep them in the right position. In addition, the ground electrode was placed in the centre of the frontal lobe and two reference electrodes (A1, A2) were placed on ears.

The samples were recorded with frequency of 360 Hz and processed in real time. The signal was gathered from the device Mitsar 201 using electrodes attached to the cap located on the head. The EEG amplifier transmitted data to a computer. The BCI scenario was prepared and realised in the OpenVibe application. Implementation of the experiment was based on four scenarios:

  1. 1.

    Online test dedicated to check the quality of the signal. For a good quality signal is one which low impedances and visible changes during blinking and clamping teeth.

  2. 2.

    Online calibration allowing to adapt the parameters of the BCI interface to the particular user. The user was asked to imagine left and right hand movements in random order imposed by the scenario.

  3. 3.

    Offline training where the applied classifier was learned. The signal was filtered with a Butterworth Band pass filter to select only alfa and beta bounds (frequency range of 8–24 Hz). Surface small Laplacian filter was also calculated to reduce the number of dimensions from ten to two, representing the left and right hemisphere. Next, the signal was epoched regarding to stimulation (4 seconds of epoch duration) and time (1 second of epoch duration). Next, the ERD/ERS ratio was calculated and the LDA classifier was trained. K-fold cross validation was applied to check the training performance.

  4. 4.

    Online testing processing of EEG signals in real-time. The signal was filtered, epoched and averaged and processed by the classifier learned in the training. The results are displayed in the form of the distance to the separation plane. One class is represented with a negative value for one class whereas the second one with a positive value.

4 The Experiment

The experiment was tested on five users of different sex, age, and handedness in age of 22–40 years. Each person was tested several times. Jointly 36 single studies were performed.

The aim of the BCI scenario was to move the stripe to the left or right side of the screen using motor imagery. The desired side is presented to a user in the form of an arrow. The scenario is composed of repetitions of a series: arrow and moving stripe. There are twenty repetitions of left and twenty of right hand movements. The EEG signals registered during the observation and imagination are presented at the computer screen, the arrows indicating the directions of the left and right movements. Raw EEG signal was gathered from ten electrodes distributed symmetrically in both hemispheres, representing images of the activity of the respective brain hemispheres. The signal was reduced to two channels with Laplacian Filter. Resulted signals were subjected to statistical analysis including neural networks based classification. Average and variability of data as well as results of ANOVA were also compared.

Two filtered signals were divided into groups corresponding to the motor imagery obtained on the basis of signs presented on the computer screen during the simulation. The results were divided into two basic categories related to study stages: left arrow (L) and right arrow (R), which were displayed to inform the user of the desired direction of the imagined move. There was also an additional category: black screen (B) displayed before the stimulus, defined as a rest time, no arousal state. Comparison of the results was performed separately for each test. Each person was calibrated individually, so the analysis also was processed separately. The comparison covered representative average values (average and median) and variability measures of three groups of the filtered signal.

5 Results

The result section is divided into two parts: ANOVA analysis and Neural Network based classification.

5.1 ANOVA Analysis of Representative Signals

The signal analysed was the EEG Surface Laplacian for left and right side of the brain. Figure 1 illustrates an exemplary distribution (study test no. 101) of the filtered signal values recorded during the left-hand imagery preceded by displaying the left arrow (group L). Signal values were subjected to analysis of variance (ANOVA).

Fig. 1.
figure 1

Example of a histogram of filtered signal 1in group L during examination no 101

The analysis of variance was performed due to the fact that the histogram indicated a normal distribution. The ANOVA analysis showed a statistical significance (\(p value <0.05\)) of differences between the filtered signals for groups L, R and B in all 36 studies. Only in four tests (of the same person) p value achieved the appropriate level of intergroup differences for only one of the two representative signals.

The results of the ANOVA analysis was verified on the basis of box-plot diagrams presenting the localisation of the mean values. Figure 2 presents the position of the mean value of the filtered signals 0 and 1 for the groups L, R and B (Left arrow, Right arrow, and Black screen representing relaxation). The hatched field define the interval mean standard error, whereas the whiskers represent intervals: \(mean \pm 1.96 * standard error\).

Moreover, signals from particular hemispheres were compared. Figure 3 presents a map of the hemisphere activities.

Fig. 2.
figure 2

Box-plot obtained for examplary study results

Fig. 3.
figure 3

Example of hemisphere activities: the two images represent the activity of the brain hemispheres. The colour of pixels corresponds to the values of signals from the electrodes

Analysis of the box-plot example presented in Fig. 5 shows that intervals determined by the mean value ± standard error of the mean are separable. A similar situation was observed in the vast majority of the tests. However, the position of the group means with regard to the other groups were changed. It is exemplified in Fig. 4, where interactions are presented. Figure 4 presents exemplary interaction of the mean values and confidence intervals calculated for representative filtered signals.

Fig. 4.
figure 4

Interaction of the mean values and confidence intervals for two examples of study tests

5.2 Construction of Neural Networks. Neural Network Based Classification and Analysis

The Neural Network-based analysis was dedicated to the assessment of the ability to recognise the type of brain arousal (motor imagery or rest) during the study. For this purpose, neural networks were designed, separately for each test. The network was designed to classify data in the form of two feature vectors obtained after preprocessing and filtering of the EEG signal. The role of classification was to separate three groups: L (left), R (right) and B (rest). A random sample was divided into: \((70\,\%)\) of the training set, \((15\,\%)\) of the test set and \((15\,\%)\) a set of validation.

Neural Network construction and analysis was performed in Statistica software. The network entrance was two filtered signals representing the activation of the left and right brain hemispheres. As the network output, three neurons corresponding to the three groups L, R and B were applied. In the study both radial networks (RBF) and linear networks (MLP) were tested. In the case of MLP networks, network testing was performed with the number of neurons in the hidden layer in the range of 3 to 9, whereas for radial networks in the range of 21 to 30. To evaluate the network performance (as the error function) the sum of squared errors and cross entropy the was applied. The sum of squared errors was applied to the thirteen networks whereas cross entropy was applied to twenty three networks. Due to the application of cross-entropy as the function of the error, network exits showed direct probability of belonging to the classes. This improved the accuracy of the classification. The most commonly used functions dedicated to hidden neurons’ activations were: logistics functions (applied fourteen times) and hyperbolic tangent (Tanh, 1 applied eleven times). In contrast, the most common function of three output neurons activation was gradient-log-normaliser of the categorical probability distribution (Softmax). In the group of networks representing the best input signal classification performance the most frequently applied network architectures were MLP 2-9-3 (9-fold) and MLP 2-7-3 (9-fold) having respectively nine and seven neurons in the hidden layers. In the originally constructed collection of 720 network (36 studies x 20 networks), where for each study the best 20 neural networks were retained, the most commonly used were the architectures with the following number of neurons in the hidden layer: 7 (65), 4 (63), and 9 (61).

Fig. 5.
figure 5

Pareto analysis of the architecture of 720 neural networks (36 studies x the best 20 networks) distinguished during the assessment of the filtered signals classification according to the directions of motor imagery

Table 1 and Fig. 5 present the statistics and distributions of testing and validation results of the best neural network obtained for thirty six motor imagery EEG studies of left-right arrow simulations. The mean values of the quality of learning, testing and validation of networks were in the range of 67.42 to \(70.73\,\%\) of correct classification.

The modes (the highest bars) and average values (with values marked with maxima of normal distributions) were presented in Fig. 6 the average value of the validation of the network reaching \(68.83\,\%\).

Table 1. Descriptive statistics of the best neural network designed for individual EEG studies of left-right arrow simulations. The number of networks: 36.
Fig. 6.
figure 6

Neural networks performance of training (blue), testing (red) and validation (green) (Color figure online)

6 Summering Discussion

The paper presents analysis results of the data obtained in the study of applying the brain-computer interface based on the motor imagery paradigm. In the study, brain activity was gathered in the form of EEG data. The experiment was dedicated to left and right hand movement imagery. The series of imagery tasks were preceded with the presentation of an arrow indicating the desired direction. In the study five persons of different sex, age, and handedness were tested. As a result of the study, 36 records were gathered and subjected to individual processing and analysis. Brain activity maps of the left and right hemispheres were generated on the basis of the signal recorded from ten electrodes. These signals were preprocessed: filtering, artifact removal and ERS/ERD ratio was calculated. Spatial filtering was also applied to reduce the data dimensionality to feature vectors. During the study the LDA classifier was performed. After the study postprocessing analysis was done. The filtered signals were divided into three groups corresponding to information displayed to users on the screen during the experiments. ANOVA analysis and automatic construction of a neural network classification were also performed.

The ANOVA analysis was calculated for filtered EEG signals divided into groups (L, R and B) according to user activity (Left imagery, Right imagery, Rest). The analysis allows to conclude that the applied measurement might be used to distinguish different signals generated by the human brain, indicating the direction of movement imagery. In addition, the differences in the EEG activity of the right and left hemispheres during different activities (left hand motor imagery, right hand motor imagery, resting) were confirmed. These results were confirmed by the neural network efficiency analysis. Neural networks were applied in the task of classification of left and right motor imagery in EEG data. The efficiency of neural networks classification of left and right hemisphere activities reached almost \(70\,\%\).

The present research is a stage in the construction process of a robot system controlled by processed EEG data. The results obtained do not as yet ensure adequate repeatability of the driving mechanism. However they justify further tests and improvements. Future works could also cover integrating EEG with additional techniques, such as fMRI and eye-tracking to increase the accuracy of the results and confirm their reliability.