Personalized Offline and Pseudo-Online BCI Models to Detect Pedaling Intent

The aim of this work was to design a personalized BCI model to detect pedaling intention through EEG signals. The approach sought to select the best among many possible BCI models for each subject. The choice was between different processing windows, feature extraction algorithms and electrode configurations. Moreover, data was analyzed offline and pseudo-online (in a way suitable for real-time applications), with a preference for the latter case. A process for selecting the best BCI model was described in detail. Results for the pseudo-online processing with the best BCI model of each subject were on average 76.7% of true positive rate, 4.94 false positives per minute and 55.1% of accuracy. The personalized BCI model approach was also found to be significantly advantageous when compared to the typical approach of using a fixed feature extraction algorithm and electrode configuration. The resulting approach could be used to more robustly interface with lower limb exoskeletons in the context of the rehabilitation of stroke patients.


INTRODUCTION
The scientific community has increasingly become more conscious of the problems suffered by people with motor disabilities, including their rehabilitation process. The use of brain-computer interfaces (BCIs) as an alternative pathway for those people who cannot move their limbs properly has been extensively studied in the literature (Dobkin, 2007;Daly and Wolpaw, 2008). Offline processing of the electroencephalography (EEG) signals can often be accurate and useful as an a posteriori tool, while a continuous processing of the signals, called here a pseudo-online analysis, may produce results of lower quality, but is much more reliable for use in active therapies that directly involve the patient's central nervous system (Daly and Wolpaw, 2008;López-Larraz et al., 2014). Indeed, exoskeletons, which are devices assisting a patient's affected limb (Hortal et al., 2015), can be combined with BCIs to improve the rehabilitation process in terms of time and quality (Pennycott et al., 2012;Rodríguez-Ugarte et al., 2016).
Accurately detecting movement intent ideally involves detecting the movement before it even initiates, but may encompass both the moments previous and the initial phases of movement. In any case, the idea is to detect the movement as early as possible from the brain waves, and typically, the earlier one wishes to detect movement initiation, the more challenging it becomes. Recent studies have found two phenomena to detect movement intent: the Bereitschaftspotential (BP) (Bhagat et al., 2014;Xu et al., 2014) and event-related desynchronization/synchronization (ERD/ERS) (Bai et al., 2007;Planelles et al., 2014). BP is a motor related cortical potential (MRCP) (Jahanshahi and Hallett, 2003). Its detection usually requires averaging across many trials due to its small amplitude and low frequency, meaning that its real-time detection is typically not viable. Meanwhile, ERD/ERS are frequency fluctuations detectable in the mu and beta bands. These phenomena start about 2 s before movement onset with a decrease of the band power (ERD), followed by its increment (ERS) at about 2 s after the movement onset (Toffanin et al., 2007;Nam et al., 2011). Overall, detection of movement intent using EEG signals has been studied in subjects when performing reaching tasks, walking, hand movement or hand motor imagery (Bai et al., 2007;Ibáñez et al., 2010;Bai et al., 2011;Lew et al., 2012;López-Larraz et al., 2014;Sburlea et al., 2015). However, many of these studies suffer from only being tested offline, or from experimental setups that produce unrealistic EEG signals when compared to real-life selfinitiated movement (Pfurtscheller et al., 2006;Lehtonen et al., 2008).
Outcomes of the effectiveness of BCIs on detecting an activity are often highly subject-dependent (Ang and Guan, 2013;Rohm et al., 2013), and therefore processing the data in several different ways and choosing the most effective way for each subject can be very useful in improving the results. Key factors in data processing include window selection (whether only time before movement onset, or time before and after movement onset is considered), electrode configurations and feature extraction algorithms. The usual approach involves uniformly using a fixed subject-independent electrode configuration (with associated filters) and feature extraction algorithm. On the other hand, the approach in this work is distinctive in being flexible on the choice of these parameters, so that the BCI model is better adapted to each subject.
The purpose of this work was to design a personalized BCI capable of detecting the intention of self-initiated pedaling. This included consideration of a wide array of processing algorithms for both offline and pseudo-online. To compare the results, a metric was defined, and a procedure to choose the best algorithm for each particular subject was described. More precisely, two different processing windows, with eight different electrode configurations, and with five different extraction algorithms were studied. To determine the effectiveness and reliability of the BCI, the average and variance of three important parameters were Abbreviations: E.C., Electrode Configuration; MVA, Majority Vote Algorithm; Acc, Accuracy; WD, Weighted Discriminator. reported: the true positive rate (TPR), the false positives per minute (FP/min) and the accuracy (Acc).
Detection of asynchronous pedaling intention was contemplated in the context of stroke patients looking to improve their walking ability. The results in this work are a stepping stone toward that final goal. Thus, there was more effort invested in the analysis of pseudo-online processing, due to its relevance in active therapies involving patients (e.g., via exoskeletons). Having said that, for now, only healthy subjects were considered. Pedaling, which is a complex motor task, was chosen over walking, because it may represent an important intermediate step in patient recovery before attempting gait. Additionally, it permits a more controlled experimental setting of the lower limbs, which for example avoids artifacts such as head movements.

