Detection of Epileptic Seizure in EEG Signals using Machine Learning



 

Detection of Epileptic Seizure in EEG Signals using Machine Learning

   Under the Guidance of

Dr. (Prof.) S.T. Patil

Group Members

Aashay More, Pruthviraj Deshmukh, Sanket Jadhav, Tejas Pacharne
B.Tech Information Technology

Introduction : 

    This blog tells us about what is Epileptic Seizures and how they can be detected using machine learning and deep learning approaches. Epilepsy is a disorder which is causes an abnormal behavior of a person which includes disturbance, trauma and stroke[1]. Epilepsy is caused due to recurrent occurrences of the seizures. As per the study and the assessments done by WHO also called as World Health Organization, every year, 50 million people suffer from these Seizures and they are not even aware about it[2]. A person who is having a seizure exhibits strange behavior, symptoms, and sensations, sometimes even losing consciousness.

Problem Statement :

  • Epilepsy is a serious neurological disorder.
  • Detection of epilepsy is done by observing the EEG signals and these are very complex, noisy, non-linear signals & produce high volume of data
  • Hence, detection of the seizures and brain related data is very tedious task.
  • Deep learning classifiers are able to classify EEG data and detect seizures without compromising the performance.
    After considering the above problem statements, we need an efficient DL classifier which can successfully detect the Epileptic Seizures from the EEG signals. This blog will present the latest research done on these problem statement. Based on the research[2] done, the problem domain needs an efficient deep learning model which can successfully detect the epileptic seizures based on the EEG signals. As the data generated by the EEG signals is very huge, the deep learning algorithms can perform well than the traditional supervised or unsupervised machine learning algorithms. Even if we apply ML algorithms, they have to be trained on the tabular data. As per the latest trends and research, the latest models are using the LSTM neural network[3] and the Artificial Neutral Network[3]. We will further discuss how these models are trained and evaluated. Before that, let us look at the dataset used by the latest models in this problem statement.

The Dataset :

The UCI - Epileptic Seizure Dataset is the set of data that is utilized for model performance[4]. The original dataset consists of 100 files in 5 separate folders, each of which corresponds to a particular patient. 23.6 second recording of brain activity stored in each file. 4097 information/data points from the associated time-series are sampled. Each data point represents the EEG recording's value at a particular time point. 500 people in all, each having 4097 data points. Every 4097 information points, it is split and jumbled into 23 sets, each of which has 178 information points for 1 second and represents the value of the EEG recording at a particular time. As a result, there are now 23(sets) x 500(people) = 11500 informational pieces, each of which comprises 178 information points for 1 second (a column), the last column represents the class as y {1,2,3,4,5}. The dataset therefore has 179 total columns, the first 178 of which are input vectors, and the 179th of which is a categorization for patients.


Fig 2. Dataset Sample

Proposed Models :


Fig 3. Proposed System

    The recent models follow the above blog diagram. First the models do a data preprocessing which includes removing unwanted columns from tabular data and unwanted images from the image dataset. Next, performing label encoding and one hot encoding for the categorical features. Further more, the proposed systems uses a DL algorithm and the model training is performed. Lastly, the models are evaluated and the accuracy is classifier[5]. In Deep learning, the ANN and the LSTM neural network are highly used for detection of the seizures. As per the research,  there are some models which have implemented the machine learning algorithms like SVM, KNN and Logistic Regression[6]. Let us look at the performances of these algorithms first.

Logistic Regression:

    The latest research shows Logistic Regression classifier which is trained on the dataset and used for the detection purpose[7]. Logistic Regression is a popular supervised machine learning algorithm which is used for classification purpose. It is based on the sigmoid function which plots an 'S' shaped curve on the graph as shown in the figure below.



Fig 5. Logistic Regression Confusion Matrix.

    The regression algorithm for binary classification is used for detection seizure activity. The model used test spilt as 33% of the dataset for validation. The Training accuracy of the model is 66.92% and validation accuracy is 63.9%. Using validation data. As shown in figure 2, the True Negative value percentage was 67.17% and True Positive 0.0% False Positive rate as 32.83% and False Negative as 0.0%.

Support Vector Machines (SVM) :

    Based on our research, support vector machines is an ML algorithm which is highly used in the medical domain for disease classification[8]. The major applications include cancer cell classification, diabetes detection & pneumonia detection, is a  algorithm which plots a hyperplane which divides the dataset into categories. If the dataset is not linearly separable, the the dimension of the graph is increased and then a hyperplane is plot based on the support vectors. When a new input is given, the algorithm plots it on the graph and checks to which side of that hyperplane the plot is located.




