## 2 Materials and Methods
### Applying EEGNet to TEAS Data  
EEGNet, a compact convolutional neural network architecture specifically designed for EEG-based brain-computer interfaces (BCIs) [28], was employed for the classification of the EEG data. The choice of EEGNet over other models was well justified by its architecture, which efficiently manages the unique temporal and spatial dynamics of EEG signals through depthwise and separable convolutions. This specialization has been shown to enhance performance in EEG classification tasks, as reported by [PERSON] et al. (2018) [28]. Furthermore, EEGNet offers high classification accuracy while maintaining a compact size, which is essential for handling computationally intensive analysis of EEG data. It achieves competitive or superior results compared to traditional models like SVMs and MLPs, while requiring fewer computational resources [28; 29]. Additionally, EEGNet's integration with saliency maps enhances interpretability by identifying critical EEG electrodes, allowing researchers to focus on significant brain regions. This capability aligns with recent advancements in deep learning for EEG analysis [30]. Figure 3 illustrates the architecture of EEGNet as adapted to our TEAS dataset. EEGNet processed the input data through a series of convolutional and pooling layers. The key components of this process are explained below, with a detailed description of the variables involved. First, consider the temporal convolution, which is defined as  
\[Y_{ij}=\sum_{k=1}^{K}X_{ik}W_{kj}+b_{j}, \tag{1}\]  
Figure 3: Block diagram of the customized EEGNet architecture. where \(Y_{ij}\) represents the output feature map at position \(i\) for the \(j\)-th feature. The input signal at position \(i\) for the \(k\)-th time sample is denoted by \(X_{ik}\), and \(W_{kj}\) is the weight of the convolutional filter connecting the \(k\)-th input time sample to the \(j\)-th output feature. The bias term for the \(j\)-th output feature is denoted by \(b_{j}\), and \(K\) represents the kernel size of the convolution. Next, the depthwise convolution is described by the following equation:  
\[Y_{ijk}=X_{ijk}*W_{k}, \tag{2}\]  
where \(Y_{ijk}\) is the output feature map at position \((i,j)\) for the \(k\)-th depthwise filter. The input signal at position \((i,j)\) for the \(k\)-th depthwise filter is denoted by \(X_{ijk}\), and \(W_{k}\) is the weight of the depthwise convolutional filter applied to the \(k\)-th input channel. Finally, the separable convolution is expressed as  
\[Y_{ijkm}=\sum_{l}(X_{ijkl}*W_{klm}), \tag{3}\]  
where \(Y_{ijklm}\) represents the output feature map at position \((i,j)\) after applying the separable convolution. The input signal at position \((i,j)\) for the \(l\)-th input channel is represented by \(X_{ijkl}\), and \(W_{klm}\) is the weight of the separable convolutional filter connecting the \(k\)-th depthwise filter to the \(m\)-th pointwise filter. The index \(l\) is used to iterate over the input channels for the depthwise convolution. The EEGNet model processed the EEG data with an input layer configured for (19 electrodes, 500 samples, 1), matching the electrode setup and temporal data length. The first convolutional block utilized a 2D convolution with 8 filters and a kernel length of 250 to effectively capture the temporal features. This was followed by a depthwise convolution with a depth multiplier of 16, enabling the network to learn spatial filters specific to each electrode. To prevent overfitting, L2 regularization with a rate of 0.1 was applied, and the ELU activation function enhanced the training process. Average pooling reduced the data dimensionality, and a dropout rate of 0.5 further mitigated overfitting. The second block used separable convolutions with 128 filters, chosen to reduce computational complexity while efficiently learning spatial and pointwise features. This block also included batch normalization and ELU activation, followed by average pooling and dropout.