# Seizure Detection in Medical IoT: Hybrid CNN-LSTM-GRU Model with Data Balancing and XAI Integration  
[PERSON]  
1 Department of Computer Science, College of Computer Engineering and Sciences, Prince Sattam Bin Abdulaziz University, Al-Khari 16278, Saudi Arabia 12 Department of Computer Science and Engineering, Faculty of Electronic Engineering, Menoufa University, Menouf 32952, Egypt; [EMAIL_ADDRESS] (S.H. ); ezzeldinhemdan@el-eng.menofia.edu.eeg (E.E.-D.H.) 1  
[PERSON]  
2 Department of Computer Science and Engineering, Faculty of Electronic Engineering, Menoufa University, Menouf 32952, Egypt; [EMAIL_ADDRESS] (S.H. ); ezzeldinhemdan@el-eng.menofia.edu.eeg (E.E.-D.H.) 2  
[PERSON]  
3 Department of Information Systems, College of Computer Engineering and Sciences, Prince Sattam Bin Abdulaziz University, Al-Khari 16278, Saudi Arabia 38 [PERSON]_ADDRESS] (S.H.) 3  
[PERSON]  
2 Department of Computer Science and Engineering, Faculty of Electronic Engineering, Menoufa University, Menouf 32952, Egypt; [EMAIL_ADDRESS] (S.H. ); ezzeldinhemdan@el-eng.menofia.edu.eeg (E.E.-D.H.) 3  
[PERSON]  
5 Department of Electrical Energy Engineering, College of Engineering & Technology, Arab Academy for Science Technology & Maritime  
Electroencephalogram (EEG) signals are electrical impulses generated by brain activity. Wearable EEG devices enable elderly and disabled individuals to collect EEG data, which can then be processed into control signals through motor imagery, allowing for remote control functions. Since EEG signals exhibit unique patterns in different mental states, machine learning techniques are well-suited for their classification. Many researchers have highlighted the applications of EEG signals and brain-computer interfaces in areas such as smart homes [5] and healthcare devices [6]; however, limited attention has been given to securing and maintaining the privacy of the EEG data itself. Medical Internet of Things (MIoT) refers to the integration of Internet of Things (IoT) technology into the healthcare sector to enable efficient, real-time monitoring, diagnosis, and management of patients' health. In practice, the Medical Internet of Things (MIoT) framework centered around EEG data is vulnerable to various security threats, including both passive and active attacks. Passive attacks involve intercepting or eavesdropping on transmitted data, while active attacks include altering or manipulating EEG data. For instance, when a hospital uses a cloud service to predict epilepsy risks in patients, it is crucial to ensure not only accurate predictions but also the security and privacy of the transmitted data. Consequently, securely handling encrypted EEG data has become a significant challenge. Some researchers have started exploring encryption-integrated machine learning solutions in response to these concerns, as discussed in [7; 8]. Advances in Artificial Intelligence (AI), Machine Learning (ML), and the Internet of Things (IoT) offer promising potential for enhancing disease classification and prediction in telemedicine applications. ML techniques, for example, can facilitate the early detection of skin conditions with high accuracy and reliability. Recently, IoT and medical systems have emerged as complementary technologies that enhance Medical Internet of Things (MIoT) applications. By integrating healthcare services with IoT devices, real-time monitoring, analysis, and decision-making become possible in complex healthcare systems, bringing substantial benefits to patient care. The MIoT system encompasses multiple tiers, as depicted in Figure 1, and are as follows:  
* **Layer 1:** In this layer, the essential role is played by MIoT sensors and actuators responsible for collecting and monitoring various medical and healthcare data. * **Layer 2:** This layer encompasses the utilization of gateway and edge devices, serving as intermediaries connecting the Wireless Sensor Network (WSN) to cloud servers. These devices form an integral part of the MIoT-based controller platform.