An Online Synchronous Brain Wave Signal Pattern Classifier with Parallel Processing Optimization for Embedded System Implementation

Commercial Brain Computer Interface applications are currently expanding due to the success of widespread dissemination of low cost devices. Reducing the cost of a traditional system requires appropriate resources, such as proper software tools for signal processing and characterization. In this paper, a methodology for classifying a set of attention and meditation brain wave signal patterns is presented by means of unsupervised signal feature clustering with batch Self-Organizing Maps (bSOM) and supervised classification by Support Vector Machine (SVM). Previous research on this matter did not combine both methods and also required an important amount of computation time. With the use of a small square neuron grid by b-SOM and an RBF kernel SVM, a well delimited classifier was obtained. The recognition rate was 70% after parameter tuning. In terms of optimization, the parallel b-SOM algorithm reduced drastically the computation time, allowing online clustering and classification for full length input data. Keywords—Brain Computer Interface; batch SOM; SVM; Parallel-processing I. COMMERCIAL BRAIN COMPUTER INTERFACE: TREND AND VISION Brain Computer Interface (BCI) is a technology that introduces for the first time the direct interaction between a person and his or her brain activity. Currently, the use of commercial BCI devices has become a trend in different research fields, like Human Augmentation, IoT, Neuroscience and Machine Learning. The success of widespread dissemination of commercial BCI devices depends on reducing the barriers to acquire and using these systems. These requirements entails several challenges that relate mainly to cost and ease of use[1]. There have been great achievements in reliable Electroencephalogram (EEG) signal acquisition with the use of newer commercial grade biosignal amplifiers that are almost equal to medical grade BCI equipment[2]. By 2025, a wide array of applications will use brain signals as an important source of information. People will be supported in choosing the best time for making difficult and important decisions. People working in safety-relevant fields will be capable of anticipating fatigue, and authorities may find good (evidencebased) reasons to incorporate such applications in regulations. Game, health, education, and lifestyle companies will link brain and other biosignals with useful applications in a broad community[3]. Although there are different methods for brain wave signal extraction, EEG provides and easier way to adjust for everyday usage. It has both low spatial and time resolution for a non-invasive brain wave signal acquisition technique. A. User-centered BCI Applications An important aspect for any BCI-controlled application is whether a potential user of the device can imagine indeed using the application in daily life. Research indicates that UserCentered Design theoretical framework provides a guide on transferring BCI-controlled applications from the laboratory to end-user’s home [4]. In order to generate an efficient application, effectiveness, efficiency and satisfaction play a key role. Research shows that BCI is evaluated in terms of speed and accuracy measurements as main components [5]. However, it has been concluded that in the near future, the BCI community will be able to provide indication criteria for individual users and the type of BCI to use. For this case research, in order to generate a specific series of signals and generate satisfactory user experience, a particular virtual environment was elaborated as detailed later. B. Brain Wave Biometrics Brain wave authentication is another addition to the wide range of authentication systems, but with a brand new concept. The electrical activity in a human brain is used to confirm the identity. Instead of physically writing a password, one can simply think about it. The password or ”pass-thought” can be anything that a human mind may think about, like a color. a feeling, an image, text or something else. The benefits over other systems are many. With a standard password, someone can watch of ”shoulder-surf” what others type, but no one can watch thoughts. Cards and keys can be lost, but the brain is always present. Handicaps can exclude people from systems like fingerprint or retina scanners, but the brain still works [6]. There has been related work in this area. For instance, the implementation of Brain-Mobile Phone Interfaces [7][8] and other ways of using this biometric are being investigated [9][10] for multiple channel EEG based BCIs. It is important to note the use of commercial grade BCI devices for related research. In the case of single electrode commercial BCI tools, www.ijacsa.thesai.org 412 | P a g e (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 8, No. 1, 2017 the generation of a specific synchronous patterns became object of study of this research, and the way to obtain and classify a specific signal with defined characteristics is presented.

An important aspect for any BCI-controlled application is whether a potential user of the device can imagine indeed using the application in daily life.Research indicates that User-Centered Design theoretical framework provides a guide on transferring BCI-controlled applications from the laboratory to end-user's home [4].In order to generate an efficient application, effectiveness, efficiency and satisfaction play a key role.Research shows that BCI is evaluated in terms of speed and accuracy measurements as main components [5].However, it has been concluded that in the near future, the BCI community will be able to provide indication criteria for individual users and the type of BCI to use.For this case research, in order to generate a specific series of signals and generate satisfactory user experience, a particular virtual environment was elaborated as detailed later.

B. Brain Wave Biometrics
Brain wave authentication is another addition to the wide range of authentication systems, but with a brand new concept.The electrical activity in a human brain is used to confirm the identity.Instead of physically writing a password, one can simply think about it.The password or "pass-thought" can be anything that a human mind may think about, like a color.a feeling, an image, text or something else.The benefits over other systems are many.With a standard password, someone can watch of "shoulder-surf" what others type, but no one can watch thoughts.Cards and keys can be lost, but the brain is always present.Handicaps can exclude people from systems like fingerprint or retina scanners, but the brain still works [6].There has been related work in this area.For instance, the implementation of Brain-Mobile Phone Interfaces [7] [8] and other ways of using this biometric are being investigated [9] [10] for multiple channel EEG based BCIs.It is important to note the use of commercial grade BCI devices for related research.In the case of single electrode commercial BCI tools, the generation of a specific synchronous patterns became object of study of this research, and the way to obtain and classify a specific signal with defined characteristics is presented.

C. BCI Portability
Although BCI applications utilize low cost commercial devices for local implementation, to our knowledge, there are not many implementation of local BCI signal interpretation processing units in an embedded form; most developments rely on the use of high processing computers as end device.Albeit some devices provide portability to the brain wave reading headset in forms presented as in [11] [12][13] [14], the use of custom devices is still required.Moreover, most of the hardware attends the brain wave signal processing part without presenting a way to display different forms of neurofeedback (e.g.spellers or games.One of the end goals of this research is to provide a set of classifiers that can be implemented on very low time computational performance in order to be implemented on high end commercial embedded hardware with portability capabilities (e.g.processors that are used in tablets, with high definition video processing qualifications) that could be useful for different available low cost EEG-based commercial based BCI tools.Therefore, a way to process and determine a set of post-processed synchronous signals consisting of attention and meditation data from a single channel electrode tool like the well known Neurosky Mindwave (http://neurosky.com) is presented as well as classification and analysis through unsupervised and supervised methodologies.In order to have almost real time response after trial, optimization with parallel processing software tools was implemented and compared with a high processing embedded processing device with parallel processing capabilities.

II. SYNCHRONOUS BCI SIGNAL PROCESSING
Real-time analysis of brain signals involves different challenges including noise removal and subject adaptability.State-of-the-art BCI systems use adaptive signal processing and machine learning algorithms to extract meaningful information from brain signals.The feature extraction methods regarding EEG data analysis can be separated into two main groups: temporal domain features and frequency domain features.As for single channel time domain features, the use of synchronicity features is advised [15].The synchronous BCI case is the most widely spread.Three kinds of classification algorithms have proved to be particularly efficient in the context, such as Support Vector Machines (SVM), dynamic classifiers and combinations of classifiers.Combining classifiers outperform single classifier implementations [16].

A. Choosing the Correct SVM Classifier as a Supervised Learning Classification Method
In order to rely on a correct classification algorithm, and due to the rapidly growing interest for EEG-based BCI, a considerable amount of published results is related to the investigation and evaluation of classification algorithms.SVMs are very unstable to outlier noise, and previous research [17] that although classification results might seem correct for a trained classifier for the test inputs, the separation is not well The kernel generally used in BCI research is the Gaussian or Radial Basis Function (RBF) kernel (Equation 1): The corresponding SVM is known as Gaussian SVM or RBF SVM [16].RBF SVM has given very good results for BCI applications.SVM have a few parameters that need to be defined by hand, namely, the regularization parameter C and the RBF width γ for the RBF case.The advantages of the margin maximization and regularization are provided at the expense of a low speed of execution.B. Batch Self-Organizing Maps as an Unsupervised Learning Clustering Tool The Self-Organizing Map (SOM) (Figure 2) is a type of artificial neural network that constructs a nonlinear topology preserving mapping of the input data set X = (x(t)|t ∈ (t 0 , • • • , t f ) where t 0 and t f are the beginning and the end of the current training session, onto a set of neurons M = µ 1 , • • • , µ n of a neural network.The neurons of the network are arranged in a grid, with associated vectors [20]: at a given time step t.W is known as the code book.Each data point x(t) is mapped to its best matching unit bm From the previous description, d is the distance function on the data set in the feature space.This can be redefined as Equation 4 The neurons re arranged on a two dimensional map (Figure 2): each neuron i has a two coordinates in a grid.Next, the weight vector of the best match neuron (BMN) and its neighbors are adjusted toward the input pattern using Equation 5: where 0 < α < 1 is the learning factor, and h bj (t) is the neighborhood function that decreases for neurons further away from the best match neuron in grid coordinates.A frequently used neighborhood function is the Gaussian (Equation 6): where r b and r j stand for the coordinates of the respective nodes.The width δ(t) decreases from iteration to narrow the area of influence.Eventually, the neighborhood function decreases to an extent that training might stop.
The time needed to train a SOM grows linearly with the dataset size, and it grows linearly with the number of neurons in the SOM.SOM has a batch formulation of updating the weights (b-SOM), which is widely used in parallel implementations(Equation 7) [20]: While not directly related to the training, it is worth mentioning the U-matrix associated with a SOM, which depicts the average Euclidean distance between the code book vectors of neighboring neurons.Let N (j) denote the immediate neighbors of a node j.Then the height value of the U-matrix for a node j is calculated as The purpose of the U-matrix is to provide a visual representation of the topology of the network [20].A well defined grid can perform well for 2D multidimensional data representation.SOM can also be interpreted as a non-linear Independent Component Analysis method and provides useful clustering at expense of processing time.Moreover, the neighborhood function resembles that of the RBF kernel characterization.On previous research [21], a well defined cluster could be generated by the normal SOM implementation, however, the computational cost of reduced dimension data still represented a challenge for online implementation (Figure 3).

C. SOM Parallelism
Currently available, there are software tools like SOM on Cluster (Somoclu) [20] that can help to provide a parallel implementation of the SOM algorithm by batch processing, allowing speed performance and reduction of execution time.Moreover, the use of this code library implements the main CPU speed perfomance by utilizing OpenMPI based parallelization or even utilize GPU resources on capable devices by the use of a sparse kernel CUDA operation with Thrust high primitives.Another important advantage of this tool is that it allows easy integration with other interfaces such as Python, R or even Matlab.This options presents a suitable form of online unsupervised classification on GPU capable devices, especially on novel embedded systems with such characteristics [20].

III. BCI SIGNAL ACQUISITION AND CLASSIFICATION
For this research, previously obtained signals from BCI interaction were used with this new classification method.The system configuration and methodology description is presented below.The BCI system configuration depicted by Figure 4 represents the implementation that was realized in order to obtain a set of predefined EEG-based Attention (A) and Meditation (B) signals.The virtual environment from Figure 5 was used before for obtaining the required signal patterns, which were found to be generated successfully by EEG-based BCI tool device trained users [22].The proposed training environment [17] was designed in order to allow ease of use and deployment.It has a series of features such as music and interaction with the environment (e.g.trees, items).If the character moves successfully through the path for 180 seconds, a series of correct Attention/Meditation waves is generated, and the attempt is classified as succes (+1).In the case that the patterns were not generated correctly, a fail attempt is noted (-1).The trained user can then attempt to generate a similar pattern, and the characteristics of the signal should be classified by clustering and classification.30 samples (attempts) were acquired from a single trained used interaction.The Attention and Meditations vectors are defined as a series of power signal values ranging from 0 to 100 depending on power band calculation from preprocessed raw EEG signal.The Neurosky headset used for this experiment provides 1Hz sampling rate as eSense feature values.Therefore, the length of each Attention and Meditation sample is 180.A matrix representation for the set of vectors A and B can be defined as:

B. Feature Extraction
From previous classification attempts [17], a combination of the summation, extraction, dot product or component division for matrices A and B were tested (e.g.A+B, A•B), however, the empirical feature vector X provided the best separation for the experiment.The expression for this vector is shown in Equation 9: where: Therefore:

C. Clustering with parallel b-SOM
The implementation of parallel b-SOM with OpenMPI [20] allows the large dimension array data to be clustered with relative ease and without the need of reducing the dimension of the large size obtained samples.A series of maps were implemented and observed for different features as performed on previous research [17], varying from square to rectangular grids with different cell implementations.Some of the mapped nets and fired Best Matching Units (BMU) are presented on Figure 6.From this comparison, it can be determined that the one that provides a better clustering is feature matrix X, the data is better spread and the vectors associated with successful trials tend to be placed in the grid's center zone.Rectangular grid implementations did not provide good cluster separations.

D. The Embedded Hardware Selection
For a proper embedded system selection, a device capable of displaying high resolution graphics was selected due to the fact that the end device must be capable of having virtual reality interaction and operation by having online, almost real time classification and signal recognition from different commercial BCI tools.The use of a GPU-based device suggests powerful threading capabilities to perform various processing tasks while executing extensive calculations in the background.The selection of a powerful GPU based System on Chip (SoC) led to the use of a development board called NVIDIA Jetson TK1 which is featuring a NVIDIA 4-Plus-1 2.32GHz ARM quad-core Cortex-A15 CPU with Cortex-A15 battery-saving shadow-core CPU and an NVIDIA Kepler GK20a GPU with 192 SM3.2 CUDA cores (up to 326 GFLOPS) [23].The board and Kepler Architecture diagram is presented in Figure 7.This research tested the OpenMPI implementation of the b-SOM algorithm.From the different generated maps, one of the best clusters was defined and selected for the training of an SVM classifier is a 20x20 b-SOM grid of feature matrix X and the BMU x and y coordinates (BMU-X and BMU-Y, respectively).The use of an RBF SVM Classifier is advised in order to obtain good classification results as stated on previous sections.After generating the classifier, it can be observed that the modification of parameter γ greatly affects the classifier (Figure 8).It has been found that for 0.10 ≤ γ ≤ 0.22 the classifier robustness due to the division between the +1 and -1 attempt features (Figure 9).The "random" Cross-Validation of the previous set of classifiers was done with ten artificial signals from the random combination of +1 and -1 training vectors that were different from the originals.(e.g. a +1 X vector consisting from random +1 A and B trial selection) The generated test sample was entered as an update of the last b-SOM BMU vector update and the resulting BMU coordinates were then adjusted and tested with the RBF-SVM generated classifier.By additional tuning of the SVM C parameter, the margins could be modified to improve classification.The resulting test vector recognition rates for different C values are presented in Table II.The best RBF-SVM classifier is presented on Figure 10.Note that there are two outliers, that even after removal do not alter the result.

B. Execution Time Performance
In order to reduce execution time, the parallel b-SOM algorithm was run with OpenMPI support.Five execution times for each grid were measured and averaged for the full classifier generation was measured.For implementing this classification method on an embedded system, the time performance should also be low.Table III and Figure 11 show the average time performance (in seconds) results for the tests with an Intel Core i7-2.30GHz(12MB RAM) computer and the proposed hardware.The plotting time (in case it is required) was also taken into account.[25] considered the use as of a set of features with classification.After obtaining all this features, LDA or Linear SVM is used to classify the obtained signals for multiple classes.In order to obtain all this features, a big system is always considered.The use of unsupervised feature learning with RBF-SVM classification for Emotion identification has also been studied [26].For the single electrode case, relevant work has been done with supervised learning feature extraction (ANN)and linear discriminant analysis LDA for stress signal wave generation with the use of MATLAB [27] from single electrode raw EEG signal extraction.Other works make use of the similarity components of signals generated by pass-thoughts in order to classify certain conditions than can also be used for authentication purposes [28].Other low cost targeted bio-sensing methods for electrocardiograms with small embedded systems are using Linear SVM Classification after proper signal processing [29].

B. Classification Results
From previous classification attempts on previous work [17] [21] [22], the clustering by this implementation provided the best classifier generation, which also certifies that the classification is robust.Also, it is noted that in some way, the empirical feature vector X contains properties that were suitable for non-linear clustering.In the case of an expected signal pattern, a synchronous signal can be characterized and recognized by static classifiers such as SVM.For this research case, polynomial kernel training could also be considered, but when attempted to generate the classification, the execution times were greater than for the RBF-SVM kernels.Although it can be considered, the a better RBF-SVM classifier could be found without sacrificing time performance.In terms of execution times, it is possible to have almost real time (human perception) recognition of the generated patterns after single trials.However, a less computational cost methodology must be implemented for the embedded hardware approach.Nonetheless, the response times are short for the small grid cases, considering the exponential time increase of the proposed method.The limitations of this method are reduced to the use of a specific set of signal patterns and a especial feature vector that the one stated in these results.A new specific cluster must be found for a different brain wave pattern through a combination of signal feature arrangements.

VI. CONCLUSIONS
The use of the unsupervised clustering by batch SOM provides a good mapping in comparison to previous research.Moreover, the parallel-implementation allowed the use of full data in a very short time.The use of the current number of samples provided a good mapping and classification via the RBF-SVM.The parameter characterization allowed a 70% classification time for the suggested features.However, other mappings could also provide different classification results, but in terms of processing/efficiency, the 20x20 regular grid allows a good recognition at the cost of low computing needs with a conventional computer.Although time performance is good for the computer case, the OpenMPI option is still a little bit high for the selected Embedded system.The combination of unsupervised clustering and RBF-SVM Classification as suggested by literature provided the best grouping in comparison to previous research.

VII. FURTHER WORK
The GPU Capabilities of the proposed embedded hardware device allows the implementation of the b-SOM and SVM algorithms to have CUDA support.Further work includes the use and comparison of the CUDA supported versions of both implementations in order to reduce overall execution time of the proposed technique on the hardware board.

Fig. 1 .
Fig. 1.The wrong kernel might provide false classification results

Fig. 3 .
Fig. 3.A normal SOM unsupervised cluster generation for sample signals at different number of iterations The use of the batch implementation can allow the reduction of the execution time for this research purpose and sometimes even provides better performance than the original SOM algorithm.This research focuses on taking advantages of SOM parallelism for BCI signal feature clustering and recognition.

TABLE III
Brain Wave (EEG) based Authentication with low cost devices have been analysed by different works.For instance, multiple electrode low cost systems as in Fig. 11.Time Performance vs. b-SOM Grid Size Plot