# A Hybrid CNN-GRU-LSTM Algorithm with SHAP-Based Interpretability for EEG-Based ADHD Diagnosis
## 4 Results
### Confusion Matrix Analysis
To complement standard classification metrics, we conducted a detailed analysis based on the confusion matrices of each model. This allowed us to evaluate model behavior in terms of false positives and false negatives, which are particularly critical in clinical diagnostics. We extracted four performance indicators from each confusion matrix: specificity (true negative rate), balanced accuracy (sensitivity and specificity average), Cohen's Kappa (chance-corrected agreement), and MCC, which includes all entries of the confusion matrix and is insensitive to class imbalance. These measures provide a more detailed picture of model reliability, especially for discriminating children with ADHD from TD controls (Table 4). The confusion matrix-based measurements show that the hybrid CNN-RNN-transformer model provides the strongest and most stable performance across all compared architectures, with close-to-perfect specificity (0.99995), balanced accuracy (0.999943), Cohen's Kappa (0.999886), and MCC (0.999886). This suggests excellent agreement with ground truth and remarkable generalization across both the control and ADHD groups. The spatiotemporal transformer also shows excellent diagnostic reliability, with all major evaluation metrics greater than 0.999, testifying to its efficacy in capturing spatial topography and intricate temporal dependencies in multichannel EEG. Conversely, the transformer encoder models (2\(\times\) and 3\(\times\))--although obtaining high accuracy in cross-validation--demonstrate significantly lower generalization power, with specificity of 0.8410 and 0.7880, and balanced accuracy below 0.77, indicating a bias toward false positives when classifying control subjects. Such performance disparity indicates the difficulty of using pure transformer models in clinical EEG applications with inadequate regularization or calibration. The CNN-GRU-LSTM model sustains high and stable performance on all measures, with balanced accuracy of 0.9968 and Cohen's Kappa of 0.9936, thus outperforming the CNN-LSTM baseline with evidently lower scores overall. Together, these results highlight \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Model** & **Specificity** & **Balanced Accuracy** & **Cohen’s Kappa** & **MCC** \\ \hline CNN–LSTM & 0.9962 & 0.9905 & 0.9810 & 0.9811 \\ CNN–GRU–LSTM & 0.9991 & 0.9968 & 0.9936 & 0.9936 \\ Transformer Encoder (2\(\times\)) & 0.8410 & 0.7625 & 0.519 & 0.531 \\ Transformer Encoder (3\(\times\)) & 0.7880 & 0.7453 & 0.4906 & 0.4924 \\ Spatiotemporal Transformer & 0.9988 & 0.9999 & 0.9998 & 0.9998 \\ Hybrid CNN–RNN–Transformer & 0.999995 & 0.999943 & 0.999886 & 0.999886 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Confusion matrix-derived metrics: specificity, balanced accuracy, Cohen’s Kappa, and MCC for all models. Figure 21: Confusion matrix for hybrid CNN–RNN–transformer model. that although attention mechanisms help in deep representations, hybrid architectures integrating CNN, GRU, LSTM, and transformer modules provide the most reliability, interpretability, and clinical feasibility for EEG-based ADHD diagnosis. Although transformer encoders were accurate under cross-validation, repeated train-test experiments manifested large performance variations over test splits (std = 2.1%). Such variability is a sign of high sensitivity to data split and implies that the degradation in performance on the test set is not accidental. By comparison, the hybrid CNN-RNN-transformer had low variance (std = 0.3%) across experiments, reinforcing its better generalization capacity.