Machine Learning for Seizure Type Classification: Setting the benchmark

by   Subhrajit Roy, et al.

Accurate classification of seizure types plays a crucial role in the treatment and disease management of epileptic patients. Epileptic seizure type not only impacts on the choice of drugs but also on the range of activities a patient can safely engage in. With recent advances being made towards artificial intelligence enabled automatic seizure detection, the next frontier is the automatic classification of seizure types. On that note, in this paper, we undertake the first study to explore the application of machine learning algorithms for multi-class seizure type classification. We used the recently released TUH EEG Seizure Corpus and conducted a thorough search space exploration to evaluate the performance of a combination of various pre-processing techniques, machine learning algorithms, and corresponding hyperparameters on this task. We show that our algorithms can reach a weighted F1 score of up to 0.907 thereby setting the first benchmark for scalp EEG based multi-class seizure type classification.



There are no comments yet.


page 1

page 2

page 3

page 4


SeizureNet: A Deep Convolutional Neural Network for Accurate Seizure Type Classification and Seizure Detection

Automatic epileptic seizure analysis is important because the differenti...

Neural Memory Networks for Seizure Type Classification

Classification of seizure type is a key step in the clinical process for...

Machine Learning for removing EEG artifacts: Setting the benchmark

Electroencephalograms (EEG) are often contaminated by artifacts which ma...

Neural Memory Networks for Robust Classification of Seizure Type

Classification of seizure type is a key step in the clinical process for...

Machine Learning Evaluation of the Echo-Chamber Effect in Medical Forums

We propose the Echo-Chamber Effect assessment of an online forum. Sentim...

SCORE-IT: A Machine Learning-based Tool for Automatic Standardization of EEG Reports

Machine learning (ML)-based analysis of electroencephalograms (EEGs) is ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Despite many new advances in drug therapy and disease understanding, our capabilities in treating and managing epilepsy are extremely limited. Roughly 1% of the world’s population, 65 million people, suffer from epilepsy. For one third of these patients, no medical treatment options exist. These patients need to find ways to live with their condition and manage their daily lives around it. For the remaining two thirds of the patient population, medical treatment options are available but have vastly differing and constantly changing results and quality of treatment. These shortcomings in diagnosis and treatment options are caused by the fact that epilepsy is a highly individualized condition, i.e. it does not look the same in all patients and even for an individual patient disease expression changes over time. As a result, until recently, the lack of data and measurements made the correct matching of patients and drugs into an unnecessary, long process of trial and error. Manual diaries are the basic data source, but these have been proven to be only 50% accurate.

With the advent of mobile devices that allow to collect patient information in real-time, continuously and at the point of sensing, and leveraging miniaturization and IoT data collection platforms, new efforts are being directed towards building individualized patient management systems. Data that is more accurate and more extensive can be used to gain a understanding of the disease and provide support for decision-making in managing it.

Machine Learning has been successfully used to address a large variety of problems in the biomedical field, ranging from image classification in cancer diagnosis to the automatic interpretation of electronic health records. Recently, we reported results demonstrating feasibility of using specialized neural networks to classify electroencephalogram (EEG) data into normal/abnormal EEG

[2] and to automatically detect and predict seizures [3]. In this paper, we expand on this work and discuss the feasibility of using machine learning algorithms for automatically distinguishing between different types of seizures as they are detected. This technology could support automatic seizure type logging in digital seizure diaries. Such seizure diaries could then be used to improve the performance of clinical trials through more efficient and reliable patient monitoring for endpoint detection, adherence control, and patient retention.

To the best of our knowledge, this is the first work showing that machine learning techniques can be successfully used for automated multi-class seizure type classification.

2 Methods

In this section, we briefly discuss the data preparation strategies, preprocessing techniques, machine learning algorithms and hyperparameter tuning methodologies we have explored.

We considered the TUH EEG Seizure Corpus [1] (v1.4.0) which includes the time of occurrence and type of each seizure in the dataset. The dataset contains 2012 seizures thereby making it the world’s largest publicly available dataset of its type. The total number of seizures per type is shown in Table 1. Out of the all seizure types reported in this table, we only ignore the myclonic seizures owing to its very low count and hence the problem becomes a 7-class classification task.

Seizure type Description Count
Focal Non-Specific Seizure Focal seizures which cannot be specified with its type 992
Generalized Non-Specific Seizure Generalized seizures which cannot be further classified into one of the groups below 415
Simple Partial Seizure Partial seizures during consciousness; Type specified by clinical signs only 44
Complex Partial Seizure Partial Seizures during unconsciousness; Type specified by clinical signs only 342
Absence Seizure Absence Discharges observed on EEG; patient loses consciousness for few seconds (Petit Mal) 99
Tonic Seizure Stiffening of body during seizure (EEG effects disappears) 67
Tonic Clonic Seizure At first stiffening and then jerking of body (Grand Mal) 50
Myoclonic Seizure Myoclonus jerks of limbs 3
Table 1: A short description and total count of different types of seizures in the TUH EEG Seizure Corpus.

For pre-processing the dataset, we used two-popular methods which has been reported to be effective in analysing EEG signals [4, 5]

