Epileptic Seizures Prediction Using Deep Learning Techniques

Epilepsy is a very common neurological disease that has affected more than 65 million people worldwide. In more than 30 % of the cases, people affected by this disease cannot be cured with medicines or surgery. However, predicting a seizure before it actually occurs can help in its prevention; through therapeutic intervention. Studies have observed that abnormal activity inside the brain begins a few minutes before the start of a seizure, which is known as preictal state. Many researchers have tried to ﬁnd a way for predicting this preictal state of a seizure but an effective prediction in terms of high sensitivity and speciﬁcity still remains a challenge. The current study, proposes a seizure prediction system that employs deep learning methods. This method includes preprocessing of scalp EEG signals, automated features extraction; using convolution neural network and classiﬁcation with the support of vector machines. The proposed method has been applied on 24 subjects of scalp EEG dataset of CHBMIT resulting in successfully achieving an average sensitivity and speciﬁcity of 92.7% and 90.8% respectively.


I. INTRODUCTION
Epilepsy is a neurological disorder in which a patient undergoes frequent seizures. More than 1% of the world population is affected by this disease [1]. Patients affected by this disease can be treated with medicines or by surgical treatments. However, it has been observed that if seizures have occurred then in more than 30% of the cases patient's subsequent seizures cannot be controlled with current methods of treatments that include medicine or surgical procedures. Therefore, it is extremely important to predict the subsequent seizures before they occur so that seizure can be prevented with the help of medication. Electroencephalogram (EEG) signals are recorded to monitor the electrical activity inside the brain. These signals can be recorded by placing EEG electrodes on the scalp of patients known as scalp EEG or by implantation of electrodes inside the brain tissues called intracranial EEG (iEEG) signals [2]. In case of any neurological disorder, an abrupt change in the electrical signals inside the brain can be observed through EEG recordings.
The associate editor coordinating the review of this manuscript and approving it for publication was Moayad Aloqaily . Figure 1 shows the plot of three channels of one hour of continuous recordings of EEG signals. These states include preictal state; a period of 30 minutes before a seizure actually takes place, ictal state; same period as the beginning and ending of a seizure, post-ictal state; period right after a seizure has occurred. Preictal state is quite useful for us as it gives information about the beginning of a seizure; because it is the period before a seizure takes place [3]. Detecting the start of the preictal state as early as possible can help in preventing seizures with medication. Figure 2, Figure 3 and Figure 4 show plots of 10 seconds of a multiple-channels of EEG signal of the interictal, preictal state and ictal states respectively. It can be observed visually that there is a clear difference between the two states in terms of both amplitude and frequency; they significantly increase in the preictal state as compared to the interictal state. This fact motivates us that prediction of epileptic seizures is possible upon successful classification of preictal and interictal signals [4].
EEG signals can be acquired with the help of headsets and stored/processed after digitization with sampling rate from 200 Hz to 5000 Hz. These signals are annotated by a neurologist with the help of specialized software to mark the onset and end of seizures. Preictal state is considered  30 to 90 minutes before the onset of the seizure. The interictal state is the normal state of brain, it starts after postictal state and ends before the preictal state. As stated earlier, the goal is to perform successful classification of preictal state and interictal state. Many researchers [5]- [15] have proposed machine learning and deep learning methods for the prediction of seizures. These methods include preprocessing, features extraction and classification. In the first step, preprocessing is done to remove noise from the EEG signals and to increase Signal to Noise (SNR) ratio [16]. Some common preprocessing methods include filtering the EEG signals in the time domain with bandpass Butterworth [17] and notch filters [18]. Common spatial pattern filter [19] and optimized spatial pattern [20] filter also provides a better signal to noise ratio when applied on EEG signals. Empirical mode decomposition [21] is also quite useful to preprocess EEG signals as it gives intrinsic mode functions and by keeping low-frequency components, we can achieve increased signal to noise ratio. Fourier transform [10] and wavelet transform [20] can also be used to preprocess the EEG signals in order to make them suitable to feed in convolutional neural networks [22].
In this paper, we propose a seizure prediction method using deep learning methods. Section II discusses the state of the art seizure prediction methods using scalp EEG data, Section III briefly describes the dataset used in this study, Section IV explains proposed methodology, Section V discusses results achieved during this research and Section VI concludes the proposed method and suggests future work.