Subjects
Five healthy subjects between 24 and 35 years old (3 males and 2 females, 28.6 ± 4.2 years), all right footed, took part in this experiment. The subjects did not have any known neurological diseases and all of them gave written informed consent according to the Helsinki declaration. The Ethics Committee of the Office for Project Evaluations (Oficina Evaluadora de Proyectos: OEP) of the Miguel Hernández University of Elche (Spain) approved the study.

Test Description
The experiment consisted on pedaling and resting during periods of time in which EEG and motion signals were recorded. Subjects were sat at a comfortable distance from a pedal exerciser, as shown in Figure 1. Each subject performed one session, which was composed of 16 trials. Each trial consisted of 5 pedaling cycles, with each cycle defined as: 10 s of resting, followed by a cue from the experimenter indicating the subject to initiate pedaling at their own volition for about 5 s. Before starting the experiment, subjects were told to wait without counting a minimum of 3 s between the cue and the pedaling movement. This requirement was specified in order to avoid the influence of cue presentation in the EEG signals. If this period was not fulfilled, the trial was discarded. Figure 2 shows a sketch of the protocol.

BCI Design
A BCI aiming to detect pedaling intent through EEG signals was designed by searching for ERD/ERS in the mu and beta bands. To achieve this, five different feature extraction algorithms were considered. In addition, each algorithm was applied using two different types of processing windows: those with only time before movement onset, and those with time before and after movement onset. Furthermore, each combination of window type and algorithm was tested with eight different electrode configurations. Then, all this data was utilized to select a personalized BCI for each subject. This will be explained in more detail throughout this section.
Data was divided in two types: training and test data. Both types follow the same process: signal acquisition, data selection, FIGURE 1 | Experiment setup. Subjects sat at a comfortable distance to pedal in a pedal exerciser wearing two IMUs per leg and an EEG reader. Both systems were connected to a computer to process the signal. The participant in the picture gave written informed consent to publish the image.
preprocessing, channel selection, and feature extraction. The features and their corresponding class of training data were used to create the model. Then, that model was used to classify the features extracted from the test data. More details will follow later.
In terms of software, a MATLAB (MathWorks Inc., Massachusetts, United States) platform was developed to record, process and classify the EEG signals. Test data was processed using offline and pseudo-online analyses. The offline analysis consists of recording the EEG signals and then, without the acquisition hardware, loading and analyzing them. As will be observed later, classification and processing of data analyzed offline requires the knowledge of the full signal beforehand (e.g., use of cross validation and majority vote algorithms). On the other hand, the pseudo-online analysis bears some similarities with the offline analysis in the local processing of the data, but crucially differs in that the EEG signals are treated as if they were to be processed in real-time. Therefore, only the data before a given time is used for classification, and data selection requiring prior knowledge of the movement onset is impossible with this type of analysis. Hence, the pseudo-online analysis is more challenging to design and implement than the offline analysis, but has the advantage of having potential use in real-time activities, such as interfacing with exoskeletons. The word pseudo is used here to clarify that in this work the EEG data was not processed in real-time during the experiments themselves, but FIGURE 2 | Experiment protocol: Subjects remain for about 10 s still followed by a cue to start pedaling for about 5 s. Time between the cue and the pedaling start is at least 3 s.
instead was collected and a posteriori was treated as such. This was done to test the different pseudo-online schemes, so that in the future a real-time processing of data is successfully achieved.
Furthermore, to verify the reliability of the BCI system, its output was compared to the Tech MCS system's output (Technaid S.L., Spain). This wireless device is based on inertial measurement units (IMUs). Each IMU is composed by three micro sensors: a 3D gyroscope, a 3D magnetometer and a 3D accelerometer. Nineteen parameters are registered by each IMU, but only the gyroscope in X was utilized to detect when a real start of the pedaling movement was produced. Data was registered at a frequency of 20 Hz through a HUB connected to the USB port of the PC. Subjects wore two IMUs per leg: one located on the external part of the ankle and the other one located on the tibialis anterior, as can be appreciated in Figure 1. It should be noted that there are "cheaper" alternatives to measuring angular velocities which do not involve IMUs, but ultimately equipment availability was the deciding factor.

