A Convolutional Gated Recurrent Neural Network for Epileptic Seizure Prediction

. In this paper, we present a convolutional gated recurrent neural network (CGRNN) to predict epileptic seizures based on features extracted from EEG data that represent the temporal aspect and the frequency aspect of the signal. Using a dataset collected in the Children’s Hospital of Boston, CGRNN can predict epileptic seizures between 35 min and 5 min in advance. Our experimental results indicate that the performance of CGRNN varies between patients. We achieve an average sensitivity of 89% and a mean accuracy of 75.6% for the patients in the data set, with a mean False Positive Rate (FPR) of 1.6 per hour.


Introduction
Epilepsy is a complex neurological disorder, manifested by unexpected and unprovoked seizures due to abnormally excessive or synchronous neuronal activity in the brain. There are various forms of epileptic seizures, and the symptoms differ from one person to another. Epileptic seizures can be accompanied with a loss of consciousness that leads to serious injuries with residual disabilities and even to death. Also, people with epilepsy are socially discriminated due to a widespread lack of knowledge, negative public attitudes, and misconceptions about the disease that reduce their self-esteem.
Therefore, it is crucial to predict epileptic seizures before they happen. This is a challenging problem attracting researchers from several disciplines. Existing approaches [3,8,[10][11][12]17,[19][20][21]23] can be divided into two categories. The first category [3,6,8,16,19,20,23] includes seizure detection approaches that are usually used by health professionals to improve diagnostic capabilities. In fact, they do not allow us to prevent the consequences of epileptic seizures. The second category [10][11][12]17,21] focuses on seizure prediction to improve a patient's quality of life. One approach [17] is based on a combination of a convolutional neural network (CNN) and a long short-term memory network (LSTM). It achieves promising results. Other approaches are essentially based on the use of a single type of deep learning network, such as a CNN or a recurrent neural network (RNN) variant (e.g., RNN vanilla, LSTM, gated recurrent unit (GRU)). GRU networks have shown good results in temporal sequence modeling and especially in the detection of different seizure phases [12,19,22].
In this paper, we present a novel convolutional gated recurrent neural network (CGRNN) to predict epileptic seizures. It is a combination of CNN and GRU. The proposed approach is a patient-specific predictor that allows us to predict epileptic seizures on the basis of the electrical activity of the brain (EEG signals). Our CGRNN takes into consideration the temporal aspect as well as the frequency aspect of the EEG signal. Using a data set collected in the Children's Hospital of Boston, CGRNN can predict epileptic seizures between 35 min and 5 min in advance. Our experimental results indicate that the performance of CGRNN varies between patients. We achieve an average sensitivity of 89% and a mean accuracy of 75.6% for the 13 patients in the data set, with a FPR ranging from 0 to 6.57 per hour.
The paper is organized as follows. Section 2 explains basic concepts of epilepsy disorder. Related work is discussed in Sect. 3. In Sect. 4, we present our proposed approach. Section 5 discusses the experimental setup and our obtained results. Section 6 concludes the paper and outlines areas for future research.

Epilepsy
Epilepsy is a chronic neurological disease that affects people of all ages and has a worldwide distribution [4]. It affects approximately 65 million people in the world [14] and is considered as the fourth most common neurological disease [4]. The cardinal manifestations of epilepsy are epileptic seizures, i.e., recurrent paroxysmal events characterized by stereotyped behavioral alterations reflecting the neural mechanisms involved in the epileptic process [5]. The recurrence of seizures and their unpredictability cause major concerns for patients and their family and have physical and psychological consequences. Therefore, epilepsy is a burdensome neurological disorder. Despite the growing number of antiepileptic drugs, almost 30% of epilepsy cases are intractable with uncontrolled epileptic seizures. These events have several phases that may not be visible or easily distinguishable from each other [4]: -The pre-ictal phase refers to the period just before a seizure [15].
-The ictal phase lasts from the initial symptoms of the seizure (including an aura) until the end of the abnormal activity. -The post-ictal phase occurs when the seizure ends. It is the period of recovering from the seizure's symptoms [4]. -The inter-ictal phase is the normal state for people with epilepsy (99% of their life). In this phase, these persons have abnormal waveforms in EEG records that are not associated with seizure symptoms [15].