II. LITERATURE REVIEW
Seizure prediction system involves preprocessing of EEG signals, features extraction and classification. Many researchers have proposed various machine learning and deep learning methods for predicting epileptic seizures using scalp EEG signals in which electrodes are placed on scalp of patients to record EEG signals. In recent years, many researchers [5]- [14] have proposed epileptic seizures prediction methods using scalp EEG signals. All these methods involve three common steps that include preprocessing of EEG signals, extracting features from EEG signals and classification between preictal and interictal states.

A. PRE-PROCESSING
Noise [45] is added during the acquisition of EEG signals that reduces the signal to noise ratio of EEG signals resulting in poor classification between interictal and preictal states [46]. It has been observed that different types of noise affects EEG signals including power line noise [47] of 50 to 60 Hz., basline noise [48] due to interference of multiple electrodes and noise added due to electrical activity of human activities including eye movement and pulse of heart. Therefore, it is very desired to remove noise as preprocessing step from EEG signals in order to increase Signal to Noise ratio for improved classification results. Researchers have proposed different preprocessing techniques to increase SNR [49]. These techniques include bandpass/ band-stop filtering [2] to remove power line noise and low pass/high pass filtering [50] for removal of other types of noise. Figure 5 shows multiple preprocessing techniques that have been used by researchers for seizures prediction method using scalp EEG signals.
Zandi et al. [5], Fei et al. [10] and Myers et al. [14] have used Bandpass filtering for nosie removal. Chu et al. [7] have applied Fast Fourier transform (FFT) [51] to preprocess the scalp EEG signals in the frequency domain. Truong et al. [8] have applied short-time Fourier transform (STFT) as preprocessing of EEG signals. STFT [52] has been considered for preprocessing due to the nonstationary EEG signals. Cho et al. [13] have used both Empirical Mode Decomposition (EMD) [53], [54] and wavelet transform [55] for preprocessing the signals. EMD divides signals into intrinsic mode functions based on frequency components. Khan et al. [9] have applied wavelet transform for preprocessing. Other methods of noise removal from EEG signals include surrogate channel [56] with the help of common spatial pattern filtering [57], local mean decomposition [54] and adaptive filtering [58], [59].
Few studies [8], [9] have used Convolutional Neural Networks (CNN) for automated features extraction. CNN extracts features keeping the target classes under consideration. In this way, it helps in extracting features with high inter-lass variance. Figure 6 shows the feature extraction techniques in state-of-the-art seizure prediction methods on scalp EEG singals.

C. CLASSIFICATION
Once the features have been extracted from EEG signals, the next step is to perform classification between 40000 VOLUME 8, 2020  interictal and preictal states. Researchers have used both machine learning and deep learning methods for classification of EEG signals in seizure prediction methods. Machine learning classification methods include k nearest neighbor classifier [39], Naive Bayes [40], Support Vector Machines (SVM) [72], Gaussian Mixture Model (GMM) [73], Decision tree [74] and Random forest classifier [75]. Deep learning classifiers include Convolutional Neural Network [76], Recurrent Neural network [77], Long Short term memory units [78] and Capsnets [79].
In recent studies, Zandi et al. [5] have used variational Gaussian Mixture model (GMM), Cui et al. [6] have applied extreme learning machines and a specific threshold to differentiate between preictal and interictal classes have been used for classification [7], [11], [14]. Cho et al. [13] have used support vector machine as a classifier. Convolutional neural networks are also used for the classification of multiple states of seizures [8], [9]. Figure 7 shows classification techniques used by researchers in recent studies. Table 1 compares state of the art methods of epileptic seizure prediction on scalp EEG dataset in terms of sensitivity, specificity and average prediction time.