Data Selection
The angular velocities associated to the two IMUs in each leg were averaged, and the real start was defined when both leg averages exceeded a threshold. Meanwhile, 32 EEG signals where acquired and, part of this data was selected.
FIGURE 3 | Processing window types. On the left (A), the start class window selection was 2 s before the movement onset. On the right (B), the start class was 2 s before and 2 s after the movement onset.
As reported in Toffanin et al. (2007), the potential generated by movement intention appears 2 s before the movement onset and it lasts until around 2 s after the onset. Hence, two types of processing windows were studied: 2 and 4 s processing windows. In addition, data was separated in two classes: rest and start. These two classes were defined according to the real start and the processing window selected. For 4 s processing windows, the start class window was defined from 2 s before to 2 s after the real start was produced. For 2 s processing windows, the start class window was defined from 2 s before up to the real start. The rest class window was chosen to be the same duration as the corresponding start class window and was located before the start class window with a gap of 0.5 s between the two classes. Figure 3 presents these two classes with the two different types of processing windows. The EEG training data was selected from these class windows.
For the offline analysis, the window placement also determined where EEG test data was selected from, while for the pseudo-online analysis the whole pedaling cycle data was used as EEG test data. Thus, for the pseudo-online analysis, the window placement merely served as a marker to determine if a given detection was located in the start class window or not.

Pre-processing
Preprocessing was carried out in order to improve the signal to noise ratio. Rest and start class windows were analyzed in 1 s epochs with a 200 ms shift. For each epoch a notch filter was applied to suppress the power line interference at 50 Hz. Then, a 4th order Butterworth high-pass filter with a cut-off frequency of 0.2 Hz was used to remove the direct current. Finally, a common average reference (CAR) filter was computed as in McFarland et al. (1997). This filter removed from each electrode the influence of the other ones by using the mean potential.

Channel Selection
Once the epoch was preprocessed, an electrode configuration was selected. Eight different electrode configurations (E.C.) were studied to determine which one presented better results for each subject. These are illustrated in Figure 4. The electrodes of each configuration were located on the somatosensory and motor cortex, which were the areas where most of the neural activity was expected.

Feature Extraction
For each epoch of interest, five different feature extraction algorithms were implemented in order to evaluate the optimal one for each subject: • Algorithm A: The mean bandpower of the signal between 18 and 28 Hz was calculated for each electrode. Therefore, this method provided one feature per electrode. • Algorithm B: Fast Fourier Transform (FFT) was applied to each electrode to evaluate the spectrum in the 0-50 Hz frequency range with 1 Hz resolution. The Euclidean norm of the resulting vector (of size 50) was then computed. Using this method, there was one feature per electrode. • Algorithm C: This algorithm computed the mean of the power spectral density of the bands of 1-4 Hz, 8-12 Hz, and 13-28 Hz. Therefore, for each electrode there were three features. • Algorithm D: For this method, the best frequency for each electrode, which corresponds to the potential with the highest variation between classes, was calculated. First, the power spectral density between 8 and 28 Hz with 0.5 Hz of resolution was applied. Then, rest and start class were separated and normalized. For each electrode, the frequency for which the maximum difference between classes occurred was selected and denominated as the optimal frequency. These optimal frequencies for each electrode were part of the model. Finally, the mean power spectral density of each electrode in the range of its optimal frequency ± 1 Hz was calculated. Using this method there was one feature per electrode. • Algorithm E: FFT with a 1 Hz resolution was applied to each electrode. Then, the sum of three frequency ranges was determined for each electrode: mu (8-12 Hz), beta low FIGURE 4 | Electrode configurations based on the International 10-10 system. For each electrode configuration, the red electrodes were the ones selected. Configuration 1 focused on the motor and premotor areas; 2 focused on the motor area; 3 focused on the premotor area; 4 focused on the left side of the motor and premotor areas; 5 focused on the left side of the motor, premotor and medial areas; 6 focused on the right side of the motor and premotor areas; 7 focused on the right side of the motor, premotor and medial areas; and 8 was a reduced version of the first configuration, which focused on the motor and premotor areas.

