## 4 Methodology and Algorithm Explanation
### Classifying Features Using Convolution Neural Network (CNN)  
Convolutional neural networks (CNNs) are feedforward deep neural networks that process EEG data through three layers: convolutional, pooling, and fully connected. The convolutional layer [38] combines the tensor with the shape, whereas the pooling layer [39] simplifies calculations to minimize data dimensions. The fully connected layer [40] connects neurons from previous layers to predict or classify target goals. This stacked-layer DL technique reduces input data while capturing the distinctive spatial dependency of EEG signals. In this work, a 1D-CNN is used; for this reason, we explain it in some detail. Containing millions of parameters and several hidden layers, deep 2D-CNNs can learn complex objects and patterns if they are trained on a large visual database containing ground-truth labels. When paired with appropriate training, this unique ability makes them the primary tool for a variety of technical applications utilizing 2D signals, includingpictures and video frames [41]. In contrast to 1D signals, this might not be a feasible option in many applications, especially if the training data is constrained or application-specific [42]. 1D-CNNs were recently proposed as a solution to this issue, and they quickly achieved state-of-the-art performance levels in a number of applications, such as motor fault detection, structural health monitoring, early diagnosis and personalized biomedical data classification, anomaly detection and identification in power electronics, and structural health monitoring [43]. Another significant benefit is that while 1D-CNNs only conduct 1D convolutions (scalar multiplications and additions), their compact and straightforward design makes real-time, low-cost hardware implementation possible [44]. In this section, a one-dimensional convolutional neural network model (Sleep-1D-CNN) is developed using the Sleep-Edf dataset. The proposed Sleep-1D-CNN showed state-of-the-art performance levels in applications involving the classification of sleep stages using EEG signals, such as identifying sleep quality. The DL-EEG classification system displayed here is based on a one-dimensional convolutional neural network (EEG-1D-CNN), which is unique in that the CNN kernels can save time by simply swiping over the elements of the input pattern's single dimension during convolution. The suggested Sleep-1D-CNN model classifies EEG signals to classify sleep stages; Table 3 displays the suggested Sleep-1D-CNN layers. Following the loading, splitting, processing, and feature selection of the dataset, the data are immediately classified using the suggested Sleep-1D-CNN model. The suggested CNN model has 26 layers, which are as follows: \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**NO.**} & \multirow{2}{*}{**Layer Type**} & \multirow{2}{*}{**Filters**} & \multirow{2}{*}{**Size/Stride**} & **Activation** & \multirow{2}{*}{**\#Param**} \\  & & & & & \\ \hline
1 & Convolutional & 16 & 3/1 & \_ & 64 \\ \hline
2 & Max Pooling & \_ & \_ & \_ & 0 \\ \hline
3 & Leaky ReLU & \_ & \_ & \_ & 0 \\ \hline
4 & Convolutional & 32 & 3/1 & \_ & 1568 \\ \hline
5 & Max Pooling & \_ & \_ & \_ & 0 \\ \hline
6 & Leaky ReLU & \_ & \_ & \_ & 0 \\ \hline
7 & Convolutional & 64 & 3/1 & \_ & 6208 \\ \hline
8 & Max Pooling & \_ & \_ & \_ & 0 \\ \hline
9 & Leaky ReLU & \_ & \_ & \_ & 0 \\ \hline
10 & Convolutional & 64 & 3/1 & \_ & 12,352 \\ \hline
11 & Max Pooling & \_ & \_ & \_ & 0 \\ \hline
12 & Leaky ReLU & \_ & \_ & \_ & 0 \\ \hline
13 & Dense & 32 & \_ & Linear & 4160 \\ \hline
14 & Convolutional & 32 & 3/1 & \_ & 6176 \\ \hline
15 & Max Pooling & \_ & \_ & \_ & 0 \\ \hline
16 & Leaky ReLU & \_ & \_ & \_ & 0 \\ \hline
17 & Convolutional & 32 & 3/1 & \_ & 3104 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The proposed Sleep-1D-CNN layers. The following details how the 1D-CNN works with EEG signals:  
1. Input layer: The input of the 1D-CNN is a sequence of EEG signal samples recorded from a single electrode channel.