III. DATASET
We have applied our proposed method on publicly free dataset of CHB-MIT. Its a scalp EEG dataset of 24 subjects with ages between 2 to 22 years. Following section provides detailed overview of this dataset.

A. CHB-MIT DATASET
EEG signals are recorded with the help of electrodes placement on scalp of patients known as scalp EEG signals [80] or by implanting the electrodes in the brain tissues are intracranial EEG (iEEG) signals [81]. In this study, we have used publicly available dataset of scalp EEG signals of CHBMIT [82]. This scalp EEG dataset has been recorded by collaboration of Children Hospital Boston with MIT and is publicly available on pysionet.org. Dataset of 24 subjects, all human including 17 females and 05 males of different ages ranging from 1.5 year to 19 year in case of females VOLUME 8, 2020   and 3 years to 22 years for male subjects. Dataset was recorded with the help of 23 electrodes placed on scalp of epilepsy patients. All recordings are in EDF files, were converted into .mat files with the help of ''edfread'' function in MATLAB. Data has been sampled at 256 Hz. Data has been divided for each subject into multiple files of 1 Hour recording.Preictal state can be assumed as state before the start of ictal state [83]. Table 2 gives detailed description of the dataset.

IV. PROPOSED METHOD
We propose a seizure prediction method that predicts start of preictal state few minutes before the seizure onset occurs. Figure 8 shows the flowchart of the proposed method. We have used publicly available scalp EEG dataset of CHBMIT [82] that consists of 24 subjects and signals have been acquired with 23 electrodes and digitized at 256 Hz. These signals are first converted into mat files using ''edfread'' function. Butterworth bandpass filter [84] is applied on EEG signals to remove power line [85] and baseline noise [86] from EEG signals. After noise removal Short Time Fourier Transform (STFT) [8] is applied by selecting a non-overlapping window of 30 seconds in order to further increase Signal to Noise ratio and convert the signals from time domain to frequency domain. Multiple handcrafted univariate and multivariate features can be extracted in both time and frequency domain. However, these features are not extracted on the basis of class information to which they belong. Therefore, we have extracted features using Convolutional Neural Networks (CNN) [87]. These features give better interclass variance as the features are extracted  with the help of class information kept under consideration. After feature extraction from CNN, we have replaced fully connected layers with SVM. Features are extracted using CNN while for classification between interical and preictal segments, we have used Support Vector Machine (SVM) [88]. The following subsections briefly explains STFT [89], CNN [90] and SVM [91].
A. SHORT TIME FOURIER TRANSFORM Short Time Fourier Transform (STFT) [8] is used to transform signals from time domain into frequency domain. Due to the non-stationary nature of EEG signals STFT gives better results of preprocessing as the STFT captures the changes of short duration of the signals. We have applied STFT on nonoverlapping window [92] of 30 seconds.

B. CONVOLUTIONAL NEURAL NETWORK
CNN is widely used for feature extraction as well as classification of time series data and images. It consists of multiple layers that perform convolution followed by pooling and last layers of traditional artificial neural network for classification. Equation 1 and 2 shows the updation of weights in CNN.
W denotes weights, l represents layer number, B is for bias, and x, n, m, t are parameters of regularization. Convolution is followed by activation function which may be sigmoid, softmax or rectified linear unit. Equation 3, 4 and 5 shows sigmoid, softmax and rectified linear unit activation functions. Table 3 shows notations used in this section. Pooling layer is the down sampling layer used to reduce number of features. Max pooling and average pooling are commonly used pooling methods. In this proposed method, we have applied 16 filters of 5 × 5 in first convolutional layer followed by batch normalization and dropout of 0.4, 32 filters of 3 × 3 in second convolutional layer followed by batch normalization and 64 filters of 3 × 3 in third layer. Activation function rectified linear unit has been used in all these layers. Each convolutional layer is followed by max pooling with 2 × 2 and batch normalization. After the third layer, these features are flattened to get features of both classes. Figure 9 shows the CNN architecture that have been used for feature extraction in our proposed method. Trainable parameters required during training phase of CNN in the proposed method are 32576.

