# Implementation of Tools for Lessening the Influence of Artifacts in EEG Signal Analysis
## 3 Tools and Methods  
As explained previously, the implemented methods are based on [14], although slight modifications have been included in the implementation provided at [[https://hdl.handle.net/10630/26154](https://hdl.handle.net/10630/26154)]([https://hdl.handle.net/10630/26154](https://hdl.handle.net/10630/26154)) (accessed on 16 January 2024), aimed at encouraging other researchers to follow the techniques described and apply their specific processing decisions. Next, a brief summary of each of them is presented, but first, the idea of artifact membership function (MSF) is outlined.  
**Artifact membership function.** The artifact membership function (MSF), inspired by [19], is a logical sequence with the same length of the recorded EEG data, in which artifacts are marked with \(+1\) (or a positive value between 0 and 1) and the rest of the samples with 0.  
In [14], this function is manually created for the evaluation of the methods presented; however, in this work, to facilitate the utilization of the data and code provided, a function (_fa_create_msf_fieldtrip_) that automatically creates an MSF using Fieldtrip toolbox functions will be described for illustrative purposes. Note that other artifact detection algorithms, such as the one proposed in [20], based on the calculation of the acceleration of EOG signals, or the one described in [21], based on the calculation of probabilistic models from the derivatives of VEOG and HEOG signals, or the procedure described by [PERSON] and [PERSON] [22], based on the extraction of features from EEG channels regenerated from signal components extracted by ICA, could be equally employed, along with others.  
**Method 1: ICs removal.** In this method, the correlations between the components obtained by ICA and EOG signals are obtained with the objective of eliminating the independent components (ICs) that have higher similarity to EOG signals (we consider vertical, VEOG, and horizontal, HEOG, signals). Subsequently, EEG channels are reconstructed without those components. This method can be seen as related to the works in [23], where the author experiments with EEG signal filtering and the removal of independent components (ICs), or [24], where the authors discard ICs on the basis of a Bayesian deep-learning scheme.  
**Method 2: Partial removal of ICs.** This method is similar to the previous one, but now the MSF is used. The procedure is as follows: the correlation between the components obtained after ICA with all channels and EOG channels is calculated to identify components similar to the EOG signals. Then, instead of eliminating them, the components are set to zero only in the samples where artifacts appear in order to later reconstruct EEG channels without these artifact samples.  
**Method 3: Partial removal of ICs using an artifact-free ICA unmixing matrix.** In this case, the unmixing matrix for ICA is calculated from EEG signals without the samples with artifacts. Samples with artifacts must be identified by using an MSF. As in the previous methods, the correlation with EOG signals is obtained to select the components with larger values. In this case, as in the previous method, the samples related to a positive value of the MSF signal, i.e., those in which artifacts were detected, will be eliminated.