# Seizure Detection in Medical IoT: Hybrid CNN-LSTM-GRU Model with Data Balancing and XAI Integration
## 4 Experimental Results
### Comparison Results  
The comparison of the different DL models with the proposed model is conducted to evaluate the effectiveness of the proposed framework. The comparison results of confusion matrices are depicted in Figure 8. These confusion matrices, for the CNN, LSTM, GRU, and the proposed model show the superiority of the hybrid model in the detection of seizure conditions based on EEG readings. The proposed framework has been rated as the best among all, with the fewest false negatives appearing (11) and false positives present (21). The LSTM model follows with 46 misclassifications, and both the CNN and GRU achieve lower accuracies with 68 and 61 misclassifications, respectively. The proposed model significantly reduces false negatives and provides higher sensitivity and specificity, making it efficient for capturing seizure events alone without much risk of normal being classified as seizures. Overall, it can be noted that the CNN-LSTM-GRU model led to great progress in seizure detection as it guarantees proper functions that involve differentiating seizure and normal conditions present in EEG data. For the value of accuracy if changing the test size, if we split the test to be 25% then the accuracy will be 99.15%, but if we reduce the test to 20% the accuracy will be 99.02% and if we increases the test to 30% the accuracy will be 98.84%. Figure 6: The local explanation for seizure classification. To evaluate how the hybrid CNN-LSTM-GRU model stacks up against DL and traditional ML models in terms of accuracy, precision, recall, F1 score, and specificity, we have compared them. Table 4 shows the comparison results. It illustrates and summarizes the performance of different algorithms and techniques deployed in Machine Learning and Deep Learning datatypes for the binary classification of seizure in EEG datasets based on measures such as accuracy, precision, recall, F1 score, and specificity, among others as shown in Figures 8 and 9. Where Logistic Regression (LR), Decision Tree (DT), Naive Bayes (NB), Support Vector Machine (SVM), Random Forest (RF), K-Nearest Neighbors (KNN), Convolutional Neural Network (CNN), Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), and the hybrid model are studied. Here, the so-called traditional Machine Learning models, like LR and DT, show moderate to high results, though, in terms of accuracy, precision, recall, F1 score, and specificity, we have compared them with the traditional ML model. Figure 7: The SHAP for feature importance, (**a**) present the SHAP figure importance in case of using LSTM model only in the detection, while (**b-d**) present the feature importance in cases of using CNN, GRU and proposed model respectively. of effectivity, LR should be placed last at 62.07% accuracy. However, the DT model has a dramatically increased rate of accuracy at 92.34% with all the metrics being equal across the board. The Naive Bayes algorithm also shows quite pleasing outcomes and performance results with its accuracy standing at 88.91% and specificity at 96.8%, meaning that it can classify the classes effectively. Figure 9 presents an evaluation comparison using a cluster bar chart among different ML algorithms, CNN, LSTM, GRU, and our proposed hybrid approach with and without SOMTE technique. It appears that Deep Learning approaches like, CNN, LSTM, or GRU, tend to perform better than conventional Machine Learning methods on most of the metrics, with CNN recording 96%:74% accuracy and LSTM achieving the highest accuracy among all the deep learning models of 98.48%. Since both LSTM and GRU belong to the family of recurrent neural networks, they achieved high recall and F1-score metrics, which indicates that they are good for time-sequence-related data. The hybrid model proposed in this paper achieves the best overall results with an accuracy of 99.13% and a precision, recall, and F1-score value of 99.13%, along with a specificity of 98.87%.