## 2 Materials and Methods
### Applying EEGNet to TEAS Data
A dense layer, with units corresponding to the number of classes, incorporated L2 regularization and a max-norm constraint to ensure stable learning. The output layer employed a softmax activation function to provide class probabilities. The key hyperparameters included a kernel length of 250, filter counts of 8 and 128, a normalization rate of 0.25, and a learning rate of 0.0001. These parameters were carefully selected to balance the model's capacity to learn complex patterns while maintaining generalization, ensuring effective capture of both temporal and spatial features for EEG classification tasks. A 5-fold stratified cross-validation approach was implemented. By this method, the dataset was partitioned into five distinct subsets, with each fold consisting of 80% training data and 20% test data. This split was performed using stratification to maintain consistent proportions of classes across both the training and the test sets. Importantly, samples from all participants were included in each fold, ensuring that our model captured the general effects of TEAS on EEG signals rather than being influenced by individual subject variability. This approach reflected our objective to assess the generalized impact of TEAS on EEG activity. Several key metrics were utilized to evaluate the performance of the EEGNet classifier for multi-class classification tasks, tailored to assess the model's ability to accurately identify instances across multiple classes. These metrics included accuracy, sensitivity (recall), specificity, precision, and F1 score. The results from each fold were then aggregated to report the average values of these parameters. Additionally, the standard deviation (\(\pm\)Value) for the accuracy across all folds is reported. Accuracy was defined as the proportion of true results (true positives and true negatives) across all classes among the total number of cases examined. It provided an overall measure of the classifier's correctness across all classes and was calculated as follows:  
\[\text{Accuracy}=\frac{\sum_{c=1}^{C}\text{{TP}_{c}}+\sum_{c=1}^{C}\text{{TN}_{c }}}{\sum_{c=1}^{C}(\text{{TP}_{c}}+\text{{FP}_{c}}+\text{{FN}_{c}}+\text{{TN}_{c }})}, \tag{4}\]  
where \(C\) is the number of classes, and \(\text{{TP}_{c}}\), \(\text{{TN}_{c}}\), \(\text{{FP}_{c}}\), and \(\text{{FN}_{c}}\) are the true positives, true negatives, false positives, and false negatives for class \(c\), respectively. Sensitivity (recall) measures the proportion of actual positives for each class that are correctly identified by the classifier. Sensitivity is crucial in applications where the omission of a condition can have serious consequences. Sensitivity for class \(c\) was calculated as  
\[\text{Sensitivity}_{c}=\frac{\text{{TP}_{c}}}{\text{{TP}_{c}}+\text{{FN}_{c}}}. \tag{5}\]  
Specificity for a multi-class classification assesses the model's ability to correctly identify instances that do not belong to each particular class. For class \(c\), specificity was calculated as  
\[\text{Specificity}_{c}=\frac{\text{{TN}_{c}}}{\text{{TN}_{c}}+\text{{FP}_{c}}}. \tag{6}\]  
Precision quantifies the number of correct positive predictions made by the classifier for each class. It was defined for class \(c\) as  
\[\text{Precision}_{c}=\frac{\text{{TP}_{c}}}{\text{{TP}_{c}}+\text{{FP}_{c}}}. \tag{7}\]  
The F1 score is the harmonic mean of precision and sensitivity for each class, providing a single score that balances the two metrics. It was calculated for class \(c\) as  
\[\text{F1-Score}_{c}=2\times\frac{\text{Precision}_{c}\times\text{Sensitivity}_{ c}}{\text{Precision}_{c}+\text{Sensitivity}_{c}}. \tag{8}\]  
These metrics provided a comprehensive view of the classifier's performance in a multi-class scenario.