## 3 Materials and Methods
### Monte Carlo Dropout with CAM Integration for MI Classification  
To address the limitations of traditional approaches and enhance both robustness and interpretability in EEG-based MI classification, we integrate Monte Carlo dropout (MCD) with class activation maps (CAMs) across the deep learning architectures described above [68]. This integration provides a unified framework that simultaneously quantifies prediction uncertainty and visualizes spatiotemporal patterns critical for MI classification. It is important to note their distinct roles: MCD is a model component whose contribution is evaluated via an ablation study (comparing models with and without it), whereas CAMs is a post-hoc visualization technique used to interpret the model's behavior, not to alter its performance.  
Channel dropout is applied by introducing a dropout mask \(\mathbf{\epsilon}^{(i)}\sim\text{Bernoulli}(1-p)\) component-wise to the input EEG tensor \(\mathbf{X}\in\mathbb{R}^{C\times T}\), such that the modified input becomes \(\mathbf{X}^{(i)}=\mathbf{X}\odot\mathbf{\epsilon}^{(i)}\), where \(\odot\) denotes element-wise multiplication. For a given layer output \(\mathbf{h}\in\mathbb{R}^{d}\), the MCD operation is defined as follows:  
\[\text{MCD Operation:}\quad\mathbf{h}^{(i)}=\mathbf{h}\odot\mathbf{\epsilon}^{(i)}, \quad\text{Scaled Output:}\quad\mathbf{\tilde{h}}^{(i)}=\frac{\mathbf{h}^{(i) }}{1-p},\quad\mathbf{\tilde{h}}^{(i)}\in\mathbb{R}^{d},\]  
where \(p\in[0,1]\) is the dropout probability, \(\mathbf{\epsilon}^{(i)}\in\{0,1\}^{d}\) is a random mask vector sampled from a Bernoulli distribution with success probability \(1-p\). The scaling factor \(\frac{1}{1-p}\) preserves the expected activation magnitude, ensuring \(\mathbb{E}[\tilde{h}_{j}^{(i)}]=h_{j}\).  
The integration of MCD goes beyond uncertainty quantification, serving as a performance-enhancing technique grounded in established machine learning principles. Its effectiveness can be explained through two theoretical lenses: (1) as a regularizer, channel dropout mitigates overfitting by randomly deactivating EEG channels during training, encouraging the model to learn more robust and generalizable representations of motor imagery; and (2) as an approximate Bayesian ensemble, multiple forward passes with different dropout masks during inference approximate the behavior of an ensemble of neural networks [60], reducing prediction variance and enhancing stability [69]. These combined effects underpin the observed performance gains in our framework.  
During inference, MCD generates \(T\) stochastic predictions, which are then augmented by CAMs to visualize spatially relevant features. This integration is formalized as [70]:  
\[\text{Stochastic Predictions:}\quad\mathbf{\hat{y}}^{(i)} =f_{\theta}(\mathbf{X};\mathbf{\epsilon}^{(i)}),\quad i=1,2,\dots,T,\] \[\text{Predictive Mean:}\quad\mathbf{\hat{y}} =\frac{1}{T}\sum_{i=1}^{T}\mathbf{\hat{y}}^{(i)},\] \[\text{Predictive Variance:}\quad\sigma^{2} =\frac{1}{T}\sum_{i=1}^{T}\|\mathbf{\hat{y}}^{(i)}-\mathbf{\hat{y }}\|^{2},\] \[\text{CAM Computation:}\quad M_{c}(\mathbf{X}) =\sum_{k}w_{k}^{c}\cdot A_{k}(\mathbf{X}),\quad w_{k}^{c}=\frac{1} {Z}\sum_{i=1}^{T}\frac{\partial\mathbf{\hat{y}}_{c}^{(i)}}{\partial A_{k}( \mathbf{X})}, \tag{1}\]  
where \(f_{\theta}(\cdot;\mathbf{\epsilon}^{(i)})\) is the network with dropout mask \(\mathbf{\epsilon}^{(i)},\mathbf{\hat{y}}^{(i)}\in\mathbb{R}^{K}\) is the prediction vector, \(\mathbf{\hat{y}}\) is the final output, and \(\sigma^{2}\) quantifies uncertainty. For CAM computation, \(M_{c}(\mathbf{X})\) is the activation map for class \(c\), \(A_{k}(\mathbf{X})\) is the activation of unit \(k\) in the target layer, and \(w_{k}^{c}\) is the importance weight averaged over \(T\) MCD samples, normalized by \(Z\) (number of spatial locations), with gradients \(\frac{\partial\mathbf{\hat{y}}_{c}^{(i)}}{\partial A_{k}(\mathbf{X})}\) reflecting feature relevance.