Fig 7. SVM Confusion Matrix.

    For binary classification SVM is used. Model is trained on 67% of the dataset. The validation accuracy is 97.2% and training accuracy is 98.09%. The model has 0.0% True Positive classification on validation data. As shown in figure 3, False Positives 19.10%. The True Negative was 80.90% and False Negative as 0%. The validation data is 720 rows as positive class and 3025 as negative class.

K-Nearest Neighbors (KNN) :


    The K nearest neighbors is an unsupervised machine learning algorithm which is used for the classification of data into a category. Initially, the data points are plotted on a scatter plot. We have to select the number of neighbors manually. Then, the algorithm selects a random data point the calculates its Euclidean Distances from the nearby data points[9]. This procedure gives it its nearest neighbors and all he nearest neighbors represent one category. This procedure is repeated until we get the categories which has minimum outliers.

Fig 8. KNN Confusion Matrix

    For binary classification SVM is used. Model is trained on 67% of the dataset. The validation accuracy is 97.2% and training accuracy is 98.09%. The model has 0.0% True Positive classification on validation data. As shown in figure 3, False Positives 19.10%. The True Negative was 80.90% and False Negative as 0%. The validation data is 720 rows as positive class and 3025 as negative class.

Artificial Neural Network (ANN) :


The multiple layer ANN Model implemented with four layers. The input shape for the model was (178, 1) that is 178 data points. The first Second and Third, layer with 32 neurons and Relu as activation function and fourth layer with 2 neurons with SoftMax as activation function. Adam optimizer was used as a model optimizer. Binary cross entropy is used as loss as there is binary classification. Total trainable parameters are 7906. Model is trained on 67% data. 
Fig 9. Artificial Neural Network



Fig 10 ANN Accuracy Graph

The model training accuracy was 98.9% and validation accuracy was 97% which is tested on 33% of testing dataset. It was observed a sudden increase in training accuracy while training the model after the first epoch from 0.91% to 0. 96% and slow increase in accuracy shown in figure 5.

Long-Short Term Memory (LSTM) :

    The multiple layer LSTM Model implemented with three layers. The input shape for the model was (1,178) that is 178 data points. The first LSTM layer with 64 neurons and Relu as activation function. The second LSTM layer with 32 neurons and Relu as activation function[10]. The last layer with 2 neurons with SoftMax as activation function converts the output to weighted sum to probability which sum to 1. Adam optimizer is used as optimizer. Binary cross entropy is used as loss as there is binary classification. Total trainable parameters as 74,690. Model is trained on 67% data. 


Fig 12. LSTM Accuracy

The model training accuracy is 99.88% and validation accuracy as 97.1% which is tested on 33% of dataset. It was observed a sudden increase in training accuracy while training the model after the first epoch from 0.91% to 0. 96% and slow increase in accuracy.

                                                                          Fig 13. LSTM Accuracy

Conclusion:

    Based on the research, both the LSTM and ANN have done the great job in successfully predicting the seizures using the EEG signals[11]. There is very negligible difference in the Training and the validation accuracy of the LSTM as well as the ANN. these models have also calculated other performance evaluation metrics such as the F1 score, precision and the recall. These parameters also shows a very negligible differences making both the LSTM and the ANN suitable for this particular problem domain.



Table 2. Evaluation Metrics of the Models.

    The above table gives detailed comparison of all 5 models used in this study. All the models were trained and validated on the same dataset with validation data as 33% UCI dataset and 67% for training models. As shown in table 2 the Positive class (Seizure activity) have 770 rows for validation and 3025 as a Negative class (No Seizure). The logistic regression achieves Training and Validation accuracy of 66.92% and 63.9% comparatively less than SVM used on the same dataset. Similarly, with precision, f1 score and recall value in Logistic regression algorithm show very less effect in Seizure classification. Refer to the confusion matrix of SVM shown in figure 3 great training accuracy 98.09 % and validation accuracy of 97.23 % but not able to predict classes as shown as True positive. The KNN showed training accuracy and validation accuracy of 93.61% and 91.96% but not able to detect classes as true positive rate is 0.0%.
    The ANN model was able to classify True Positive rate(sensitivity) value with minimal False Positive compared to SVM[12]. For ANN shown in table 2 gives precision value 0.96, recall 0.89 and F1 score 0.92 for seizure signals and precision value 0.97, recall 0.99 and F1 score 0.98 for healthy signals. The proposed model LSTM was able to classify more accurately than ANN with very minimal difference in training and validation accuracy. The proposed model was able to achieve 99.88% accuracy on training data and validation accuracy of 97.1% as compared to ANN validation accuracy of 97.0%. For LSTM shown in table 2 gives precision value 0.96, recall 0.90 and F1 score 0.93 for seizure signals and precision value 0.97, recall 0.99 and F1 score 0.98 for healthy signals. based on overall comparison LSTM based model performs better

