## 3 Materials and Methods
### Subject-Dependent MI-EEG Classification Using Deep Learning  
Let \(\mathcal{D}=\{\mathbf{X}_{n}\in\mathbb{R}^{C\times\tau},\mathbf{y}_{n}\in\{0,1\}^{K} \}_{n=1}^{N}\) be a subject-dependent input-output MI-EEG dataset, gathering \(N\) trials, \(\tau\) time samples, \(C\) channels, and \(\hat{K}\) MI-classes (\(\hat{K}=2\) for the GIGAScience dataset). To optimize meaningful spatial-temporal-spectral patterns in EEG from a given \(\mathbf{X}\in\mathcal{D}\) and decrease noise for the improved prediction of MI classes, a DL approach can be employed as follows:  
Figure 2: EEG preprocessing scheme for MI-EEG classification. \[\mathbf{\hat{y}}=\tilde{f}(\mathbf{X}|\theta)=(f_{L}\circ f_{L-1}\circ\cdots\circ f_{1})( \mathbf{X}), \tag{2}\]  
\(\hat{y}\in[0,1]^{K}\), \(\sum_{k=1}^{K}\hat{y}_{k}=1\), \(L\) stands for the number of layers, and  
\[\mathbf{Z}_{l}=f_{l}(\mathbf{Z}_{l-1})=\varphi(\mathbf{Z}_{l-1}\otimes\mathbf{W}_{l}+\mathbf{B}_{l }), \tag{3}\]  
where \(\varphi(\cdot)\) is a given non-linear activation function, \(\mathbf{Z}_{l}\in\mathbb{R}^{C_{l}^{l}\times\pi_{l}^{l}\times\tilde{R}_{l}}\) is the \(l\)-th feature map \(\mathbf{W}_{l}\), \(\mathbf{B}_{l}\) holds the weights and bias of proper size, \(\tilde{P}_{l}\) stands for the number of filters, and \(\theta=\{\mathbf{W}_{l},\mathbf{b}_{l}\}_{l=1}^{L}\) collects the network parameters. Furthermore, \(\otimes\) represents the tensor product operator for fully connected, convolutional, or recurrent layers. Then, an optimization problem can be formulated as follows:  
\[\hat{\theta}=\arg\min_{\theta}\mathbb{E}\{\mathcal{L}(\mathbf{y}_{n},\tilde{f}( \mathbf{X}_{n}|\theta)):\forall n\in\{1,2,\ldots,N\}\}, \tag{4}\]  
where \(\mathcal{L}(\cdot,\cdot)\) is a given loss function, i.e., cross-entropy. In addition, a gradient descent-based framework using back-propagation is employed to optimize the parameter set [64]:  
\[\theta_{i}=\theta_{i-1}-\eta_{i}\frac{\partial}{\partial\theta_{i}}\left\{ \frac{1}{N}\sum_{n=1}^{N}\mathcal{L}(\mathbf{y}_{n},\tilde{f}(\mathbf{X}_{n}|\theta_{ i}))\right\}, \tag{5}\]  
where a sample mean estimation is used to approximate the expected value, and an autodiff-based approach computes the gradient (\(\eta_{i}\in\mathbb{R}^{+}\) is a learning rate). Here, the following MI-EEG DL networks will be considered:  
* EEGNet [36]: The process begins with a temporal convolution, which is followed by a depthwise layer that serves as a spatial representation for each filter produced at the previous stage. Afterward, an exponential linear activation function (ELU) is used before an average pooling and a dropout to help minimize overfitting. Next, it applies separable convolution, which is followed by another ELU activation and an average pooling. Lastly, a second dropout layer precedes the flattening and classification stages. Batch normalization is always performed immediately after each convolutional layer. * KREEGNet [38]: Similar to EEGNet, it uses a Gaussian kernel after batch normalization to extract the connectivity between EEG channels. A delta kernel is implemented on the label data, and a centered kernel alignment (CKA)-based regularization between connectivities and label data is added as a penalty to the straightforward cross-entropy. * KCS-FCNet [39]: A single convolutional stage occurs before a Gaussian kernel is utilized to measure EEG connectivity. These are then run through an average pooling layer before batch normalization and classification. Interestingly enough, a dropout step is performed between the flatten layer and the dense layer. Figure 3: [PERSON]’s entropy for the GIGAScience database questionnaire answers. Questions were sorted by their entropy value in decreasing order. The dotted line shows the selected threshold (25 th percentile) for selecting questions. * ShallowConvNet [65]: It performs two consecutive convolutions and then proceeds with batch normalization and square activation. After that, average pooling is achieved before logarithmic activation and dropout.