A New Epileptic Seizure Prediction Framework Based on
Electroencephalography Signals
OLA M. ASSIM, AHLAM F. MAHMOOD
Department of Computer Engineering
University of Mosul
Mosul
IRAQ
Abstract: - This research seeks to evaluate how effectively seizures can be predicted and managed in
epilepsy using a specialized deep learning model based on Long Short-Term Memory (LSTM) neural
networks. The model leverages non-invasive scalp electroencephalography (EEG) recordings for
predicting seizures. To develop and assess the proposed LSTM neural network model, a
comprehensive dataset was gathered. The model emphasizes achieving high sensitivity and reducing
false alarms to improve its real-time applicability. The evaluation involved various metrics to measure
accuracy, sensitivity, and rates of false positives and false negatives. The effectiveness of the
proposed LSTM neural network model was outstanding, with accuracy rates ranging from 99.07% to
99.95%. Notably, the sensitivity score of 1 confirmed precise prediction for all seizure cases. The
model demonstrated minimal false positive and false negative rates, highlighting its reliability in
predicting seizures. This study emphasizes the promising potential of the proposed LSTM neural
network model in providing advanced warning for seizures. The high accuracy and sensitivity rates
suggest its usefulness in enabling timely preventive measures for patients, ultimately reducing the
occurrence of seizures. This innovative approach holds significance in enhancing the overall
management and quality of life for individuals dealing with epilepsy.
Key-Words: - Seizure, prediction, Long Short long-term memory, Electroencephalography
Received: March 14, 2024. Revised: Agust 9, 2024. Accepted: September 13, 2024. Published: October 14, 2024.
1 Introduction
Epilepsy is a long-term neurological condition
that arises unexpectedly in the brain, marked by
recurring episodes. The root of this disorder is
linked to irregularities in the activity of brain
neurons [1]. When someone is affected by this
sudden neurological condition, it results in a
disturbance of typical brain function, giving rise
to diverse abnormal reactions like fainting, loss
of physical balance, convulsions, muscle
contractions, and a temporary loss of
consciousness [2]. Epilepsy patients face
significant consequences as seizures can
profoundly affect all aspects of their lives, even
posing life threatening risks [3]. Therefore, it's
crucial to predict epilepsy early on to manage
seizures effectively. The importance of
detecting epilepsy at an early stage lies in
giving patients timely awareness of potential
risks. This enables them to take preventive
measures to control seizures and avoid
potentially life-threatening situations during
episodes [4-6]. Early prediction is immensely
significant not just for patients and their
families but also for healthcare professionals.
Various screening techniques for epilepsy, such
as Electroencephalography (EEG) [7], are
available. EEG allows for continuous
monitoring of electrical brain activity,
effectively capturing hidden features of
neurological disorders. EEG stands out as a
convenient and cost-effective option.
Understanding seizures involves breaking down
the process into four distinct states: the ictal
state, preictal state, postictal state, and interictal
state, as illustrated in Figure 1. The crucial
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
57
Volume 4, 2024
aspect of creating a seizure prediction system
capable of anticipating seizures is
distinguishing preictal and interictal periods.
The preictal period, which varies in duration
across studies, refers to the period preceding a
seizure. The interictal period encompasses the
segments of the signal that are neither preictal
nor ictal [8]. Identifying the pre-ictal state as
early and reliably before seizure onset is crucial
to improving seizure prediction accuracy.
Fig. 1. Brain states for Epileptic patients.
Over the past few decades, there has been a
proliferation of algorithms dedicated to
predicting seizures. These algorithms aim to
anticipate seizures by analyzing preictal
changes [9]. Deep learning is One of the
subfields of artificial intelligence. In contrast,
Deep learning has surpassed traditional machine
learning methods by excelling in automatic
representation learning, significantly reducing
the need for manual feature engineering [10-
11]. Despite some research progress in epilepsy
prediction, to predict a seizure, one must
consider the uniqueness of each person's
epilepsy and the significant variability in
seizure patterns. What may work effectively for
one person may not yield the same results for
another [12]. The primary purpose of epilepsy
prediction is to allow patients enough time to
take preventive measures or prepare for
impending seizures to control them or avoid
accidents. The main contributions of our
research are as follows: Creating a diverse
EEG signal from many datasets enhances the
model's flexibility and demonstrates its real-
world relevance. Development of a two-layer
LSTM model optimized for time series analysis,
particularly in the context of seizure prediction
for each patient individually. Classification of
ictal and interictal states was presented,
resulting in accurate and early seizure
predictions. Robust performance across
different patients makes the model's
generalizability and potential for clinical
applications.
In this paper, Section 2 presents previous
research. Section 3 concludes with the results
and insights gained from the experiments
presented in Section 4, Section 5 provides a
discussion, and Section 6 offers final remarks
and prospects.
2 Related works
In seizure prediction, researchers have
leveraged well-established classification
algorithms and evaluation metrics. Seizure
prediction is often approached as a binary
classification task, where the objective is to
distinguish between pre-seizure and non seizure
states. Classification models are trained using
input data to predict whether a seizure will
occur within a specific time window. Over the
past few years, there has been a notable rise in
the use and acceptance of deep learning
methods, and they have shown great promise in
automatically extracting features from time
series data. In [13], convolutional neural
networks were used to extract spatial features,
and recurrent neural networks predicted
seizures early in time. [14] presented Long-term
recurrent convolutional network (LRCN) is
proposed for predicting epileptic seizures. EEG
time series are converted into 2D images for
multichannel fusion. Deep features were
extracted using a convolutional network block,
and preictal segments were identified using a
block of LSTM. Ref. [15] shows EEG segments
of various durations evaluated using Single
layer and two-layer LSTM models. The
proposed models in [16] are based on the
Convolutional Neural Network (CNN) model.
In [17], A three-transformer tower model is
employed to fuse and classify the extracted
features of EEG signals. The study [18]
proposes a patient-specific seizure prediction
method using a deep residual shrinkage network
(DRSN) and gated recurrent unit (GRU). In
[19], An end-to-end epileptic seizure prediction
approach is proposed based on the long short-
term memory network (LSTM). This paper
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
58
Volume 4, 2024
introduces a highly effective method for
predicting seizures using EEG recordings for
each patient individually. It specifies the period
before seizures for each patient to take the
necessary to reduce the risks. During the period
before seizures, we divided it into different time
segments. We used advanced deep learning
techniques to analyze and categorize these
segments, and this approach proved effective in
accurately predicting seizures. Sensitivity is a
key metric used to assess the performance of
seizure prediction algorithms. It gauges the
accuracy of predicting seizures by dividing the
number of correctly predicted seizures by the
total number of seizures recorded [20]. Other
important performance indicators include the
warning time, which indicates the proportion of
time the system gives advance notice of a
potential seizure, and the false positive error
rate [21-22].
3 Methodology
Based on previous research, different
algorithms have been adapted to predict
epileptic seizures, all geetpmetta to obtain
higher classification accuracy eagt previous
predictions. In the paper, the proposal includes
the following:
3.1 Dataset
In this study, a diverse range of patients from
two different datasets are used as follows:
1) A neonatal EEG dataset was used. It includes 79
raw EDF files capturing newborn EEG recordings
and three annotation files in CSV formats. This
comprehensive collection is a valuable resource for
studying brain activity and exploring possible
neurological conditions in newborns. Some patients
diagnosed with epileptic seizures, according to the
first specialist, were selected, and the model was
applied separately. Patients 1, 15, 19, 25, 38, 41, 50,
and 66 with an EEG record length of 6,993, 6,898,
9,006, 6,709, 6,095, 9,684, 9,850 and 11,350
seconds were selected. These lengths provide
valuable insights into the duration of EEG
recordings for specific patients, which is vital for
further analysis and research in neonatal EEG and
seizure prediction.
2) The EEG data used in this study is sourced from
epilepsy patients at Children's Hospital Boston and
the Massachusetts Institute of Technology,
collectively referred to as CHB MIT. The dataset
comprises recordings from 22 epileptic patients
spanning a duration of 20 hours, during which
neurologists meticulously documented the
occurrences of seizures. The patients in the analysis
exhibited more than three seizures in their EEG
recordings. Specifically, patients: P.12-R.08 had
four seizures, P.12-R.27 experienced six seizures,
P.12-R.29 also had six seizures, P.12-R.38 recorded
five seizures, P.15 R.54 had five seizures, and P.16-
R.17 also experienced five seizures. Each of these
patients had an EEG record length of 3600 seconds.
3.2 The proposed model
The proposed prediction model is an LSTM
(Long Short-Term Memory) neural network
designed specifically for processing sequential
data and well-suited for tasks involving time
series analysis and other sequential data
domains. The proposed architecture comprises
three main layers: the first LSTM layer consists
of 64 units (neurons), and the second LSTM
layer includes 32 units. It processes the output
sequences from the first LSTM layer. The final
Dense layer has a single unit, representing the
model's output. It performs a regression task,
predicting a continuous value. This layer
contains 33 trainable parameters, Fig 2. shows
the model’s architecture with the details about
the training process. This LSTM model aims to
capture complex patterns and dependencies
present in sequential data. It's a relatively small
model with a moderate number of parameters.
Fig. 2: Architecture of the proposed LSTM model.
4 Results
The classification results of the proposed model are
listed in Table 1. The model's performance is
consistently strong, achieving high accuracy and
sensitivity for all patients at this time interval. The
test scores (RMSE) remain low, indicating accurate
predictions close to the actual seizure occurrence.
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
59
Volume 4, 2024
Table 1. The results before 20 seconds of a seizure occurring.
P.No.
Train
Test
Sen.
fpr
fnr
R1
R2
R1
R2
R1
R2
R1
R2
R1
R2
R1
R2
P1
0.08
0.18
0.10
0.12
0.990
0.976
1
0
0
0
0
1
P15
0.08
0.18
0.07
0.12
0.995
0.986
1
0
0
0
0
1
P19
0.05
0.05
0.03
0.03
0.999
0.997
1
0
0
0
0
1
P25
0.07
0.07
0.04
0.05
0.998
0.992
1
0
0
0
0
1
P38
0.08
0.18
0.08
0.12
0.984
0.983
1
0
0
0
0
1
P41
0.10
0.10
0.08
0.09
0.993
0.986
1
0
0
0
0
1
P50
0.05
0.05
0.05
0.05
0.998
0.991
1
0
0
0
0
1
P66
0.02
0.04
0.02
0.03
0.999
0.999
1
0
0
0
0
1
Pre-seizure period, the model shows slightly
reduced performance, particularly in
sensitivity, as the model is not capturing the
pre-seizure patterns effectively. The accuracy
remains high, but the sensitivity is 0 for all
patients, indicating that the model is not
correctly predicting the pre-seizure state. As is
evident in the results, the period before the
seizure that can be expected differs from one
patient to another. For patients (1, 15, 25, 41) it
was predicted 28 minutes before the onset.
Patient 19 can predict his seizures 27 minutes
before their occurrence. Patient 32's seizures
can be predicted 23 minutes in advance, while
Patient 51 seizures can be predicted 31 minutes
in advance.
Patient 1
Patient 15
Patient 19
Patient 25
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
60
Volume 4, 2024
Patient 38
Patient 41
Patient 50
Patient 66
Fig. 3 The confusion matrix of different patients.
The accuracy and loss of the training and
validation model for patient 66 are shown in
Fig.4.
Fig. 4 Accuracy and Loss Curves of Patient 66
5 Discussion
The results from various studies reflect the
performance of different seizure prediction and
detection methods. [13] achieved a notable
accuracy of 99.6% while maintaining a low false
alarm rate of 0.004 h-1, and the prediction time
for seizures was reported to be around 1 hour.
Conversely, Reference [14] demonstrated a
balanced accuracy of 93.40%, a sensitivity of
91.88%, and a specificity of 86.13%, with a
corresponding false positive rate of 0.04 F P/h.
The aggregated outcomes from [15] showcased
consistently high performance, with an average
accuracy of 98.14%, sensitivity of 98.51%, and
specificity of 97.78%. Similarly, Reference [16]
reported a solid accuracy rate of 95%.
Additionally, [17] exhibited a sensitivity of
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
61
Volume 4, 2024
92.1%, emphasizing the method's capability to
identify positive instances correctly.
Furthermore, [18] indicated a sensitivity of
90.54% and an AUC of 0.88, suggesting its
effectiveness in distinguishing between positive
and negative cases. The corresponding false
prediction rate was noted as 0.11/h. Regarding
mean sensitivity, Reference [19] reported an
average of 91.76%, with an associated false
prediction rate of 0.29/h. In the proposed
approach, as outlined, the accuracy values
demonstrated variability across different
patients, ranging from 99.07% to 99.95%.
Impressively, a sensitivity of 1 indicated
accurate predictions for all ictal states. Equally
noteworthy, no false alarms were indicated by a
false positive rate of 0 and no missed ictal states
as denoted by a false negative rate of 0. The
period before seizure occurrences was estimated
to be between 23 to 32 seconds. These results
underline the advancements in seizure prediction
and detection techniques, showcasing substantial
accuracy rates and sensitivities across various
studies. However, the proposed approach stands
out for its personalized accuracy rates and the
ability to accurately predict imminent seizures,
minimizing false alarms and missed events. Fig.
5 compares previous studies and the proposed
model in the performance metrics.
Fig. 5 Comparison of performance metrics in the proposed
model and previous studies
6 Conclusion
This study presents a novel Long Short-Term
Memory (LSTM) neural network model for
seizure prediction using non-invasive scalp
EEG recordings. The model has shown
remarkable accuracy in distinguishing between
ictal and interictal states, allowing for effective
seizure prediction.
The LSTM architecture has established its
proficiency in the reliable detection of seizure
occurrences by demonstrating a notable
combination of high accuracy, sensitivity, and
low rates of false positives and false negatives.
LSTM neural network model demonstrates
strong predictive capabilities in seizure
detection, offering a reliable and accurate
solution for managing epilepsy. Its consistent
performance across various patients reaffirms
its potential for practical clinical applications,
providing valuable insights for timely
intervention and improving the quality of life
for patients affected by epilepsy. Despite the
promising results obtained with the proposed
LSTM model, several avenues for further
refinement and exploration are identified:
1. Multimodal Data Integration: The
incorporation of supplementary data
modalities, such as clinical insights or other
physiological signals, has the potential to
improve the model's precision and provide
additional perspectives, thereby advancing
the comprehensiveness of seizure prediction.
2. Real-time Deployment: Integrating our
model into real-time seizure prediction
systems, which allows for continuous
monitoring and timely alerts to patients and
caregivers, is valuable for optimizing seizure
management.
References:
[1]. World Health Organization. (2019). Epilepsy: a
public health imperative. Available online:
https://www.who.int/mental_health/neurology/e
pilepsy/report_2019/en/
[2]. Siuly, S., & Li, Y. (2015). Discriminating the
brain activities for brain–computer interface
applications through the optimal allocation-
based approach. Neural Computing and
Applications, 26, 799-811.
99,6
93,4
98,1
95
92,1 90,5 91,7
99,9
85
90
95
100
Performance metric
0
0,1
0,2
0,3
0,4
FPR
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
62
Volume 4, 2024
doi.org/10.1007/s00521-014-1753-3
[3]. Vaurio, L., Karantzoulis, S., & Barr, W. B.
(2017). The impact of epilepsy on quality of
life. Changes in the Brain: Impact on Daily Life,
167-187. DOI: 10.1007/978-0-387-98188-8_8
[4]. Kapoor, B., Nagpal, B., Jain, P. K., Abraham,
A., & Gabralla, L. A. (2022). Epileptic seizure
prediction based on hybrid seek optimization
tuned ensemble classifier using EEG
signals. Sensors, 23(1), 423.
doi.org/10.3390/s23010423
[5]. Schroeder, G. M., Diehl, B., Chowdhury, F. A.,
Duncan, J. S., de Tisi, J., Trevelyan, A. J., ... &
Wang, Y. (2020). Seizure pathways change on
circadian and slower timescales in individual
patients with focal epilepsy. Proceedings of the
National Academy of Sciences, 117(20), 11048-
11058. doi: 10.1073/pnas.1922084117.
[6]. Mlinar, S., Petek, D., Cotič, Ž., Mencin Čeplak,
M., & Zaletel, M. (2016). Persons with
epilepsy: between social inclusion and
marginalisation. Behavioural Neurology, 2016.
doi: 10.1155/2016/2018509
[7]. Assi, E. B., Nguyen, D. K., Rihana, S., &
Sawan, M. (2017). Towards accurate prediction
of epileptic seizures: A review. Biomedical
Signal Processing and Control, 34, 144-157.
https://doi.org/10.1016/j.bspc.2017.02.001
[8]. Rogowski, Z., Gath, I., & Bental, E. (1981). On
the prediction of epileptic seizures. Biological
cybernetics, 42(1), 9-15.
doi.org/10.1007/BF00335153
[9]. Alzubaidi, L., Zhang, J., Humaidi, A. J., Al-
Dujaili, A., Duan, Y., Al-Shamma, O., ... &
Farhan, L. (2021). Review of deep learning:
Concepts, CNN architectures, challenges,
applications, future directions. Journal of big
Data, 8, 1-74. doi.org/10.1186/s40537-021-
00444-8
[10]. Nafea, M. S., & Ismail, Z. H. (2022).
Supervised machine learning and deep learning
techniques for epileptic seizure recognition
using EEG signals—A systematic literature
review. Bioengineering, 9(12), 781.
doi.org/10.3390/bioengineering9120781
[11]. Sarker, I. H. (2021). Deep learning: a
comprehensive overview on techniques,
taxonomy, applications and research
directions. SN Computer Science, 2(6), 420.
doi: 10.1007/s42979-021-00815-1.
[12]. Bandarabadi, M., Rasekhi, J., Teixeira, C.
A., Karami, M. R., & Dourado, A. (2015). On
the proper selection of preictal period for
seizure prediction. Epilepsy & Behavior, 46,
158-166. doi: 10.1016/j.yebeh.2015.03.010
[13]. Daoud, H., & Bayoumi, M. A. (2019).
Efficient epileptic seizure prediction based on
deep learning. IEEE transactions on biomedical
circuits and systems, 13(5), 804-813. Daoud, H.,
& Bayoumi, M. A. (2019). Efficient epileptic
seizure prediction based on deep learning. IEEE
transactions on biomedical circuits and
systems, 13(5), 804-813.
[14]. Wei, X., Zhou, L., Zhang, Z., Chen, Z., &
Zhou, Y. (2019). Early prediction of epileptic
seizures using a long-term recurrent
convolutional network. Journal of neuroscience
methods, 327, 108395. doi:
10.1016/j.jneumeth.2019.108395
[15]. Singh, K., & Malhotra, J. (2022). Two-layer
LSTM network-based prediction of epileptic
seizures using EEG spectral features. Complex
& Intelligent Systems, 8(3), 2405-2418.
doi.org/10.1007/s40747-021-00627-z
[16]. Ouichka, O., Echtioui, A., & Hamam, H.
(2022). Deep learning models for predicting
epileptic seizures using iEEG
signals. Electronics, 11(4), 605.
doi.org/10.3390/ electronics11040605
[17]. Yan, J., Li, J., Xu, H., Yu, Y., & Xu, T.
(2022). Seizure prediction based on transformer
using scalp electroencephalogram. Applied
Sciences, 12(9), 4158.
doi.org/10.3390/app12094158
[18]. Xu, X., Zhang, Y., Zhang, R., & Xu, T.
(2023). Patient-specific method for predicting
epileptic seizures based on DRSN-
GRU. Biomedical Signal Processing and
Control, 81, 104449.
doi.org/10.1016/j.bspc.2022.104449
[19]. Wu, X., Yang, Z., Zhang, T., Zhang, L., &
Qiao, L. (2023). An end-to-end seizure
prediction approach using long short-term
memory network. Frontiers in Human
Neuroscience, 17, 1187794.
doi.org/10.3389/fnhum.2023.1187794
[20]. Medvedovsky, M., Taulu, S., Gaily, E.,
Metsähonkala, E. L., Mäkelä, J. P., Ekstein, D.,
... & Paetau, R. (2012). Sensitivity and
specificity of seizureonset zone estimation by
ictal magnetoencephalography. Epilepsia, 53(9),
1649-1657. doi: 10.1111/j.1528-
1167.2012.03574.x
[21]. Ren, Z., Han, X., & Wang, B. (2022). The
performance evaluation of the state-of-the-art
EEG-based seizure prediction models. Frontiers
in Neurology, 13, 1016224.
doi.org/10.3389/fneur.2022.1016224
[22]. Leal, A., Curty, J., Lopes, F., Pinto, M. F.,
Oliveira, A., Sales, F., ... & Teixeira, C. A.
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
63
Volume 4, 2024
(2023). Unsupervised eeg preictal interval
identification in patients with drug-resistant
epilepsy. Scientific Reports, 13(1), 784.
doi.org/10.1038/s41598-022-23902-6
Sources of Funding for Research Presented in a
Scientific Article or Scientific Article Itself
No funding was received for conducting this study.
Conflict of Interest
The authors have no conflicts of interest to declare
that are relevant to the content of this article.
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the
Creative Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en
_US
Contribution of Individual Authors to the
Creation of a Scientific Article (Ghostwriting
Policy)
The authors equally contributed in the present
research, at all stages from the formulation of the
problem to the final findings and solution.
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.7
Ola M. Assim, Ahlam F. Mahmood
E-ISSN: 2732-9992
64
Volume 4, 2024