# A Hybrid CNN-GRU-LSTM Algorithm with SHAP-Based Interpretability for EEG-Based ADHD Diagnosis
## 3 Materials and Methods
### Rationale for Method Selection  
Choosing a suitable computational paradigm is essential to attain both correct ADHD classification and clinically interpretable results in EEG-based diagnosis. Conventional machine learning methods, like Support Vector Machines (SVMs), k-Nearest Neighbors (KNNs), and decision trees, have yielded limited success in this field because they rely on hand-engineered features and lack generalizability across subjects and recording sessions. Such models fail to capture the nonlinear and dynamic spatiotemporal patterns of EEG signals, especially those involved in cognitive control and attentional modulation. To overcome these limitations, deep learning methods have been ever more embraced owing to their ability to discover hierarchical representations from raw or minimally preprocessed EEG data. CNNs excel at capturing localized spatial dependencies over electrode topographies, whereas RNNs--particularly GRUs and LSTM networks--are naturally suited to capture temporal dynamics. GRUs offer computational efficiency via simplified gating mechanisms, whereas LSTMs are adept at capturing long-range dependencies within EEG sequences. The proposed CNN-GRU-LSTM architecture combines the strengths of these three components--CNN for spatial encoding, GRU for short-term sequence modeling, and LSTM for long-term dependency learning--into a unified end-to-end framework capable of extracting comprehensive spatiotemporal features. A baseline CNN-LSTM model was implemented to serve as a comparative benchmark. In addition to recurrent-based models, this study investigates transformer encoder architectures with two and three stacked attention blocks, as well as a spatiotemporal transformer model, which incorporates 2D positional encoding to jointly capture spatial electrode topography and temporal dependencies in EEG signals. These architectures have shown promising results in biomedical time-series tasks due to their ability to model long-range global dependencies via multi-head self-attention mechanisms, without relying on recurrence. Finally, we propose a novel hybrid CNN-RNN-transformer architecture that integrates convolutional, recurrent, and attention-based modules within a single framework. This hybrid design aims to leverage the complementary strengths of each component to improve both predictive performance and interpretability. This multi-architecture approach facilitates a rigorous comparative evaluation of spatial, sequential, and global modeling strategies for ADHD classification using task-evoked EEG. It also establishes a methodological foundation for achieving high diagnostic accuracy alongside feature-level interpretability, which is an essential requirement for real-world clinical applications. Figure 4 illustrates the baseline hybrid neural network architecture, combining one-dimensional convolutional (Conv1D) layers and LSTM units to independently extract  
spatial and temporal features from EEG signals. In this model, one branch processes the input through two consecutive LSTM layers to capture long-range temporal dependencies, while a parallel convolutional pathway applies progressively deeper Conv1D layers, followed by MaxPooling1D operations to extract localized spatial features. The outputs from both branches are flattened and concatenated and then passed through a dense layer and dropout for regularization, concluding with a sigmoid-activated output neuron for binary classification. Figure 5 presents the proposed enhanced CNN-GRU-LSTM architecture specifically designed to improve the robustness and representational capacity of EEG-based ADHD classification. In contrast to the baseline model, the novel architecture utilizes a recurrent unit that alternates between GRU and LSTM layers to leverage their complementary strengths in modeling both dynamic and long-term temporal interactions.