EEG
Epileptic seizures are related to the electrical activity of the brain. Therefore, electroencephalography (EEG) is the most effective way to determine the epileptogenic cortex. EEG [2] is an electrophysiological exploration method to measure the electrical activity of the brain using electrodes fixed on the scalp. Since EEG can detect any abnormal brain activity, it is mainly used for epilepsy diagnosis and seizure analysis. Figure 1 shows the EEG signal of a patient that has experienced a seizure. It is evident that a seizure can be visually distinguished from a normal brain signal.

Related Work
In this section, different approaches related to seizure detection and prediction are presented.

Epileptic Seizure Detection
Thodoroff et al. [20] proposed patient-specific and cross-patient epileptic seizure detectors. Both are based on features extracted from spatial, temporal, and frequency information of the EEG recordings. EEG data was first transformed into an image representation that integrates spatial domain knowledge (i.e., electrode's positions). Then, the data was fed into a recurrent convolutional neural network that combines CNN and LSTM networks. The method presented by Yuan et al. [23] detects epileptic seizure onsets. It combines features extracted from handcrafted engineering methods and deep learning approaches. The authors used short-time Fourier transforms (STFT) for image based representation and a stacked sparse denoising autoencoders (SSDA) for data classification. An SSDA-based channel selection procedure was adopted to reduce the dimension of features by considering the correlation of EEG channels.
Talathi [19] proposed a deep learning framework for epileptic seizure detection. He developed a RNN with GRU hidden units for the classification task. Raw input data was directly used after a minimal pre-processing step. The model achieved 99.6% accuracy on the validation data set and can detect about 98% of epileptic seizures within the first 5 s of the event.
Golmohammadi et al. [8] presented two RNN variants for seizure detection: LSTM and GRU. Both recurrent variants are based on handcrafted features, and each of them is integrated into a CNN. The experiments revealed that the convolutional LSTM network has slightly better results than the convolutional GRU network. In fact, both networks achieved 30% sensitivity, but with 6 false alarms per day (FA/24h) for LSTM and 21 FA/24h for GRU.
Choi et al. [3] proposed a multi-scale 3D-CNN with a bidirectional GRU model for cross-patient seizure detection. The authors used STFT to get spectral and temporal features from EEG signals. They also considered spatial features extracted from electrode positions. The proposed model [3] was evaluated on two data sets: the Boston Children's Hospital MIT scalp EEG data set (CHB-MIT) and the Seoul National University Hospital (SNUH) Scalp EEG data set. The approach achieved a sensitivity of 89% with a FPR of 0.5/h on the first database and 89% sensitivity with FPR of 0.6/h on SNUH data.

Epileptic Seizure Prediction
Truong et al. [21] applied a CNN to three databases: (1) the Freiburg Hospital intra-cranial EEG (iEEG) data set, (2) the CHB-MIT data set, and (3) the American Epilepsy Society (AES) Seizure Prediction Challenge data set. They considered only data from 13 patients over 24 cases when considering the CHB-MIT database. These patients have less than 10 seizures per day and at least 3 h of inter-ictal signals. STFT has been applied on raw data to build spectrograms. The proposed model is patient-oriented. It achieved a sensitivity of 81.4%, 81.2%, and 75% and a FPR of 0.06/h, 0.16/h, and 0.21/h, for the 3 data sets mentioned above, respectively.
In the context of the AES Seizure Prediction Challenge organised by Kaggle, Korshunova [11] implemented two models for seizure prediction. She proposed a CNN architecture and also explored a classifier based on logistic regression and linear discriminant analysis. The iEEG data used in the competition was recorded from 5 dogs and 2 humans. It was transformed into spectrograms by applying a discrete Fourier transform (DFT) before being fed to the models.
Larmuseau [12] compared three RNNs for seizure prediction: vanilla RNN, GRU, and LSTM. iEEG data of four subjects was used. He concluded that GRU layers outperform other networks and are also faster than LSTM. RNNs are effective in analyzing the sequential iEEG data, but the results were not better than those of other methods used from the state of the art.
Hosseini et al. [10] proposed a cloud-based approach for real-time seizure prediction. This work followed three main steps: (1) dimensionality reduction to reduce algorithmic computational complexity and get faster response, (2) a stacked autoencoder as a deep learning approach for automatic feature extraction and classification, and (3) a cloud computing system for real-time analysis of iEEG signals. The authors achieved 94% of accuracy and a FPR of 0.05/h. Shahbazi and Aghajan [17] proposed an approach based on CNN-LSTM and STFT for raw data transformation. A seizure is anticipated only if at least 8 of 10 successive samples are detected as pre-ictal signals. This model was evaluated on the CHB-MIT data set. It achieved an average sensitivity of 98.21% with a FPR of 0.13/h and a mean 44.74 min as the prediction time.
Seizures are events demarcated in time with several successive phases. During this event, EEG segments are correlated. Therefore, the recurrent aspect in a neural network was shown to be important in seizure prediction. In fact, RNNs are usually used when output at time t depends on the previous one. Regarding different proposed networks [3,8,12,19], GRU was demonstrated to be efficient for EEG data analysis.

CGRNN
To predict epileptic seizures on the basis of EEG signals in a patient-oriented manner, we propose a deep learning model based on the combination of CNN and GRU networks, called convolutional gated recurrent neural network (CGRNN). As shown in Fig. 2, our approach follows two steps: data preparation and data analysis.
The data preparation step consists of refining the data and transforming raw EEG into spectrograms, which allows us to capture spectral and temporal patterns representing a seizure. The data analysis step includes the deep learning

Data Preparation
Epileptic seizure prediction can be modeled as a binary classification problem. Therefore, after introducing the used data set (CHB-MIT Scalp EEG database), we select the two appropriate classes. We also exclude the unused signals from our data set before data transformation.

Database:
The CHB-MIT Scalp EEG database is used in this paper. It was collected by an MIT team in partnership with the pediatric hospital in Boston and can be downloaded from the Physionet platform [7]. The data set is composed of approximately 1136 h of brain activity recordings and 198 seizures. It includes many types of seizures and was collected from both genders with different ages. One fifth of the data was recorded from men aged from 3 to 22 years. The remaining data concerns females aged from 1.5 to 19 years [18]. In a few records, other non-EEG signals were also recorded, such as electrocardiogram (ECG) or vagal nerve stimulus (VNS). Furthermore, we used electrode positions and nomenclature different from the International 10-20 system in some records. Consequently, one step to do was data refitting to get the same channels for all files. The data sampling rate is 256 samples per second [7].
Data Refinement: Litt et al. [13] demonstrate that complex epileptiform discharges are common 7 h before seizures and an activity similar to a seizure becomes more frequent 2 h before the actual onset. Also, the accumulated energy increases during the 50 min before the ictal state [13]. Most of the existing studies consider the pre-ictal phase as one hour before a seizure begins. In our work, we consider the inter-ictal and the pre-ictal signals, shown in Fig. 3, as the two most relevant categories to classify. The inter-ictal signal is defined as the period between 1 h after the end of a seizure and 1 h before the onset of the next one. Based on Truong et al. [21], the pre-ictal signal is extracted from 35 min to 5 min before the epileptic seizure, which enables us to take the necessary precautions. Furthermore, considering that seizures can happen very close to each other, we are interested in predicting the leading crisis, which is about less than 30 min away from the next one.  After considering the two categories, we get different ratios between pre-ictal and inter-ictal data for every patient due to the number of recorded seizures. Considering that seizures are rare events, the number of inter-ictal recordings is higher than the number of pre-ictal ones. Consequently, we get an unbalanced data set for all cases. Most machine learning algorithms assume that data from different classes is equally distributed. If we have unbalanced data, we get biased classifiers towards classes with more instances over other classes [9]. Therefore, to deal with this issue, we use an overlapped sampling technique with the training data to get more pre-ictal segments. For every patient, we calculate the ratio between the pre-ictal and inter-ictal hours. Then, we slide a 30 s window by the calculated factor along the time axis over all the pre-ictal records.
Raw Data Transformation: Abnormal brain activity is detected on the basis of the cerebral rhythms in the EEG recordings. These are classified according to their frequency range hence the importance of the frequency aspect with the temporal aspect in EEG data analysis. Time-frequency features are usually studied using the signal spectrogram [1]. This is a tool used to visualize the change in the frequency spectrum of a signal over time. It represents in one two-dimensional diagram three parameters. The time and frequency are the two axes of the graph. The third parameter indicates the amplitude of a particular frequency at a particular time and is distinguished by the color of each point in the image. Spectrograms are generated using the Fourier transform. In this work, after excluding useless signals, we apply STFT to translate raw EEG signals into a two-dimensional matrix with time and frequency axes, which is a suitable input for a CNN. STFT is a common method for time-frequency analysis. EEG records are contaminated by a 60 Hz power line noise in the American continent. Therefore, a bandpass filter for frequency ranges of 57-63 Hz and 117-123 Hz is used. The 0 Hz component is also excluded.

Data Analysis
We use our CGRNN model illustrated in Fig. 4 for data analysis. The first part of the model is a CNN with 3 convolution blocks. Each block includes a convolution layer with a rectified linear unit activation (ReLU). Max pooling layers are used to reduce the number of calculations and prevent the model from overfitting during the training. We also use batch normalization between layers to ensure that the input distribution is the same for each layer no matter the changes in the previous one. The data is then flattened and reshaped to be piped into a first gated recurrent layer with 256 units. The next fully connected layer uses a sigmoid activation function. It is followed by a second gated recurrent layer with 100 units. The output of this layer is fed into the softmax layer to predict the class probabilities of the input data. The gated recurrent layer has a dropout rate of 0.5 to reduce overfitting.

Experimental Evaluation
The proposed CGRNN was implemented in Python 3.5 using Tensorflow 1.9.0 backend and Keras 2.2. Models for different patients were configured to run on an NVIDIA GeForce GTX 1080 GPU. We used 25% of the data for validation and 75% for training. Categorical cross-entropy was adopted as our loss function and the ADAM optimization algorithm was used for model optimization. It is an extension of stochastic gradient descent. To test our model, we consider that one signal clip is preceding a seizure only if at least 8 of 10 successive samples of this sequence are detected as pre-ictal. The calculated metrics are accuracy, sensitivity, and FPR. We also implemented a CNN model with the same architecture as proposed by Truong et al. [21]. This model considers the same defined classes in [21]: the inter-ictal signal which is about 4 h before and after a seizure and the pre-ictal signal as the period from 35 min to 5 min before the ictal phase. Thus, both implemented CGRNN and CNN models can predict epileptic seizures between 35 min and 5 min in advance.
For the seizure prediction task, the most crucial part is to determine all of the positive cases. Missing a patient who has a seizure but goes undetected will be critical. Furthermore, the less we get false alarms, the better will be the solution. Therefore, our model evaluation is mainly based on sensitivity and also FPR values.
The obtained results on the 13 patients considered by Truong et al. [21] are shown in Table 1. The differences between metrics presented by Truong et al. [21] and the results obtained with the implemented CNN is due to data pre-processing step and also to the random initialization of weights in neural networks.
The model performance varies from one patient to another. In fact, for the patients 1, 2, 10, 18 and 19, our CGRNN achieves better classification results. For the three patients 3, 13, and 20, we obtain better sensitivity values than the CNN approach, but we get a higher FPR. Our model achieves comparable results for the patients 14 and 21 and lower sensitivity values for the patients 3, 9, and 23. An average of 75.6% accuracy and an average sensitivity of 89% are reached for the 13 patients. The FPR ranges between 0 and 6.57 per hour, with a mean FPR of 1.6 per hour. The differences in the performance for each patient are related to the characteristics of the available data, namely the number of recorded seizures and the time periods between the events.

Conclusion
We presented a novel convolutional gated recurrent neural network (CGRNN) to predict epileptic seizures. The proposed approach is a patient-specific predictor that allows us to predict epileptic seizures on the basis of EEG signals, taking into account the temporal aspect as well as the signal frequency content. The publicly available data set CHB-MIT was used in our experimental evaluation. Our CGRNN can predict epileptic seizures between 35 min and 5 min in advance and achieved an average sensitivity of 89% and a mean accuracy of 75.6% for the 13 patients in the data set, with a mean FPR of 1.6 per hour. This demonstrates the efficiency of the proposed approach in the epileptic seizure prediction task.
There are several areas for future work. First, we want to investigate whether techniques of weight initialization and regularization of the implemented neural network have effects on the evaluation metrics, such as zero and He initializations. Furthermore, we plan to train the model on large-scale data sets to achieve higher performance, such as the Freiburg Hospital iEEG data set and the TUH EEG Seizure Corpus. Also, we plan to build a real database by recording EEG signals from the university hospital of Sfax, Tunisia. Finally, we also intend to investigate channel selection techniques and design neural architectures based on attention mechanisms.