scieee AI-readable full text Open interactive document viewer

Enhancing ERP-based Brain-Computer Interfaces for Practical Applications: Asynchrony, Deep Learning, and a Novel BCI Platform

SantaMaría Vazquez, Eduardo

Abstract

Escuela de Doctorado

Full text

Doctoral Program of Information and Telecommunication Technologies Doctoral Dissertation Enhancing ERP-based Brain-Computer Interfaces for Practical Applications: Asynchrony, Deep Learning, and a Novel BCI Platform Dissertation presented by D. Eduardo Santamar´ıa-V´azquez in partial fulfillment of the requirements for the Ph.D. Degree at the University of Valladolid Directed by: Dr. Roberto Hornero S´anchez 2023 Valladolid, Spain El cerebro es un mundo que consta de numerosos continentes inexplorados y grandes extensiones de territorios desconocidos. Santiago Ramon y Cajal Defense T´ ıtulo Enhancing ERP-based Brain-Computer Interfaces for Practical Applications: Asynchrony, Deep Learning, and a Novel BCI Platform Autor D. Eduardo Santamar´ıaV´azquez Director Dr. D. Roberto Hornero S´anchez Departamento Teor´ıa de la Se˜nal y Comunicaciones e Ingenier´ıa Telem´atica Tribunal Presidente Vocal Secretario acuerda otorgarle la calificaci´on de En Valladolid, a de del Escuela T´ecnica Superior de Ingenieros de Telecomunicaci´on Dpto. de Teor´ıa de la Se˜nal y Comunicaciones e Ingenier´ıa Telem´atica Research Stay for the International Mention City: Boston (United States of America) Faculty: Harvard Medical School Institution: Spaulding Research Institute Research group: Spaulding Neuromodulation Center Dates: 01/07/2022-10/10/2022 Duration: 3 months and 10 days Supervisor: Dr. Leon Morales-Quezada IV Abstract mand decoding are equally important for assistive systems, proposing novel signal processing methods for both stages. In this regard, the final design of our asynchronous ERP-based BCI, the first that fully relies on deep learning, represents a significant step forward in this context. Additionally, MEDUSA © is a novel software ecosystem that meets the needs of BCI researchers by providing a range of signal processing functions, deep-learning architectures, connectivity analysis tools, and ready-to-use BCI and neuroscience experiments. Thus, it has the potential to accelerate BCI and cognitive neuroscience research. Acronyms ADHD Attention-Deficit/Hyperactivity Disorder BCI Brain–Computer Interface BE Backward Elimination BH Benjamini-Hochberg correction BOLD Blood-Oxygen-Level-Dependent response CAR Common Average Reference CCA Canonical Correlation Analysis CNS Central Nervous System C-VEP Code-Modulated Visual Evoked Potential EEG Electroencephalography ERD Event-Related Desynchronization ERP Event-Related Potential ERS Event-Related Synchronization FDR False Discovery Rate FIR Finite Impulse Response fMRI Functional Magnetic Resonance Imaging fNIRS Functional Near-Infrared Spectroscopy HS Healthy Subjects IIR Infinite Impulse Response ISI Inter-Stimuli Interval JCR Journal Citation Reports LIS Locked-In Syndrome LDA Linear Discriminant Analysis LOO Leave one out MD Motor-Disabled Subjects MEG Magnetoencephalography V VI Acronyms MI Motor Imagery MSE Multiscale Entropy NF Neurofeedback OSRD Oddball Steady State Response Detection PET Positron Emission Tomography PSD Power Spectral Density RCP Row-Col Paradigm RG Riemannian geometry ROC Receiving Operating Characteristic RSVP Rapid Serial Visual Presentation SampEn Sample Entropy SCI Spinal Cord Injury SCP Slow Cortical Potentials SD Stimulus Duration SMR Sensorimotor Rhythms SOA Stimulus Onset Asynchrony SSVEP Steady-State Visual Evoked Potential SVM Support Vector Machine SW Step-Wise regression VEP Visual Evoked Potential Contents Abstract I Acronyms V 1 Introduction 1 1.1 Compendium of publications: thematic consistency . . . . . . . . . 2 1.2 Dissertation Context . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 Brain–computer interfaces . . . . . . . . . . . . . . . . . . . . . . . 9 1.3.1 Recording neural activity . . . . . . . . . . . . . . . . . . . 10 1.3.2 EEG............................... 18 1.3.3 BCI control signals . . . . . . . . . . . . . . . . . . . . . . . 20 1.3.4 EEG processing in BCI . . . . . . . . . . . . . . . . . . . . 22 1.3.5 BCI Applications . . . . . . . . . . . . . . . . . . . . . . . . 24 1.4 Stateoftheart............................. 25 1.4.1 Asynchronous control of ERP-based BCIs . . . . . . . . . . 25 1.4.2 Deep learning in ERP-based BCIs . . . . . . . . . . . . . . 27 1.4.3 BCIplatforms ......................... 29 2 Hypothesis and objectives 33 2.1 Hypothesis ............................... 33 2.2 Objectives................................ 34 3 Subjects and signals 37 3.1 The row-column paradigm . . . . . . . . . . . . . . . . . . . . . . . 37 3.2 Subjects................................. 39 3.3 EEG recording setup . . . . . . . . . . . . . . . . . . . . . . . . . . 41 VII VIII Contents 4 Methods 45 4.1 Pre-processing ............................. 45 4.1.1 Frequency filtering . . . . . . . . . . . . . . . . . . . . . . . 46 4.1.2 Spatial filtering . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.2 Featureextraction ........................... 47 4.2.1 Time-based features . . . . . . . . . . . . . . . . . . . . . . 48 4.2.2 Frequency-based features . . . . . . . . . . . . . . . . . . . 48 4.2.3 Correlation-based features . . . . . . . . . . . . . . . . . . . 49 4.3 Featureselection ............................ 51 4.3.1 Stepwise regression . . . . . . . . . . . . . . . . . . . . . . . 51 4.4 Feature classification . . . . . . . . . . . . . . . . . . . . . . . . . . 52 4.4.1 Linear Discriminant Analysis . . . . . . . . . . . . . . . . . 53 4.4.2 EEG-Inception ......................... 54 4.5 Validation................................ 59 4.5.1 Performance metrics . . . . . . . . . . . . . . . . . . . . . . 59 4.5.2 Statistical analysis . . . . . . . . . . . . . . . . . . . . . . . 60 4.5.3 Cross-validation . . . . . . . . . . . . . . . . . . . . . . . . 61 4.6 BCI platform development . . . . . . . . . . . . . . . . . . . . . . . 62 4.6.1 Components .......................... 62 4.6.2 Design principles . . . . . . . . . . . . . . . . . . . . . . . . 62 4.6.3 Implemented in Python . . . . . . . . . . . . . . . . . . . . 63 4.6.4 Open-source community-oriented philosophy . . . . . . . . 64 5 Results 65 5.1 SSVEPs elicited by the RCP . . . . . . . . . . . . . . . . . . . . . 65 5.2 Oddball Steady Response Detection (OSRD) method . . . . . . . . 67 5.2.1 Offline experiment . . . . . . . . . . . . . . . . . . . . . . . 69 5.2.2 Online experiment . . . . . . . . . . . . . . . . . . . . . . . 70 5.3 Command decoding with EEG-Inception . . . . . . . . . . . . . . . 72 5.3.1 Hyperparameter optimization . . . . . . . . . . . . . . . . . 73 5.3.2 Evaluation experiment . . . . . . . . . . . . . . . . . . . . . 74 5.4 Control state detection with EEG-Inception . . . . . . . . . . . . . 75 5.4.1 Evaluation experiment . . . . . . . . . . . . . . . . . . . . . 78 5.5 MEDUSA © : our novel BCI platform . . . . . . . . . . . . . . . . . 82 5.5.1 MEDUSA © Kernel ...................... 82 5.5.2 MEDUSA © Platform ..................... 84 Contents IX 6 Discussion 91 6.1 SSVEP elicited by non-target stimuli from ERP-based spellers . . 92 6.2 Feature-engineering approach for control state detection: the OSRD method ................................. 94 6.2.1 Evaluation experiment . . . . . . . . . . . . . . . . . . . . . 94 6.2.2 Comparison with previous approaches . . . . . . . . . . . . 95 6.3 Deep-learning approach for command decoding: EEG-Inception . . 98 6.3.1 Architecture design . . . . . . . . . . . . . . . . . . . . . . . 98 6.3.2 Evaluation experiment . . . . . . . . . . . . . . . . . . . . . 99 6.4 Deep-learning approach for control state detection: EEG-Inception 101 6.4.1 Evaluation experiment . . . . . . . . . . . . . . . . . . . . . 102 6.4.2 Comparison with previous approaches . . . . . . . . . . . . 103 6.5 Design of MEDUSA © and comparison with previous BCI platforms 105 6.6 Limitations ............................... 109 7 Conclusions 111 7.1 Contributions.............................. 111 7.2 Mainconclusions............................ 113 7.3 Future research lines . . . . . . . . . . . . . . . . . . . . . . . . . . 114 A Compendium of publications 117 B Scientific achievements 119 B.1 Publications............................... 119 B.1.1 Papers indexed in the JCR . . . . . . . . . . . . . . . . . . 119 B.1.2 Bookchapters ......................... 121 B.1.3 International conferences . . . . . . . . . . . . . . . . . . . 121 B.1.4 National conferences . . . . . . . . . . . . . . . . . . . . . . 123 B.2 International internship . . . . . . . . . . . . . . . . . . . . . . . . 125 B.3 Awardsandhonors........................... 127 C Resumen en castellano 129 C.1 Introducci´on............................... 129 C.2 Hip´otesis y objetivos . . . . . . . . . . . . . . . . . . . . . . . . . . 133 C.3 Sujetos.................................. 135 C.4 M´etodos................................. 137 C.5 Resultados y discusi´on . . . . . . . . . . . . . . . . . . . . . . . . . 139 C.6 Conclusiones .............................. 143 X Contents Bibliography 145 Index 155 List of Figures 1.1 Main contributions of the papers included in the compendium of publications, arranged by the BCI function addressed in each study and ordered chronologically. IEEE TNSRE: IEEE Transactions on Neural Systems and Rehabilitation Engineering; CMPB: Computer Methods and Programs in Biomedicine; BCI: brain-computer interface; EEG: electroencephalography; ERP: event-related potentials; RCP: row-column paradigm; SSVEP: steady-state visual evoked potentials. ................................. 3 1.2 Schematic representation of a EEG-based BCI system. Firstly, the signal is acquired with electrodes over the scalp. Then, the signal processing stage decodes the user’s intentions and translated them into commands. Finally, the commands are sent to the final application, which provides feedback to the user. BCI applications can replace, restore, enhance, supplement and/or improve the natural body outputs. Adapted with permission from Mart´ınez-Cagigal (2020) .................................. 10 1.3 Schematic representation of a neuron. Dendrites receive electrical impulses from other neurons. The cell body, or soma, is the core section of the neuron, maintaining its structure and providing energy to drive function. The axon transmits electrical impulses to the axon terminals, and can be coated in myelin, a protein that improves the transmission. Dendrites and axon terminals are connected by synapses. Adapted from He (2020)............. 11 1.4 Schematic representation of the brain, divided in its three anatomical parts: brainstem, cerebellum and cerebrum. The lobes of the cerebral cortex are also displayed. Adapted from Jacobson (2008). 13 XI XII List of Figures 1.5 The International System 10-10 illustrated in schematic views showing (A) a lateral view, (B) a top view, and (C) a scalp projection. This standard uses proportional distances of 10% between the nasion and the inion for positioning the electrodes on the scalp (Mart´ınez-Cagigal,2020). ....................... 20 1.6 The figure illustrates the averaged EEG epochs for both target and non-target stimuli in an ERP-based BCI. The left graph represents the signal in channel Cz, with the stimulus onset placed at t=0. As can be seen, the ERP, with the P300 component, is clearly visible for target stimuli. The graph on the right shows the amplitude values recorded in eight different channels at the peak of the ERP. 23 3.1 Representation a row-column paradigm (RCP) trial with a 6×6 matrix. When the trial starts, the system highlights all the rows and columns of the matrix. The process is repeated Nstimes to increase the number of observations and improve the detection accuracy of the P300 potential. Finally, the BCI processes the EEG signal and decodesthecommand.......................... 38 3.2 Electrode montages according to the International System 10–10: (A) Asynchrony database (Santamar´ıa-V´azquez et al.,2019a,2022); (B) BCI Web Browser and BCI Social Networks databases (Santamar´ıa-V´azquez et al.,2020b). Ground and reference electrodes are marked in yellow and blue, respectively. Adapted from Mart´ınez- Cagigal (2020). ............................. 42 4.1 (a) Representation of the frequency-based feature, including the parameters fst,bw1,bw2. The graph shows the averaged power spectral density (PSD) of control and non-control trials of the Asynchrony database. (b) Schematic representation of the canonical correlation analysis (CCA) used to extract the correlation-based. The EEG signal represents one trial of dimensions C×N, where C is the number of channels and Nthe trial length in samples. The reference signal is an ideal sinusoid sin(2π·fst ·t) of dimensions 1×N. 50 4.2 Schematic representation of EEG-Inception. 2D convolution blocks and depthwise 2D convolution blocks include batch normalization, non-linear activation and dropout regularization. The kernel size is displayed for convolutional and average pooling layers. . . . . . . . 56 List of Figures XIII 5.1 Matrices used during the experiments: (a) RCP matrix, (b) overt matrix, (c) covert matrix. . . . . . . . . . . . . . . . . . . . . . . . 66 5.2 SSVEPs for different stimulation frequencies. Graphs on the left show the grand average of the PSD for all trials, channels and participants. Topographic plots on the right show the normalized peak value of the PSD at the stimulation frequency averaged for all trials andparticipants. ............................ 68 5.3 Temporal and spectral representation of the ERPs in overt, covert, control and non-control modes for participant S01. The upper part of the figure shows the averaged epochs (i.e., 1000 ms after stimuli) in channel Cz. The shaded area represents the 95% confidence interval. The bottom part of the figure shows the averaged PSD in channel Cz. The stimulation frequency in overt and control modes was5.71Hz................................ 68 5.4 Experimental setup. (a) Depicts a schematic representation of the subject and the two screens. The left screen displayed the browser used during the non-control runs while the speller was shown on the right screen. The paradigm was active during both tasks, but subjects were only required to pay attention to the stimuli during the control runs. (b) Shows the experiment plan, which was made up of two sessions, each with 10 runs of 6 trials and 15 sequences. Control and non-control runs were alternated to prevent subject fatigue. ................................. 71 5.5 Workflow of the study. First, the hyperparameter optimization process for EEG-Inception was done based using the validation set. Then, the models were trained using the training set. Finally, they were evaluated in the test set using a fine-tuning process for each subject. Fine-tuning trials were randomly selected, and the process is repeated 100 times for each Nand subject. . . . . . . . . . . . . 73 5.6 Results of the optimization process of EEG-Inception in the validation set (8 healthy subjects). Each line depicts the mean command decoding accuracy after a fine-tuning process for each subject with N= 30, considering 5 sequences of stimulation. (a) Score for each activation function and dropout rate using the best value of learning rate (lr = 0.001). (b) Score for each learning rate and dropout rate using the best activation function (ELU). . . . . . . . . . . . . 74 4 Chapter 1. Introduction to this research, making MEDUSA © one of the most complete solutions available today. The four articles that make up this dissertation, which is organized as a compendium of publications, are included in this document in Appendix A. Titles, authors, and abstracts of each one, as well as the journals in which they were published, are shown below: Asynchronous Control of ERP-based BCI Spellers Using Steady-State Visual Evoked Potentials Elicited by Peripheral Stimuli (Santamar´ıa- V´azquez et al.,2019a). Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Javier Gomez-Pilar, and Roberto Hornero. IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 27(9), p. 1883-1892, 2019. Impact factor in 2019: 3.340, D1 (Q1) in “Rehabilitation”, and Q1 in Biomedical Engineering (JCR-WOS). Abstract: Brain–computer interface (BCI) spellers based on event related potentials (ERPs) are intrinsically synchronous systems. Therefore, selections are constantly made, even when users are not paying attention to the stimuli. This poses a major limitation in real-life applications, in which an asynchronous control is required. The aim of this study is to design, develop and test a novel method to discriminate whether the user is controlling the system (i.e., control state) or is engaged in other task (i.e., non-control state). To achieve such asynchronous control, our method detects the steady-state visual evoked potentials (SSVEPs) elicited by peripheral stimuli of ERP-based spellers. A characterization experiment was conducted to investigate several aspects of this phenomenon. Then, the proposed method was validated in offline and online sessions. A total of 20 healthy subjects participated the experiments. The proposed method achieved an average accuracy of 95.5% for control state detection during the online sessions, providing a reliable asynchronous control. Furthermore, our approach is independent of the ERP classification stage, and to the best of our knowledge, is the first procedure that does not need to extend the duration of the calibration sessions to acquire non-control observations. EEG-Inception: A Novel Deep Convolutional Neural Network for Assistive ERP-based Brain-Computer Interfaces (Santamar´ıa-V´azquez et al.,2020b). 1.1. Compendium of publications: thematic consistency 5 Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Fernando Vaquerizo- Villar, and Roberto Hornero. IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 28(12), p. 2773-2782, 2020. Impact factor in 2020: 3.802, D1 (Q1) in “Rehabilitation” and Q2 in Biomedical Engineering (JCRWOS). Abstract: In recent years, deep-learning models gained attention for electroencephalography (EEG) classification tasks due to their excellent performance and ability to extract complex features from raw data. In particular, convolutional neural networks (CNN) showed adequate results in brain-computer interfaces (BCI) based on different control signals, including event-related potentials (ERP). In this study, we propose a novel CNN, called EEG-Inception, which improves the accuracy and calibration time of assistive ERP-based BCIs. To the best of our knowledge, EEG-Inception is the first model to integrate Inception modules for ERP detection, which combined efficiently with other structures in a light architecture, improved the performance of our approach. The model was validated in a population of 73 subjects, of which 31 present motor disabilities. Results show that EEG-Inception outperforms 5 previous approaches, yielding significant improvements for command decoding accuracy up to 16.0%, 10.7%, 7.2%, 5.7% and 5.1% in comparison to rLDA, xDAWN + Riemannian geometry, CNN-BLSTM, DeepConvNet and EEGNet, respectively. Moreover, EEG-Inception requires very few calibration trials to achieve state-of-the-art performances taking advantage of a novel training strategy that combines cross-subject transfer learning and fine-tuning to increase the feasibility of this approach for practical use in assistive applications. Robust Asynchronous Control of ERP-Based Brain-Computer Interfaces using Deep Learning (Santamar´ıa-V´azquez et al.,2022). Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Sergio P´erez-Velasco, Diego Marcos-Mart´ınez, and Roberto Hornero. Computer Methods and Programs in Biomedicine, vol. 215, 2022. Impact factor in 2021: 7.027, Q1 in “Computer Science, Interdisciplinary Applications”,“Computer Science, Theory & Methods”,“Biomedical Engineering” and “Medical Informatics” (JCR-WOS). Abstract: Background and Objective. Brain-computer interfaces (BCI) based on event-related potentials (ERP) are a promising technology for alternative and augmented communication in an assistive context. However, most approaches 6 Chapter 1. Introduction to date are synchronous, requiring the intervention of a supervisor when the user wishes to turn his attention away from the BCI system. In order to bring these BCIs into real-life applications, a robust asynchronous control of the system is required through monitoring of user attention. Despite the great importance of this limitation, which prevents the deployment of these systems outside the laboratory, it is often overlooked in research articles. This study was aimed to propose a novel method to solve this problem, taking advantage of deep learning for the first time in this context to overcome the limitations of previous strategies based on hand-crafted features. Methods. The proposed method, based on EEG-Inception, a novel deep convolutional neural network, divides the problem in 2 stages to achieve the asynchronous control: (i) the model detects user’s control state, and (ii) decodes the command only if the user is attending to the stimuli. Additionally, we used transfer learning to reduce the calibration time, even exploring a calibration-less approach. Results. Our method was evaluated with 22 healthy subjects, analyzing the impact of the calibration time and number of stimulation sequences on the system’s performance. For the control state detection stage, we report average accuracies above 91% using only 1 sequence of stimulation and 30 calibration trials, reaching a maximum of 96.95% with 15 sequences. Moreover, our calibration-less approach also achieved suitable results, with a maximum accuracy of 89.36%, showing the benefits of transfer learning. As for the overall asynchronous system, which includes both stages, the maximum information transfer rate was 35.54 bpm, a suitable value for high-speed communication. Conclusions. The proposed strategy achieved higher performance with less calibration trials and stimulation sequences than former approaches, representing a promising step forward that paves the way for more practical applications of ERP-based spellers. MEDUSA © : A novel Python-based software ecosystem to accelerate brain-computer interface and cognitive neuroscience research (Santamar´ıa-V´azquez et al.,2023). Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Diego Marcos-Mart´ınez, V´ıctor Rodr´ıguez-Gonz´alez Sergio P´erez-Velasco, Selene Moreno-Calder´on, and Roberto Hornero. Computer Methods and Programs in Biomedicine, vol. 230, 2023. Impact factor in 2021: 7.027, Q1 in “Computer Science, Interdisciplinary Applications”,“Computer Science, Theory & Methods”, “Biomedical Engineering” and “Medical Informatics” (JCR-WOS). 1.2. Dissertation Context 7 Abstract: Background and objective. Neurotechnologies have great potential to transform our society in ways that are yet to be uncovered. The rate of development in this field has increased significantly in recent years, but there are still barriers that need to be overcome before bringing neurotechnologies to the general public. One of these barriers is the difficulty of performing experiments that require complex software, such as brain-computer interfaces (BCI) or cognitive neuroscience experiments. Current platforms have limitations in terms of functionality and flexibility to meet the needs of researchers, who often need to implement new experimentation settings. This work was aimed to propose a novel software ecosystem, called MEDUSA © , to overcome these limitations. Methods. We followed strict development practices to optimize MEDUSA © for research in BCI and cognitive neuroscience, making special emphasis in the modularity, flexibility and scalability of our solution. Moreover, it was implemented in Python, an open-source programming language that reduces the development cost by taking advantage from its high-level syntax and large number of community packages. Results. MEDUSA © provides a complete suite of signal processing functions, including several deep learning architectures, and several ready-to-use BCI and neuroscience experiments, making it one of the most complete solutions nowadays. We also put special effort in providing tools to facilitate the development of custom experiments, which can be easily shared with the community through an app market available in our website to promote reproducibility. Conclusions. MEDUSA © is a novel software ecosystem for modern BCI and neurotechnology experimentation that provides state-of-the-art tools and encourages the participation of the community to make a difference for the progress of these fields. Visit the official website at https://www.medusabci.com/ to know more about this project. 1.2 Dissertation Context This dissertation is focused on the improvement of several aspects of BCIs to increase their applicability outside the laboratory. Therefore, it falls within the area of biomedical engineering, and more specifically, it is related to the fields of biomedical signal processing, neural engineering and assistive technologies. In the following paragraphs, an overview of these disciplines is presented in order to provide a common framework for the study. The field of biomedical signal processing studies how to measure and analyze physiological signals (Bronzino and Peterson,2014). Our organism is composed by a great number of systems (e.g., nervous, cardiovascular, gastrointestinal, res- 8 Chapter 1. Introduction piratory) that work together to maintain our body function. Through different mechanisms, we can acquire and analyze physiological signals that measure some feature of these systems over time in order to gain knowledge or perform diagnostics (Bronzino and Peterson,2014). Some of the greatest discoveries in this discipline occurred as early as the early 20th century, the most notable being the invention of the electrocardiogram (ECG) in 1903 by William Eindhoven (Bronzino and Peterson,2014). Another of the great milestones in this field was the EEG, discovered in 1929 by Hans Berger (Berger,1929). During the last decades, this field experienced a rapid expansion, and nowadays there are tens of physiological signals that are widely used for different purposes. These signals are usually classified based on their origin, being the most representative: bio-electrical, bioimpedance, bio-acoustic, bio-mechanic and bio-chemical (Bronzino and Peterson, 2014). In this work, we applied biomedical signal processing to analyze the EEG, which measures the electrical activity of the brain. Thus this field played a crucial role in this work. Another field that is related to this investigation is neural engineering, also known as neuroengineering. This emerging discipline encompasses any technology that combines principles from neuroscience and engineering to understand, design, diagnose, replace, repair, or enhance biological or artificial neural systems (He, 2020). This general definition encompasses a very wide range of fields, including neuroimaging, neuromodulation, neuromechanics, neural prostheses, neuromorphic circuits, neural tissue engineering or computational neuroscience, among others (Durand,2006). BCIs are also included in this definition, using neural engineering techniques to measure brain activity and identify specific patterns or waveforms that can be used to decode the user’s intentions and control an application (He,2020). These waveforms are called control signals, and the study and optimization of the cognitive tasks or the stimulation paradigms that trigger them is one of the main research areas in the BCI field. Concretely, this doctoral dissertation focused on visual ERPs, which are the response to visual stimuli reflected in the EEG. In this regard, ERPs are a reliable and widely studied control signal that can be used for assistive applications. Finally, assistive technologies are products, equipment, and systems that are used to increase, maintain, or improve the functional capabilities of persons with disabilities. Some examples of assistive technologies are wheelchairs, specialpurpose computers, prosthetics, screen readers, power lifts, eye trackers, etc. BCIs were also conceived as assistive technologies, and despite that the range of uses has increased in recent years, this application remains as one of its main purposes 1.3. Brain–computer interfaces 9 (Wolpaw et al.,2002). In fact, BCIs have the potential to solve many of the communication and dependency problems of severely disable people once the technical limitations of these systems are resolved. This dissertation focused on this application to design, develop and test the contributions that have been proposed in the four papers of the compendium, and thus, it represents the higher level framework of the investigation. 1.3 Brain–computer interfaces Ever since the development of the EEG in 1929 by Hans Berger, scientists have speculated about the use of BCIs to decode neural activity in real time to provide new forms of interaction with the outside world. A BCI capable of interpreting thoughts, desires, or intentions could drastically change the way we interact with our environment, unlocking an unimaginable world of possibilities —and risks— in multiple fields. Although we are still far from this point, the field has rapidly evolved in the last decades to build increasingly complex and accurate BCI systems. Formally, BCIs are systems that provide an alternative communication pathway between the user and the environment by decoding brain activity in real time to replace, restore, enhance, supplement or improve the human natural outputs, i.e., motor responses (Wolpaw and Wolpaw,2012). In general, all BCIs have a common workflow with three stages: (1) recording of neural activity with neuroimaging techniques, such as the EEG; (2) decoding of recorded data using signal processing to detect the user’s intentions; and (3) translation of these intentions into application commands and execution of these commands. This general workflow is depicted in Figure 1.2. As can be seen, BCI systems form a closed loop. The user’s intentions, encoded in their brain activity, drive responses that have a tangible impact on the environment through the BCI system, which leads to further interactions. Therefore, this workflow follows the rules of operant conditioning, a crucial feature to achieve natural interactions (Wolpaw and Wolpaw, 2012). The next subsections provide an overview of the most important topics to design and develop modern BCIs, defining a common framework from which to approach the rest of the dissertation. 10 Chapter 1. Introduction Figure 1.2: Schematic representation of a EEG-based BCI system. Firstly, the signal is acquired with electrodes over the scalp. Then, the signal processing stage decodes the user’s intentions and translated them into commands. Finally, the commands are sent to the final application, which provides feedback to the user. BCI applications can replace, restore, enhance, supplement and/or improve the natural body outputs. Adapted with permission from Mart´ınez-Cagigal (2020) 1.3.1 Recording neural activity The central nervous system is the most complex part of multi-cellular organisms. It can be seen as a control center that receives information from the outside world and acts accordingly. Neurons are the functional units of the nervous system, thus representing a central part in its study (Jessen,2004). Figure 1.3 depicts a typical neuron, which consists of a cell body, or soma, dendrites and the axon. These specialized cells are specifically designed to receive and generate electrical signals. Between the intra-cellular and extra-cellular spaces, there is a gradient of energy, called resting membrane potential, created by the different concentration of positive and negative ions on both sides of the cellular membrane (Raghavan et al.,2019). The cell can control the resting membrane potential by changing 1.3. Brain–computer interfaces 11 Figure 1.3: Schematic representation of a neuron. Dendrites receive electrical impulses from other neurons. The cell body, or soma, is the core section of the neuron, maintaining its structure and providing energy to drive function. The axon transmits electrical impulses to the axon terminals, and can be coated in myelin, a protein that improves the transmission. Dendrites and axon terminals are connected by synapses. Adapted from He (2020). the concentration of the ions across the membrane, predominantly sodium (Na+), potassium (K+), and chloride (Cl−) (Raghavan et al.,2019). Since the cell lipid bilayer membrane is not permeable to ions, this change is enabled by specialized structures called ion channels and ion pumps (Raghavan et al.,2019). Ion channels allow the passive movement of ions down their electrochemical gradient. On the other hand, ion pumps transport ions against their natural gradient at the expense of energy (Raghavan et al.,2019). In normal conditions, the resting membrane potential has a negative value between -40 and -80 mV relative to the extra-cellular medium. However, under certain conditions of excitation, neurons trigger regenerative events that revert the resting potential to values close to +50 mV, returning to the baseline point after a few milliseconds. These events, called action potentials, are propagated through the neural network, being central for multiple functions, including information processing and transmission, muscle contraction or hormone release (Raghavan et al.,2019). A neuron receives actions potentials from other neurons through the dendrites and cell body, and transmits new stimulus through the axon (Raghavan et al.,2019). The interaction between axons and dendrites is governed by complex biochemical interactions in the synapses. Whether or not an action potential is generated in the cell body of a neuron depends on the input signals, forming a very complex communication system (He,2020). However, it should be noted that there are still many open 12 Chapter 1. Introduction questions regarding the details of the structure and functioning of neurons. In fact, it is estimated that the human brain roughly 100 billion neurons, with more than 40 different types described to date, each one of them with different characteristics that are not always fully understood (He,2020). From a macroscopic point of view, neurons arrange in networks that, together, form the nervous system. Particularly, the central nervous system (CNS) is composed by the spinal cord and the brain, being the latter the organ responsible for the centralized control of the majority of body functions. Anatomically, the brain can be divided in three parts, as shown Figure 1.4: brainstem, cerebellum, and cerebrum (Jacobson,2008). The brainstem connects the inferior parts of the brain with spinal cord, having critical functions such as the transmission of sensory and motor information, cardiac and respiratory regulation, or sleep cycle management. The cerebellum is related to accurate unconscious motor control (timing, coordination and body posture), and primary cognitive functions and emotions, such as attention, emotional control, and fear/pleasure responses. Finally, the cerebrum, which the largest part of the human brain, contains the cerebral cortex and subcortical structures like the hippocampus, basal ganglia and olfactory bulb. This part of the brain controls the majority of high-level functions, being the cerebral cortex the most important structure for the purposes of this dissertation. The cerebral cortex, whose main lobes are shown in Figure 1.4, can be divided in different functional areas, being the most relevant for this work (Jacobson,2008): (1) the primary motor cortex, located in the frontal lobe, plays an important role in motor planning and execution through efferent pathways; (2) the somatosensory cortex, located in the parietal lobe, receives sensory information (e.g., temperature, pain, touch or proprioception) through afferent pathways; (3) the visual cortex, located in the occipital lobe, processes the visual information received through the optic nerves; (4) the auditory cortex, located in the superior and medial areas of the temporal lobes, processes sounds, being also involved in language; and (5) the prefrontal cortex, located in the frontal part of the brain, is fundamentally involved in high-level cognitive processes such as working memory, planning motor execution, decision making, personality and social behaviour, language, etc. When the brain performs a cognitive task, the neurons involved in the process increase their activity. Typically, complex cognitive processes activate multiple local networks that are sensitive to the current task. The neurons that form these networks synchronize their activity and increase the firing rate of action potentials to process and transmit relevant information. At a higher level, these local networks also synchronize through long distance connections with other parts 1.3. Brain–computer interfaces 13 Figure 1.4: Schematic representation of the brain, divided in its three anatomical parts: brainstem, cerebellum and cerebrum. The lobes of the cerebral cortex are also displayed. Adapted from Jacobson (2008). of the brain, forming a larger network that leaves a recognizable activity footprint. This allows to study which parts of the brain are involved in a certain cognitive task (Jacobson,2008). The goal of a BCI is to decode this activity in real time to detect the user’s intentions. Therefore, in order to implement a BCI, the first step is the acquisition of data reflecting the underlying neural activity of the user’s brain, and especially, the cortex. Unfortunately, this measurement is a difficult challenge. First, the physical barriers that protect the brain (e.g., scalp, skull, dura, arachnoid) make it difficult to measure neural activity directly on the source, which would maximize precision (Wolpaw and Wolpaw,2012). In fact, this is only possible with highly invasive and complex techniques that, for safety and ethical reasons, can only be used as last resource in life threatening situations. Another reason is the exceptional complexity of the brain. The accurate decoding of high-level mental processes would be required to measure the activity of billions of neurons at the same time throughout the brain, but current technology lack the required capacity and precision. However, the development of neuroimaging in the last decades brought up several techniques that opened a window into the brain, enabling crucial advancements for a better understanding of this organ (Wolpaw and Wolpaw, 2012). 20 Chapter 1. Introduction Figure 1.5: The International System 10-10 illustrated in schematic views showing (A) a lateral view, (B) a top view, and (C) a scalp projection. This standard uses proportional distances of 10% between the nasion and the inion for positioning the electrodes on the scalp (Mart´ınez-Cagigal,2020). 1.3.3 BCI control signals Decoding neural activity from EEG signals is not straightforward due to the low spatial resolution and high complexity of this signal. To achieve this goal, EEG must first encode the user’s intention that is being conveyed. Then, different signal processing techniques must be applied to isolate this information and translate it into an application command. In order to encode user’s intentions in the EEG, BCIs use certain types of evoked activity. During the last decades, researchers studied different paradigms to optimize the use of evoked activity for BCI control, using neural engineering techniques to trigger adequate responses for each application. These responses are known as control signals, being the most important nowadays: 1.Sensorymotor rhythms (SMR). SMR are components recorded in the sensorimotor cortex in alpha, beta, and gamma bands. SMR activity is provoked by the conscious preparation of a motor intent and is characterized by: (1) a contralateral power decrease, known as event-related desynchronization (ERD); and (2) an ipsilateral power increase, known as event-related synchronization (ERS) (Pfurtscheller and McFarland,2012). ERD/ERS events are bound to the area of the cortex that controls the muscles involved in the movement. An interesting feature for BCI control is that, since SMRs are modulated by motor planning and attention mechanisms, instead of actual movement execution, executed and imagined movements can trigger similar ERD/ERS responses. Therefore, this control signal can be used by different 1.3. Brain–computer interfaces 21 types of users, including severely disabled, to control a BCI system. However, in order to achieve a successful control through motor imagery exercises, users usually need to train for several hours. Another handicap of the SMRs is that the number of classes that can be discriminated is limited due to the low spatial resolution of the EEG. Therefore, the number of different commands that can be implemented in a SMR-based BCI is also limited. In fact, current SMR-based BCIs rarely implement more than 4 commands to maintain a suitable accuracy. 2.Steady-state visual evoked potentials (SSVEP). SSVEPs are the result of rapid and repetitive visual stimulation at fixed rates (Luck,2014). In this paradigm, the resulting evoked responses are overlapped producing a constant oscillation at the stimulation frequency. Since these evoked responses are the result of low-level sensory processing, no mental tasks are involved. Therefore, SSVEPs are a considered an exogenous control signal that can be triggered in the user without training. If the stimulation is maintained enough time, SSVEPs can be identified with a simple frequency analysis. The classical setup of SSVEP-based BCIs is a matrix with cells that produce visual stimuli at different frequencies. When the user pays attention to a specific cell, the SSVEP is detected in the EEG and the corresponding application command is executed. This setup allows to implement a high number of commands (typically between 12 and 64), but it is still limited by the refreshing rate of current LCD screens (Luck,2014). 3.Code-modulated visual evoked potentials (c-VEP). c-VEPs are elicited by flashing stimulation sequences that follow pseudo-random noise codes, generating evoked neural activity correlated with the sequence the user is paying attention to (Mart´ınez-Cagigal et al.,2021). In this paradigm, several cells are arranged in a matrix, each one of them with a different stimulation sequence associated to a command. When the user wants to perform a selection, the BCI system detects which sequence is more correlated to the EEG activity and executes the corresponding command (Mart´ınez-Cagigal et al.,2021). In recent years, this paradigm achieved the highest accuracy and selection speed ever reported in the BCI literature, being one of the most promising alternatives for communication and control BCIs. However, c-VEP-based BCIs require complex time synchronization and the number of commands, typically between 4 and 16, is still limited by the availability of uncorrelated psudo-random codes and the refreshing rate of LCD screens 22 Chapter 1. Introduction (Mart´ınez-Cagigal et al.,2021). 4.P300 evoked potentials. In this paradigm, the user is presented with different cells, each one associated to a command, that are highlighted sequentially in random order. The task of the user is to focus on the target cell while ignoring the other stimuli that are presented. In this setup, target events elicit visual ERPs with the P300 potential in the EEG, whereas the other stimuli triggers visual ERPs without this component, as can be seen in Figure 1.6 (Santamar´ıa-V´azquez et al.,2019a). The P300 component is a positive potential elicited by the recognition of a rare stimulus (target) within a series of frequent stimuli (non-target), appearing around 300 ms after the stimulus onset. In order to decode the command, the BCI system detects the P300 in the EEG using signal processing techniques. This waveform is considered an endogenous component, since it reflects high-level cognitive tasks to differentiate between the two different types of stimuli, but the user does not require training to elicit it. This control signal has been widely studied to implement systems for communication and control. Despite the fact that P300 evoked potentials generally provide lower accuracy and speed than SSVEPs and c-VEPs, the number of commands is not limited, thus allowing to control complex interfaces such as domotic systems or full keyboards. Furthermore, it does not require complex user interfaces or accurate time synchronization. For these reasons, this control signal is considered the most reliable for applied systems outside the laboratory, probably being the most extended in the BCI field nowadays (Sellers et al.,2012). The systems that use this control signal are known as ERP-based BCIs or P300-based BCIs. Although both terms are often used interchangeably in the literature, in this document we use the term ERP-based BCIs. 1.3.4 EEG processing in BCI Once the information to discriminate the command has been encoded in the EEG using the previous or other control signals, the system must detect the corresponding neural activity and isolate it from the rest of EEG components by applying signal processing methods. Although the algorithm will depend on the specific BCI paradigm, we can define a general signal processing framework implemented in 4 sequential stages: pre-processing, feature extraction, feature selection and feature classification. 1.3. Brain–computer interfaces 23 Figure 1.6: The figure illustrates the averaged EEG epochs for both target and nontarget stimuli in an ERP-based BCI. The left graph represents the signal in channel Cz, with the stimulus onset placed at t=0. As can be seen, the ERP, with the P300 component, is clearly visible for target stimuli. The graph on the right shows the amplitude values recorded in eight different channels at the peak of the ERP. The goal of the pre-processing stage is to remove non-target components and noisy artifacts from the EEG, increasing the signal-to-noise ratio (SNR) of the control signal (Lotte et al.,2018). The most typical methods include: (1) frequency filters such as infinite impulse response (IIR) filters and finite impulse response (FIR) filters to remove frequencies outside the interest band; (2) spatial filters to increase the spatial resolution, such as common average reference (CAR), Laplacian Filters or Common Spatial Patterns; and (3) source separation to remove certain signal components, such as Independent Component Analysis (ICA) (Lotte et al.,2018). In the feature extraction stage, the algorithm extracts meaningful features to detect the control signal in the EEG, facilitating the learning and generalization steps in the classification stage (Lotte et al.,2018). Depending on the control signal, different features can be used, being the most relevant: (1) temporal features such as amplitude distribution indices or moving averages; (2) spectral features based on Fourier analysis, such as band powers or spectral entropy; (3) non-linear metrics such as central tendency measure (CTM), Lempel-Ziv complexity (LZC) or Sample entropy (SampEn); (4) connectivity metrics, including amplitude and phase parameters such as phase locking value (PLC), amplitude envelope correlation (AEC); and (5) graph theory metrics. A common approach is to calculate different types of features and use all of them in the following stages (Lotte et al., 2018). After the feature extraction stage, the information contained in the EEG is syn- 24 Chapter 1. Introduction thesized in a set of variables (Lotte et al.,2018). However, some of these features may provide irrelevant or redundant information for the control signal detection problem, which may reduce the performance of the algorithm and increase overfitting. Therefore, an optional feature selection stage can be applied to select the most relevant features. There are two types of algorithms that can be used. Filter approaches are independent from the classification stage, selecting the most relevant features based on correlation analyses. On the other hand, wrapper methods use predictions with a given model to decide which features are more relevant for the task, calculating the optimal set for a specific classification method (Guyon and Elisseeff,2003). The feature classification stage automatically detects the EEG patterns corresponding to the control signal depending on the values of the input features. The classification method calculates the optimal decision boundaries in the feature space to separate the classes based on different criteria. For EEG classification tasks, the most successful methods are based on supervised learning, which require a training set to calculate the optimal decision boundaries (Lotte et al.,2018). Some widely used classifiers for EEG classifications tasks are linear regression, linear discriminant analysis (LDA), support vector machines (SVM), artificial neural networks (ANN) and Riemannian-based classifiers (Lotte et al.,2018). Depending on the paradigm, an additional step might be necessary to translate the classifier output to application commands, as in ERP-based BCIs, where the detected P300 must be mapped to their corresponding command. 1.3.5 BCI Applications A BCI system works as a general interface between the user’s brain and an external device. Therefore, this technology can be potentially used for unlimited applications. Nevertheless, due to its current high complexity and low performance, its use is restricted to specific fields. Nowadays, the most important applications of BCIs on the biomedical field are assistive systems and neurorehabilitation. In the 1980s, BCIs were conceptualized as an aid system for people with communication and motor control problems (Farwell and Donchin,1988). Nowadays, increasing the quality of life and independence of severely disabled people is still one of the main goals of the EEG-based BCI technology (Wolpaw and Wolpaw, 2012). In the last decades, many different kinds of assistive systems controlled through BCI appeared: web browsers (Mart´ınez-Cagigal et al.,2017), wheelchairs (Cruz et al.,2021), exoskeletons and robotic limbs (Tariq et al.,2018), social media 1.4. State of the art 25 applications (Mart´ınez-Cagigal et al.,2019a) or alternative communication devices (Vansteensel and Jarosiewicz,2020). BCIs can also be used to rehabilitate or enhance brain functions through repetitive endogenous stimulation of brain activity (Enriquez-Geppert et al.,2017). Using neurofeedback (NF) and operant conditioning, BCIs allow to self-modulate neural activity and promote brain plasticity using real-time feedback of neural activation parameters (Enriquez-Geppert et al.,2017). NF has emerged in recent years as a promising methodology to correct pathological states and behaviours, such as attention deficit hyperactivity disorder, anxiety or depression, and even to improve recovery expectancies after suffering brain damage provoked by stroke or traumatic brain injury. Furthermore, NF techniques have been proposed as a cognitive enhancement tool for healthy subjects (Enriquez-Geppert et al.,2017). 1.4 State of the art The contributions of this dissertation cover a wide range of topics in the BCI field, including: (1) improvement of asynchronous control of ERP-based BCIs; (2) application of novel pattern recognition techniques based on deep learning to improve BCI performance; and (3) the development of a novel platform to accelerate BCI and cognitive neuroscience research. The following subsections provide a comprehensive state of the art review of these topics. 1.4.1 Asynchronous control of ERP-based BCIs As mentioned in previous sections, BCIs use evoked activity to decode the user’s intentions from the EEG. However, in a single EEG observation, control signals (e.g., SMR, ERP) are, in most cases, barely discernible from the spontaneous components due to the low SNR of this signal. For this reason, the command selection time is usually pre-allocated. This approach allows to synchronize neural events in order to increase the performance of the signal processing algorithm, simplifying the classification task. The main implication is that the user can only interact with the system during specific, fixed-duration time windows. Furthermore, to maximize the accuracy, the system assumes that the user always wants to make a selection in the given time slot. Thus, it always decides and executes a command even if the user does not want to interact with the BCI. This synchronous behaviour is not a limitation in neurorehabilitation applications, where the goal is to facilitate endogenous stimulation of certain neural 26 Chapter 1. Introduction activity patterns. But for practical assistive applications, this poses a great drawback. In this case, users must be able to shift their attention away from the BCI to attend different tasks on demand (Santamar´ıa-V´azquez et al.,2019a). If the system randomly selects commands when the user is not controlling it, it can potentially create undesired or even dangerous situations, as in an application for wheelchair control. In these cases, the system needs to implement an additional control state detection layer to provide an asynchronous control of the application by dynamically detecting whether the user is willingly controlling the BCI (i.e., control state), or is attending to other task (i.e., non-control state). As one of the most widely used paradigms for assistive applications, asynchronous ERP-based BCIs based on the P300 potential are of great interest. Several works studied different strategies to provide an asynchronous control of ERP-based BCIs. The approaches can be divided into two categories: (1) thresholds dependent on the output scores of the feature classification stage (Aloise et al.,2011;Aydin et al.,2018;He et al.,2017;Mart´ınez-Cagigal et al.,2017, 2019a;Zhang et al.,2008); or (2) hybrid BCIs that combine different control signals (Li et al.,2013;Panicker et al.,2010;Yu et al.,2017). Nevertheless, these approaches still present limitations. For instance, algorithms that rely on the output scores of the ERP classification stage have high inter-session variability. Small changes in the amplitude or latency of the ERPs could override the threshold and cause a drastic decrease in the accuracy of these methods. In fact, thresholds must be recalibrated before each session with the BCI system. This procedure is time consuming, affects the usability of the system and it is frustrating for users (Mart´ınez-Cagigal et al.,2017;Schettini et al.,2014). Moreover, previous approaches require to record additional data to characterize the EEG when the users are not paying attention to the system in order to calculate the threshold, which increases the duration of the calibration sessions. On the other hand, hybrid BCIs increase the complexity of the system, requiring different stimulation interfaces. In these BCIs, the user has to be able to manage with two or more control signals, making them more demanding. Consequently, hybrid BCIs might be a major challenge for certain users who cannot maintain high levels of concentration (Amiri et al.,2013). Algorithms independent of the ERP classification stage may help to overcome the previous limitations. In this regard, Pinegger et al. (2015) proposed a groundbreaking method based on the hypothesis that the flashing frequency of the classical P300-based speller should be encoded somehow in the EEG due to low-level processing of non-target visual stimuli. However, the proposed method 1.4. State of the art 27 only reached an average accuracy of 79.5% in the control state detection task. Moreover, it required to double the duration of the calibration sessions in order to acquire non-control trials. Therefore, there was still room for improvement, and further developments could solve the limitations of the study of Pinegger et al. (2015). In this regard, novel techniques to detect the low-level processing of visual stimuli are promising candidates to provide a real asynchronous control of ERP-based BCIs. 1.4.2 Deep learning in ERP-based BCIs Another limitation of current BCIs is their performance. For some applications, including assistive systems, the accuracy and command selection speed, which are the two main metrics to measure the performance of a BCI, are far from ideal. In this regard, there are two ways of improving the accuracy and speed of a BCI: (1) improve the control paradigm to elicit stronger responses in the EEG that are easier to detect (i.e., improve SNR); or (2) improve the signal processing stage to increase the sensibility and specificity of the system for a given paradigm. Although both approaches get a lot of attention, the latter is easier to put into practice, taking into account that you can use existing BCI applications and databases to design novel pattern recognition methodologies. In the case of ERP-based BCIs, classical methods based on feature engineering and machine learning, such as LDA and SVM, have been widely explored (Lotte et al.,2018,2007). They achieve a reasonable performance, but their robustness is easily compromised by noisy artifacts or inter-subject and inter-session variability (Lotte et al.,2007). Moreover, several studies demonstrated that the performance of these methods is reduced drastically in real environments with severely disabled populations (Mart´ınez-Cagigal et al.,2017,2019a). Recent developments in tensor classifiers based on Riemannian geometry (RG) and adaptive methodologies have made some improvements, but their accuracy and generalization ability remain limited (Congedo et al.,2017;Lotte et al.,2018). In recent years, the development of deep learning brought breaking advances in the field of pattern recognition (Craik et al.,2019). Deep neural networks are able to automatically extract complex features from raw data, learning hierarchical representations of the input in different levels of abstraction (Lecun et al.,2015). This ability has revolutionized fields such as computer vision, natural language processing, genomics or drug-discovery (Lecun et al.,2015). In the EEG domain, deep neural networks have been used for ERP, SMR and SSVEP classification, 28 Chapter 1. Introduction seizure detection and prediction, sleep stage scoring, mental workload detection, data augmentation or emotion recognition, among others (Craik et al.,2019). However, there are still relatively few studies of deep-learning models for EEG analysis (Roy et al.,2019). Since the application of deep learning to EEG is relatively new, most studies explored simple architectures based on convolutional neural networks (CNN) and recurrent neural networks (RNN) (Craik et al.,2019). Nevertheless, there is still room for improvement, and more complex architectures specifically designed for EEG analysis could enhance the performance of CNNs in this domain. Several studies proposed deep-learning models for ERP detection in a BCI framework. Table 1.1 presents a summary of previous approaches, including a brief description of their contributions, validation method, testing subjects, and outcomes. It can be observed that CNNs are the most widely used method. Among them, EEGNet, proposed by Lawhern et al. (2018), had great impact for its suitable performance and efficient use of depthwise and separable convolutions to create a robust and lightweight structure. Another approach was the model proposed by Borra et al. (2019), which was a fine-tuned version of EEGNet for ERP detection in subjects with attention-deficit/hyperactivity disorder (ADHD). In this table, we also include our first deep-learning model (not included in this compendium), called CNN-BLSTM, which combines a convolutional layer to extract spatial patterns with 2 recurrent layers based on bidirectional long-short term memory units (BLSTM) to learn temporal patterns (Santamar´ıa-V´azquez et al., 2019b). The use of RNNs for EEG processing is scarce, especially for ERP detection (Craik et al.,2019). The reason for this may be that RNNs have a high computational cost and take longer to train compared to CNNs. However, RNNs are well-suited for processing time series data, making them a viable alternative to CNNs in EEG processing. It should be noted that previous studies have not tested their deep-learning models on subjects with motor impairments. Furthermore, Cecotti and Gr¨aser (2011) and Liu et al. (2018) only included two and three healthy subjects, respectively. It is well-known that patients often have lower classification accuracy due to factors related to their specific conditions, such as neural damage, attention problems, visual impairment, involuntary tremors, or limited cognitive performance (Mart´ınez-Cagigal et al.,2017,2019a). Furthermore, these symptoms can vary greatly between individuals, even among those with the same condition, making severely disabled subjects a particularly challenging and heterogeneous group for ERP detection. Therefore, a thorough evaluation of new models in this group is 1.4. State of the art 29 Table 1.1: Previous deep-learning approaches for ERP-based BCIs Study Highlights Validation Subjects Accuracy Cecotti and Gr¨aser (2011) First CNN for BCI classification tasks Intra-subject 2 CS 95% Manor and Geva (2015) Spatio-temporal regularization Cross-subject 15 CS 70% Liu et al. (2018) Dropout and Batch normalization Intra-subject 3 CS 97% Lawhern et al. (2018) Depthwise and separable convolutions Cross/intrasubject 18 CS 90/92% Santamar´ıa- V´azquez et al. (2019b) Use of bidirectional LSTM layers Hybrid 15 ADHD 84% Borra et al. (2019) Depthwise and separable convolutions Intra-subject 15 ADHD 92% CS: control subjects; CNN: convolutional neural network; ADHD: subjects with attention deficit hyperactivity disorder; MDS: motor disabled subjects; CNN: convolutional neural network; LSTM: long-short term memory; Validation: intra-subject strategies train and test the models with data from the same subject, cross-subject strategies train and test the models with data from different subjects and hybrid approaches combine both techniques; Accuracy: test command decoding accuracy. necessary to determine their usefulness in assistive BCI applications. 1.4.3 BCI platforms In order to gain new insights into brain function or test new signal processing algorithms, BCI researchers often need to conduct sophisticated experiments with strict temporal requirements and high-precision synchronization between processes. The implementation of such experiments requires specialized software tools to handle the signal acquisition, data processing, task presentation, and feedback to the user (Wolpaw and Wolpaw,2012). The design and development of these tools is difficult and time consuming, requiring extensive technical knowledge in several domains. Furthermore, a great flexibility is often required in this research environment to rapidly adjust the applications to particular studies or projects. Unfortunately, this expertise is often out of reach for most neuroscience research groups, who stick to the available software or rely on external entities to develop the required programs for their research, leading to delays and cost increases. This is particularly relevant in closed-loop experiments implemented with BCIs due to their technical complexity (Ciliberti and Kloosterman,2017;Lopes and Monteiro, 2021). In this context, software tools and applications specifically designed to facilitate the implementation of neuroscience experiments are of great importance for the progress of brain research and neurotechnology. The impact that this kind of tools could have in particular fields should not be underestimated due to their ability Chapter 3 Subjects and signals In this chapter, the databases that were used in each of the studies that compose this dissertation are detailed. Section 3.1 introduces the row-column paradigm (RCP), which is the BCI control paradigm that was used in the first three studies of the compendium: Santamar´ıa-V´azquez et al. (2019a,2022,2020b). Section 3.2 describes the clinical and demographic characteristics of the subjects that participated in the experiments. Finally, section 3.3 details the acquisition setups for each study, including EEG devices, sampling rate and electrode montages. 3.1 The row-column paradigm As discussed in section 1.3.3, ERPs are the brain response to specific events. For instance, sudden visual stimuli provoke a series of characteristic EEG waveforms with different positive and negative peaks that can be revealed by averaging EEG epochs after the stimulus onset. Specifically, P300 evoked potentials are endogenous components elicited by the oddball paradigm, where the user has to detect an infrequent target stimuli among frequent non-target stimuli. This simple cognitive task triggers conscious responses that activate high-level areas of the cortex in frontal and parietal lobes whenever the user detects a target stimulus. This activity is reflected in the EEG with a characteristic waveform called P300 potential, which appears around 300 ms after the stimulus onset. Importantly, the P300 is not present for non-target stimulus (Sellers et al.,2012). Different BCI paradigms take advantage of these differences in the EEG for target vs non-target stimuli. The RCP is probably the most known among them. In this paradigm, the system displays a matrix of commands, whose rows and 37 38 Chapter 3. Subjects and signals Figure 3.1: Representation a row-column paradigm (RCP) trial with a 6×6 matrix. When the trial starts, the system highlights all the rows and columns of the matrix. The process is repeated Nstimes to increase the number of observations and improve the detection accuracy of the P300 potential. Finally, the BCI processes the EEG signal and decodes the command. columns are highlighted randomly. To select a command, the user has to stare at the desired option, eliciting an ERP with the P300 component when a target stimulus is perceived. On the other hand, non-target stimuli does not trigger such response, only eliciting low-level responses in the early stages of the visual cortex related to unconscious processing. Finally, the system decodes the row and the column using signal processing algorithms to detect the P300 component and executes the corresponding command, providing feedback to the user. Figure 3.1 shows an schematic representation of the RCP operation. It should be noted that this paradigm is inherently synchronous: the system assumes by default that the user is always attending the stimuli and selects a command after every trial. In this regard, due to the low SNR of the ERPs, the control state detection task requires specific processing in order to detect the user’s control state. In order to configure the RCP operation, several parameters must be defined: 1)Stimulus duration (SD). This parameter defines the time that each row and column is highlighted. Its value is usually set between 75 to 200 ms. Values below 50 ms can prevent the detection of the stimulus by the user, leading to very low command decoding accuracies (Blankertz et al.,2006; Treder et al.,2011). 2)Inter-stimulus interval (ISI). This parameter defines the temporal separation between two consecutive stimuli. Typically, the ISI is set between 75 3.2. Subjects 39 and 300 ms (Blankertz et al.,2006;Treder et al.,2011). A rather common practice is to let the value of the ISI change between stimulus according to a random uniform distribution to prevent users’ anticipation (Mart´ınez- Cagigal et al.,2017). 3)Stimulus onset asynchrony (SOA). The SOA is the sum of the SD and the ISI, representing the time between two consecutive onsets. It usually takes values in the range of 175–500 ms (Blankertz et al.,2006). 4)Number of sequences (Ns). In order to increase the accuracy of the system, the stimulation procedure is repeated Nstimes to increase the accuracy of the system. Generally, calibration data is recorded with 10 ≤Ns≤15 sequences, being reduced afterwards to increase the command selection speed (Mart´ınez-Cagigal et al.,2017). The flashing order should be randomized for every sequence to assure one of the main principles to elicit suitable P300: an unexpected stimulation. 5)Matrix dimensions. The number of rows and columns of the matrix will determine the number of commands that can be allocated. One of the most useful features of the RCP is that the accuracy of the system is not compromised regardless the number of commands. However, it should be noted that a higher number of commands implies a higher selection time. Another important aspect is that there are few target stimuli that will elicit a P300 in comparison with non-target stimuli, leading to class-imbalanced datasets (e.g., 1:6 for a 6 x 6 matrix) that will affect the design of the signal processing algorithms. Additional notation details that will be used along this document are: (1) a stimulus refer to the highlighting of a row or column; (2) a trial is a single selection with the system (e.g., one letter); and (3) a run is series of several trials that are selected to perform a specific task (e.g., write a word, browse a web). Several studies proved that the RCP could be a reliable paradigm for assistive BCI applications (Mart´ınez-Cagigal et al.,2017,2019a). However, as stated in section 1.4, there is still room for improvement in terms of accuracy, speed and asynchronous management. 3.2 Subjects Three independent databases were used during the course of this doctoral thesis: 40 Chapter 3. Subjects and signals 1 Asynchrony database. This database was acquired to characterize the differences in the EEG during control vs. non-control states in our ERP-based speller with the RCP. Participants performed 120 trials, 60 control and 60 non-control, of 15 stimulation sequences with the proposed system. Signals were recorded using a 16-channel EEG cap. The database was recorded in two phases. The first 15 subjects (11 males, 4 females, mean age: 26.1 ± 2.3 years) were acquired for Santamar´ıa-V´azquez et al. (2019a). Afterwards, this sample was extended for Santamar´ıa-V´azquez et al. (2022) with 7 more subjects, making a total of 22 control subjects (CS) (15 males, 7 females, mean age: 24.7 ±4.3 years). Table 3.1 shows the demographic information of subjects in this database. 2 BCI Web Browser database. This database was acquired to validate an RCP speller to help severely disabled people to surf the internet with an adapted BCI web browser (Mart´ınez-Cagigal et al.,2017). The database consisted of 10 CS (6 males, 4 females, mean age: 24.8 ±2.9) and 15 motor disabled subjects (MD) (10 males, 5 females, mean age: 42.7 ±7.5 years) that performed different tasks with the web browser using the speller. Each subject performed 87.9 ±7.3 control trials. It should be noted that some tasks contained free spelling moments, hence the variability in the number of trials per subject. Signals were recorded using an 8-channel EEG cap (Mart´ınez-Cagigal et al.,2017). Demographic and clinical data of this database are shown in Table 3.2 3 BCI Social Networks database. This database contains data from a feasibility study to evaluate an assistive BCI application to use several social networks in a smartphone controlled through a RCP speller (Mart´ınez- Cagigal et al.,2019a). The database contained data from 10 CS (8 males, 2 females, mean age: 26.10 ±3.45) and 16 MD (10 males, 6 females, mean age: 45.5 ±9.68 years). Each subject performed 63.4 ±8.2 control trials using an 8-channel cap (Mart´ınez-Cagigal et al.,2019a). Demographic and clinical data of this database are shown in Table 3.3. Table 3.4 summarizes the characteristics of each database. All subjects gave their informed written consent for participating in the respective studies. The protocols were approved by the local ethics committee and complied with the declaration of Helsinki. MD subjects of “BCI Web browser study” and “BCI Social networks study” were recruited by the Spanish National Reference Centre on Disability and Dependence. 3.3. EEG recording setup 41 Table 3.1: Demographics of the Asynchrony database. User Sex Age Control subjects CS01 M 27 CS02 M 26 CS03 M 27 CS04 M 30 CS05 M 35 CS06 M 26 CS07 M 27 CS08 M 27 CS09 F 28 CS10 F 26 CS11 M 27 CS12 F 25 CS13 F 23 CS14 M 26 CS15 M 27 CS16 F 19 CS17 M 19 CS18 M 19 CS19 F 19 CS20 M 19 CS21 F 19 CS22 M 26 MD: motor disabled subjects, M: male, F: female. 3.3 EEG recording setup For the three databases, the data were recorded with a g.USBAmp (g.tec Medical Engineering, Austria), at a sampling rate of 256 Hz. The ground was placed in FPz and the EEG signal was referenced to the earlobe. The electrode positions were different across databases. For the Asynchrony database 16 EEG channels were recorded, whereas for the BCI Web Browser and BCI Social Networks we used 8 EEG channels. Figure 3.2 shows the EEG montages for the three databases according to the International System 10–10. For all the recordings, the participants were sat on a comfortable chair in front of a computer screen, keeping a minimum distance of 50 cm. 42 Chapter 3. Subjects and signals Table 3.2: Demographics and clinical data of the BCI Web Browser database. User Sex Age Condition Control subjects CS23 M 26 Healthy CS24 M 24 Healthy CS25 F 25 Healthy CS26 M 26 Healthy CS27 F 23 Healthy CS28 F 28 Healthy CS29 M 30 Healthy CS30 M 20 Healthy CS31 M 24 Healthy CS32 F 22 Healthy Motor disabled subjects MD01 M 31 Multiple sclerosis MD02 M 43 Multiple sclerosis MD03 F 47 Multiple sclerosis MD04 M 56 Multiple sclerosis MD05 F 32 Multiple sclerosis MD06 M 35 Multiple sclerosis MD07 M 41 Multiple sclerosis MD08 F 49 Multiple sclerosis MD09 M 44 Multiple sclerosis MD10 F 41 Multiple sclerosis MD11 M 43 Multiple sclerosis MD12 M 44 Multiple sclerosis MD13 M 52 Multiple sclerosis MD14 F 38 Multiple sclerosis MD15 M 47 Multiple sclerosis MD: motor disabled subjects, M: male, F: female. Figure 3.2: Electrode montages according to the International System 10–10: (A) Asynchrony database (Santamar´ıa-V´azquez et al.,2019a,2022); (B) BCI Web Browser and BCI Social Networks databases (Santamar´ıa-V´azquez et al.,2020b). Ground and reference electrodes are marked in yellow and blue, respectively. Adapted from Mart´ınez- Cagigal (2020). 3.3. EEG recording setup 43 Table 3.3: Demographics and clinical data of the BCI Social Networks database. Identifier Sex Age Condition Control subjects CS33 M 25 Healthy CS34 M 25 Healthy CS35 M 24 Healthy CS36 M 25 Healthy CS37 M 25 Healthy CS38 M 32 Healthy CS39 M 24 Healthy CS40 M 25 Healthy CS41 F 23 Healthy CS42 F 33 Healthy Motor disabled subjects MD16 F 48 Stroke MD17 M 46 Spinal cord injury MD18 F 38 Friedreich’s ataxia MD19 M 39 Spinal cord injury MD20 F 49 Friedreich’s ataxia MD21 M 31 Cerebral palsy MD22 M 52 Cerebral palsy MD23 M 44 Friedreich’s ataxia MD24 M 47 Cerebral palsy MD25 M 67 Cerebral palsy MD26 M 62 Muscular dystrophy MD27 M 47 Muscular dystrophy MD28 F 66 Friedreich’s ataxia MD29 F 40 Friedreich’s ataxia MD30 M 38 Spinal cord injury MD31 M 50 Spinal cord injury MD: motor disabled subjects, M: male, F: female. Table 3.4: Summary of each database. Database CS MD Paradigm SD ISI Channels Asynchrony 22 0 RCP 75 100 16 BCI Web Browser 10 15 RCP 62.5 U(125, 250) 8 BCI Social Networks 10 16 RCP 62.5 U(125, 250) 8 CS: control subjects; MD: motor disabled subjects; RCP: row-col paradigm; SD: stimulus duration in ms, ISI: inter-stimuli interval in ms; Urandomized within uniform distribution. Chapter 4 Methods This chapter describes the methods that have been applied to conduct this doctoral dissertation. First, the signal processing methods are explained, including pre-processing in section 4.1, feature extraction in section 4.2, feature selection in section 4.3, and feature classification in section 4.4. It should be taken into account that in this document we only included the methods that were part of the proposed processing pipelines of each study, leaving out those that were used only for comparison purposes. After the signal processing methods, the performance metrics, statistical methodology and validation strategies that were used in this work are detailed in section 4.5. Finally, the methods and strategies to develop MEDUSA © , our novel BCI platform, are explained in section 4.6. 4.1 Pre-processing Pre-processing is an important step in the analysis of EEG signals, as it helps to clean and prepare the raw data for further analysis. This is crucial because EEG signals often contain a significant amount of noise and artifacts, such as electrical interference, muscle activity, and eye movements. A proper pre-processing can help to remove or reduce these artifacts, improving the overall quality and reliability of EEG data. It can also help to extract relevant features from the EEG signal in further stages of the processing pipeline, such as frequency-based features or time-frequency representations, which can provide valuable information about the underlying brain activity. In this work, we applied two pre-processing techniques to enhance the EEG signals: frequency filtering and spatial filtering. 45 52 Chapter 4. Methods no features that meet the pin and pout criteria; (2) there are no remaining features; or (3) the number of included features reach a predefined limit. It is important to note that in order to prevent an infinite loop, the pin threshold should be at least as small as pout (Jobson,1991). In Santamar´ıa-V´azquez et al. (2019a), SW regression was used with the following criteria: pin = 0.10, pout = 0.15 and a maximum of 60 features. These values were selected in accordance to previous studies (Krusienski et al.,2008). 4.4 Feature classification In this dissertation, we used machine learning algorithms in the feature classification stage to decide the presence/absence of the pattern we are looking for in the EEG and decode the user’s intentions. Thus, it is the final step of the signal processing pipeline in a BCI system. Machine learning is a subfield of artificial intelligence that involves the development of algorithms and models that allow computer systems to learn and improve their performance on a specific task without explicit programming. These algorithms and models are designed to recognize patterns and relationships in data, making predictions or decisions based on that analysis (Bishop and Nasrabadi, 2006). There are several types of machine learning, including supervised learning, unsupervised learning, semi-supervised learning, and reinforcement learning (Bishop and Nasrabadi,2006). In this dissertation, we only applied supervised learning, which is the most robust approach for EEG classification tasks. In supervised learning, the model infers a discriminant function to make predictions based on a labeled dataset, which includes a collection of observations from the phenomena that need to be detected, along with the corresponding correct output for each observation (Bishop and Nasrabadi,2006). The model is then trained by minimizing the error between its predictions and the correct output. In this work, the models were used for two tasks: (1) control state detection to provide an asynchronous control of our ERP-based speller; and (2) command decoding to detect the user’s intentions. The training data consisted of labeled EEG recordings while the user was using the system. For the control state detection, we recorded the brain activity of the subjects while they were using the system and while they were performing other tasks, labeling the control trials as positive, otherwise as negative. For the command decoding task, subjects were asked to spell predefined words using the system, labeling the stimuli that corresponds 4.4. Feature classification 53 to the target character as positive, otherwise as negative. Once the models were trained, the system could classify new online or offline data (Santamar´ıa-V´azquez et al.,2019a,2022,2020b). In the following subsections, the classifiers that were used to implement the proposed methods in this dissertation are described: linear discriminant analysis and EEG-Inception. 4.4.1 Linear Discriminant Analysis Linear discriminant analysis (LDA) is a method to separate observations from different classes using a linear combination of features. In this dissertation, we used this method as a classification technique, although it can be applied for dimensionality reduction too. In the training stage, LDA calculates the linear combination of features that best separates the classes by maximizing the separation between-class mean while simultaneously minimizing the within-class variance. In the testing stage, this linear combination is used to make predictions with new data. For a binary classification problem like the one being considered, the weight vector can be found by solving the following optimization problem (Bishop and Nasrabadi,2006): max J(w) = wTSBw wTSWw,(4.6) SB= (µ2−µ1)(µ2−µ1)T,(4.7) SW=X n∈C1 (Xn−µ1)(Xn−µ1)T+X n∈C2 (Xn−µ2)(Xn−µ2)T,(4.8) where SBis the between-class matrix, SWthe within-class matrix, and µithe mean of class i∈ C{1,2}. Given these equations, the optimal weights are: w∝S−1 W(µ2−µ1).(4.9) Once the optimal vector wis found, it can be used to define a linear decision boundary, which can be written as wTx+b= 0, where bis a bias term. Generally, this term is chosen as the hyperplane between the class means: b=wT·1 2(µ1+µ2). New data points can then be classified by evaluating their position relative to this decision boundary. Points on one side of the boundary belong to one class, while points on the other side belong to the other class. 54 Chapter 4. Methods In order to reduce the over-fitting effect and increase the robustness of the classifier to outliers, there are different regularization techniques that can be applied. A widely used method is to introduce shrinkage to improve the estimation of covariance matrices. This technique increases the generalization performance of the classifier when the number of training samples is small. Generally, the regularized covariance estimator is defined as (Ledoit and Wolf,2004): S∗= (1 −λ)S+λµI, (4.10) µ=Tr(S) Nf ,(4.11) where λ∈(0,1) is the shrinkage parameter, Sis the sample covariance, Iis the identity matrix, Tr represents the sum of the diagonal elements, and Nfis the number of features. In this dissertation, the shrinkage parameter was calculated using the Ledoit and Wolf formula as implemented in the scikit-learn package (Pedregosa et al.,2011). When this technique was applied, we denote to the classifier as regularized LDA (rLDA) (Santamar´ıa-V´azquez et al.,2020b). Finally, it is worth noting that, for the command decoding task, an additional step is needed to decode the command. For each trial, we have (R+C)×NsEEG epochs (i.e., observations), being Rthe number of rows of the RCP matrix, Cthe number of columns, and Nsthe number of sequences. Each epoch corresponds to one stimulus (i.e., highlight of a row or a column). The LDA algorithm then decides, for each observation, whether it contains an ERP with P300 potential (i.e., target epoch) or not. Thus, in order to decide the command, the scores for each row and column are averaged, selecting the pair of them with highest probability for the target class. 4.4.2 EEG-Inception EEG-Inception is a novel CNN that was proposed in Santamar´ıa-V´azquez et al. (2020b) for EEG classification tasks. In comparison to a machine learning classifier, such as LDA, deep learning models incorporate an additional feature extraction stage embedded in the architecture that is automatically optimized during training (Lecun et al.,2015). Concretely, EEG-Inception is a model composed of multiple layers that extract hierarchical representations of the input data. In general, the first layers of the network learn to extract simple, low-level features from the input data. However, as the data passes through the network and it is processed by deeper layers, the features become increasingly abstract and complex, 4.4. Feature classification 55 capturing high-level information about the signal. EEG-Inception was inspired by previous works on the computer vision field, incorporating several concepts from this domain, such as Inception modules and depthwise convolutions, to improve the processing of EEG signals (Santamar´ıa- V´azquez et al.,2020b). Inception modules were proposed by Szegedy et al. (2015) for image classification. This structure uses multiple convolutional layers in parallel with different kernel sizes to perform multiscale analysis of the input signal. This approach has been shown to be effective at extracting rich feature maps with relatively low computational cost, improving performance while maintaining a reasonable training and evaluation time. Inception modules are particularly well-suited for analyzing EEG signals, which are composed of transient and oscillatory patterns of various temporal lengths that reflect brain activity (Santamar´ıa-V´azquez et al.,2020b). Depthwise convolutions were introduce to allow the model to learn more targeted and specialized features in a CNN (Chollet,2015). Standard convolutional layers filter the input data using the same set of weights for all the feature maps. Depthwise convolutions, on the other hand, apply a different set of weights to each feature map. Thus, the model processes each map separately, rather than combining them as in standard convolutions. In EEG-Inception, depthwise convolutions enable the learning of specific features for each feature map extracted by the Inception modules. This is a key feature for the model, as it will be revealed bellow (Santamar´ıa-V´azquez et al.,2020b). Additionally, EEG-Inception incorporates standard methods to increase the performance of the model for EEG processing, including batch normalization to normalize the feature maps (Ioffe and Szegedy,2015), non-linear activation functions (Goodfellow et al.,2016), and dropout regularization (Srivastava et al.,2014) to prevent overfitting. The architecture of EEG-Inception is shown in Figure 4.2, whereas Table 4.1 provides further details about the hyperparameters of each layer. The input expected by the model is the time-based feature array as described in section 4.2.1 with decimation to 128 Hz sampling rate and eight channels Santamar´ıa-V´azquez et al. (2020b). Then, the signal is processed by the model, which is organized in three main blocks, each one with a different purpose. The first module performs a first temporal and spatial analysis of the EEG to extract low-level features in both domains. The second module performs a second analysis that combines the temporal and spatial information to extract high-level features. Finally, the output block is responsible for the final classification of the input signal. In the following 56 Chapter 4. Methods Figure 4.2: Schematic representation of EEG-Inception. 2D convolution blocks and depthwise 2D convolution blocks include batch normalization, non-linear activation and dropout regularization. The kernel size is displayed for convolutional and average pooling layers. sections, the three modules of EEG-Inception are explained in detail: Inception module 1 The first Inception module is designed to perform a first stage of temporal and spatial analysis. The initial 2D convolutions analyze the input signal in the time domain using three branches, each one with a different temporal scale. The temporal scales are defined by the kernel sizes of the 2D convolutional layers: C1, C2 and C3. The kernels sizes of these layers are 64×1, 32×1 and 16×1, respectively. Therefore, given that the sampling rate of the input is 128 Hz, these kernels correspond to temporal windows of 500 ms, 250 ms and 125 ms. Following these layers, D1, D2 and D3 process the signal in the spatial domain using depthwise convolutions. In this architecture, this type of convolutions allow the model to learn optimal spatial filters (i.e., EEG channels weights) for each temporal feature map extracted by previous layers (Santamar´ıa-V´azquez et al.,2020b). Finally, the concatenation layer N1 merges the output features from D1, D2 and D3. Finally, average pooling is applied for dimensionality reduction. Inception module 2 The second module has a similar structure to the previous one. It is formed by three branches that process the feature maps in the same temporal scales: 500 ms, 250 ms and 125 ms. It should be noted that, after the previous average pooling layer (A1), the kernel sizes that correspond to these temporal scales are 16×1, 8×1 and 4×1. As in the first module, the outputs of convolutional layers are 4.4. Feature classification 57 concatenated and average pooling is applied. The purpose of this module is to extract higher level features, already taking into account the temporal and spatial information, which was mixed in the previous module. Output module The final convolutional layers of the model are responsible for identifying the most relevant patterns for the classification task and condensing this information into a small number of features. The dimensionality is reduced by progressively decreasing the number of filters and applying average pooling layers to avoid overfitting. In fact, only 24 features are passed to the final classification layer. Finally, the softmax output performs the binary classification, estimating the probability of each class (Santamar´ıa-V´azquez et al.,2020b). Hyperparameter choice and training process The selection of hyperparameters in deep learning models is critical for achieving good results. For EEG-Inception, we automatically optimized the learning rate, activation function, and dropout rate due to their significant impact on model performance (Santamar´ıa-V´azquez et al.,2020b). Unfortunately, an automatic optimization of all hyperparameters is impractical due to the cost in time and computational resources of this process. Thus, the remaining hyperparameters (e.g., number of layers, number of branches in Inception modules, number of filters, kernel sizes, and pooling sizes) were set based on our experience. The results of the automatic optimization process are detailed in section 5.3.1. Regarding the training process, the model wights were optimized using the Adam algorithm with default hyperparameters β1= 0.9 and β2= 0.999 (Kingma and Ba,2015), the categorical cross entropy loss function (Zhang and Sabuncu, 2018), and a mini-batch size of 1024. The model was trained for a maximum of 500 epochs with early stopping if the loss on the validation set did not improve for 10 consecutive epochs. This early stopping mechanism speeds up training and prevents overfitting (Santamar´ıa-V´azquez et al.,2020b). 58 Chapter 4. Methods Table 4.1: EEG-Inception architecture details Block Type Filters Depth Kernel Padding Output shape Connected to Role IN Input – – – – 128 ×8×1 C1, C2, C3 Input C1 Conv2D 8 – 64 ×1 Same 128 ×8×8 D1 Temporal analysis D1 DepthwiseConv2D – 2 1 ×8 Valid 128 ×1×16 N1 Spatial analysis C2 Conv2D 8 – 32 ×1 Same 128 ×8×8 D2 Temporal analysis D2 DepthwiseConv2D – 2 1 ×8 Valid 128 ×1×16 N1 Spatial analysis C3 Conv2D 8 – 16 ×1 Same 128 ×8×8 D3 Temporal analysis D3 DepthwiseConv2D – 2 1 ×8 Valid 128 ×1×16 N1 Spatial analysis N1 Concatenate – – – – 128 ×1×48 A1 Concatenation A1 AveragePooling2D – – 4 ×1 – 32 ×1×48 C4, C5, C6 Concatenation C4 Conv2D 8 – 16 ×1 Same 32 ×1×8 N2 Temporal analysis C5 Conv2D 8 – 8 ×1 Same 32 ×1×8 N2 Temporal analysis C6 Conv2D 8 – 4 ×1 Same 32 ×1×8 N2 Temporal analysis N1 Concatenate – – – – 32 ×1×24 A2 Concatenation A2 AveragePooling2D – – 2 ×1 – 16 ×1×24 C7 Dimension reduction C7 Conv2D 12 – 8 ×1 Same 16 ×1×12 A3 Temporal analysis A3 AveragePooling2D – – 2 ×1 – 8 ×1×12 C8 Dimension reduction C8 Conv2D 6 – 4 ×1 Same 8 ×1×6 A4 Temporal analysis A4 AveragePooling2D – – 2 ×1 – 4 ×1×6 C7 Dimension reduction OUT Dense – – – – 2 – Softmax output Column ”Type” describes the class used to implement each block in Keras framework. It should be taken into account that this implementation may vary across different frameworks. All convolutional blocks (i.e., Conv2D and DethpwiseConv2D) include batch normalization, activation and dropout regularization. The model has 15154 parameters, of which 14926 are fitted during training. 4.5. Validation 59 4.5 Validation 4.5.1 Performance metrics When an ERP-based speller is validated, there are several ways of measuring its performance. For this reason, different metrics were needed to provide a comprehensive evaluation of the system: 1)Accuracy. This metric represents the percentage of correctly classified trials: Acc = Nct Nt ×100,(4.12) where, Nct is the number of correctly classified trials, and Ntthe total number of trials. In this case, we used this metric to evaluate different aspects of the proposed system. For this reason, several suffixes are used throughout this document to identify these aspects and avoid confusion. Acccsd denotes the accuracy of the control state detection stage, i.e., the percentage of trials in which the user’s control state was correctly identified. As there are two possible states (control or non-control), the chance level is 50%. Acccmd represents the accuracy of the command decoding stage, i.e., percentage of correct selections (letters or commands). In this case, the chance level is 1 Nc×100, where Ncis the number of possible commands in the RCP matrix. Finally, Accovr is the accuracy of the overall asynchronous system, including the control state detection and command decoding stages. To calculate Accovr, a trial is considered correct only if both the control state and the command are accurately detected. 2)Positive predictive value (PPV). This metric represents the probability of having an actual positive case, given a positive prediction: PPV = Ntp Ntp +Nfp ×100,(4.13) where, Ntp is the number of true positives, and Nfp the number of false positives. 3)Negative predictive value (NPV). This metric represents the probability of having an actual negative case, given a negative prediction: NPV = Ntn Ntn +Nfn ×100,(4.14) 60 Chapter 4. Methods where, Ntn is the number of true negatives, and Nfn the number of false negatives. 4)True positive rate (TPR). This metric, also known as sensitivity, represents the probability of a positive result, conditioned on the trial truly being positive: TPR = Ntp Ntp +Nfn ×100,(4.15) where, Ntp is the number of true positives, and Nfn the number of false negatives. 5)True negative rate (TNR). This metric, also known as specificity, represents the probability of a negative result, conditioned on the trial truly being negative: TNR = Ntn Ntp +Nfp ×100,(4.16) where, Ntn is the number of true negatives, and Nfp the number of false positives. 6)Information transfer rate (ITR). The ITR takes into account not only the command decoding accuracy, but also the speed of the system. Using the Shannon’s information theory, the ITR estimates the number of bits per minute that the system is able to convey (Wolpaw et al.,2002): ITR = 1 Tlog2N+Plog2P+ (1 −P) log2 1−P N−1,(4.17) where Nis the number of trial selections, Pis the selection accuracy (i.e., Acccmd for synchronous systems, and Accovr for asynchronous systems), and Tsis the average duration of a trial in seconds. 4.5.2 Statistical analysis Statistical tests are applied to make a fair comparison between two groups of results and extract the correct conclusions from the analysis. These tests evaluate the evidence provided by the data against a null hypothesis H0. The p-value returned by the test represents the probability of getting the observation assuming that H0 is true. If this probability is lower than a certain threshold α, it is considered that H0is false. A typical value for αis 0.05, representing a probability of 5%. When these tests are applied for group comparison, H0assumes that there are no 4.5. Validation 61 differences between the two groups of data. If H0is rejected, then we can talk about significant differences (Narsky and Porter,2013). In this dissertation, we applied two continuous, univariate, non-parametric statistical tests. In this regard, we used non-parametric tests because variables under study did not passed normality and/or homoscedasticity tests (Jobson,1991). First, the Wilcoxon signed-rank test was used to assess paired comparisons (i.e., dependent samples that came from the same subjects) to analyze the statistical differences between the proposed pipelines and the previous methods in Santamar´ıa- V´azquez et al. (2019a,2022,2020b). On the other hand, the Mann-Whitney U test, also known as the Wilcoxon rank-sum test, was used for unpaired comparisons (i.e., independent samples that came from different subjects) (Santamar´ıa-V´azquez et al.,2022). When multiple tests were performed (e.g., comparisons among several models, for different number of sequences, etc), multiple testing correction was applied to correct the false discovery rate (FDR) using the Benjamini-Hochberg approach (Benjamini and Hochberg,1995). 4.5.3 Cross-validation Fundamentally, cross-validation techniques are used to assess the generalization ability of the results achieved by a classification algorithm. In other words, crossvalidation allows to evaluate if a model can generalize to an independent dataset, which is not assured if the training samples are not representative (Bishop and Nasrabadi,2006). In this dissertation, we used leave-one-out (LOO) cross validation in Santamar´ıa-V´azquez et al. (2019a,2022,2020b) to test the models in the different classification tasks. This method is a particularization of the k-fold cross-validation, keeping in each iteration one sample (or subject) for testing, whereas the rest of the dataset is used for training. This process is repeated for every observation in the dataset, so that each sample is used once as the test set. Then, the classification results are used to calculate the performance of the model using different metrics (e.g., accuracy). This technique provides an adequate estimate of the generalization ability of the model when the model is applied to new, unseen data without the need of a separate validation set (Bishop and Nasrabadi,2006). LOO can be computationally expensive, especially for large datasets, but it is a robust technique for evaluating models with small sample sizes. It is also useful when the dataset is unbalanced, having different number of observations for each class (Bishop and Nasrabadi,2006). 68 Chapter 5. Results Figure 5.2: SSVEPs for different stimulation frequencies. Graphs on the left show the grand average of the PSD for all trials, channels and participants. Topographic plots on the right show the normalized peak value of the PSD at the stimulation frequency averaged for all trials and participants. Figure 5.3: Temporal and spectral representation of the ERPs in overt, covert, control and non-control modes for participant S01. The upper part of the figure shows the averaged epochs (i.e., 1000 ms after stimuli) in channel Cz. The shaded area represents the 95% confidence interval. The bottom part of the figure shows the averaged PSD in channel Cz. The stimulation frequency in overt and control modes was 5.71 Hz. EEG signal corresponding to one trial from the first stimulus of the first sequence to the last stimulus of the last sequence. When the control state is detected (y= 1), the system continues to the command decoding pipeline and performs a selection. Conversely, when the non-control state is detected (y= 0), no further actions are taken and a new trial begins. In order to train and test the algorithm, we performed experiments with 15 subjects of the Asynchrony database, as detailed in section 3.2. Regarding the configuration of the system, we used a SD of 75ms and an ISI of 100ms, which gives a SOA of 175ms (see 3.2). Therefore, the corresponding stimulation frequency 5.2. Oddball Steady Response Detection (OSRD) method 69 of the RCP was fst = 1/SOA = 5.71 Hz. The signal processing methods that compose the OSRD method were explained in section 4, but there are some details that must be further specified. For the pre-processing, OSRD applies bandpass FIR filtering between [fst −1, fst + 1] Hz, where fst is the stimulation frequency (i.e., 5.71 Hz), and CAR spatial filtering . The features that were extracted for each control and non-control trial were the frequency- and correlation-based features that were explained in sections 4.2.2 and 4.2.3, respectively. We proposed two approaches to calculate the features. The first and most classical one used control and non-control trials to calculate the training and testing observations. On the other hand, the second approach used synthetic non-control observations from control trials, avoiding de need of recording noncontrol trials and thus reducing the calibration time of the OSRD method by half. This approach assumes that the characteristics of the EEG around f′ st for control trials are the same as around fst for non-control trials, being f′ st =fst + 0.5 Hz. In this case, non-control observations can be simulated by calculating the features with control trials, but using f′ st. Finally, the features were classified using LDA, as explained in section 4.4.1. This model was trained with control and real non-control/synthetic non-control observations. In this study, we also applied a classical and widely used processing pipeline for the command decoding task in RCP spellers (Krusienski et al.,2008). This pipeline is independent of the OSRD method. The pre-processing consisted on FIR filtering between 1 and 10 Hz and CAR spatial filtering . The feature-extraction stage used time-based features (see 4.2.1), with sub-sampling to 20 Hz, epochs of 800 ms from the stimulus onset, and baseline correction using the signal 250 ms prior to stimulus onset. The 60 most relevant features were selected using SW as explained in section 4.3.1, and the final ERP classification was performed with LDA. The algorithm selected the command corresponding to the row and column that reached the highest score in the classification stage (Santamar´ıa-V´azquez et al.,2019a). In sections 5.2.1 and 5.2.2, the results of the experiments that were performed to validate the OSRD method are presented. 5.2.1 Offline experiment The offline experiment was designed to assess the performance of the OSRD method, validate the synthetic non-control observations approach, and gather data to train the OSRD method for the online experiment. 70 Chapter 5. Results The 15 participants completed two sessions, each one with five control and five non-control runs of six trials. The control runs required the participants to spell six random characters using a 6×6 RCP matrix, while the non-control runs required them to ignore stimuli while watching a video or reading a text. The experiment setup is depicted in Figure 5.4. Therefore, the dataset of the offline experiment had 60 control trials and 60 non-control trials per participant. Two analyses were conducted to evaluate the OSRD method and validate the synthetic noncontrol observations approach. The first analysis applied LOO cross-validation (see section 4.5.3) to the entire dataset for each participant (i.e., 119 trials for training, 1 for testing), using both control and non-control trials. The second analysis modified the evaluation procedure by training the OSRD method on synthetic noncontrol observations, which were created from control trials following the process explained above. Importantly, the testing synthetic non-control observations were replaced by actual non-control observations in each iteration of the LOO process, providing a realistic estimation of the model’s performance. The results of these analyses are summarized in Table 5.2. The test accuracy in the control state detection task using the OSRD method is shown for 1, 5, 10 and 15 sequences, breaking down the results using real and simulated noncontrol observations for training. As can be seen, the OSRD method achieved a high accuracy, reaching values near 90% with only five sequences of stimulation. Additionally, we analyzed the differences between the real and synthetic noncontrol observations approaches with Wilcoxon signed-rank test, correcting the FDR with the Benjamini-Hochberg approach, as described in section 4.5.2. We did not found statistical differences, which validates the use of synthetic non-control observations to reduce the calibration time of the asynchronous system. 5.2.2 Online experiment The online experiment was designed to evaluate the efficacy of OSRD in a more real scenario. To this end, the same participants of the offline experiments performed a third session. In this session, they were asked to make four runs of six selections each (i.e., 24 trials) using the same 6×6 RCP matrix. The participants had to attend stimuli the first three trials of each run, while they had to ignore the stimuli in the others. For each trial, the control state was determined using the OSRD method. Afterward, the command was selected by applying the command decoding pipeline. Of note, the system only selected a command if control state was determined by 5.2. Oddball Steady Response Detection (OSRD) method 71 Figure 5.4: Experimental setup. (a) Depicts a schematic representation of the subject and the two screens. The left screen displayed the browser used during the non-control runs while the speller was shown on the right screen. The paradigm was active during both tasks, but subjects were only required to pay attention to the stimuli during the control runs. (b) Shows the experiment plan, which was made up of two sessions, each with 10 runs of 6 trials and 15 sequences. Control and non-control runs were alternated to prevent subject fatigue. Table 5.2: Results of the offline experiment No. Sequences 1 5 10 15 R S R S R S R S U01 55.0 54.2 84.2 85.0 98.3 98.3 99.2 99.2 U02 60.8 59.2 88.3 89.2 95.8 95.8 97.5 97.5 U03 63.3 64.2 94.2 95.0 97.5 97.5 100 100 U04 64.2 64.2 83.3 84.2 96.7 95.8 99.2 99.2 U05 61.7 60.8 87.5 87.5 96.7 96.7 97.5 98.3 U06 65.8 64.2 95.8 95.0 96.7 96.7 98.3 98.3 U07 56.7 58.3 75.0 75.8 79.2 76.7 87.5 86.7 U08 63.3 62.5 97.5 97.5 100 100 100 100 U09 61.7 60.0 89.2 88.3 91.7 92.5 95.0 97.5 U10 50.8 50.0 80.8 80.0 88.3 89.2 88.3 88.3 U11 65.0 65.8 91.7 91.7 100 100 100 100 U12 60.0 61.7 79.2 80.0 86.7 85.8 92.5 92.5 U13 65.0 65.0 79.2 78.3 90.0 90.0 95.0 95.0 U14 60.0 56.7 94.2 95.0 99.2 98.3 100 100 U15 73.3 72.5 96.7 96.7 99.2 99.2 100 100 Mean 61.8 61.3 87.8 87.9 94.4 94.2 96.7 96.8 ±SD 5.0 5.2 7.0 6.9 5.8 6.2 4.1 4.2 Control state detection accuracy (Acccsd). R: training and testing with real non-control observations, S: training with synthetic non-control observations and testing with real non-control observations. the OSRD method previously. The control state detection and command selection stages were calibrated using the 60 control trials that were collected in the offline experiment for each participant. Therefore, we used synthetic observations to calibrate the OSRD method for the online session. The number of stimulation sequences for each participant was determined as the minimum to reach a training accuracy of 95% in command selection. If a participant could not reach this threshold, the number of sequences was set to 15. The results of this analysis are summarized in Table 5.3. This table provides a detailed description of the system’s performance. Results for the control state 72 Chapter 5. Results Table 5.3: Results of the online experiment NsControl State Detection Overall Acccsd PPV NPV TPR TNR Accovr ITR U01 10 100 100 100 100 100 91.7 12.4 U02 10 95.8 100 92.3 91.7 100 91.7 12.4 U03 8 100 100 100 100 100 95.8 16.8 U04 10 91.7 100 85.7 83.3 100 91.7 12.4 U05 12 91.7 100 85.7 83.3 100 83.3 8.7 U06 10 95.8 100 92.3 91.7 100 91.7 12.4 U07 15 95.8 92.3 100 100 91.7 95.8 9 U08 8 95.8 92.3 100 100 91.7 95.8 16.8 U09 12 95.8 92.3 100 100 91.7 95.8 11.2 U10 15 91.7 91.7 91.7 91.7 91.7 91.7 8.2 U11 10 95.8 100 92.3 91.7 100 95.8 13.4 U12 10 91.7 91.7 91.7 91.7 91.7 91.7 12.4 U13 8 100 100 100 100 100 100 18.5 U14 12 95.8 100 92.3 91.7 100 91.7 10.3 U15 10 95.8 92.3 100 100 91.7 83.3 10.5 Mean 10.7 95.5 96.8 94.9 94.5 96.7 92.5 12.4 ±SD 2.1 2.8 3.9 5.2 5.8 4.1 4.4 2.9 Ns: number of sequences; Acccsd: accuracy of the control state detection stage; PPV: positive predictive value; NPV: negative predictive value; TPR: true positive rate; TNR: true negative rate; ACCovr : accuracy of the overall system; ITR: information transfer rate (bits/min). detection stage include Acccsd, PPV, NPV, TPR and TNR achieved by OSRD method during the online sessions. In this analysis, control state has been considered as the positive class and the non-control state as the negative class. Results of the overall system include the control state detection and command detection stages. Hence, control trials were considered correct whether the control state and the command were correctly determined at the same time. For the overall system, ACCovr and ITR are given. The table shows that the system achieved high accuracy in both tasks, reaching 92.5% for the asynchronous speller. 5.3 Command decoding with EEG-Inception In Santamar´ıa-V´azquez et al. (2020b), we focused on the ERP detection problem to improve the command decoding accuracy of our asynchronous ERP-based speller. In this study, we proposed a novel deep-learning model, called EEG-Inception, which was described in section 4.4.2. The model was evaluated in an experiment simulating a realistic scenario, taking into account that the amount of training data from a single subject is limited in real-life settings, and that the target users of ERP-based spellers are severely disabled people. Additionally, we compared EEG-Inception with five previous methods: rLDA (Krusienski et al.,2008), xDAWN + RG (Barachant et al.,2012), CNN-BLSTM (Santamar´ıa-V´azquez et al.,2019b), DeepConvNet (Schirrmeister et al.,2017) and EEGNet (Lawhern et al.,2018). 5.3. Command decoding with EEG-Inception 73 Figure 5.5: Workflow of the study. First, the hyperparameter optimization process for EEG-Inception was done based using the validation set. Then, the models were trained using the training set. Finally, they were evaluated in the test set using a fine-tuning process for each subject. Fine-tuning trials were randomly selected, and the process is repeated 100 times for each Nand subject. For the evaluation experiment, we used the three databases that were detailed in section 3.2. The dataset was split in three. Of the 42 healthy subjects, 33 (i.e., 80%) were assigned to the training set, and 11 to the validation set (i.e., 20%). The remaining 31 severely disabled subjects from the BCI Web Browser database and the BCI Social Networks database were assigned to the test set in order to achieve a more realistic estimation of the performance of the model in this population. The hyperparameter optimization process and the evaluation experiment are detailed in sections 5.3.1 and 5.3.2. The Figure 5.5 shows a schematic representation of the process followed to perform these analyses. 5.3.1 Hyperparameter optimization We optimized the learning rate (lr), activation function (fact) and dropout rate (pdrop) of EEG-Inception using the validation set. The search space for each hyperparameter was: lr ={0.01,0.001,0.0001};fact ={Sigmoid,ReLU,ELU}; pdrop ={0.00 : 0.05 : 0.5}. The Figure 5.6 depicts the results of this optimization process. The score is the command decoding accuracy in the validation set. The optimal values for each hyperparameter were chosen by identifying the set that resulted in the highest score. The optimal set was lr = 0.001; fact =ELU;pdrop = 0.25. The results also showed that the activation function and learning rate had great impact in the performance of EEG-Inception, whereas dropout rates between 0.1 and 0.4 yielded 74 Chapter 5. Results Figure 5.6: Results of the optimization process of EEG-Inception in the validation set (8 healthy subjects). Each line depicts the mean command decoding accuracy after a fine-tuning process for each subject with N= 30, considering 5 sequences of stimulation. (a) Score for each activation function and dropout rate using the best value of learning rate (lr = 0.001). (b) Score for each learning rate and dropout rate using the best activation function (ELU). similar results. 5.3.2 Evaluation experiment The performance of EEG-Inception and the comparison models was assessed with the evaluation experiment. Firstly, all models were trained using the training set. Then, we evaluated all the models in the test set using a fine-tuning process for each subject with N={0,5,10,20,30}trials. When N= 0, the models were directly evaluated on the test set, simulating a plug & play device. This allows us to assess their robustness to inter-subject variability. For N > 0, the models were fine-tuned. First, the algorithm picked Ntrials from each test subject randomly. Then, the model, which is already initialized with the training set, fits the data from these trials. Finally, the fine-tuned model is tested with the rest of trials of the test subject. This process was repeated 100 times for each value of Nand subject, and the results were averaged to obtain a final performance measure. The evaluation experiment was designed to mimic a real-life scenario, where the calibration time should be under 20 minutes of effective training (or approximately 30 trials) to maintain a suitable usability. In this regard, excessively long calibration times can negatively impact the usability of an ERP-based speller (Mart´ınez-Cagigal et al.,2017). Our training approach, which combines crosssubject transfer learning with fine-tuning, aims to reduce the required calibration 5.4. Control state detection with EEG-Inception 75 Figure 5.7: ITR: information transfer rate; N: number of fine-tuning trials. ITR in bits/min in the test set (31 motor disabled subjects) as a function of Nand the number of sequences. time and prevent overfitting. Moreover, the distribution of the dataset for the evaluation experiment, with all the severely disabled subjects in the test set, allowed us to evaluate the effectiveness of the proposed model and training strategy for end users of ERP-based spellers. Table 5.4 summarizes the results of the evaluation experiment, showing the command decoding accuracy of the models in the test set for each number of finetuning trials and sequences considered to make the prediction. The last column provides the improvement achieved by EEG-Inception with respect to the rest of models. This improvement was calculated as the mean difference in the command decoding accuracy. Wilcoxon Signed-Rank Test was used to assess the statistical difference between the performance of EEG-Inception and the other models, correcting the FDR with the Benjamini-Hochberg approach, as detailed in 4.5.2. On the other hand, the Figure 5.7 shows the simulated ITR of the models. As can be seen, EEG-Inception clearly outperformed the rest of models, reaching the highest performance for command decoding accuracy and ITR. Moreover, this improvement was significant (p-value <0.01), regardless of the number of fine-tuning trials and sequences considered in the analysis. 5.4 Control state detection with EEG-Inception In Santamar´ıa-V´azquez et al. (2020b), we focused on increasing the command decoding accuracy of our ERP-based speller with EEG-Inception. However, we did not address the control state detection problem. EEG-Inception could be complemented with the OSRD method to provide an asynchronous control. However, after the impressive results of this CNN in the ERP detection task, our goal was to achieve similar improvements in the control state detection stage. Consequently, we continued with this line of research in Santamar´ıa-V´azquez et al. (2022). Unlike 76 Chapter 5. Results Table 5.4: Command decoding accuracy No. Sequences NModel 1 5 10 15 Imp. 0 rLDA 14.6 ±8.6 33.1 ±20.4 40.3 ±24.2 43.7 ±25.1 14.7 xDAWN + RG 17.9 ±9.2 37.5 ±19.6 46.2 ±22.8 49.7 ±23.4 9.6 CNN-BLSTM 19.6 ±8.8 42.7 ±19.8 53.6 ±22.0 57.2 ±22.5 3.7 DeepConvNet 20.7 ±9.8 42.0 ±20.8 53.2 ±23.4 56.9 ±23.7 4.0 EEGNet 19.5 ±9.5 42.3 ±21.0 51.9 ±23.2 56.5 ±23.3 4.6 EEG-Inception 21.3 ±9.9 46.1 ±21.1 57.4 ±23.7 61.4 ±23.8 — 5 rLDA 18.6 ±8.6 41.7 ±18.7 53.4 ±20.3 58.2 ±20.0 16.0 xDAWN + RG 20.6 ±8.9 47.3 ±19.6 59.0 ±20.5 63.4 ±19.9 10.7 CNN-BLSTM 24.3 ±10.3 52.7 ±19.8 64.7 ±20.2 68.5 ±19.4 5.6 DeepConvNet 23.8 ±10.3 53.2 ±20.5 64.3 ±21.3 68.3 ±20.4 5.7 EEGNet 23.8 ±9.8 53.0 ±20.2 65.3 ±20.8 69.4 ±20.1 5.1 EEG-Inception 26.4 ±10.8 58.7 ±19.4 70.7 ±18.8 74.6 ±17.2 — 10 rLDA 22.0 ±10.0 50.4 ±19.5 63.5 ±20.3 68.2 ±19.2 11.6 xDAWN + RG 24.1 ±9.8 54.9 ±19.4 67.2 ±19.1 71.5 ±17.8 7.7 CNN-BLSTM 25.9 ±10.7 56.0 ±19.9 68.3 ±19.5 72.1 ±18.5 6.7 DeepConvNet 26.4 ±11.0 58.4 ±20.3 69.6 ±20.1 73.3 ±18.8 5.2 EEGNet 26.1 ±10.2 58.2 ±19.8 70.6 ±19.6 74.5 ±18.3 4.8 EEG-Inception 28.8 ±11.1 63.6 ±18.7 75.3 ±17.6 78.9 ±15.5 — 20 rLDA 25.1 ±11.0 56.7 ±19.6 69.9 ±19.6 74.6 ±17.8 9.9 xDAWN + RG 26.4 ±10.4 60.1 ±18.3 72.3 ±17.3 76.4 ±15.6 7.2 CNN-BLSTM 27.5 ±11.2 60.1 ±19.2 72.3 ±18.1 75.7 ±16.8 7.2 DeepConvNet 28.9 ±11.6 62.7 ±19.6 73.7 ±18.7 77.1 ±17.0 5.6 EEGNet 28.8 ±10.7 63.2 ±18.8 75.6 ±17.9 79.1 ±16.2 4.3 EEG-Inception 32.0 ±12.1 68.4 ±17.9 79.4 ±16.0 82.8 ±13.7 — 30 rLDA 26.2 ±11.2 59.5 ±19.3 72.7 ±19.0 77.3 ±16.9 9.4 xDAWN + RG 27.3 ±10.6 62.0 ±17.9 74.2 ±16.5 78.2 ±14.9 7.5 CNN-BLSTM 29.0 ±11.5 62.6 ±18.9 74.4 ±17.4 77.7 ±16.0 7.2 DeepConvNet 29.8 ±11.8 64.9 ±19.1 75.8 ±17.9 79.0 ±16.3 5.7 EEGNet 30.4 ±11.3 65.7 ±18.6 77.8 ±17.2 81.0 ±15.5 4.3 EEG-Inception 33.7 ±12.4 70.6 ±17.4 81.5 ±15.3 84.6 ±13.2 — N: number of fine-tuning trials for each subject. Command decoding accuracy (Acccmd) averaged over the test set subjects (31 motor disabled). Column ”Imp.” shows the accuracy improvement (%) yielded by EEG-Inception compared to the other 5 models, calculated as the mean difference in command decoding accuracy for each N. Statistical differences between EEG-Inception and the other models were assessed with Wilcoxon Signed Rank Test, correcting the FDR with Benjamini-Hochberg approach, as described in section 4.5.2. All comparisons were significant (p-value <0.01), regardless of Nand the number of sequences. earlier deep-learning approaches for ERP classification, EEG-Inception allows the analysis of EEG signals in multiple temporal scales (Santamar´ıa-V´azquez et al., 2020b). This could enhance the model’s versatility, making it more adaptable to a wider range of tasks. Therefore, our hypothesis was that this architecture could be leveraged to provide a reliable asynchronous control of ERP-based spellers, targeting different EEG patterns linked to the control of these systems, such as SSVEPs elicited by the RCP (Santamar´ıa-V´azquez et al.,2019a), or differences in the complexity of the EEG due to the user’s concentration, especially in the prefrontal cortex (Mart´ınez-Cagigal et al.,2019b). In this regard, neither EEG- 5.4. Control state detection with EEG-Inception 77 Inception nor any other deep-learning model had yet been used to discriminate the user’s control state in ERP-based spellers. To test this hypothesis, we performed an experiment designed to evaluate the performance of EEG-Inception for this task. First, we extended the Asynchrony database, which had 15 subjects at that moment, to reach 22 subjects, following the same protocol as in the OSRD study. This protocol is described in section 5.2.1. Then, we adapted the signal processing pipeline presented in Santamar´ıa-V´azquez et al. (2020b) to facilitate the integration of EEG-Inception for this control state detection. This pipeline used the same features for the control state detection and command decoding tasks. The pre-processing stage applied FIR filtering between 0.5 and 45 Hz to keep as much discriminative information as possible. Then, a CAR spatial filtering was used to remove noisy artifacts. The features were calculated as described in 4.2.1. We applied decimation to 128 Hz and extracted the epochs from 0 to 1000 ms after the onset. Baseline correction was performed taking a window of 250 ms before the stimulus. Thus, the feature array had 128 samples ×8 channels, which are the input dimensions required by EEG-Inception (Santamar´ıa-V´azquez et al.,2020b). Considering that the experiment had 2 sessions of 10 runs, with 6 trials of 15 sequences per run, the number of observations for each subject was 21,600. Then, the total number of EEG epochs for the 22 subjects was 475,200. Finally, two different EEG-Inception instances are used for each of the two classification tasks. The control state detection stage dynamically turns the system into an asynchronous BCI. The workflow in this stage for each trial was as follows: (1) the epochs are classified with the model trained to discriminate the control state; (2) the model returns the probability of each state for every observation; and (3) the probabilities are averaged, determining non-control state when the score is less than 0.5 and control state otherwise. If the trial is classified as non-control, the system starts a new trial without taking further actions. On the other hand, if the trial is classified as control, the system continues to the command decoding stage. Note that the algorithm operates under the assumption that all observations within a given trial have the same control state. Consequently, users are advised to avoid switching tasks until the current trial has been completed. This will ensure that the proposed method can analyze the data accurately and provide reliable results. Once the control state was determined for a trial, the other instance of EEG- Inception is used to decode the command. This model was trained to detect P300 potentials. Thus, it discriminates between target and non-target epochs of the 84 Chapter 5. Results Figure 5.11: Schematic overview of MEDUSA © . EEG: electroencephalography; ECG: electrocardiography; EMG: electromyography; LSL: lab-streaming layer. An arbitrary number of input signals can be received in the platform through the LSL. These signals are available for real-time charts and apps, which implement open-loop or closed-loop BCI and neuroscience experiments. In this case, we represent the row-column paradigm (RCP) app. Functions from the Kernel may be used for signal processing in real-time charts and apps. In this example, the model detects the event-related potentials (ERP) in the EEG. reproduce exactly the same results in online and offline experiments, which facilitates the reproducibility of a research experiment. Finally, it should be noted that community contributions are welcome. For more information, check the official documentation page at https://docs.medusabci.com/kernel, where the API reference, hands-on tutorials, and the contributor’s guide can be found. 5.5.2 MEDUSA © Platform MEDUSA © Platform has a flexible and adaptable architecture that can be used for a wide range of BCI and neuroscience experiments. Its architecture has three modules: signal acquisition, real-time charts, and apps. The functionalities of these modules can be controlled through a user-friendly GUI that provides a quick and intuitive control of the software. A schematic overview of all the components of MEDUSA © is shown in Figure 5.11. Additionally, the main window of MEDUSA © Platform is shown in Figure 5.12. The official documentation can be found at https://docs.medusabci.com/platform, where some hands-on tutorials, and the contributor’s guide can be found. 5.5. MEDUSA © : our novel BCI platform 85 Figure 5.12: Main window of MEDUSA © Platform. The view is divided in panels to control the different functionalities. These panels are: apps (up-left), log (bottom-left) and real-time plots (right). Additionally, more controls and configurations are available in the task bars. Signal acquisition MEDUSA © Platform manages the incoming data using the lab-streaming layer (LSL) protocol (Kothe,2014). This open-source protocol handles the networking, time-synchronization and real-time propagation to allow the transmission of time series data, making our solution independent of the data recording hardware. Additionally, the signal acquisition module wraps the LSL protocol with high-level functionalities to offer advanced data acquisition features. In order to connect a device with MEDUSA © Platform, an LSL bridge (i.e., independent program or script) is needed to receive data using the specific interface of the device and send it through LSL. Then, MEDUSA © Platform can be configured to receive the stream. Once the stream has been added to the platform’s workspace, it is available for the other modules. An important detail is that the signal acquisition module is able to manage several LSL streams at the same time, which is useful in a wide variety of experiments (e.g., synchronous recording of ECG and EEG, implementation collaborative/competitive BCIs). The LSL protocol is widely used in many research laboratories around the world to record biological signals, having a large community of users and developers. Thus, most commercial EEG recording devices (e.g., g.tec, Brain Products, Neuroscan) have ready-to-use LSL bridges compatible with MEDUSA © Platform. 86 Chapter 5. Results If a device does not have this support yet, it is possible to create an LSL bridge to connect the device to LSL. These features make LSL an ideal technology for the signal acquisition module of MEDUSA © Platform, allowing it to offer advanced functionality compared to other available solutions. Real-time charts MEDUSA © Platform includes time and frequency of charts for visualizing LSL streams in real time using PyQtGraph (Luke Campagnola,2020), an open source Python package optimized for real-time representations. The panel can be customized to fit various charts that can be adapted to different situations. Temporal charts display the time courses of signals in real time. Both single and multi-channel charts are supported, with options for pre-processing the signal before representation, adjusting the display time, reducing computational cost through decimation, scaling the display, and customizing the graphical user interface (e.g., line width, colors, etc.). Frequency charts estimate the PSD of the signal using the Welch method in real time. This lightweight algorithm allows for smooth, real-time visualization of single or multi-channel signals. The charts can be configured with various parameters, such as spectral resolution, overlap, and segment length. These charts provide an alternative way to visualize data and can be used to identify specific features in the signal, noisy components, or sensor malfunctions, among others. Apps Apps are the most crucial components of MEDUSA © Platform. These programs carry out tasks or stimulation paradigms, while simultaneously providing real-time feedback and monitoring one or more signals. The platform’s architecture has been structured to allow independence between the apps and the other modules. This design enables the development of new apps as needed, without requiring changes to the base code of the platform, increasing the scalability of out solution. Additionally, the software offers generic workflows that can be used in most BCI and neuroscience experiments, which facilitates the implementation of new apps MEDUSA © . MEDUSA © platform supports apps based on Qt and Unity to handle graphical part of the app (e.g., visual stimuli and feedback presentation). Qt is a C++ library with official Python bindings that is commonly used for developing GUI applications. It offers a wide range of predefined widgets and functions, making it 5.5. MEDUSA © : our novel BCI platform 87 Figure 5.13: Screenshots of some MEDUSA © apps. (a) row-column paradigm (RCP) speller, (b) code-modulated visual evoked potentials (c-VEP) speller, (c) Motor imagery paradigm, (d) Jedi cube scenario from the neurofeedback app, (e) Luke’s spaceship scenario from the neurofeedback app, (f) Neurorunner scenario from the neurofeedback app, (g) Digit Span test from the Neuropsychological evaluation app (h) Corsi Block-Tapping test from the Neuropsychological evaluation app, (i) Dual N-Back test from the Neuropsychological evaluation app. suitable for quickly creating simple apps. However, it does not offer precise refresh rates and time synchronization, which can be important for certain experiments (e.g., c-VEP or SSVEP spellers). On the other hand, Unity is a powerful graphics engine with advanced options for GUI control, 3D modeling, and animations. It requires coding in C#, its native programming language, and is more complex to use for visual applications and games. However, it does provide precise control over refresh rates, making it suitable for advanced BCI applications. The communication between Unity and MEDUSA © is handled through a multi-client asynchronous TCP/IP protocol. Currently, MEDUSA © platform offers six ready-to-use apps:  Recorder. This app is designed to simplify the process of recording biosignals by providing a generic open-loop system. It allows users to define custom conditions (e.g., eyes closed, eyes open) and events (e.g., movement, blink) and create a recording plan to automatize experiments. 88 Chapter 5. Results  RCP speller. The RCP speller app implements the ERP-based BCI that has been developed in this dissertation. First, it allows to configure all the important parameters: stimulus duration, inter-stimulus interval, text or icon commands, flashing colors or command functions. The app also allows to configure the number of commands, including nested matrices to design complex menus for practical applications. Regarding the signal processing methods, all the models that have been presented in this document are included. For the command decoding task, the available models are the pipelines based on rLDA (Santamar´ıa-V´azquez et al.,2020b), EEGNet and EEG-Inception (Santamar´ıa-V´azquez et al.,2020b). For the control state detection task, we included OSRD (Santamar´ıa-V´azquez et al.,2019a) and the pipeline based on EEG-Inception (Santamar´ıa-V´azquez et al.,2022). Figure 5.13(a) shows a screenshot of this application.  c-VEP speller. The c-VEP speller app is, to the best of our knowledge, the only available open-source implementation of this BCI paradigm. It allows the customization of the number of commands, sequence stimulation rate, sequence length, flashing colors and signal processing methods. It also includes different binary m-sequences with different lengths which are automatically encoded using circular-shifting. The default command decoding pipeline uses a filter bank, epoch averaging and CCA to compute command templates (Mart´ınez-Cagigal et al.,2021). Figure 5.13(b) shows a screenshot of this app.  Motor imagery. The MI app presents feedback to the user (e.g., a colored sphere and a sliding bar) depending on the detected class. It allows to configure different parameters, such as preparation, trial or rest times. The app includes two classification pipelines: CSP + rLDA (Fu et al.,2019) and EEGSym (P´erez-Velasco et al.,2022). The latter model includes an initialized version of EEGSym trained with data from 280 subjects that allows to start controlling the app without prior calibration with an expected accuracy above 80% (more information in (P´erez-Velasco et al.,2022)). The MI application also implements a tool to visualize the ERD/ERS events associated to MI. Figure 5.13(c) shows a screenshot of this app.  Neurofeedback. This app includes three different scenarios to enable the design of progressively more challenging NF protocols. Each scenario has a unique, gamified design to keep users motivated and engaged throughout the study (Roc et al.,2021). It also allows users to easily set up all the key 5.5. MEDUSA © : our novel BCI platform 89 parameters of a NF study, including the feedback rate, the brain activity to be trained (using metrics based on band powers or connectivity between different regions), and the difficulty of the training. Figures 5.13(d), 5.13(e) and 5.13(f) show screenshots of the three training scenarios contained in this app.  Neuropsychological evaluation tasks. Included in this package, there are six apps that implement computerized versions of widely used neuropsychological tests: Dual N-Back (Jaeggi et al.,2010), Stroop task (MacLeod, 1991), Digit Span test (Ockelford,2002), Corsi Block-Tapping test (Kessels et al.,2000) and Go/No-go task(Verbruggen and Logan,2008). These apps alllow to record biosignals while the users are using doing the tests, allowing to study the physiological response to this work. Figure 5.13(g), 5.13h, and 5.13(i) show screenshots of three of these test. Additionally, it is worthy to mention that MEDUSA © Platform is also designed to enable the creation of custom experiments. To make this easier, the platform provides Qt- and Unity-based templates to simplify the design and development of new apps, with a generic workflow that can be applied in most experiments. The platform’s official documentation includes a comprehensive guide on how to design and develop apps for MEDUSA © , including real examples. These apps can then be shared through the official app market at https://www.medusabci.com/market. Chapter 6 Discussion In this dissertation, we have examined various challenges associated with current BCIs and proposed solutions to address these issues. On one hand, we focused on the development and optimization of signal processing techniques for ERP-based spellers. The goal was to improve the performance of these systems by refining the methods used to process and interpret the EEG data they rely on. Firstly, we explored the effects of non-target stimuli in these systems to propose a novel method, called OSRD, for the control state detection task. This method was tested with 15 subjects, showing a suitable asynchronous management of the speller. Afterwards, we developed EEG-Inception for P300 classification to improve the performance of the system in the command decoding task. This CNN model was trained and tested with a database of 73 subjects, including 42 severely disabled, outperforming the previous approaches. Finally, we implemented a novel method that used EEE-Inception to provide an asynchronous control of our system. This last method was tested in 22 subjects, showing outstanding results. Noteworthy, this was the first asynchronous ERP-based speller that used a fully deep-learning approach for the command decoding and control state detection tasks. On the other hand, we developed a novel software ecosystem to accelerate BCI and neuroscience research called MEDUSA © . With this platform, we aimed to simplify the development and distribution of BCI experiments and signal processing methods. In this chapter, the main outcomes of this doctoral dissertation are discussed. Additionally, the main limitations of the conducted research are presented in the last section. 91 92 Chapter 6. Discussion 6.1 SSVEP elicited by non-target stimuli from ERP-based spellers As explained in section 1.4.1, providing a suitable asynchronous control of BCIs for communication and control in general (e.g., SSVEP-based spellers, c-VEP- based spellers), and ERP-based spellers in particular, is essential. Without it, these systems have no practical applications outside the laboratory. The first step to achieve such asynchronous control is the identification and characterization of EEG patterns that can be used for this purpose. In this dissertation, the two experiments presented in section 5.1 aimed to analyze the SSVEP triggered by non-target stimuli of an ERP-based speller using the RCP. In the first experiment, we tested different values of SOA, as detailed in Table 5.1, to study how the variation of the stimulation rate affected the SSVEP. As showed in Figure 5.2, all the stimulation frequencies provoke a SSVEP in the user’s EEG. However, it is interesting to see how this waveform has higher power for lower stimulation rates, being maximum at 2.67 Hz. On the other hand, the amplitude of the SSVEP decreased for 6.66 Hz and 8.00 Hz. Additionally, the second and third order harmonics are only clearly noticeable for 2.10 Hz, 2.67 Hz and 3.54 Hz. We hypothesize that, as non-target stimuli are received with the peripheral field of vision, higher stimulation rates are more difficult to detect, thus triggering weaker responses. This tendency is in accordance with the work of Zhang et al. (2019), who demonstrated that the SSVEPs elicited by peripheral flickering stimuli at 15 Hz have significantly lower amplitude than those received in the central region of the receptive field. This analysis facilitated our choice of SOA for the Asynchrony database. In this regard, the experiments had to be performed to maximize the power of the SSVEP to increase the accuracy of the control state detection task, without increasing too much the selection time of the system. Table 6.1 explains this trade-off, comparing the SSVEP power and the selection time using one stimulation sequence for each SOA. Despite the fact that the maximum SSVEP power is reached at fst = 2.67 Hz (SOA = 375 ms), this frequency would increase too much the command selection speed. Comparatively, the average power of the SSVEP for a stimulation rate of fst = 5.71 Hz (SOA = 175 ms) is comparable, but the speed of selection is doubled. Moreover, this value is similar to other related studies (He et al.,2017;Mart´ınez-Cagigal et al.,2019a; Pinegger et al.,2015). Accordingly, we chose fst = 5.71 Hz in this dissertation to perform the control state detection experiments and acquire the Asynchrony database. 6.1. SSVEP elicited by non-target stimuli from ERP-based spellers 93 Table 6.1: Comparative of the SSVEP power and speed of selection SOA Stimulation frequency SSVEP power Selection time 475 ms 2.10 Hz 0.007 µV 2/Hz 5.55 s 375 ms 2.67 Hz 0.010 µV 2/Hz 4.55 s 275 ms 3.64 Hz 0.008 µV 2/Hz 3.33 s 175 ms 5.71 Hz 0.009 µV 2/Hz 2.00 s 150 ms 6.66 Hz 0.004 µV 2/Hz 1.78 s 125 ms 8.00 Hz 0.005 µV 2/Hz 1.49 s SSVEP power: averaged power of the SSVEP across all participants in the first analysis of the characterization experiment, SOA: stimulus onset asynchrony, Selection time: time required to select a command with one sequence of stimulation. The study of the spatial distribution of SSVEPs revealed interesting patterns. At lower frequencies (2.10 Hz, 2.67 Hz, 3.64 Hz, 5.71 Hz), the power of the SSVEPs was higher in the electrodes located on the midline of the brain (i.e., Fz, Cz, CPz, Pz). Nevertheless, as the stimulation rate increased, the power of the SSVEPs moved towards electrodes situated closer to the occipital lobe, where the visual cortex is located (i.e., POz, PO7, PO8, Oz). This seems to contradict the results of previous studies, which generally find that SSVEPs are triggered by stimulation rates above 6 Hz and primarily found in the visual cortex (Bin et al.,2009;Chuan Jia et al.,2011;Friman et al.,2007;Lin et al.,2006). This variation in results may be attributed to the fundamental differences in the stimulation methodologies. Most studies use a conventional flickering cell where the participant has to focus to elicit an SSVEP. Thus, this paradigm does not involve any cognitive effort (Wolpaw and Wolpaw,2012). In contrast, in the RCP, the participant has to distinguish between target and non-target stimuli to select a command, which engages high-level cognitive functions. At low stimulation rates, the individual may have the ability to differentiate the stimuli consciously, which may engage frontal and parietal regions of the brain, linked with complex cognitive processes and decision making (Standring,2015). As the frequency of stimulation increases, it becomes challenging for the participant to differentiate these stimuli consciously, leaving the primary visual cortex as the most active area. Although this was the first study that examined the frequency range and spatial distribution of the SSVEP elicited by the RCP, previous research demonstrated that even minimal differences in stimulation paradigms can change the frequency range, amplitude, and brain sources of this control signal, making our hypothesis plausible (Bachiller et al.,2015;Mazaheri and Picton,2005;Odom et al.,2010;Polich,2007). The findings of the second experiment, as illustrated in Figure 5.3, indicate that the SSVEP in the overt mode is evoked by the non-target stimuli of the RCP, which are perceived in the peripheral field of vision. On the other hand, the covert matrix 100 Chapter 6. Discussion reported in the original studies due to varying training and testing strategies, as well as differences in tested populations. In addition to the results of the experiment, these aspects are also discussed in the following paragraphs. Table 5.4 displays the command decoding accuracy for each model, number of fine-tuning trials, and sequences. Thus, it provides direct and fair comparison. As shown, EEG-Inception consistently achieved significantly better performance (p-value <0.01) than EEGNet, DeepConvNet, CNN-BLSTM, xDAWN+RG, and rLDA. EEG-Inception also demonstrated higher robustness to inter-subject variability, as shown by the reduced standard deviation values, which is an important factor in severely disabled populations with different pathologies. Regarding the ITR, EEG-Inception reached the highest value, 25.64 bits/min, as illustrated in Figure 5.7. This ITR is comparable to the range reported in related studies with healthy subjects, indicating that, with the appropriate signal processing algorithms, individuals with severe disabilities can achieve similar performance (Liu et al.,2018). It is not surprising that a higher number of fine-tuning trials improves performance, given the high inter-subject variability of the P300 potential. More fine-tuning trials allow the models to learn subject-specific features, thus enhancing command decoding accuracy. However, this also increases the calibration time, reducing the usability if the system. Therefore, a balance between performance and calibration time should be found. In this regard, deep-learning models had a clear advantage over machine learning approaches, achieving suitable accuracy with fewer fine-tuning trials. Another factor to consider is the selection speed, which is influenced by the number of sequences. A greater number of sequences results in higher accuracy, regardless of the model, but also slows down the system. Therefore, it is essential to strike a balance between precision and speed for practical applications. In this regard, EEG-Inception offers higher accuracy with shorter selection time. The proposed strategy to train EEG-Inception is an important contribution of the study, allowing for some valuable conclusions that are worth mentioning. Most related works, likely due to limitations in the available data, assessed the performance of new BCI classification approaches using either cross-subject evaluation (i.e. training and testing with data from different subjects) or intra-subject evaluation (i.e. training and testing with data from the same subject) (Lawhern et al.,2018;Liu et al.,2018;Schirrmeister et al.,2017). In contrast, we used a hybrid method that combined transfer learning and fine-tuning. For N= 0, the models were not fine-tuned, simulating a calibration-less approach for cross- 6.4. Deep-learning approach for control state detection: EEG-Inception 101 subject evaluation. For N > 0, the model was fine-tuned to the test subject with few calibration trials. This approach is crucial to study the true potential of deep learning for assistive BCIs, where reducing the calibration time is an important issue. In this regard, EEG-Inception is specifically engineered to take full advantage of this training approach, offering benefits for the practical implementation of ERP-based spellers in real-world applications. Another crucial aspect is that we validated our approach with data from 31 severely disabled subjects, which are the target users of assistive ERP-based spellers. This allowed us to implement specific methods to improve the robustness of EEG-Inception against inter-subject variability, which explains the outstanding results in this particular, but important characteristic. In contrast, none of the previous studies that proposed deep-learning approaches for ERP-based spellers evaluated their models with this population (Borra et al.,2019;Cecotti and Gr¨aser, 2011;Lawhern et al.,2018;Liu et al.,2018;Manor and Geva,2015;Santamar´ıa- V´azquez et al.,2019b;Schirrmeister et al.,2017). In this regard, individuals with severe disabilities pose a significant challenge due to their heterogeneity and unique characteristics. Generally, their performance is significantly lower compared with healthy subjects, making a direct comparison with previous studies difficult. However, it is essential to validate new algorithms with end users to obtain an accurate assessment of the model’s performance in a real-world setting. Thus, we consider this point as one of our study’s strengths. 6.4 Deep-learning approach for control state detection: EEG-Inception After demonstrating the advantages of EEG-Inception for the command decoding task, the next goal was to improve the performance of the asynchronous management in our ERP-based speller using deep learning as well. Whereas the OSRD method reached high accuracy, we suspected that the SSVEPs elicited by nontarget stimuli of the RCP were not the only EEG patterns that could be used to detect the user’s control state. For instance, Mart´ınez-Cagigal et al. (2019b) demonstrated that the attention mechanisms involved during the usage of an ERP- based speller increase the complexity of the EEG, measured with the multiscale sample entropy. Therefore, deep-learning models able to discriminate this kind of patterns should increase the performance feature-engineering methods for the detection of the user’s control state, given that they automatically learn high- 102 Chapter 6. Discussion level features from the input data. In this regard, EEG-Inception was a perfect candidate due to its multiscale approach, which could be particularly optimal for detecting different patterns of activity. To test this hypothesis, we designed the first study that tested a deep-learning model, EEG-Inception, for this task. The main results of this experiment, explained in section 5.4, are discussed bellow, providing a comparison with previous approaches. 6.4.1 Evaluation experiment EEG-Inception demonstrated high performance in the control state detection task, as illustrated in Table 5.5. As can be seen, there is a trade off between performance and selection time. More stimulation sequences led to a higher confidence in the selection and reduced the impact of outliers, thereby improving the model’s accuracy. As a downside, more sequences increase the selection time, reducing the speed of the system. In this regard, EEG-Inception was able to achieve accuracies above 91% with just one sequence of stimulation and N≥20, which is an outstanding result. The number of fine-tuning trials also had a positive impact on the performance at the expense of increasing the calibration time. Nonetheless, our approach can still achieve satisfactory results even with a limited number of training observations, showing the effectivity of our cross-subject transfer learning initialization. In fact, when simulating a plug-and-play system with no calibration for the test subject (N= 0), the model still achieved accuracies close to 90% for 10 or more stimulation sequences. In addition to its ability to perform well with no calibration for the test subject, EEG-Inception also has the ability to take advantage from the fine-tuning process (N > 0). This results in a significant increase in performance after a brief calibration. For example, for N= 30, the control state detection accuracy was 91.91% with just one sequence of stimulation and 96.95% with 15 sequences. The confusion matrices, as shown in Figure 5.8, also offer some interesting observations. The rate of false negatives tends to be higher than the rate of false positives, particularly for lower values of N. This discrepancy could be attributed to lapses in concentration, a theory that is supported by the EEG analysis in Figure 5.9. This figure shows that the ERP had a lower amplitude, with the SSVEP also exhibiting less power. The evaluation of the entire system, with the control state detection and command decoding stages, proved the feasibility of our approach. As seen in Table 5.6, our system demonstrated outstanding performance. A possible practical con- 6.4. Deep-learning approach for control state detection: EEG-Inception 103 figuration could be N= 30 and five stimulation sequences, which has an expected overall test accuracy of 91.3%. Additionally, the Figure 5.10 shows that the system achieved a maximum ITR of 35.54 bpm for N= 30 and one stimulation sequence, with one subject achieving 88.60 bpm. In regard to the calibration-free approach (N= 0), the system reached an accuracy of 85.38%, with an ITR of 13.57 bpm. Finally, it is worth mentioning that the training/testing strategy plays an important role in leveraging the capabilities of the model. For instance, it allows to have subject specific models with very few training trials by exploiting crosssubject transfer learning. Ideally, in the initialization phase, the model learns common features across subjects to detect the target patterns in each case. Then, in the fine-tuning phase, the model particularizes these features to the specific characteristics of each subject, resulting in an improved performance, as it was demonstrated in our previous study (Santamar´ıa-V´azquez et al.,2020b). At the same time, this method allows to take advantage from all the available data, improving its scalability for real use, where data from new subjects could be incorporated to the models to increase their performance. 6.4.2 Comparison with previous approaches EEG-Inception achieved promising results in the control state detection task. Moreover, this was accomplished using an extensive database (the largest among related studies) that assures the robustness of our results. However, making direct comparisons with previous studies is often challenging due to significant variations in stimulation paradigms, experimental design, and sample characteristics. This section highlights the most important aspects. When results per subject were available, the statistical significance of the comparisons between different approaches was determined using the Mann-Whitney U-test, adjusting the FDR with Benjamini-Hochberg method (see section 4.5.2). The performance of the proposed pipeline for control state detection was significantly higher than previous approaches that relied on feature engineering, as showed in Table 6.3. To simplify the comparison, here we only consider studies that proposed asynchrony methods independent of the command decoding stage. Note that wrapper threshold-based approaches were previously discussed in section 6.2.2. Pinegger et al. (2015) proposed the SAM method, reaching an average accuracy of 79.5% with 15 sequences of stimulation using spectral features, whereas EEG-Inception achieved 97.28% (p-value <0.01), as shown in Table 5.5. Similarly, the proposed approach also outperformed the OSRD method, which was 104 Chapter 6. Discussion Table 6.3: Comparative of previous asynchronous systems with independent control state detection and command decoding pipelines. Study Asynch. method Subj. Acccsd (%) Accovr (%) ITR (bpm) Pinegger et al. (2015) SAM 21 CS 79.5 – – Mart´ınez-Cagigal et al. (2019b) SampEn 10 CS 94.52 – – Santamar´ıa-V´azquez et al. (2019a) OSRD 15 CS 95.5 92.5 12.4 Santamar´ıa-V´azquez et al. (2022) EEG-Inception 22 CS 97.28 96.68 35.54 SAM: spectral analysis method; HAM: hybrid analysis method, SampEn: sample entropy; CS: control subjects; Acccsd : accuracy for the control state detection task; ITR: information transfer rate of the overall system; bpm: bits per min; OSRD: oddball steady response detection. based on spectral and correlation features (p-value <0.01) (Santamar´ıa-V´azquez et al.,2019a). The comparison with the results presented in Mart´ınez-Cagigal et al. (2019b), which used sample entropy features, was also significant (p-value < 0.01). Notably, these differences are more pronounced when using few stimulation sequences. For instance, when using five sequences, the accuracy was increased by 10.41% and 19.60% with respect to the latter two studies. Regarding the overall results, there are some noteworthy points to consider. Related studies achieved lower overall accuracy and ITR, which demonstrates the superiority of EEG-Inception. For instance, the maximum average ITR was 35.54 bpm (see Figure 5.10). In comparison, the highest values achieved by Zhang et al. (2008), Aloise et al. (2011) and Santamar´ıa-V´azquez et al. (2019a) were 15.0 bpm, 11.2 bpm (p-value <0.01) and 12.3 bpm (p-value <0.01), respectively. On the other hand, Tang et al. (2019) obtained a maximum accuracy of 90.30% compared to 96.47% in our analysis. In terms of calibration time, this study was the first to investigate an asynchronous ERP-based BCI without any user’s calibration (i.e., N= 0), achieving an accuracy of 85.38% and ITR of 13.57 bpm. These results exceeded by a large margin an overall performance of 70%, which is generally considered the minimum acceptable accuracy to control a BCI (K¨ubler et al.,2004). In this regard, we think that minimizing, or even eliminating, the system’s calibration is essential for increasing the usability of asynchronous ERP-based spellers for practical assistive applications. Thus, this is a key contribution of our work, paving the way for further research in this area. In summary, the results presented in Santamar´ıa-V´azquez et al. (2022) demonstrated that EEG-Inception provides great advantages for the control state detection task in ERP-based spellers. The proposed approach reached higher performance than the previous methods. It also addressed some of the main limitations of 6.5. Design of MEDUSA © and comparison with previous BCI platforms 105 these systems for practical assistive applications, such as the calibration time and instability of wrapper approaches based on thresholds. In this regard, it is worth noting that none of the related studies explored the possibility of a calibration-free approach. With this study, we completed the final design of our asynchronous ERP- based speller. The system is fully based on deep learning, using EEG-Inception for the control state detection and command decoding tasks. As shown by the results presented Santamar´ıa-V´azquez et al. (2022,2020b), this design represents a significant step forward in the state of the art of practical asynchronous ERP- based spellers, providing higher performance than previous approaches. 6.5 Design of MEDUSA © and comparison with previous BCI platforms MEDUSA © is a novel BCI platform that was developed to address the limitations of existing BCI software. It was created as part of this research project to help us to achieve our goals and fill the gap of available options. The goal was to accelerate BCI and cognitive neuroscience research by facilitating the implementation and open-source distribution of new systems and methods, as the ones that have been presented in this dissertation. Furthermore, MEDUSA © also includes additional BCI paradigms and EEG processing methods that were developed in parallel projects as part of the research line. The results of this work were described in section 5.5. In this section, we discuss the most important features MEDUSA © , providing at the same time a detailed comparative with other general-purpose BCI software, such as OpenVibe or BCI2000. This comparison only includes those platforms that provide the three main stages of a BCI system: signal recording, signal processing, and feedback presentation. Thus, we leave out toolboxes for bio-signal analysis, such as MNE or EEGLAB. A summarized comparison of the various BCI platforms currently available can be found in Table 6.4. The first aspect to discuss is the programming framework in which each platform has been developed, as this characteristic has an important impact in other features. The majority of platforms were developed in C++, including BCI2000, OpenVibe, xBCI and BF++, while Pyff was the only one implemented Python (Bianchi et al.,2003;Kothe and Makeig,2013;Renard et al.,2010;Schalk et al., 2004;Susila et al.,2010;Venthur et al.,2010). In this regard, C++ is a general- 106 Chapter 6. Discussion purpose and efficient language, but it has a steep learning curve and the development time is increased due to its complex syntax. This makes difficult to maintain the software and keep up with the latest advances in the field. On the other hand, Python is a script-like, flexible language that reduces the development time thanks to its simplicity. Additionally, it has a wide range community packages (e.g., Scipy, Numpy, Tensorflow) that simplify the development of signal processing methods. For these reasons, this language has gained popularity in the last years. The main drawback of Python is its lower efficiency compared to compiled languages like C++, but this can be addressed with careful implementations and concurrent processing for most use cases. So far, Pyff was the only BCI software that was completely written in Python, but its development has been interrupted for more than 7 years. Additionally, BCpy2000 is a Python package designed to facilitate the development of BCIs using BCI2000 as a foundation (Luczak and Marcus,2020). However, it is important to note that BCpy2000 has important limitations in terms of functionality and carries forward other disadvantages inherited from BCI2000. This makes MEDUSA © the leading alternative implemented in Python. Another important consideration is the maintenance of the software. As shown in Table 6.4, most of the BCI platforms are no longer being updated. Out of the software tools considered in this analysis, only OpenVibe is currently being actively developed to stay current with the latest BCI advancements, whereas BCI2000 only receives critical updates. The remaining platforms have not been updated for several years. It is important to note that creating these platforms requires extensive knowledge in software design, DevOps practices, concurrent programming, signal processing, machine learning, or graphical engines. Due to this complexity, updating and maintaining BCI software can be especially difficult, particularly given the rapid pace of progress in the field. As a result, many projects are abandoned shortly after their release. In MEDUSA © , we apply several methods to address this issue: (1) modular design that allows upgrading the different components easily without requiring major changes to the rest of the software; (2) flexible implementation in Python, a high-level programming language well-suited for rapid development of new functionalities; (3) scalable architecture prepared to accommodate additional signal processing methods or apps as needed; and (4) tools specifically designed to promote community contributions. The development of MEDUSA © has been guided by these principles to simplify the maintenance process, which aligns with our long-term vision of the project. MEDUSA © provides a comprehensive suite of signal processing methods and 6.5. Design of MEDUSA © and comparison with previous BCI platforms 107 BCI experiments. For instance, it includes deep learning models and connectivity metrics for M/EEG analysis, which can be used in offline and online experiments. Furthermore, the diverse range of apps included in MEDUSA © Platform allows for the investigation of crucial aspects within the BCI and cognitive neuroscience fields. These apps facilitate the exploration of stimulus and feedback characteristics in various BCI paradigms, the comparison of classification methods in online and offline experiments, or the characterization of bio-signals, such as EEG or ECG, under different cognitive states. It is worth noting that our c-VEP speller implementation is currently the only publicly available option for investigators interested in this BCI paradigm (Mart´ınez-Cagigal et al.,2021). In terms of functionality, OpenVibe stands out as the only platform that offers a comparable range of capabilities, whereas the other projects are significantly less advanced in this regard (see Table 6.4). Finally, it should be noted that numerous research studies conducted in recent years have tested the feasibility of these functionalities, thus providing scientific validation for our solution (Marcos-Mart´ınez et al.,2021; Mart´ınez-Cagigal et al.,2019b;P´erez-Velasco et al.,2022;Santamar´ıa-V´azquez et al.,2019a,2022,2020a,b). Another aspect worth mentioning is that MEDUSA © provides tools to develop and share custom apps with less effort. The tools include templates to facilitate app development with Qt and Unity, detailed tutorials, and an official app market to share apps with the community through our website. These features create the adequate environment to encourage an active participation from a multidisciplinary community. By simplifying the implementation of BCI and cognitive neuroscience experiments and increasing their reproducibility, MEDUSA © aims to attract more developers and professionals to these fields. In fact, this community’s involvement is critical to the success of the project. 108 Chapter 6. Discussion Table 6.4: Comparative between different platforms for BCI experiments. Platform Language Last update Analysis toolbox Deep Learning Connectivity analysis LSL Open app develop. App market Novel BCI paradigms User friendly xBCI C++ Dec 2008 ✓ Pyff Python Feb 2016 ✓ BF++ C++ May 2016 ✓ BCI2000 C++ Aug 2020 ✓ OpenVibe C++ Dec 2022 ✓ ✓ ✓ ✓ ✓ MEDUSA © Python Dec 2022 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Analysis toolbox: integrated signal processing funtions suitable for offline and online analysis; Open app development: specific tools and guides to develop custom experiments; App market: community space dedicated to share apps or experiments; Novel BCI paradigms: refers to most recent BCI paradigms, such as c-VEPs or connectivity-based neurofeedback. 6.6. Limitations 109 6.6 Limitations Despite the positive results that were achieved in all the studies that compose this compendium, our work is not without limitations. The first limitation is related to the databases that were used to test the proposed models in this dissertation. For instance, the OSRD method and EEG-Inception were evaluated using the Asynchrony database, which was specifically designed for asynchrony studies with ERP-based spellers. However, due to the difficulty of recruiting severely disabled patients, we were only able to include healthy subjects in this database. Therefore, the results achieved in Santamar´ıa-V´azquez et al. (2019a,2022) may be overestimating the accuracy of both methods in a real setting with end users. The importance of this aspect is illustrated if we compare the results achieved by EEG-Inception in Santamar´ıa-V´azquez et al. (2020b) and Santamar´ıa-V´azquez et al. (2022). In the latter study, which did not include disabled subjects, the overall accuracy and ITR was much higher than on the first study, where the model was evaluated on 31 severely disabled subjects, even when the system was fully asynchronous and used the same command decoding pipeline. The cause is usually related to physical and cognitive problems associated with disabilities (e.g., attention deficit, involuntary movements). This demonstrates the importance of testing these methods with target users to obtain a better estimation of the model’s performance in a real setting. In this regard, it should be noted that this is a common limitation in BCI studies. For this reason, the fact that our command decoding approach based on EEG-Inception was tested on target users in Santamar´ıa-V´azquez et al. (2020b) is a great achievement. Another limiting factor related to the databases is their size, which especially affects deep learning models. Despite the fact that the sample size used in Santamar´ıa-V´azquez et al. (2022,2020b) was the largest among related studies, our training strategy for EEG-Inception is designed to benefit from as much data from as many subjects as possible. Therefore, a larger sample size would increase the accuracy of the models for the control state detection and command decoding tasks. In fact, more training data could help to reduce the effect overfitting, which would allow to increase the complexity of the model. Additionally, having more test subjects would contribute to more robust and generalizable results. Regarding EEG-Inception, this model has only been tested for P300 detection, control state detection and MI decoding, achieving very satisfactory results (P´erez-Velasco et al.,2022;Santamar´ıa-V´azquez et al.,2022,2020b). However, EEG-Inception introduces several architectural advantages that could help to in- Appendix A Compendium of publications 1. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Diego Marcos- Mart´ınez, V´ıctor Rodr´ıguez-Gonz´alez, Sergio P´erez-Velasco, Selene Moreno- Calder´on and Roberto Hornero, “MEDUSA © : A novel Python-based software ecosystem to accelerate brain-computer interface and cognitive neuroscience research”, Computer Methods and Programs in Biomedicine, March, 2023, DOI: 10.1016/j.cmpb.2023.107357. 2. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Sergio P´erez- Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “Robust Asynchronous Control of ERP-Based Brain-Computer Interfaces using Deep Learning”, Computer Methods and Programs in Biomedicine, vol. 215, March, 2022, DOI: 10.1016/j.cmpb.2022.106623. 3. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Fernando Vaquerizo-Villar, Roberto Hornero, “EEG-Inception: A Novel Deep Convolutional Neural Network for Assistive ERP-based Brain-Computer Interfaces”, IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 28 (12), pp. 2773 - 2782, December, 2020, DOI: 10.1109/TNSRE.2020.304810. 4. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Javier Gomez- Pilar, Roberto Hornero, “Asynchronous Control of ERP-based BCI Spellers Using Steady-State Visual Evoked Potentials Elicited by Peripheral Stimuli”, IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 27 (9), pp. 1883–1892, August, 2019, DOI: 10.1109/TNSRE.2019.2934645. 117 Appendix B Scientific achievements B.1 Publications B.1.1 Papers indexed in the JCR 1. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Diego Marcos- Mart´ınez, V´ıctor Rodr´ıguez-Gonz´alez, Sergio P´erez-Velasco, Selene Moreno- Calder´on and Roberto Hornero, “MEDUSA © : A novel Python-based software ecosystem to accelerate brain-computer interface and cognitive neuroscience research”, Computer Methods and Programs in Biomedicine, March, 2023, DOI: 10.1016/j.cmpb.2023.107357. 2. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Sergio P´erez- Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “Robust Asynchronous Control of ERP-Based Brain-Computer Interfaces using Deep Learning”, Computer Methods and Programs in Biomedicine, vol. 215, March, 2022, DOI: 10.1016/j.cmpb.2022.106623. 3. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Fernando Vaquerizo-Villar, Roberto Hornero, “EEG-Inception: A Novel Deep Convolutional Neural Network for Assistive ERP-based Brain-Computer Interfaces”, IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 28 (12), pp. 2773 - 2782, December, 2020, DOI: 10.1109/TNSRE.2020.304810. 4. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Javier Gomez- Pilar, Roberto Hornero, “Asynchronous Control of ERP-based BCI Spellers 119 120 Appendix B. Scientific achievements Using Steady-State Visual Evoked Potentials Elicited by Peripheral Stimuli”, IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 27 (9), pp. 1883–1892, August, 2019, DOI: 10.1109/TNSRE.2019.2934645. 5. Sergio P´erez-Velasco, Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez- Cagigal, Diego Marcos-Mart´ınez, Roberto Hornero, “EEGSym: Overcoming Inter/subject Variability in Motor Imagery Based BCIs with Deep Learning”, IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 30, pp. 1766-1775, Junio, 2022, DOI: 10.1109/TNSRE.2022.3186442. 6. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “Brain–Computer Interface Channel Selection Optimization using Meta-heuristics and Evolutionary Algorithms”, Applied Soft Computing, vol. 115, pp. 108176, January, 2022, DOI: 10.1016/j.asoc.2021.108176. 7. V´ıctor Mart´ınez-Cagigal, Jordy Thielen, Eduardo Santamar´ıa-V´azquez, Sergio P´erez-Velasco, Peter Desain, Roberto Hornero, “Brain–computer interfaces based on code-modulated visual evoked potentials (c-VEP): a literature review”, Journal of Neural Engineering, vol. 18 (6), pp. 061002, November, 2022, DOI: 10.1088/1741-2552/ac38cf. 8. Diego Marcos-Mart´ınez, V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa- V´azquez, Sergio P´erez-Velasco, Roberto Hornero, “Neurofeedback Training Based on Motor Imagery Strategies Increases EEG Complexity in Elderly Population”, Entropy, vol. 23 (12), pp. 1574, November, 2021, DOI: 10.3390/e23121574. 9. Fernando Vaquerizo-Villar, Daniel ´ Alvarez, Leila Kheirandish-Gozal, Gonzalo C. Guti´errez-Tobal, Ver´onica Barroso-Garc´ıa, Eduardo Santamar´ıa- V´azquez, F´elix del Campo, David Gozal, Roberto Hornero, “A convolutional neural network architecture to enhance oximetry ability to diagnose pediatric obstructive sleep apnea”, IEEE Journal of Biomedical and Health Informatics, vol. 25 (8), pp. 2906-2916, August, 2021, DOI: 10.1109/jbhi.2020.3048901. 10. Sa´ul J. Ruiz-G´omez, Roberto Hornero, Jes´us Poza, Eduardo Santamar´ıa- V´azquez, V´ıctor Rodr´ıguez-Gonz´alez, Aar´on Maturana-Candelas, Carlos G´omez, “A new method to build multiplex networks using Canonical Correlation Analysis for the characterization of the Alzheimer’s disease contin- B.1. Publications 121 uum”, Journal of Neural Engineering, vol. 18 (2), pp. 026002, February, 2021, DOI: 10.1088/1741-2552/abd82c. 11. Marco Sim˜oes, Davide Borra, Eduardo Santamar´ıa-V´azquez, GBTUPM, Mayra Bittencourt-Villalpando, Dominik Krzemi˜nski, Aleksandar Miladinovic, Neural-Engineering-Group, Thomas Schmid, Haifeng Zhao, Carlos Amaral, Bruno Direito, Jorge Henriques, Paulo Carvalho, Miguel Castelo-Branco, “BCIAUT-P300: A Multi-Session and Multi-Subject Benchmark Dataset on Autism for P300-Based Brain-Computer-Interfaces”, Frontiers in Neuroscience, vol. 14, pp. 978, September, 2020, DOI: 10.3389/fnins.2020.568104. 12. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Javier Gomez- Pilar, Roberto Hornero, “Towards an Accessible Use of Smartphone- Based Social Networks through Brain-Computer Interfaces”, Expert Systems With Applications, vol. 120, pp. 155–166, April, 2019, DOI: 10.1016/J.ESWA.2018.11.026. 13. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “Asynchronous Control of P300-based Brain–Computer Interfaces using Sample Entropy”, Entropy, vol. 21 (3), pp. 230, February, 2019, DOI: 10.3390/E21030230. B.1.2 Book chapters 1. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Javier Gomez- Pilar, Roberto Hornero, “A brain–computer interface web browser for multiple sclerosis patients”, in Neurological Disorders and Imaging Physics, Volume 2: Engineering and Clinical Perspectives of Multiple Sclerosis, ISBN- 10: 0750317604, pp. 12:1–12:31, Bristol, United Kingdom: Institute of Physics Publishing, Editors: Ayman El-Baz and Jasjit S. Suri, 2019, DOI: 10.1088/978-0-7503-1762-7CH12. B.1.3 International conferences 1. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, V´ıctor Rodr´ıguez-Gonz´alez, Sergio P´erez-Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “MEDUSA: A Novel Platform for Modern Non-invasive Braincomputer Interfaces”, IUPESM World Congress on Medical Physics and 122 Appendix B. Scientific achievements Biomedical Engineering 2022, Singapur (Singapore), June 12 - June 17, 2022. 2. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Daniel Rodr´ıguez, Jaime Finat, Roberto Hornero, “Preventing Cognitive Decline in Elderly Population through Neurofeedback Training: A Pilot Study”, 5th International Conference on Neurorehabilitation (ICNR2020), Virtual conference (Spain), October 13 - October 16, 2020. 3. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Javier Gomez- Pilar, Roberto Hornero, “Deep learning architecture based on the combination of convolutional and recurrent layers for ERP-based brain-computer interfaces”, XV Mediterranean Conference on Medical and Biological Engineering and Computing (MEDICON 2019), ISBN: 978-3-030-31635-8, pp. 1844–1852, Coimbra (Portugal), September 26 - September 28, 2019, DOI: 10.1007/978-3-030-31635-8 224. 4. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Sergio P´erez- Velasco, Diego Marcos-Mart´ınez, Selene Moreno-Calder´on, Roberto Hornero, “Non-binary m-sequences for reliable, high-speed Brain–Computer Interfaces based on c-VEP: a pilot study”, IUPESM World Congress on Medical Physics and Biomedical Engineering 2022, Singapur (Singapore), June 12 - June 17, 2022. 5. Sergio P´erez-Velasco, Gonzalo C. Guti´errez-Tobal, V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, Assessment of Residual Deep Neural Networks and AdaBoost to predict adherence to digitalbased active and healthy aging interventions, IUPESM World Congress on Medical Physics and Biomedical Engineering 2022, Singapur (Singapore), June 12 - June 17, 2022. 6. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “A Portable P300-based Brain–Computer Interface as an Alternative Communication Device”, 5th International Conference on Neurorehabilitation (ICNR2020), Virtual conference (Spain), October 13 - October 16, 2020. 7. V´ıctor Rodr´ıguez-Gonz´alez, Jes´us Poza, Pablo N´u˜nez, Carlos G´omez, Mar´ıa Garc´ıa, Yoshihito Shigihara, Hideyuki Hoshi, Eduardo Santamar´ıa- V´azquez, Roberto Hornero, “Towards Automatic Artifact Rejection in B.1. Publications 123 Resting-State MEG Recordings: Evaluating the Performance of the SOUND Algorithm”, 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society, ISBN: 978-1-5386-1311-5, pp. 4807-4810, Berlin (Germany), July 23 - July 27, 2019. 8. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “Controlling a Smartphone with Brain-Computer Interfaces: A Preliminary Study”, X Conference on Articulated Motion and Deformable Objects (AMDO 2018), ISBN: 978-3-319-94543-9, pp. 34–43, Palma de Mallorca (Spain), July 12 - July 13, 2018, DOI: 10.1007/978-3-319-94544-6 4. 9. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “A Novel Hybrid Swarm Algorithm for P300-Based BCI Channel Selection”, World Congress on Medical Physics & Biomedical Engineering (IUPESM 2018), ISBN: 978-981-10-9022-6, pp. 41–45, Prague (Czech Republic), June 3 - June 8, 2018, DOI: 10.1007/978-981-10-9023-3 8. B.1.4 National conferences 1. Eduardo Santamar´ıa-V´azquez, Sergio P´erez-Velasco, V´ıctor Mart´ınez- Cagigal, Roberto Hornero, “EEG-InceptionGen: Una Red Convolucional de Prop´osito General para la Clasificaci´on de se˜nales EEG”, XXXIX Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2021), ISBN: 978-84-09-36054-3, pp. 163-166, Madrid (Spain), November 25 - November 26, 2021. 2. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Javier Gomez- Pilar, Roberto Hornero, “Control as´ıncrono de sistemas BCI basados en ERP mediante la detecci´on de potenciales evocados visuales de estado estable provocados por los est´ımulos perif´ericos del paradigma oddball”, 11 º Simposio CEA de Bioingenier´ıa (CEA 2019), pp. 1–11, Valencia (Spain), July 18 - July 19, 2019. 3. Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Roberto Hornero, “MEDUSA: Una Nueva Herramienta Para El Desarrollo De Sistemas Brain-Computer Interface Basada en Python”, 10 º Simposio CEA de Bioingenier´ıa (CEA 2018), ISSN: 2341-4243, pp. 97–102, Madrid (Spain), July 2 - July 3, 2018. 124 Appendix B. Scientific achievements 4. Selene Moreno-Calder´on, V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa- V´azquez, Sergio P´erez-Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “Conecta 4: un Videojuego Multijugador para Sistemas Brain-Computer Interface basados en c-VEPs”, Jornadas de Rob´otica, Educaci´on en Autom´atica y Bioingenier´ıa 2022 (JREB 2022), pp. 246-252, M´alaga (Spain), May 18 - May 20, 2022. 5. Diego Marcos-Mart´ınez, Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Sergio P´erez-Velasco, Selene Moreno-Calder´on, Roberto Hornero, “ITACA: Un nuevo sistema de entrenamiento cognitivo mediante Neurofeedback”, Jornadas de Rob´otica, Educaci´on en Autom´atica y Bioingenier´ıa 2022 (JREB 2022), M´alaga (Spain), May 18 - May 20, 2022. 6. Selene Moreno-Calder´on, V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa- V´azquez, Sergio P´erez-Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “Evaluaci´on de un videojuego multijugador basado en Brain Computer Interfaces utilizando c-VEPs”, XL Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2022), ISBN: 978-84-09-45972-8, pp. 324- 327, Valladolid (Spain), November 23 - November 25, 2022. 7. Sergio P´erez-Velasco, Diego Marcos-Mart´ınez, Eduardo Santamar´ıa- V´azquez, V´ıctor Mart´ınez-Cagigal, Selene Moreno-Calder´on, Roberto Hornero, “Caracterizaci´on espacio-temporal de la clasificaci´on de imaginaci´on motora con herramientas de explainable artificial intelligence (XAI)”, XL Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2022), ISBN: 978-84-09-45972-8, pp. 316-319, Valladolid (Spain), November 23 - November 25, 2022. 8. Diego Marcos-Mart´ınez, Ana Mart´ın-Fern´andez, Sergio P´erez-Velasco, Eduardo Santamar´ıa-V´azquez, V´ıctor Mart´ınez-Cagigal, Selene Moreno- Calder´on, Roberto Hornero, “An´alisis de los cambios en la conectividad funcional tras un entrenamiento cognitivo mediante Neurofeedback”, XL Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2022), ISBN: 978-84-09-45972-8, pp. 27-30, Valladolid (Spain), November 23 - November 25, 2022. 9. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Sergio P´erez- Velasco, Diego Marcos-Mart´ınez, Selene Moreno-Calder´on, Roberto Hornero, “Un nuevo m´etodo de parada temprana no param´etrico para sistemas B.2. International internship 125 Brain–Computer Interface basados en c-VEP”, XL Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2022), ISBN: 978-84- 09-45972-8, pp. 196-199, Valladolid (Spain), November 23 - November 25, 2022. 10. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Sergio P´erez- Velasco, Diego Marcos-Mart´ınez, Roberto Hornero, “Sobre la Eficacia del Principio de Vecinos Equivalentes en Sistemas BCI basados en c-VEP”, 12o Simposio CEA de Bioingenier´ıa, pp. 32-36, Madrid (Spain), June 3 - June 4, 2021. 11. Fernando Vaquerizo-Villar, Daniel ´ Alvarez, Leila Kheirandish-Gozal, Gonzalo C. Guti´errez-Tobal, Ver´onica Barroso-Garc´ıa, Eduardo Santamar´ıa- V´azquez, F´elix del Campo, David Gozal, Roberto Hornero, “Modelo de deep learning basado en la arquitectura Inception para el diagn´ostico de la apnea del sue˜no infantil mediante la se˜nal de oximetr´ıa”, XXXVIII Congreso Anual de la Sociedad Espa˜nola de Ingenier´ıa Biom´edica (CASEIB 2020), ISBN: 978-84-09-25491-0, pp. 340-343, Valladolid (Spain), November 25 - November 27, 2020. 12. V´ıctor Mart´ınez-Cagigal, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “Interfaz Cerebro–Ordenador para el Control de las Funcionalidades de un Tel´efono M´ovil”, XXXVI Congreso Anual de La Sociedad Esp˜nola de Ingenier´ıa Biom´edica (CASEIB 2018), ISBN: 978-84-09-06253-9, pp. 61–64, Ciudad Real (Spain), November 21 - November 23, 2018. 13. V´ıctor Mart´ınez-Cagigal, Javier Gomez-Pilar, Daniel ´ Alvarez, Eduardo Santamar´ıa-V´azquez, Roberto Hornero, “Sistema Brain-Computer Interface de Navegaci´on Web Orientado a Personas con Grave Discapacidad”, XXXVIII Jornadas de Autom´atica (JA 2017), ISBN: 978-84-16664-74-0, pp. 313–319, Gij´on (Spain), September 6 - September 8, 2017. B.2 International internship Three-month research internship at the Spaulding Neuromodulation Center, Spaulding Rehabilitation Hospital, Harvard University, Boston, Massachusetts, USA. i.Purpose of the internship The objective of the research stay was to establish a framework for col-