## 2 Materials and Methods
### Feature Extraction
#### 2.3.1 Convolutional Neural Network  
ERPs are characterized by non-stationary activity that varies across different sessions and individuals. This variability makes it challenging to extract robust and reliable features for analysis. CNNs have shown great promise in addressing this challenge by leveraging their ability to learn hierarchical representations of the input data [28; 29]. The architecture of a CNN is typically composed of multiple convolutional layers and a set of fully connected layers. Feature extraction is completed by applying a series of convolutional filters to the input image or signal in CNN. These filters are designed to detect specific patterns or features in the data. The output of each filter is then passed through a non-linear activation function to introduce non-linearity into the network. This process of convolution is repeated multiple times in the network to extract increasingly complex features from the input image. Once the features have been extracted, they are fed into a fully connected layer that performs classification. Overall, feature extraction is a critical step in CNN that enables it to learn meaningful representations of images and achieve state-of-the-art performance on various tasks. Figure 2: Graphical representation of the suggested method. In this paper, both CNN networks (CNN1 and CNN2) have the same structure as a two-layer CNN network and were trained to extract features from the EEG signal based on the details given in the literature [20]. Each convolutional layer applies a set of kernels to the input data to extract spatial and temporal patterns at different scales, respectively. The size and number of kernels used in each layer are important design choices that affect the quality of the extracted features. In our study, we used a kernel size of \([64\times 1]\) for the first convolutional layers, which has been shown to be effective for capturing local spatial patterns in EEG data. Then we used a kernel size of \([1\times 20]\) for the second convolutional layer, which has been shown to be effective for capturing local temporal patterns in EEG data, and also applied the rectified linear unit (ReLU) activation function after each convolutional operation. ReLU has been shown to be an effective non-linearity for deep neural networks, which sets all negative values in the feature map to zero while passing all positive values unchanged. This helps to create sparse representations that are easier to learn and generalize, allowing for efficient training and avoiding the vanishing gradient problem. Note that the choice of kernel size and number is problem-specific and depends on the nature of the EEG analysis task. For instance, if the task involves detecting transient events in the EEG signal, such as P300 responses, larger kernel sizes may be more effective for capturing the temporal dynamics of the signal. On the other hand, if the task involves identifying spatial-temporal patterns in the signal, smaller kernel sizes may be more appropriate for capturing local features. Additionally, the number of kernels used in each layer can be increased or decreased depending on the complexity of the task and the amount of available data. A larger number of kernels may result in overfitting if the dataset is small, while a smaller number of kernels may not capture the full complexity of the signal if the dataset is large and diverse. The number of kernels for both convolution layers is set to 16. Finally, the features were extracted from the second layer of the CNN using the ReLU activation function. These extracted features were then used as inputs for subsequent processing and analysis. * CNN train approach  
Fine-tuning is the process of taking a pre-trained neural network, such as a CNN, and training it on a new task or dataset [30]. In the context of CNNs, fine-tuning involves modifying the weights of the pre-trained network to better adapt it to the new task while still preserving the knowledge learned from the original task.