. In method 1, We applied Fast Fourier Transform (FFT) to each

seconds of clip (with seconds overlap) across all EEG channels. Next, we took of the magnitudes of frequencies in the range Hz. After this operation, the dimension of each training sample becomes where is the number of EEG channels. On the other hand, in method 2, first FFT is applied to each seconds of clip (with seconds overlap) across all EEG channels. Next, the output of FFT is then clipped from 1 to Hz and normalized across frequency buckets. The correlation coefficients ) matrix is calculated from this normalized matrix of

. Real eigenvalues are calculated on this correlation coefficients matrix with complex eigenvalues made real by taking the complex magnitude. We only considered the upper right triangle of the

correlation coefficients matrix (since it is symmetric) and sorted the eigenvalues by magnitude which (1D vectors) is then fed to the classifiers.

For classification, we used the following algorithms: k-Nearest Neighbors (k-NN), SGD classifier, XGBoost, AdaBoost, and Convolutional Neural Networks (CNN). We adopted the 5-fold cross-validation strategy in such a way that for each split (fold), the seizures for each type were divided into training (60%), validation set (20%), and the test set (20%). For the first four algorithms, we used HyperOpt

[6] to choose the best hyperparameters based on the performance on the validation set. For CNN, we used the popular ResNet50 [7] model retrained the final layer for this task. Also, to tackle the class imbalance problem, while training these classifiers, we under-sample the majority classes by randomly picking samples without replacement. During evaluation, each seizure is classified into a type by taking a vote of the predictions made by each sample generated from it.

3 Experiments and results

As a first step, to explore the design space in an efficient manner, we chose the two computationally fastest classifiers from Sec. 2 namely k-NN and SGD classifier and generated their weighted-F1 score on both the pre-processing methods for the first cross validation split. For , , and i.e. the pre-processing hyperparameters, we generated results (weighted-F1 scores) for all combinations of = {12, 24, 48, 64, 96} Hz, = {1, 2, 4, 8, 16} secs, and = {0.5, 0.75} secs which is shown in Fig. 1. The best hyperparameters of k-NN and SGD for each combination was automatically discovered by running Hyperopt for 100 iterations. Note that we used weighted-F1 score since the dataset is imbalanced.

The above experiment served two purposes. First, it allowed us to understand how the performance of the system varies with , , and separately. Upon inspecting the top row of Fig. 1, we find that while the performance is higher at mid-

of 24 and 48 Hz, it drops at extreme frequencies. This probably happens since at lower

we loose relevant information [8] and at higher

the classifiers suffer from the curse of dimensionality due the increase in the number of input features. The second and third row of Fig.

1 suggest that typically the performance increases when decreases and increases respectively. Note that while this might be the averaged trend there are exceptions as depicted in Table 2. We speculate that this happens since both the decrease of and increase of lead to more samples in the training set.

Figure 1: In this figure, we show how the weighted-F1 score varies with (top row), (middle row), and (bottom row) for both the pre-processing techniques on k-NN and SGD classifier.

Second, this design space exploration using simple classifiers revealed which combination of hyperparameters works best for both the pre-processing methods. We select the top four performing sets of hyperparameters and perform 5-fold cross-validation on all the classifiers. Since pre-processing method 2 doesn’t produce 2D data, CNNs can’t be used in this context ( in Table 2). Table 2 shows the obtained average weighted-F1 scores for both the pre-processing methods. It is evident that k-NN achieves a weighted-F1 score of thereby achieving the best performance on this task.

(Hz) (secs) (secs)

Method 1


Method 2

Table 2: 5-fold cross-validation results (weighted F1-score) on the four top performing hyperparameter sets for each pre-processing method.

4 Conclusion

In this article, we performed the first exploratory study to show that machine learning techniques can be used to classify the type of detected seizures. We hope that automatic classification of seizure types will improve long-term patient care, enabling timely drug adjustments and remote monitoring.


  • [1] Shah, V. et al.: The Temple University Hospital Seizure Detection Corpus. Frontiers in Neuroinformatics 12, 83 (2018)
  • [2]

    Roy, S. et al.: Deep Learning Enabled Automatic Abnormal EEG Identification. In: 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pp. 2756-2759, IEEE, Honolulu, HI (2018)

  • [3] Kiral-Kornek, I.*, Roy, S.*: Epileptic Seizure Prediction Using Big Data and Deep Learning: Toward a Mobile System. EBioMedicine 27, pp. 103–111 (2018)
  • [4] Paul, Y.: Various epileptic seizure detection techniques using biomedical signals: a review. Brain informatics 5(2), 6 (2018)
  • [5] Schindler, K.: Assessing seizure dynamics by analysing the correlation structure of multichannel intracranial EEG. Brain 130(1), pp. 65–77 (2007)
  • [6] Bergstra, J.: Hyperopt: a Python library for model selection and hyperparameter optimization. Computational Science & Discovery 8(1) (2015)
  • [7]

    He, K.: Deep Residual Learning for Image Recognition. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770-778, Las Vegas, NV (2016)

  • [8] Arroyo, S.: High-Frequency EEG Activity at the Start of Seizures. Journal of Clinical Neurophysiology 9, pp. 441-448 (1992)