## 2 Materials and Methods
### Performance Analysis  
On both the datasets, two variables have been analyzed: (I) the performance of the passive BCI system in classifying the two workload levels (i.e., easy vs. hard), and (II) the percentage of data affected by covariate shift phenomenon by using the isolation forest technique over all the conditions (i.e., Control data, Testing data with covariate shift, Testing data corrected). To determine whether a _shift_ causes a decrease in classification accuracy, we initially investigated to what extent the performance of a Machine Learning model decreases when test data exhibits a shift with respect to training data.  
Since the investigated variable (i.e., easy and hard conditions) is balanced between Easy and Hard values, to quantify the degradation in the performance of the Machine Learning classification model, we employed the accuracy metric [59].  
To perform analyses involving the comparison of classification accuracy values, we computed a moving average of the classifier's predicted values (i.e., 0 or 1) by grouping the data into variable-length windows ranging from 1 s to 60 s. Consequently, at each time point (_t_), we obtained the accuracy value associated with the method by calculating the moving average over a window of length t records with a unitary shift.  
\[Accuracy_{dec_{t}}=\frac{Number\ of\ correct\ assessments_{dec_{t}}}{Number\ of\ all\ assessments_{dec_{t}}}\ \ \ \forall\ t=1,\ 2,\ldots 60 \tag{2}\]  
where at each decimation, the value of \(Number\ of\ correct\ assessments_{dec_{t}}\) is computed by comparing the list of predicted values and correct values created by applying a moving average with window size \(t\) and unit step.  
The second analysis was performed to investigate the effectiveness of the method employed to detect the presence of covariate shifts in recorded data, in particular, using the Isolation Forest [60] method. In this case, the model was trained using the control data, and then the percentage of data in the test conditions that were identified as outliers was evaluated. These outliers represent data that presents a _shift_ with respect to the distribution of the control data [60].  
As mentioned before, we tried to test whether a linear transformation of shift-affected data could improve classification accuracy. For this reason, the analyses previously described were performed both before and after the application of the linear transformation. The results obtained were then compared to determine if and under what conditions the application of the correction method could yield improvements in workload classification.  
In order to establish the minimum number of test data samples required to optimize the detection of the covariate shift phenomenon, several simulations were conducted, each involving different sample sizes of recorded data. Specifically, the test data underwent an analytical process to identify the presence of shift by considering only the initial \(n\) seconds, where \(n\) ranged from 10, 15, 20, 30, 45, to 60 s. This approach was adopted because the type of shift of interest is associated with an incorrect positioning of the EEG electrode cap. Therefore, if this discrepancy is detectable in the initial moments of recording, it is presumed to persist in subsequent phases. Consequently, the objective was to determine the minimum length of the data subset to be analyzed for the detection of covariate shift.  
Both analyses were conducted separately on both available datasets to ensure a comprehensive and accurate evaluation of the performance of the covariate shift detection and correction method.