Classification
A support vector machine (SVM) classifier was used to create the model and classify the data. This classifier is based in hyperplane separation by maximizing the margin between the nearest points of the different classes (Steinwart and Christmann, 2008). When combined with nonlinear kernels, the classifier is one of the most robust and often provides better outcomes than other classifiers like linear discriminant analysis Sburlea et al., 2016). In this work a radial basis function was utilized as a kernel for the SVM.
For the offline analysis a cross-validation was performed: fifteen trials were used to create the model and one to test it; the process was repeated 16 times until all the trials were tested; and the results were averaged among the 16 repetitions. Indeed, each of the 16 created models was applied to classify features of test data so that each epoch lying in the start or rest classes was associated with an epoch prediction of either 0 (indicating nothing is happening) or 1 (indicating a detection). Then, the epoch predictions were grouped appropriately into the corresponding class in which they belonged (resulting in groups of 16 for 4 s windows and groups of 6 for 2 s windows), and a majority vote algorithm (MVA) was used for each group to produce a single prediction (either 0 or 1) per group. If the output of the MVA was a tie, the output of the classifier for that group was 0. Then, that outcome was compared with the real value of the class (0 for the rest class and 1 for the start class). This process can be seen in Figure 5A.
For the pseudo-online analysis, the first 10 trials were used to create the model and the other 6 to test it. For each epoch, the classifier took a decision (an epoch prediction). Afterward, a voting queue algorithm was used. This algorithm determined that a pedaling initiation detection was produced after 5 consecutive detections. The detection was then checked to see if it lied in a start class window, in which case it was a true detection, and otherwise was labeled as a false positive. If many true detections occurred in a fixed start class window, only one true detection was counted. Figure 5B shows this classification analysis.

Post-processing
In order to quantify the results, different parameters were calculated: • True positive rate (TPR): indicates the percentage of real pedaling intentions that were correctly classified as such, TPR = Number of true detections Number of true events .
(1) (2) • Accuracy (Acc): denotes how many pedaling intentions detected were actually real pedaling intentions, Acc = Number of true detections Number of total detections .
It is extremely convenient to have full knowledge of all three parameters. Indeed, if one of the parameters is not known, there are cases where one cannot determine with certainty whether the classifier is working properly or not. For instance, if Acc is 100%, FP/min is 0 and the TPR is missing, it could be because the classifier correctly detected just one pedaling intention out of five, meaning the BCI would not be working very well despite the known parameters having seemingly desirable values. Moreover, as a unifying metric to differentiate results coming from distinct processing schemes, a new combined parameter was defined. It is called the weighted discriminator (WD) and is a linear combination of TPR, Acc, and the false positive rate (FPR), which is related to FP/min. The weights are chosen to reflect the preferences of the authors in the corresponding parameter. This unified parameter greatly facilitates statistical analysis and comparison between different electrode configurations and feature extraction algorithms. The weights chosen were -1.0 for FPR, which one would want to minimize as much as possible (the authors think false positives are highly undesirable in real-time applications of the BCI); 0.6 for Acc, which the authors want to give slight preference over TPR; and 0.4 for TPR, such that the range of WD goes from -1 (in the worst case scenario) to 1 (in the best case scenario). The equation for WD is then, Here, the false positive rate (FPR) is defined as FPR = (FP/min) × (Duration of a single FP in mins) , where that duration is precisely the window length (either 2 or 4 s) for the offline analysis and 1 s (equivalent to 5 consecutive detections, each represented by the shift of 200 ms) for the pseudo-online analysis.

