A Sliding Window Common Spatial Pattern for Enhancing Motor Imagery Classification in EEG-BCI
In this study, two sliding window techniques are proposed to enhance the binary classification of MI.
A Sliding Window Common Spatial Pattern for Enhancing Motor Imagery Classification in EEG-BCI
This Wiki article is based on the paper "A Sliding Window Common Spatial Pattern for Enhancing Motor Imagery Classification in EEG-BCI" [1] of Pramod Gaur, Harsh Gupta, Anirban Chowdhury, Karl McCreadie, Ram Bilas Pachori and Hui Wang.
Challenges exist in accurately classifying electroencephalography (EEG) signals for the development of motor imagery BCI systems, particularly due to the nonstationary nature of EEG data. Two sliding window techniques, SW-LCR and SW-Mode, are proposed in this study as solutions to improve the classification by finding the most generalizable features.
Methodology
The presented methods are applied to a publicly available BCI Competition IV-2a data set of healthy individuals[2] and to a stroke patients’ data set[3].
| The data is split into nine overlapping time windows of 2 seconds, with a difference of 0.1 s between each successive sliding window, as shown in Fig. 1. | Fig. 1: Sliding time windows |
Then Common spatial pattern (CSP) is used for extracting features with linear discriminant analysis (LDA) used for classification of each time window.
These estimated class labels of each window are then used by the two sliding window methods to decode MI tasks performed by the participants. This independence from a specific time point gives the generalized feature extraction techniques, such as CSP, an advantage, enhancing their performance. An overview of the proposed methodology using SW-LCR can be seen in Fig. 2.

Fig. 2: Block diagram for the proposed method [1:2].
The sliding window approach in single-trial prediction has the advantage of increasing classification accuracy regardless of the feature extraction or classification algorithm used.
This is because the method looks for the features at different time segments within the trial rather than focusing on a single time point, which may vary from trial to trial and session to session. This approach captures the idea that changes in mental state occur gradually throughout the entire trial and not instantaneously.
However, there is a disadvantage, as the sliding window technique can introduce latency in real-time BCI feedback.
Comparison
Healthy individuals Data Set
We compare the classification accuracy obtained on BCI Competition IV data set 2a by applying the proposed SW-LCR and SW-Mode methods to other methods applied to the same data set.
| The LCR-based approach achieved superior performance for left- versus right-hand MI classification compared to the previous methods with reduced inter-subject variability in the case of healthy individuals. | . Fig. 3: Comparison of the classification Accuracy (%) for left- versus right-hand MI task on BCI competition IV data set 2A [1:3]. |
Fig.3 also shows that the performance of the SW-LCR is comparable to that of M2, but it is evident that the SW-LCR results in more consistency in performance across all subjects, as the standard deviation is lower compared to M2.
Stroke patients Data Set
For the stroke patient's data set, the comparison to the previous benchmark accuracy [3:1] is shown in Fig. 4. It also contains the classification accuracy using a deep learning-based approach that was applied on the same data set previously [4] using EEGNet[5], a compact convolutional network for EEG-based BCI.
| It is clear that both are outperformed by the proposed methods. The mode-based approach in particular demonstrates great results, which could be due to the fact that it can handle the issue of lack of focus more effectively. | Fig. 4. Comparison of CAs of the proposed methods with previous methods applied on the stroke patients’ data set. |
Conclusion
EEG data are often recorded across sessions as well as across subjects (sometimes from those with brain injuries) and tend to be highly nonstationary with intersubject variability. In this work, two sliding window-based CSP techniques, namely SW-LCR and SW-Mode, were introduced to classify EEG signals into multiple MI tasks. The proposed methods take advantage of examining multiple time segments within a trial rather than depending on a single time point, which is more robust against intertrial and intersession variabilities.
| Overall the performance of the proposed methods has proven to be good for both healthy individuals and stroke patients with an accuracy of around 80% (as seen in Fig.5). Thus, SW-LCR and SW-Mode have the potential to augment the performance of MI-BCI and can set the foundation for reliable neurorehabilitative BCI applications. | Fig. 5. Comparison of CA distributions of the proposed methods between the healthy and stroke patients’ data sets. |
P. Gaur, H. Gupta, A. Chowdhury, K. McCreadie, R. B. Pachori and H. Wang, "A Sliding Window Common Spatial Pattern for Enhancing Motor Imagery Classification in EEG-BCI," in IEEE Transactions on Instrumentation and Measurement, vol. 70, pp. 1-9, 2021, Art no. 4002709, doi: 10.1109/TIM.2021.3051996 ↩︎ ↩︎ ↩︎ ↩︎
C. Brunner, R. Leeb, G. Müller-Putz, A. Schlögl and G. Pfurtscheller, BCI Competition 2008–Graz data set A. Institute for Knowledge Discovery (Laboratory of Brain-Computer Interfaces), Graz University of Technology, vol. 16, pp. 1-6, 2018, link ↩︎
A. Chowdhury, H. Raza, Y. K. Meena, A. Dutta and G. Prasad, "Online Covariate Shift Detection-Based Adaptive Brain–Computer Interface to Trigger Hand Exoskeleton Feedback for Neuro-Rehabilitation," in IEEE Transactions on Cognitive and Developmental Systems, vol. 10, no. 4, pp. 1070-1080, Dec. 2018, doi: 10.1109/TCDS.2017.2787040. ↩︎ ↩︎
H. Raza, A. Chowdhury and S. Bhattacharyya, "Deep Learning based Prediction of EEG Motor Imagery of Stroke Patients’ for Neuro-Rehabilitation Application," in 2020 International Joint Conference on Neural Networks (IJCNN), Glasgow, UK, 2020, pp. 1-8, doi: 10.1109/IJCNN48605.2020.9206884. ↩︎
H. Raza, A. Chowdhury, S. Bhattacharyya, and S. Samothrakis, “Singletrial EEG classification with EEGNet and neural structured learning for improving BCI performance,” in 2020 International Joint Conference on Neural Networks (IJCNN), Jul. 2020, pp. 1–8, doi: 10.1109/IJCNN48605.2020.9207100. ↩︎
Fig. 1: Sliding time windows
. Fig. 3: Comparison of the classification Accuracy (%) for left- versus right-hand MI task on BCI competition IV data set 2A
Fig. 4. Comparison of CAs of the proposed methods with previous methods applied on the stroke patients’ data set.
Fig. 5. Comparison of CA distributions of the proposed methods between the healthy and stroke patients’ data sets.