# Seizure Detection in Medical IoT: Hybrid CNN-LSTM-GRU Model with Data Balancing and XAI Integration
## 4 Experimental Results
### Results Analysis  
In the initial phase, EEG signals are preprocessed to improve their quality. This process begins with the application of the min-max normalization technique to standardize the dataset. First, the minimum and maximum values in the dataset are identified. Each data point is then scaled relative to these extremes to set the maximum value to 1 and the minimum to 0, placing all other values within the [0, 1] range.  
To correct the dataset's class imbalance, SMOTE is applied. Class imbalance refers to the situation when one or more classes have an extremely lower number of sample data than the other(s); this could make the model biased towards the majority class. With SMOTE, the seizure activity class is expanded by synthetic means instead of just randomly respawning some members of that class. This means that the feature space of the minority class instances is located, similar ones are paired up, and synthetic ones are created in between those pairs. This way the classes in the training set become balanced, improving the capability of the model to learn the distinguishing characteristics of the minority class thus improving the generalization of the model.  
The design of the hybrid CNN-LSTM-GRU-based algorithm for the detection of seizures from EEG signals takes advantage of Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM), and Gated Recurrent Units (GRU) to consider all features from the EEG data.  
Figure 4 shows the training and validation accuracy of our proposed framework for 100 epochs. The training accuracy rises sharply and flattens out at almost 100%, indicating that the model fits the training data very well. The validation accuracy increases in the same manner but stabilizes at a value slightly less than the training accuracy, around 99%. The above scenario of the training and validation accuracy indicates that there is no overfitting as the model has generalized well. The high accuracy level of 99.13% achieved within the framework demonstrates the strength of this framework in seizure detection using EEG signals.  
From the ROC curve shown in Figure 5, our proposed framework achieves an accuracy of 99.15% which indicates exceptional performance in distinguishing between classes. The curve closely follows the top left corner of the graph, reflecting that the model accurately identifies almost every positive instance without incorrectly classifying any negatives as positives. Such a result signifies an ideal balance between sensitivity and specificity, suggesting the model's highly reliable performance in classification tasks.  
The XAI technique with the use of SHAP [25] is employed to enhance interpretability, providing insights into feature contributions for the prediction for the different model as shown in Figures 6 and 7. This makes it easier to comprehend how the model is attained and helps in the decision-making process. So, the SHAP summary plot provides a comprehensive view of feature importance and its influence on seizure classification. The features are ranked by their impact, with \(X177\) being the most influential in the proposed model. The local explanation and SHAP plot play a significant role in showing how the model came up with the prediction of a seizure, determining the specific features that contribute to the model's output, enhancing interpretability, and identifying the key drivers in seizure detection.  
Figure 4: The accuracy over epochs.  
Figure 5: The ROC curves for the proposed framework.