## 3 Methods
### Deep Learning
This allows for information reduction while preserving the most important features. After processing the data through convolutional and pooling layers, the results are transformed into a vector and passed to a fully connected layer. This layer consists of a set of neurons that are connected to neurons in the previous layer. These neurons compute weighted sums of inputs and apply an activation function. The final classification results are compared with the expected labels using a loss function. The goal of the network is to minimize this function, which is achieved using optimization algorithms such as stochastic gradient descent (SGD) or adaptive moment estimation (Adam) [113]. During training, the network weights are updated to minimize the loss function. Creating CNN layers for discrete signals requires considering the specific characteristics of the signals and analysis goals. Depending on the specific problem, layer parameters such as filter size, stride, padding, and activation functions can be adjusted to achieve the best results. It is also important to appropriately customize the architecture of the entire network, including other types of layers such as a fully connected layer, to ensure proper processing and classification of discrete signals. Convolutional neural networks are used for the detection of epileptic seizures in EEG signals for several reasons [114]. CNNs are capable of automatically extracting relevant features from EEG signals, eliminating the need for manual feature engineering by humans. By utilizing convolutional layers, the network can learn to recognize characteristic patterns and shapes of waves that are important for seizure identification [115]. These patterns can be characterized by changes in amplitude or sequences of waves. CNNs create a hierarchical representation of the data, allowing for the modeling of complex relationships between the features of EEG signals. Convolutional layers extract low-level features, such as wave shapes, while subsequent higher-level layers integrate these features into more global patterns. This enables more advanced seizure recognition. As a result, the use of CNNs for seizure detection in EEG signals provides an automatic and objective approach that can be used for the rapid identification of epileptic seizures, offering hope for improving the effectiveness of algorithms. In searching for the best CNN structure, the influence of the number of convolutional layers (in the range of 2-5) was investigated. Moreover, the influence of the number of filters (values: 3-10) was checked. Next, the influence of filter sizes (2, 4, 8, 16, 32, 64, and 128) was investigated. At this stage, the knowledge of iEEG signal processing and analysis methods was not taken into account. The choice of the network structure resulted from an automatic search of optimal combinations of the number of layers, the number of filters, and the filter size. Finally, we opted for a relatively simple CNN structure with 3 convolutional layers. A ReLU layer was applied after each convolutional layer. The last convolution layer and the last ReLU layer contain 128 filters. The structure, along with the basic features and parameters of the layers, are listed in Table 2. During the selection of the best parameters, different optimizers (ADAM, SDG), InitialLearnRate values (0.0001, 0.001, 0.01), and L2 Regularization values (0.01, 0.001, 0.0001) were also checked. To train the CNN, the Adam optimization algorithm was used. The initial learning rate parameter was set to 0.001. This parameter determines how quickly the network adjusts its weights during training. The maximum number of training epochs was set to 50. An epoch represents one pass through the entire training dataset. In this case, the network will be trained for a maximum of 50 epochs, meaning that each training sample will be used no more than 50 times. The option of shuffling the training data before each epoch was applied.