*3.6. O*ffl*ine Analysis*

Once the data is recorded and the experimental phase is ended, we repeated the computation of the EEG offline but this time with a much more elaborate processing, since during the offline analysis the subject is not present, and then a more time-consuming algorithm can be used.

MATLAB is used to preprocess the subjects' EEG data. In the offline analysis, we enabled a notch filter at 50 Hz. This is due to the AC lines of the electrical supplies, which can introduce oscillations at 50 Hz and hence, noise oscillations in the EEG recordings. In addition, the data were low-pass filtered and high-pass filtered with cut-off frequencies of 1 Hz and 100 Hz, respectively, in order to eliminate frequencies which are impossible to be produced by the brain, thereby improving the signal cleanliness. Detection of artifacts is carried out with visually routines. An "artifact" can be described as any component of the EEG signal that is not directly produced by human brain activity, but induced by muscle activity, cardiac activity, respiration, and mainly blinks. The proximity of the eyes to frontal electrodes and the intensity of the blinking can produce a big distortion of the EEG that is sometimes impossible to be cleaned. To the trained eye, it is easy to detect, in an EEG graph, the presence of artifacts and their importance. The most notable artifacts are removed by rejecting the piece of data containing the artifact, forcing to discard in some cases the whole data of some volunteers.

To obtain the performance results of each subject, a combination of the CSP and LDA algorithms executed with leave-one-out cross validation has been used. Leave-one-out cross-validation is a certain cross-validation case where the number of folds is equal to the instances in the data set. Hence, the learning algorithm is applied one time for each instance, using all the other measurements as the training set and using the selected instance as a unique item test-set.
