# Cross-Subject Classification of Effectiveness in Performing Cognitive Tasks Using Resting-State EEG
## 2 Materials and Methods
### Machine Learning Algorithm for Classification of EEG Patterns  
Using the Light Gradient Boosting Machine (LightGMB) method and PSD features, we performed cross-subject group classification to recognize the group type to which the individual EEG data belonged. Light GBM is an advanced pipeline based on a decision tree algorithm with one partition per leaf. Gradient Boosting Machines (GBM), is a machine learning technique that involves the iterative training of decision trees. In GBM, decision trees are trained sequentially to improve the performance of the model by reducing the error of the previous tree. The algorithm works by calculating the gradient of the loss function with respect to the output of the previous tree and using this gradient to adjust the parameters of the next tree. Light GBM hyperparameter simulations were performed using cross-validation grid analysis. For subject-independent classification of the group of participants, epochs were labeled according to the group to which the subject belongs. EEG epochs of two participants, which were selected from different groups, were used for the test set. The validation set picked EEG epochs of another two participants also from different groups. Both sets were selected randomly. EEG epochs of other subjects were utilized for training. This process was repeated ten times, creating ten different folds for group classifications. The balanced accuracy (BA), receiver operating characteristic (ROC) curve, and area under the curve (AUC) were used to assess the performance of LightGMB. The Mann-Whitney U-test was applied for statistical comparison of classification performance in different comparisons.  
The Shapley Additive Explanations (SHAP) approach was used for the interpretation of the classification results and to retrieve the average contribution of a feature among all possible coalitions [28]. SHAP values are a model-agnostic method for explaining the output of any machine learning model. The SHAP approach is based on game theory and provides a way to estimate the contribution of each feature to the final prediction made by the model. The basic idea behind SHAP values is to calculate the expected value of the model output when a certain feature is included in the model, compared to the expected value of the model output when the feature is not included. This is completed by calculating the average prediction for all possible combinations of features, and then computing the difference between the average prediction with and without the feature of interest. This difference represents the contribution of that feature to the model prediction. The SHAP value for a given feature can be thought of as the average marginal contribution of that feature across all possible feature subsets. This means that SHAP values capture not only the main effect of a feature, but also its interactions with other features. SHAP values provide several advantages over other methods for explaining machine learning models. First, they are model-agnostic, meaning that they can be applied to any type of model, including deep learning models and ensemble models. Second, they provide a local explanation for each individual prediction, which can be helpful for understanding the factors that influence a specific outcome. Finally, SHAP values can be used to compare the importance of different features in the model, which can be useful for feature selection or feature engineering [28].