RESULTS AND DISCUSSION
For each subject, the data was processed using both offline and pseudo-online analyses, with two different types of processing windows, five different extraction algorithms, and eight different electrode configurations, for a total of 160 possible combinations per subject. For each combination, the TPR, FP/min and Acc were calculated as in Equations (1-3), and from these, the values of FPR and WD were also computed as indicated in Equations (4) and (5). Table 1 shows the values of WD per subject after using an offline analysis of the EEG data. As mentioned before, these were averages that resulted from the cross-validation among the 16 trials (see Section 2.3.6). Additionally, for each subject, type of processing window, and algorithm, the WD was averaged among the eight different electrode configurations (E.C.), and this is referred to here as the E.C.-averaged WD. These were reported in Table 1 as well. Then, based on these E.C.-averaged WD values, the "best" two algorithms (for each subject and type of processing window) were chosen as those corresponding to the two highest averages. The selected algorithms were marked with two asterisks in Table 1.

Offline Analysis
The 4 s processing windows include time after which the movement has initiated (see Figure 3) and are comprised of 16 epochs, while the 2 s processing windows only include the 6 epochs preceding movement initiation. Thus, intuitively, it is much more demanding to detect the ERD/ERS phenomena when Results for the 2 s processing windows are shown on the left, while those of the 4 s processing windows are shown on the right. The best two feature extraction algorithms for each subject (S) are indicated with two asterisks. The best electrode configurations for those algorithms are also pointed out with one asterisk (those within 0.01 of the highest WD value among those two-asterisk-columns). using the 2 s windows than with the 4 s windows. Indeed, as expected, the WD values for the 2 s processing windows were considerably lower (the E.C.-averaged WD values did not go beyond 0.32) than those of the 4 s windows (where an E.C.averaged WD value of 0.73 was observed). Clearly, the results varied across subjects and it was evident that some electrode configurations and algorithms were better suited to certain individuals. With this in mind, the goal was to find the "best" combination of feature extraction algorithm and electrode configuration for each person. This selection was restricted to the 4 s processing windows given the stark difference in the quality of the results when compared to the 2 s windows. The "best" BCI for each subject was determined using the following procedure: 1. The best two algorithms were selected based on the two highest E.C.-averaged WD values. These were marked with double asterisks in Table 1. 2. Among the 16 WD values associated to the two algorithms and eight electrode configurations, the maximum WD value was preselected along with all those WD values within 0.01 of that maximum. These were marked with a single asterisk in Table 1. 3. Lastly, among the preselected combinations, the one corresponding to the electrode configuration with the lowest number of electrodes was chosen (see Figure 4). If there was a tie on the number of electrodes, the one with the highest WD was selected. If the tie continued, one was chosen at random.
The best personalized BCIs with an offline analysis and 4 s processing windows were tabulated in Table 2. The crossvalidation averages and standard deviations of the TPR, FP/min and Acc were reported.

Pseudo-Online Analysis
A more detailed examination of the pseudo-online analysis is presented next. This is due to the long-term goal of using these BCIs in active therapies to aid recovering stroke patients, where an online processing of the signals is crucial. In real-time applications it would be ideal to use the 2 s windows over the 4 s windows, since they would produce more natural movement in a patient. Having said that, this choice is contingent upon the quality of the results. For the pseudo-online analysis, the test data was processed differently using the last 6 trials and then averaged (with the first 10 training trials being used to create the models). In fact, computing the WD values analogously to Table 1 again showed much better results for 4 s processing windows than with 2 s windows. Thus, the results suggest that it is preferable to use the 4 s processing windows, even if slightly delayed movement is produced as a result of this choice. Indeed, from now on, only the 4 s processing windows will be investigated for the pseudo-online analysis.

