Common Spatial Patterns Feature Extraction and Support Vector Machine Classification for Motor Imagery with the SecondBrain

Document Type : Original Article


1 Department of Computer Engineering, Babol Noshirvani University of Technology, Babol, Iran

2 Department of Physics, Babol Noshirvani University of Technology, Babol, Iran


Recently, a large set of electroencephalography (EEG) data is being generated by several high-quality labs worldwide and is free to be used by all researchers in the world. On the other hand, many neuroscience researchers need these data to study different neural disorders for better diagnosis and evaluating the treatment. However, some format adaptation and pre-processing are necessary before using these available data. In this paper, we introduce the SecondBrain as a new lightweight and simplified module that can easily apply various major analysis on EEG data with common data formats. The characteristics of the SecondBrain shows that it is suitable for everyday usage with medium analyzing power. It is easy to learn and accept many data formats. The SecondBrain module has been developed with Python and has the power to windowing data, whitening transform, independent component analysis (ICA), downloading the public datasets, computing common spatial patterns (CSP) and other useful analysis. The SecondBrain, also, employs a common spatial pattern (CSP) to extract features and classifying the EEG MI-based data through support vector machine (SVM). We achieved a satisfactory result in terms of speed and performance.


1. Issa, T., Kommers, P., Issa, T., Isaias, P. and Issa, T.B., "Smart
technology applications in business environments, IGI Global, 
2. Yong, X., Ward, R.K. and Birch, G.E., "Robust common spatial
patterns for eeg signal preprocessing", in 2008 30th Annual
International Conference of the IEEE Engineering in Medicine
and Biology Society, IEEE. Vol., No. Issue, (2008), 2087-2090. 
3. Koles, Z.J., Lazar, M.S. and Zhou, S.Z., "Spatial patterns
underlying population differences in the background eeg", Brain
Topography,  Vol. 2, No. 4, (1990), 275-284. 
4. Ramoser, H., Muller-Gerking, J. and Pfurtscheller, G., "Optimal
spatial filtering of single trial eeg during imagined hand
movement", IEEE Transactions on Rehabilitation Engineering, 
Vol. 8, No. 4, (2000), 441-446. 
5. Popescu, F., Fazli, S., Badower, Y., Blankertz, B. and Müller, K.R.,
"Single trial classification of motor imagination using 6 dry
eeg electrodes", PloS one,  Vol. 2, No. 7, (2007), e637. 
6. Cortes, C. and Vapnik, V., "Support-vector networks", Machine
Learning,  Vol. 20, No. 3, (1995), 273-297. 
7. Lemm, S., Blankertz, B., Curio, G. and Muller, K.-R., "Spatiospectral
filters for improving the classification of single trial eeg", IEEE Transactions on Biomedical Engineering, Vol. 52, No.9, (2005), 1541-1548.
8. Miner, L., Bolding, P., Hilbe, J., Goldstein, M., Hill, T., Nisbet,
R., Walton, N. and Miner, G., "Practical predictive analytics and
decisioning systems for medicine: Informatics accuracy and costeffectiveness
for healthcare administration and delivery including medical research, Academic
9. Vert, J.-P., Tsuda, K. and Schölkopf, B., "Kernel methods in
computational biology", MIT Press, (2004). 
10. Xu, G., Zong, Y. and Yang, Z., "Applied data mining, CRC Press, 
11. Ben-Hur, A. and Weston, J., A user’s guide to support vector
machines, in Data mining techniques for the life sciences. 2010,