References :


[1] Syed Muhammad Usman, Muhammad Usman, Simon Fong, "Epileptic Seizures Prediction Using Machine Learning Methods", Computational and Mathematical Methods in Medicine, Volume 2017, December 2017.
[2] Mengni Zhou, Cheng Tian, Rui Cao, Bin Wang, Yan Niu, Ting Hu, Hao Guo, Jie Xiang, "Epileptic Seizure Detection Based on EEG Signals and CNN", Frontiers in Neuroinformatics, Volume 12, December 2018.
[3] Jos´e Antonio de la O Serna, Mario R. Arrieta Paternina, Alejandro Zamora-M´endez, Rajesh Kumar Tripathy,Ram Bilas Pachori, "EEGRhythm Specific Taylor-Fourier filter bankImplemented with Osplines for the Detection ofEpilepsy using EEG Signals", IEEE Sensors Journal, February 2020. 
[4] S. Raghu, Natarajan Sriraam, Yasin Temel, Shyam Vasudeva Rao, Pieter L. Kubben, "EEG based multi-class seizure type classification using convolutional neural network and transfer learning", Neural Networks, January 2020, pp. 202-212. 
[5] Simone A. Ludwig, "Multi-label Classification for Epileptic Seizure Recognition: Deep Neural Network Ensemble versus Choquet Fuzzy Integral Fusion", 2020 IEEE Symposium Series on Computational Intelligence (SSCI), December 2020, Australia, pp. 836-841. 
[6] Singh, Nalini, Dehuri, Satchidananda, "Multiclass Classification of EEG Signal for Epilepsy Detection Using DWT Based SVD and Fuzzy kNN Classifier", January 2020, pp. 239 – 252. 
[7] Aayesha, Muhammad Bilal Qureshi, Muhammad Afzaal, Muhammad Shuaib Qureshi, Muhammad Fayaz, "Machine learning-based EEG signals classification model for epileptic seizure detection", Multimedia Tools and Applications, February 2021. 
[8] Ahmed Abdelhameed, Magdy Bayoumi, "A Deep Learning Approach for Automatic Seizure Detection in Children with Epilepsy", Frontiers in Computational Neuroscience Volume 15, 08 April 2021, United States. 
[9] Shamriz Nahzat, Mete Yaganoglu, "Classification of Epileptic Seizure Dataset Using Different Machine Learning Algorithms and PCA Feature Reduction Technique", Journal of Investigations on Engineering & Technology Volume 4, Issue 2, pp. 47-60, 2021. 
[10] Afshin Shoeibi, Marjane Khodatars, Navid Ghassemi, Mahboobeh Jafari, Parisa Moridian, Roohallah Alizadehsani, Maryam Panahiazar, Fahime Khozeimeh, Assef Zare, Hossein Hosseini-Nejad, Abbas Khosravi, Amir F. Atiya, Diba Aminshahidi, Sadiq Hussain, Modjtaba Rouhani, Saeid Nahavandi, Udyavara Rajendra Acharya, "Epileptic Seizures Detection Using Deep Learning Techniques: A Review", International Journal of Environmental Research and Public Health, May 2021. [11] Mohammad Asif A Raibag, Dr. J Vijay Franklin, Dr. Rashal Sarkar, "Multi-Feature Learning Model for Epilepsy Classification Supervised by a Highly Robust Heterogeneous Deep Ensemble", Turkish Journal of Computer and Mathematics Education, Volume 13, pp. 273-284, 2022. 
[12] D. A. Torse and R. Khanai, "Classification of Epileptic Seizures using Ensemble Empirical Mode Decomposition and Least Squares Support Vector Machine," 2021 International Conference on Computer Communication and Informatics (ICCCI), pp. 1-5, 2022.
   


Comments