Best Personalized BCIs
WD values were tabulated as in Table 1, but for compactness, only the WD results for the two best algorithms of each subject using 4 s processing windows were shown in Table 3. Note that the best two algorithms per subject were the same for the offline processing as with the pseudo-online processing, but this is a consequence of this particular data set. In general, the best two algorithms could be completely different for the two types of analyses. Also, notice the apparent contradiction that WD results for some subjects seem to be higher with the pseudo-online analysis than with the offline analysis. This happened due to the way the false positives were detected, and thus in the way FP/min and FPR were computed with the two different analyses (see 5). Indeed, due to the nature of the offline analysis, only one FP can be detected per rest window. This means that if the FPs were abundant in pseudo-online (say, 6 per rest window), the FPR would be underestimated in the offline analysis, but if the FPs were scarcer (an average of less than 4 per 4 s rest window), the offline analysis would overestimate the FPR and produce lower WD offline values. This can be observed when computing the FPR from Tables 2, 4 and comparing. Thus, it is not wise to compare results between offline and pseudo-online analysis via WD. However, given a fixed type of analysis, it would be justifiable to compare between electrode configurations and feature extraction algorithms.
The best personalized BCIs were selected as described in Section 3.1. The TPR, FP/min and Acc for those personalized configurations are displayed in Table 4, where the standard deviations were computed from the 6 different test trials of each subject.

Are Personalized BCIs Worthwhile?
The purpose of this section is to show that the use of personalized BCIs is indeed preferable over a more traditional approach, were the electrode configuration and feature extraction algorithm are fixed and are used uniformly for all subjects. The goal is also to determine to what extent the personalization of the BCI among all subjects makes sense for this data set. To do this, a criteria to find the best feature extraction algorithm among all subjects (not per subject) is described. Then, for that fixed algorithm a procedure to choose the best (personalized) electrode configuration per subject is outlined. Next, the results are statistically compared with those of the "fully" personalized BCI described in the previous section (reported in Table 4). Finally, given the choice of the best algorithm, a method to choose the best electrode configuration among all subjects is described, The best electrode configurations are pointed out with one asterisk. leading to a fixed algorithm and electrode configuration. Again, the results are statistically compared with those of the "fully" personalized BCI.
The procedure used to choose the best uniform feature extraction algorithm was as follows: 1. For each subject and algorithm its E.C.-averaged WD was computed (WD values were averaged among electrode configurations). These values were then averaged among the subjects, so that a single averaged WD represented each algorithm. 2. The algorithm associated to the highest such average was selected.
Taking these steps yielded that the best uniform algorithm was D, followed closely by algorithms C and E. Next, given this choice of best algorithm, the method to select the best electrode configuration per subject was: 1. Given the best uniform algorithm, there are eight WD values associated to the eight electrode configurations per subject. The maximum WD value was preselected along with all those WD values within 0.01 of that maximum. 2. Among the preselected WD values, the one corresponding to the electrode configuration with the lowest number of electrodes was chosen (see Figure 4). If there was a tie on the number of electrodes, the one with the highest WD was selected. If the tie continued, one was chosen at random. For a pseudo-online analysis and 4 s processing windows, the BCIs associated with the best uniform algorithm and a personalized electrode configuration are presented in Table 5.
To get a better statistical sample to compare the results of Tables 4, 5, the WD values of each of the 6 test trial sessions were computed for each subject. This yielded 30 WD values (from 5 subjects and 6 trial sessions) associated to the BCIs in Table 4 and the same with Table 5. A Wilcoxon signed-rank test determined that the differences of these samples were not statistically significant (p = 0.07) at the standard 5% significance level. Thus, for this particular set of subjects it would make sense to use D as a fixed feature extraction algorithm. This can be helpful to reduce processing time when determining the best possible personalized BCI, since one must only seek between different electrode configurations, instead of different algorithms plus electrode configurations.
Lastly, the idea was to find the best "traditional" approach by finding the feature extraction algorithm and electrode configuration that best suited all subjects. The procedure to find the algorithm that best fitted all subjects was already described, while that of finding the optimal electrode configuration was as follows: 1. Given the best uniform algorithm, the WD values were averaged among the subjects for each electrode configuration. This gave a single averaged WD for each electrode configuration. 2. The electrode configuration associated to the highest such average was selected.
Following this procedure yielded that the "traditional" approach that best suited all subjects was that associated to the fixed use of algorithm D and electrode configuration 4. The results associated to these parameters are shown in Table 6.
The results of Tables 4, 6 were compared using the Wilcoxon signed-rank test as described previously. In this case, there were statistically significant differences (p = 0.0007) of the two samples. A quick inspection of Table 6 shows the results are much less preferable than those of Table 4. Thus, it is clear that a personalized BCI seems to be more suitable than a traditional approach. This shows the power of considering personalized BCIs, as they give greater versatility in providing the best results possible for a particular individual.