C. SUPPORT VECTOR MACHINES (SVM)
After extracting features from CNN, we have used Support Vector Machines (SVM) [37] for classification between interictal and preictal states. SVMs can be divided into two types i.e; linear and non-linear SVM [93].  If we have data which is linearly separable then we can easily find support vectors and with the help of slop and intercept we can draw a decision boundary. These are called linear SVM. Generally, we cannot classify data with the help of linear boundary as data may not be linearly separable. Therefore, SVM maps the data into higher dimensional space so that data is easily separable. Kernel trick is used for this purpose. Some commonly used kernels include multilayer perceptron [94], linear and Gaussian kernels. In this work, we have used linear SVM to classify interictal state and preictal state.

V. RESULTS
We have applied our proposed method on 24 subjects of CHBMIT scalp EEG dataset for classification between interictal and preictal states for early prediction of epileptic seizures. We have achieved an average sensitivity of 92.7% with specificity of 90.8%. Average anticipation time of our proposed method is 21 minutes. Figure 10 compares results of our proposed method with state of the art seizure prediction methods. It has been observed that our proposed method for epileptic seizures prediction performs better than state of the art methods in terms of both sensitivity and specificity. We have considered preictal class as positive class, therefore it is important to achieve high true positive rate with low false positive alarms. We have compared ROC curves of state of the art methods with our proposed method. Figure 11 shows comparison of ROC curves. These ROC curves show the plot of sensitivity against false positive rate and compares the performance of methods. Performance of a method is considered as acceptable if false positive alarms do not increase with the increase in sensitivity. It is quite evident that our proposed method performs better in case terms of achieving high true positive rates with low false alarms. Therefore, it is concluded that proposed method gives effective seizures prediction for epilepsy patients.

VI. CONCLUSION AND FUTURE WORK
We have proposed an epileptic seizures prediction method using deep learning. Patients affected from epilepsy can live a healthy and risk-free life if effective prediction of seizures is ensured. Our proposed method combines feature extraction using CNN and classification with the help of machine learning classifier to achieve increased sensitivity and specificity compared with other methods. However, there is still room for improvement in many aspects. In future, if preprocessing is further enhanced for increasing signal to noise ratio. In case of using deep learning methods for feature extraction and/or classification, a large number of parameters need to be learned. Therefore, i future research can also be done to reduce number of parameters. Our proposed method like other state of the art methods provides patient specific seizures' prediction. In future, more research is required for non-patient specific epileptic seizures prediction methods.
SHEHZAD KHALID received the B.Sc. degree in computer systems engineering from the GIK Institute of Engineering Sciences and Technology, Topi, in 2000, the M.Sc. degree in software engineering from the National University of Science and Technology, Rawalpindi, in 2003, and the Ph.D. degree in motion data mining and machine learning from the University of Manchester, U.K., in 2009. He is currently working as a Professor with the Department of Computer Engineering, Bahria University, Islamabad. He is also designated as the Director (ORIC) of the Head office, Bahria University. His research interests include computer vision, machine learning, and pattern recognition.
MUHAMMAD HASEEB ASLAM received the degree (cum laude) in computer engineering and the bachelor's degree (Hons.). He is currently pursuing the master's degree in data sciences with Bahria University, Islamabad, Pakistan. He is a Roboticist at heart. He has mentored various teams and represented Pakistan at multiple prestigious international robotics competitions. His research interests include deep learning, computer vision, medical signal processing, and embedded systems. He has received international awards for his volunteer work in IEEE. He was also listed amongst rising talents of Pakistan in TechJuice as its class of 25 under 25 young technology leaders. VOLUME 8, 2020