Further Discussion
To summarize, as one would expect, the 2 s processing windows with only time before movement onset produce results of lower quality (in terms of WD) than the 4 s processing windows which include time before and after the movement onset. For this reason, it seems preferable to use 4 s processing windows for most purposes, even if they may cause a slight delay when used in real-time applications. Furthermore, based on the WD values, a rigorous procedure to select the best feature extraction algorithm and electrode configuration for each subject was described. Generally speaking, the optimal combination involves high WD values along with the lowest number of electrodes possible. The "minimization" of the number of electrodes is in part to qualitatively pinpoint the areas of the brain that produce the best results, and in part because results can be processed faster (which may be useful in real-time processing of signals). Lastly, statistical analyses determined that the fully personalized BCIs produced better results than a traditional approach. Naturally, other choices of feature extraction algorithms and electrode configurations than those provided in this work are possible, and those are left to the criteria of new researchers. However, the overarching philosophy of personalizing the BCI to each subject is the key point.
Regarding other work in the literature, it should be mentioned that most studies are analyzed offline (Bai et al., 2007(Bai et al., , 2011Lew et al., 2012;Bulea et al., 2014;Jiang et al., 2015;Sburlea et al., 2015). The results seem comparable in terms of TPR and Acc.
Having said that, in many cases comparisons are difficult, since either the relevant parameters are not reported or they must be post-processed from their own results. One study with a pseudoonline analysis Ibáñez et al. (2010) also presented similar results in all parameters. Thus, the results in this work seem to be consistent with those in the literature.
Pseudo-online personalized BCI models were preferred in comparison with offline models, due to their potential use with exoskeletons and other real-time applications. Specifically, the goal is to use this approach in therapies to improve the pedaling capabilities of recovering stroke patients who will be aided by an exoskeleton (or some other medium). Indeed, pedaling seems to be a natural intermediate step before fully rehabilitating gait. The results in this work are valid for the small sample of healthy subjects studied, but to make any assertions in terms of the quality of the results in larger population samples of healthy or recovering patients, more experiments are needed. Having said that, when compared with a traditional approach, the idea of personalizing the BCIs is also expected to yield better results in the population of stroke patients.
Regarding the limitations, a potential for concern in the results of this work is the relatively high number of FP/min which is highly undesirable when trying to detect self-initiated movement. Thus, there is still room for improvement in trying to reduce this variable. Finally, another future avenue of research with these personalized BCI models is the detection of pedaling or walking initiation via motor imagery, for which new protocols must be designed.

CONCLUSIONS
A personalized BCI model aimed at the prediction of the intention of self-initiated pedaling was successfully designed for each subject. This included choosing among different types of processing windows (2 possible), feature extraction algorithms (5 possible) and electrode configurations (8 possible). Moreover, this process was done both for offline analysis and pseudoonline analysis. More precisely, a metric developed by the authors, called the weighted discriminator (WD), was used to compare different BCIs. Indeed, a procedure based on the WD and used to select the best personalized BCI model of each individual was described in detail. This procedure resulted in a desirable choice of feature extraction algorithm and electrode configuration for each specific subject. In general, a processing window of longer duration and including time after movement onset was preferred over the other type of processing window. The results in pseudo-online for the best BCI models of each subject were in average 76.7% of TPR, 4.94 FP/min and 55.1% of Acc. More importantly, statistical analyses were used in a systematic fashion to show that personalized BCIs provide better results than a traditional approach, where a subject-independent feature extraction algorithm and electrode configuration are used for all subjects. Finally, in the context of the rehabilitation of stroke patients, this approach may be useful in active therapies to interface with a lower limb exoskeleton.

AUTHOR CONTRIBUTIONS
MR is responsible for the design, implementation, acquisition and data analysis. MR and EI took part in the interpretation of data. In addition, EI and MO supervised the work and contributed with the revision process. JA actively contributed as director of the work.