https://doi.org/10.31449/inf.v46i4.3768 Informatica 46 (2022) 491–504 491 EEG Signal Feature Extraction and Classification for Epilepsy Detection Cherifi Dalila 1 , Falkoun Noussaiba 1 , Ouakouak Ferial 1 , Boubchir Larbi 2 , Nait-Ali Amine 3 1 Institute of Electrical and Electronic Engineering, University of Boumerdes, Algeria. 2 LIASD Laboratory, University of Paris 8, France. 3 LISSI Laboratory, University of Paris-Est Créteil, France. Email: da.cherifi@univ-boumerdes.dz, noussaibafalkoun@gmail.com Keywords: EEG, Epilepsy, Feature Extraction, DCT, DWT, Classification, K-NN, SVM, ANN. Received: September 09, 2021 Epilepsy is a neurological disorder of the central nervous system, characterized by sudden seizures caused by abnormal electrical discharges in the brain. Electroencephalogram (EEG) is the most common technique used for Epilepsy diagnosis. Generally, it is done by the manual inspection of the EEG recordings of active seizure periods (ictal). Several techniques have been proposed throughout the years to automate this process. In this study, we have developed three different approaches to extract features from the filtered EEG signals. The first approach was to extract eight statistical features directly from the time-domain signal. In the second approach, we have used only the frequency domain information by applying the Discrete Cosine Transform (DCT) to the EEG signals then extracting two statistical features from the lower coefficients. In the last approach, we have used a tool that combines both time and frequency domain information, which is the Discrete Wavelet Transform (DWT). Six different wavelet families have been tested with their different orders resulting in 37 wavelets. The first three decomposition levels were tested with every wavelet. Instead of feeding the coefficients directly to the classifier, we summarized them in 16 statistical features. The extracted features are then fed to three different classifiers k-Nearest Neighbor (k-NN), Support Vector Machine (SVM), and Artificial Neural Network (ANN) to perform two binary classification scenarios: healthy versus epileptic (mainly from interictal activity), and seizure-free versus ictal. We have used a benchmark database, the Bonn database, which consists of five different sets. In the first scenario, we have taken six different combinations of the available data. While in the second scenario, we have taken five combinations. For Epilepsy detection (healthy vs epileptic), the first approach performed badly. Using the DCT improved the results, but the best accuracies were obtained with the DWT-based approach. For seizure detection, the three methods performed quite well. However, the third method had the best performance and was better than many state-of-the-art methods in terms of accuracy. After carrying out the experiments on the whole EEG signal, we separated the five rhythms and applied the DWT on them with the Daubechies7 (db7) wavelet for feature extraction. We have observed that close accuracies to those recorded before can be achieved with only the Delta rhythm in the first scenario (Epilepsy detection) and the Beta rhythm in the second scenario (seizure detection). Povzetek: Opisana je metoda zaznavanje epilepsije preko EEG signalov. 1 Introduction The human brain is the most complex and mysterious organ of the human body, consisting of billions of neurons. It is considered as an electro-chemical machine because neurons exploit chemical reactions to generate electrical signals. These electrical signals can be monitored through different scientific techniques such as Electroencephalography (EEG), Magnetic Resonance Imaging (MRI), functional Magnetic Resonance Imaging (fMRI) and Positron Emission Tomography (PET). EEG is the most used technique to capture brain signals due to its ease of use, its excellent resolution and its low cost. It is used in the medical environment more precisely in the diagnosis and treatment of mental and neurological disorders (Alzheimer, Dementia....) and more particularly in the case of Epilepsy. According to an estimate of the World Health Organization (WHO), Epilepsy affects around 50 million people worldwide. Epilepsy is characterized by recurrent and sudden seizures. These seizures are the result of a transient and unexpected electrical disturbance of the brain and an excessive neuronal discharge that is evident in EEG. The detection of epileptic seizures by visual scanning of a patient’s EEG data is a tedious and time-consuming process. In addition, it requires an expert to analyze the entire length of the EEG recordings. Moreover, the diagnosis of Epilepsy is nearly impossible from the seizure-free EEG recordings. As a result, it is necessary to develop a robust and a reliable automatic classification and detection system for Epilepsy diagnosis. For this aim, several automated EEG signal classification methods, using different approaches, have been proposed. However, 492 Informatica 46 (2022) 491–504 D. Cherifi et al. most of them deal with seizure detection only. In this work, an analysis of EEG signal is performed to detect Epilepsy during both ictal and interictal states. This is executed using three different techniques of feature extraction and three distinct classification algorithms. In order to compare the performance of these methods, each algorithm is tested on a real dataset which consists of three subject groups: healthy subjects (normal EEG), epileptic subjects during a seizure-free interval (interictal EEG), and epileptic subjects during a seizure (ictal EEG). To carry out this work, the article has been divided into four parts, briefly described as follows: the first section aims to introduce the EEG signal and the Epilepsy. The second section explains the three steps of the EEG signal analysis, which are respectively: the preprocessing step, the feature extraction step where three techniques are described, and the classification step where three classifiers are presented. Ultimately, section three illustrates the experimental part applied on the Bonn dataset and the statistical analysis for various methods proposed as well as their performances. Finally, conclusions about this work and possible perspectives are drawn. 2 EEG based methodology for epilepsy diagnosis EEG is the most common test used to diagnose Epilepsy. The electrodes attached to the scalp, with a paste-like substance or a cap, record the electrical activity of the brain. If a person has Epilepsy, it is common to have changes in the normal pattern of brain waves, even when there is no seizure. However, the changes are more noticeable during seizure activity. The doctor may monitor patients on video when conducting an EEG while they are awake or asleep, to record any seizures they experience in order to determine their kind. The test may be done in a doctor's office or the hospital. If appropriate, an ambulatory EEG, which the patient wears at home, may be used. The EEG records seizure activity over the course of a few days. The doctor may give some instructions to trigger the seizures [1]. Recently, many researches are conducted in order to make the process of detecting Epilepsy automatic by means of machine learning. That is also the topic of interest in this work. 2.1 Literature review Electroencephalography (EEG) records brain activities by measuring the voltage fluctuation on the scalp. This signal has a great potential for diagnosis and treatment of brain disorders. However, it is very difficult to get useful information from raw EEG signals directly. Hence, preprocessing and feature extraction steps are necessary in the EEG signal analysis. Numerous methods of feature extraction and classification have been proposed throughout the years. The Bonn database is used as a benchmark data set in many of the cited works. It consists of five sets denoted A, B, C, D and E. Sets A and B recordings belong to healthy subjects. Sets C and D recordings belong to epileptic patients during seizure- free intervals. Set E corresponds to seizure recordings. Gandhi et al. [2] used the DWT to extract three features from the EEG signals, energy, entropy and standard deviation. As classifiers, they used SVM and Probabilistic Neural Networks (PNN) to obtain a maximum accuracy of 95.44% for the ABCD-E case [3]. Nicolaou et al. [4] extracted a single feature, which is the permutation entropy from EEG signals and used the SVM classifier to report 93.5% accuracy for the A-E data sample whereas the maximum accuracy for other data samples such as B-E, C-E, D-E and ABCD-E is 86.1% [3]. M. Z. Parvez and M. Paul [5] presented an approach based on the high frequency components of The DCT for feature extraction, which are combined with the bandwidth feature extracted from the Empirical Mode Decomposition (EMD). They used the Least Square SVM (LS-SVM) classifier to identify the ictal and interictal periods of epileptic EEG signals from different brain locations. The maximum achieved accuracy on the Freiburg database was 79%. V. Bajaj and R. B. Pachori[6] proposed a novel method to detect the seizures using the Hilbert transformation of Intrensic Mode Functions (IMFs). The classification achieved an accuracy of 90% [7]. R. J. Martis et al. [8] used a decision tree classifier with energy, fractal dimension and entropy as features. The achieved accuracy is 95.7%. N. Ahammed et al. [9] used the Daubechies order 2 wavelets to extract the coefficients. The parameters fed to a linear classifier are energy, entropy, mean, maximum and minimum. They used three sets from the Bonn database, set A, set D and set E. The overall accuracy obtained is 84.2%. Juarez-Guerra et al. [10] extracted statistical features such as mean, median and variance from the EEG signals and used the feed-forward neural networks to report an accuracy of 93.23%. Zakariya Lasfer et al. [11] used only sets A and E from the Bonn database for seizure detection. They extracted the wavelet coefficients as features and calculated the energy of each wavelet coefficient. They obtained a maximum accuracy of 98.1%, a sensitivity of 97.8% and a specificity of 98.1% with the ANN classifier. A.B.Peachap and D.Tchiotsop[12] decomposed the EEG signal using Laguerre polynomials based wavelets. They reduced the dimensionality with Principal Component Analysis (PCA) and performed the classification using SVM and pattern recognition ANN. They tested multiple cases from the Bonn database. The lowest classification accuracy obtained with ANN was 94% and with SVM, it was 90%, which corresponds to data sample C-E. The best classification accuracy with ANN was 100% and with SVM, it was 98%, which corresponds to data sample B-E. They also pointed out that the scheme they used constitutes a classic case of overfitting, such as all the reported accuracies were 100% before the cross- validation. EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 493 2.2 Methodology The Block diagram of the steps applied to EEG signal analysis in our study is presented in figure 1. We first used for the preprocessing step a Butterworth low-pass filter to correct and remove artifacts. Then, for the feature extraction step, three methods are proposed. The first one is to extract directly eight features from the original signal. In the second and third methods, features are extracted from the EEG signal after applying respectively Discrete Cosine Transform and Discrete Wavelet Transform. Concerning the classification step, we have used three classifiers, which are k-Nearest Neighbors, Support Vector Machine and Artificial Neural Network. Figure 1: Block diagram of the basic steps applied to EEG signal analysis. 2.2.1 Preprocessing EEG recording is highly susceptible to various forms of noise and artifacts, such as blinking or muscle movement, that can contaminate the data and distort the picture. Therefore, an initial task of any EEG data analysis is noise and artifact removal, which consists of separating the relevant neural signals from random neural activity that occurs during EEG recordings. This is done in the step of preprocessing, which is a procedure of transforming data into a format that is more suitable for further analysis and interpretable for the user [13]. For this preprocessing step, a filtering is done using a second-order low-pass Butterworth filter to cut off all the frequencies above 60Hz which are viewed as noise. 2.2.2 EEG Signal feature extraction After the preprocessing stage, a filtered EEG signal suitable for extracting the needed features is obtained. In this study, three methods of feature extraction are used. In the first method, we extract statistical features directly from the filtered time-domain signal. In the second method, we transform the signal to the frequency domain using DCT. While in the third method, the signal is transformed to the time frequency domain by the DWT. A) Feature extraction using statistical parameters Throughout our study, eight statistical features have been introduced. They are maximum, mean, standard deviation, median, mode, first quartile, third quartile and interquartile range. B) Feature extraction using Discrete Cosine Transform (DCT) The Discrete Cosine Transform (DCT) is very similar to the Fourier Transform (FT), but DCT involves the use of just Cosine functions and real coefficients, whereas FT makes use of both Sine and Cosine functions and requires the use of complex numbers. Both FT and DCT are transformation methods used for converting a time series signal into basic frequency components and their respective inverse functions convert things back the other way. A DCT expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. An important feature of DCT is that it takes correlated input data and concentrates its energy in just the first few transform coefficients. If the input data consists of correlated quantities, then only the first few coefficients are large and the other coefficients are zeros or small numbers. Therefore, they can be negligible. The one-dimensional DCT for a signal is given by [14]: Gf = √ 2 𝑛 Cf ∑ 𝑝 𝑛 −1 𝑡 =0 t cos (2𝑡 +1)𝑓𝜋 2𝑛 (1) The input is a set of n data values p t, and the output is a set of n DCT transform coefficients (or weights) G f. (a) (b) Figure 3: An EEG signal (a) before and (b) after DCT. Figure.3(a) shows a 200 points EEG signal in time domain. While figure 3(b) shows the same sample after applying DCT on it. In frequency domain, figure 3(b), it is clear that the energy is compressed into the first few coefficients while the remaining are either null or close to zero. C) Feature extraction using Discrete Wavelet Transform (DWT) The DWT is computed by successively passing x[n] through a series of low-pass and high-pass filters. Each stage consists of two digital filters and two down- samplers by 2 to generate the digitized signal. The first filter, H 0, is the discrete mother wavelet, which is a high- pass filter, and the second, G 0, is a low-pass filter. The downsampled outputs of the first high-pass filter produce the detail information d 1[n], while the downsampled outputs of the first low-pass filter produce the coarse (a) (b) Figure 2: One portion of an EEG signal (a) before and (b) after the filtering process. Pre- processing Feature extraction Classification EEG Data 494 Informatica 46 (2022) 491–504 D. Cherifi et al. approximation, a 1[n]. The first approximation, a 1[n], is again decomposed and this process is repeated at each stage. In this work, we have used six different families of wavelets, which are Haar, Daubechies, biorthogonal, Coiflet, Symlet and discrete Meyer [15-16]. 2.2.3 EEG signal classification using machine learning Signal classification means to analyze different characteristic features of a signal, and based on them, decide to which grouping or class the signal belongs. The resulting classification decision can be then mapped back into the physical world to reveal information about the physical process that created this signal. In order to have a broad understanding of classification, this section mainly provides an overview of used machine learning and classification algorithms. Machine Learning is a branch of artificial intelligence based on the idea that systems can automatically learn and improve from experience without being explicitly programmed. The process of learning begins with observations or training data in order to look for patterns in that data and make better decisions in the future based on the provided data [17]. There are three types of learning approaches, namely, supervised, unsupervised and reinforcement learning. In a nutshell, reinforcement learning is dynamic programming that trains algorithms using a system of reward and punishment. Unsupervised learning is when the model is given training based on unlabeled data without any guidance while in supervised learning, the machine learns from a labeled dataset with guidance. Supervised learning uses classification algorithms and regression techniques to develop predictive models. Several algorithms have been developed [18]. In this section, the three algorithms used in the context of our study to perform binary classification are briefly explained. A) k-Nearest Neighbor (k-NN) The k-nearest neighbor’s algorithm is a non-parametric and supervised machine learning method used for classification and regression. In classification, k-NN is based on similarity measure among the training and the testing sets. Given a point 𝑥 0 to be classified into one of N groups, the k nearest data points to 𝑥 0 must be found. The classification rule is to assign 𝑥 0 to the population that has the most observed data points out of the k nearest neighbors. Points for which there is no majority are either classified to one of the majority populations at random, or left unclassified [19]. The advantage of k-NN classification is its simplicity. There are only two important concepts that should be taken into consideration [20]: the parameter k, and the choice of a method to measure the distance between the attributes in both the training and the testing sets. The k-NN classification process is usually based on the following steps [21]: • Determine parameter k as the number of nearest neighbors. • Calculate the distance between each testing sample and all the training set element by element. • Sort the distances and determine the k nearest neighbors. • Determine the classes of each of the k nearest neighbors. • Apply majority voting to decide the class of the new data. B) Support Vector Machine (SVM) Support vector machine, or SVM, is a machine learning algorithm initiated by Vladimir Vapnik. It was developed to solve linear or nonlinear classification and regression problems. The basic idea of the SVM classification algorithm is to construct a hyperplane that separates two groups if possible. The optimal hyperplane must have the largest distance to the nearest training-data points of the two classes in order to reduce the misclassification error. These points are called support vectors and the distance between the hyperplane and the support vectors of each class is called the margin. The goal of the SVM algorithm is to find the optimal separating hyperplane which maximizes the margin [22]. There are two types of SVMs, namely linear SVM and nonlinear SVM. C) Artificial Neural Network (ANN) Artificial neural networks are computing systems, in which a computer learns to perform tasks by analyzing training examples, generally without being programmed with task-specific rules [23-25]. ANNs take inspiration from the learning process of human brain. This latter is composed of cells called neurons interconnected with links (or axons). Similar to the brain, an ANN is composed of processing units called artificial neurons and interconnections. A graph of a network consists of a number of nodes connected through directional links. Each node represents a processing unit, and the links between nodes specify the causal relationship between connected nodes [21]. 3 Experiments and results This section describes and compares the performance of three methods, at the level of the feature extraction stage, proposed for Epilepsy detection from EEG signals during both ictal and interictal intervals. The raw EEG signal goes through a preprocessing step, then feature extraction and finally the classification. The same procedures are used for both experiments. The difference lies in the way we divide the data. All the details are provided later on. 3.1 Data set description The used data set was developed by the Department of Epileptology, University of Bonn, Germany. It is made publicly available in [26]. The database consists of five separate sets denoted set A, B, C, D and E. Each containing 100 single-channel EEG samples of length 23.6s and sampled at 173.6 Hz using 12-bit resolution, resulting in 4097 data points per each signal. The amplitude is in microvolts. All the recordings were made with the same 128-channel amplifier system. Set A and set B were collected from surface EEG recordings of five healthy subjects with eyes open and eyes closed respectively. Sets C, D and E correspond to EEG records EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 495 of five epileptic patients. The samples in the first two sets are collected during seizure-free intervals (interictal), from the hippocampal formation of the opposite hemisphere of the brain and from within the epileptogenic zone respectively. Set E samples are collected during seizure activity (ictal). The properties of each set are summarized in table 1. Figure 4 depicts five samples of the EEG recordings from the five different sets in the Bonn database. The y- axis corresponds to the amplitude in microvolts and the x-axis corresponds to the time in seconds. 3.2 Experimental procedure Three methods are proposed for two experiments. In the first experiment, Epilepsy is detected mainly from the interictal intervals and the implemented scenario is healthy vs. epileptic. Therefore, all the samples in the dataset fall in two classes: healthy, for sets A and B, and epileptic for sets C, D and E. In the second experiment, Epilepsy is detected from ictal intervals and the implemented scenario is seizure-free vs. seizure. Since the database has only one set with ictal samples, sets A, B, C and D fall in the first class which is seizure-free (regardless of whether the subject is healthy or epileptic) while set E samples belong to the second class, ictal. For simplicity, we will refer to the first experiment as Epilepsy detection and the second as seizure detection throughout the whole section. In order to have good training and validate the results with a test dataset, the Bonn database is quite limited. To tackle this issue, an augmentation scheme is proposed. Each EEG signal is divided into 8 samples using a window length of 512 data points with no overlap. The resulting samples are treated as independent instances. Therefore, the augmented database has 800 signals per each set, which sums up to a total of 4000 samples. 3.2.1 Feature extraction step The choice of the right features plays a major role in classification problems. In the first method, eight statistical features are extracted directly from the signal to summarize the relevant information contained in it. Hence, this method relies only on time-domain information. The used statistical features are maximum amplitude, mean, mode, median, standard deviation, first quartile, third quartile and interquartile. The second method relies solely on frequency domain information using the DCT, which is a widely used data compression technique. Since energy is concentrated in low frequencies, we keep only the first 150 coefficients (29.3% of the signal after the transformation). Then, we extract four features, which are mean of the absolute value of the coefficients, interquartile, energy and entropy. We will later show that further reduction is possible on the number of input features. The third method is based on the DWT, which captures both frequency and location in time information. The first three decomposition levels are tested separately. Figure 6 illustrates the plots of detail (in red) and approximation (in blue) coefficients, using the Haar wavelet on a sample from set A. Instead of directly feeding the coefficients to the classifier, we summarize the relevant information in 16 statistical features, 8 for the detail coefficients and 8 for the approximation coefficients. These features are maximum, mean of the absolute value of the coefficients, mode, median, standard deviation, first quartile, third quartile and interquartile. (a) (b) (c) Figure 6: Discrete Haar wavelet coefficients on a set A signal at (a) level 1 (b) level 2 (c) level 3. Figure 4: Example of an EEG signal from (a) Set A (b) Set B (c) Set C (d) Set D (e) Set E [ 27]. Table 1: Summary of the main properties of each set within the database. Subject state Electrode type Electrode placement Set A Healthy Eyes open Surface International 10-20 system Set B Healthy Eyes closed Surface International 10-20 system Set C Epileptic Interictal Intracranial Opposite to epileptogenic zone Set D Epileptic Interictal Intracranial Within epileptogenic zone Set E Epileptic Ictal Intracranial Within epileptogenic zone (a) (b) (c) (d) (e) Figure 5: DCT of a signal from (a) Set A (b) Set B (c) Set C (d) Set D (e) Set E. 496 Informatica 46 (2022) 491–504 D. Cherifi et al. 3.2.2 Classification step After extracting the selected features depending on the used method, they are fed to three different classifiers to compare their performances. The first classifier is k-NN, the second is SVM, and the last is ANN. To train both k- NN and SVM models, we used the software Matlab R2018b. The two classifiers are already implemented in the Statistics and Machine Learning Toolbox as the two functions fitcknn and fitcsvm. To train the ANN classifier, the model was built with Python 3.6. It is made exclusively of dense layers from the Keras library as we are using a simple MLP. The model consists of four hidden layers; the first layer has 30 neurons, while the remaining three were implemented with 20 neurons each. The ReLU activation function was used for the hidden layers, and the sigmoid activation function was chosen for the output layer. 3.2.3 Evaluation parameters The data is divided into 75% for the training and 25% for testing. The performance metrics used for the evaluation of the model are accuracy, sensitivity, and specificity. The accuracy (acc) of a classifier is its ability to differentiate between positive and negative cases correctly. Mathematically, it is expressed as follows: 𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = 𝑇𝑃 +𝑇𝑁 𝑇𝑃 +𝐹𝑃 +𝑇𝑁 +𝐹𝑁 (2) Where: • TP (true positive) is the number of cases correctly identified as positive (unhealthy). • TN (true negative) is the number of cases correctly identified as negative (healthy). • FP (false positive) is the number of cases incorrectly identified as positive. • FN (false negative) is the number of cases incorrectly identified as negative. The sensitivity (sen) of a binary classification model is its ability to determine the positive cases correctly, whereas, the specificity (spe) measures its ability to identify negative cases correctly. They are calculated as follows: 𝑆𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦 = 𝑇𝑃 𝑇𝑃 +𝐹𝑁 (3) 𝑆𝑝𝑒𝑐𝑖𝑓𝑖𝑐𝑖𝑡𝑦 = 𝑇𝑁 𝑇𝑁 +𝐹𝑃 (4) 3.2.4 Experiment 1: epilepsy detection In this experiment, the goal is to identify whether a subject has Epilepsy or not mainly from interictal intervals. Several data samples of the Bonn database are tested. First, a pair from the four sets (excluding set E) is taken each time (a healthy set and an epileptic set) resulting in four combinations: A-C, A-D, B-C, and B-D. Then, sets A and B are grouped to form the healthy class while sets C and D form the epileptic class. Finally, set E is added to the latter. For each pair, 1200 samples are used for the training, and 400 samples for the testing. In each train and test dataset, the positive and negative cases are equal. The data sample AB-CD is divided into 2400 samples for the training and 800 samples for the testing. Here again, the epileptic portion and the healthy portion are of equal size. The last data sample, which includes the whole database, is divided into 3000 samples for training, from which 1200 are healthy cases and 1800 are epileptic cases, and 1000 samples for testing, where 400 are negative cases and the remaining 600 are positive cases. A) Method 1: Feature extraction using statistical parameters As mentioned before, the first method is based on the extraction of statistical features directly from the original signal in the time domain. The results are recorded in table 2, table 3 and table 4 for the k-NN classifier, SVM classifier and ANN classifier, respectively. When using the k-NN classifier, changing the parameter k affects the accuracy, such that it increases when we increase the number of nearest neighbors. The average accuracy is 73.36% for k = 8, which makes the k-NN classifier the least performing in this case, followed by ANN with an average accuracy of 73.7%. The SVM classifier has the best performance with an average accuracy of 77.72%. Generally, the pairs with set A as the healthy set give better results than with set B. It is worth noting that the two resting states eyes-open and eyes-closed have different impacts on the brain activity, which results in the observed difference. Mostly, the recorded specificity is higher than the sensitivity. In other words, the three models tend to misclassify the epileptic cases more than the healthy cases. The first method resulted in poor performance. The time-domain Table 4: The obta-ined results for Epilepsy detection with the ANN classifier using the first method (statistical features applied on the original signal). A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 72.5 78.5 71 74.75 69.5 76 Sen (%) 65 66 63.5 74 55 79.33 Spe (%) 80 91 78.5 75 84 75.5 Table 3: The obtained results for Epilepsy detection with the SVM classifier using the first method (statistical features applied on the original signal). A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 82.75 81.7 73 78.75 74.87 75.2 Sen (%) 80.5 71.5 56.5 69 66.25 75 Spe (%) 85 92 89.5 88.5 83.5 75.5 Table 2: The obtained results for Epilepsy detection with the k-NN classifier using the first method (statistical features applied on the original signal). A-C A-D B-C B-D AB- CD AB- CDE k = 3 Acc (%) 74.75 74.75 67.75 72 66.12 69.8 Sen (%) 67 69 49 62.5 56.5 67.17 Spe (%) 82.5 80.5 86.5 81.5 75.75 73.75 k = 5 Acc (%) 77 76.25 70 71.25 68 71.2 Sen (%) 70 67 51 60 55.25 65.67 Spe (%) 84 85.5 89 82.5 80.75 79.5 k = 8 Acc (%) 78.25 76.25 70.5 74.75 68.12 72.3 Sen (%) 73.5 71 54 67 60.5 62 Spe (%) 83 81.5 87 82.5 75.75 87.75 EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 497 information alone is far from enough for Epilepsy detection. We remarked from the different features used for the four samples (set A, set B, set C and set D) that there is no obvious distinction between the healthy and epileptic cases, which would explain the confusion of the classifiers. However, since set E signals are recorded during the seizure, they are distinguishable from the rest. B) Method 2: Feature extraction using DCT Since extracting the statistical features directly from the original signal resulted in a bad performance, we moved to the frequency domain with the DCT to see if that leads to any improvement. Using the four features mentioned in section 3.2.1, the results are recorded in tables 5-6 for the classifiers k-NN and SVM respectively. The best average accuracy with the k-NN classifier, 89.39%, was again achieved with parameter k=8. The SVM model performed barely better with an average accuracy of 89.43%. The performance was especially bad with data sample B-C compared to the other pairs where the accuracy was greater than 90%. The correctly classified cases are not equally distributed over the two classes with both models, as they tend to “favor” the healthy class. The specificity recorded with the SVM classifier was generally greater than 98% (except with data sample AB-CDE), unlike the sensitivity, which was quite low. k-NN was slightly better, as it offers more balance between the two metrics. To see if there were any redundant features in the input vector, we removed one feature at a time and observed the results. We concluded that the dimensionality could be reduced to half the original one. Both energy and entropy were redundant and therefore removed. The results are shown in table 7, table 8 and table 9 for the classifiers k-NN, SVM and ANN, respectively. Table 8: The obtained results for Epilepsy detection with the SVM classifier using the second method after the dimensionality reduction of the input vector. A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 94.25 92.25 84 90.75 87.75 89.3 Sen (%) 90.5 87 69 82.5 77.5 85.33 Spe (%) 98 97.5 99 99 98 95.25 After reducing the size of the input vector, the best average accuracy recorded is 90.30% with the k-NN classifier (a gain of almost 1%), followed by ANN with an average accuracy of 90.16%, then SVM with an average accuracy of 89.72%. Relying on the frequency domain information with the DCT improved the performance considerably compared to the first method. The gain is 16.94% with k-NN, 16.46% with ANN and 12% with SVM. Nevertheless, the results for some data samples are still not satisfying, especially the sensitivity, which is quite low in most cases. C) Method 3: Feature extraction using DWT As an attempt to farther improve the performance for Epilepsy detection, we have used a powerful mathematical tool, which is the DWT, to extract the statistical features from the generated approximation and detail coefficients. We have recorded the results for 37 wavelets from six different families, which are Haar, Daubechies, Biorthogonal, Coiflet, Symlet and discrete Meyer. We tested the three first decomposition levels separately, but only the best accuracy was recorded with the corresponding level. The table 10 and table 11 show only 6 wavelets for which the accuracy was highest with k-NN and SVM classifiers respectively. Table 12 refers to the results achieved with ANN. Table 5: The obtained results for Epilepsy detection with the k-NN classifier using the second method (four statistical features applied on the DCT coefficients). A-C A-D B-C B-D AB-CD AB-CDE k= 3 Acc (%) 91.5 90.75 81.5 89.75 85.25 88 Sen (%) 85.5 86.5 65.5 84 78 84.83 Spe (%) 91.5 95 97.5 95.5 92.5 92.75 k= 5 Acc (%) 91.5 92 81 91.5 87 88.8 Sen (%) 85.5 87.5 64 86.5 80 86 Spe (%) 97.5 96.5 98 96.5 94 93 k= 8 Acc (%) 91.75 92.75 84.25 91 87.87 88.7 Sen (%) 86 91 70.5 87 82.75 84.33 Spe (%) 97.5 94.5 98 95 93 95.25 Table 6: The obtained results for epilepsy detection with the SVM classifier using the second method (four statistical features applied on the DCT coefficients). A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 94.25 92.25 81.5 91.5 87.87 89.2 Sen (%) 90 86.5 64 84 77 84.83 Spe (%) 98.5 98 99 99 98.75 95.75 Table 7: The obtained results for Epilepsy detection with the k-NN classifier (k=8) using the second method after the dimensionality reduction of the input vector. A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 93.5 92 86.75 91.75 88.75 89.1 Sen (%) 90.5 88.5 75 85.5 82.5 84.17 Spe (%) 96.5 95.5 98.5 98 95 96.5 Table 9: The obtained results for Epilepsy detection with the ANN classifier using the second method after the dimensionality reduction of the input vector. A-C A-D B-C B-D AB-CD AB-CDE Acc (%) 93 92 87.75 88.75 89.37 90.1 Sen (%) 88.5 86 76 78.5 80.75 85 Spe (%) 97.5 98 99.5 99 98 97.75 498 Informatica 46 (2022) 491–504 D. Cherifi et al. We observe from the obtained results that there is no "best wavelet" for EEG data, which would give the highest accuracy for all cases. It depends on both the data sample and the selected classifier. However, the db10 wavelet achieved the best average accuracy of 93.26% with k-NN. SVM was especially sensitive to the change in the training data such that the performance drops drastically with the sample B-C. It is also the least performing classifier with an average accuracy of 92.68%. k-NN was more stable and the least sensitive to data change, wavelet and level change. The average accuracies for the two classifiers, k-NN and ANN were 93.88% and 94.04% respectively. Probably, better results could be obtained with the latter since we tested the model with only one wavelet for each data sample. The choice of the wavelet for ANN was based on the results obtained with the two other classifiers. We choose one with which the accuracy was high for both classifiers. The DWT has indeed improved the overall performance. All the samples have a higher accuracy than 90% (except with SVM). The sensitivity is still lower than the specificity, but considerably high compared to the previous method. After carrying on the experiment with the whole EEG signals and deducing that the DWT based method has the best accuracy for Epilepsy detection, we decided to test the performance on the separate EEG rhythms and see whether we can achieve close results with only one rhythm. The rhythms were obtained from filtering the original signal using a second-order Butterworth filter. The wavelet used throughout the whole experiment is db7 (Daubechies order 7). The wavelet choice was not random, it was obtained empirically, but there is no guarantee that this is the best choice. It is worth noting that unlike when using the whole signal, changing the wavelet when dealing with the rhythms separately could lead to very different results (up to 20% difference in the accuracy was observed when testing different wavelets). The used classifiers are SVM and k-NN; however, we only recorded the results obtained with the latter, as shown in table 13, since it had a better performance. Table 12: The obtained results for Epilepsy detection with ANN classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-C Bior2.4 1 90.5 83 98 A-D Bior2.4 3 93.75 88.5 99 B-C Db3 3 94.5 90.5 98.5 B-D Coif4 3 98 96 100 AB-CD Db10 3 94 90 98 AB-CDE Db3 3 93.5 91.17 97 Table 11: The obtained results for Epilepsy detection with the SVM classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-C Db2 2 95.75 93 98.5 Bior1.3 1 94.75 93.5 96 Bior2.4 1 94.5 94 95 Bior2.6 1 94.5 94 95 Sym2 1 95.75 94 97.5 Sym6 1 94.5 93 96 A-D Db3 3 93.5 90.5 96.5 Db5 2 93.75 88.5 99 Bior2.4 3 93.5 92.5 94.5 Bior2.8 3 93.75 91 96.5 Bior5.5 3 93.5 89.5 97.5 Sym3 3 93.5 90.5 96.5 B-C Db1 2 84.25 68.5 100 Db2 3 83.5 67 100 Db3 3 84.5 69 100 Sym2 3 83.5 67 100 Sym3 3 84.5 69 100 Sym7 3 83.5 67 100 B-D Db1 2 95.25 93.5 97 Db10 3 93.75 87.5 100 Bior1.3 1 95.75 94 97.5 Bior1.5 1 96.5 94.5 98.5 Coif4 3 94 88 100 Sym8 3 93.25 86.5 100 AB-CD Db1 1 91 84.75 97.25 Db3 3 88.25 77.75 98.75 Bior1.3 1 89.37 79.75 97 Bior1.5 1 89.5 81.25 97.75 Coif3 3 88 76.75 99.25 Sym3 3 88.25 77.75 98.75 AB-CDE Db3 3 94.6 92 98.5 Db5 3 94.3 90.83 99.5 Bior1.3 1 93.8 90 99.5 Sym3 3 94.6 92 98.5 Sym4 3 93.9 90.83 98.5 Sym5 3 94.1 91 98.75 Table.10: The obtained results for epilepsy detection with the k-NN classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-C Db5 2 92 84.5 99.5 Db7 1 93 88.5 97.5 Bior2.4 1 92.5 86 99 Bior2.6 1 91.75 85 98.5 Bior5.5 2 91.75 84.5 99 Coif4 2 92.75 87.5 98 A-D Db10 3 93 88.5 97.5 Bior2.4 3 93.25 88 98.5 Bior3.3 3 93 86.5 99.5 Bior4.4 3 93.25 88.5 98 Bior5.5 3 93 89 97 Sym5 3 92.75 86.5 99 B-C Db3 3 93.75 87.5 100 Db5 3 93 87 99 Db7 3 93 86 100 Db9 3 93.5 87.5 99.5 Db10 3 93.75 88 99.5 Sym3 3 93.75 87.5 100 B-D Db6 3 97.75 95.5 100 Db10 3 98 96 100 Bior4.4 3 97.75 95.5 100 Bior5.5 3 97.75 97 98.5 Coif4 3 97.75 96.5 99 Sym8 3 98.75 97.5 100 AB-CD Db5 3 91 84 98 Db7 3 91.37 84.5 98.25 Db10 3 92.25 86.25 98.25 Bior6.8 3 91.5 84.5 98.5 Coif4 3 91.62 85 98.25 Sym5 3 91.12 83 99.25 AB-CDE Db3 3 92 88.5 97.25 Db5 3 91.7 87 98.75 Db10 3 91.8 89 96 Coif3 3 91.6 86.83 98.75 Sym3 3 92 88.5 97.25 Sym5 3 92.3 88.5 98 EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 499 We observe from the obtained results that Epilepsy is better detected in low frequency elements (<8Hz). The best performance was recorded with the Delta rhythm, which has the lowest frequency band (<4Hz) and the highest average accuracy, 93.84%, followed by the theta rhythm (4Hz< frequency <8Hz) with an average accuracy of 88.95%. Then, Alpha, Gamma and Beta rhythms with average accuracies 84.20%, 83.62% and 83.23% respectively. The best accuracy was achieved with data sample B-D, 96.75%, which also has the highest sensitivity and specificity, 94% and 99.5% respectively. Using only the Delta rhythm instead of the whole EEG signal leads to almost the same results, with a loss of only 0.04% in accuracy, a gain of 0.03% in sensitivity and a loss of 0.2% in specificity. Using a different method does not forcibly lead to the same conclusions. 3.2.5 Experiment 2: Seizure detection This experiment aims to identify epileptic seizures from EEG data. Several samples of the Bonn database are tested. First, we take set E, which represents the ictal class, with one of the remaining four sets each time, resulting in four combinations: A-E, B-E, C-E and D-E. Then, we use the whole database where sets A, B, C and D form the seizure-free class and set E forms the ictal class. Table 14 shows how the data was divided between training and testing the models. A) Method 1: Feature extraction using statistical parameters After extracting the features from the original signal in time-domain, the results are recorded in table 15 with the k-NN classifier, table 16 with the SVM classifier, and table 17 with the ANN classifier. The performance of the three classifiers was quite good, unlike the obtained results for Epilepsy detection. This is due to the remarkably high peaks in the EEG data, which results from the hyper-activity of the brain during seizure intervals. The results illustrate clearly the big difference in statistical features between set E samples and the other sets. It also justifies why we obtained the lowest accuracy with the data sample D-E. The best set used with set E in the training was set A, which represents the EEG recordings of healthy subjects with eyes open. It resulted in an accuracy of 100% with SVM and 99.75% with both k-NN and ANN. The effect of varying the parameter k in the k-NN model is barely noticeable. The best average accuracy of 97.29%, was recorded with k=5. The least performing classifier was SVM with an average accuracy of 96.66% followed by ANN with an average accuracy of 97.11%. When using the whole database, the sensitivity was especially lower than the specificity compared to the values obtained with the pairs. This is probably due to the unbalance of the positive and negative cases in the training data set. The negative class was 4 times bigger than the positive class, which resulted in lower sensitivity. Table 13: The obtained results for Epilepsy detection with the k-NN classifier using the DWT coefficients after decomposing the EEG signal into 5 rhythms. A-C A-D B-C B-D AB-CD AB-CDE Delta Rhythm Acc (%) 92.75 93.25 94.25 96.75 93.12 92.9 Sen (%) 86 87.5 91 94 88.25 90.17 Spe (%) 99.5 99 97.5 99.5 98 97 Theta Rhythm Acc (%) 87.5 87.25 88.5 91.5 88.12 90.8 Sen (%) 79 78.5 85.5 89.5 83 88.17 Spe (%) 96 96 91.5 93.5 93.25 97.75 Alpha Rhythm Acc (%) 76.5 84.25 88.5 91.75 82.12 82.1 Sen (%) 64 76 78.5 84.5 73 78.5 Spe (%) 89 92.5 98.5 99 91.25 87.5 Beta Rhythm Acc (%) 78 81.25 84.25 91.25 81.62 83 Sen (%) 63.5 69 71 83.5 70.5 77 Spe (%) 92.5 93.5 97.5 99 92.75 92 Gamma Rhythm Acc (%) 80 83.5 88.5 85.5 81.12 83.1 Sen (%) 71 72.5 78.5 77.5 70.75 78.17 Spe (%) 89 94.5 98.5 93.5 91.5 90.5 Table 14: Data division to train and test the models for seizure detection. Data sample Purpose EEG recordings Seizure- free cases Ictal cases Pairs (A-E, B-E, C- E and D-E) Training 1200 600 600 Testing 400 200 200 ABCD-E Training 3000 2400 600 Testing 1000 800 200 Table 15: The obtained results for seizure detection with the k-NN classifier using the first method (statistical features applied on the original signal). A-E B-E C-E D-E ABCD-E k = 3 Acc (%) 99.75 96 97.75 94.25 97.1 Sen (%) 99.5 93 98.5 94.5 90.5 Spe (%) 100 99 97 94 98.75 k = 5 Acc (%) 99.75 96.25 97.75 95.5 97.2 Sen (%) 99.5 93 98 96 89.5 Spe (%) 100 99.5 97.5 95 99.12 k = 8 Acc (%) 99.75 95.75 98.25 94.25 96.5 Sen (%) 99.5 92.5 99 96 90 Spe (%) 100 99 97.5 92.5 98.12 Table 16: The obtained results for seizure detection with the SVM classifier using the first method (statistical features applied on the original signal). A-E B-E C-E D-E ABCD-E Acc (%) 100 95.25 98.5 93.75 95.8 Sen (%) 100 93 99 95 89.5 Spe (%) 100 97.5 98 92.5 97.37 Table 17: The obtained results for seizure detection with the ANN classifier using the first method (statistical features applied on the original signal). A-E B-E C-E D-E ABCD-E Acc (%) 99.75 95.75 98.5 94.75 96.8 Sen (%) 99.5 92.5 99 96 89.5 Spe (%) 100 99 98 93.5 98.62 500 Informatica 46 (2022) 491–504 D. Cherifi et al. B) Method 2: Feature extraction using DCT In the previous experiment, Epilepsy detection, the two features, energy and entropy, were proved redundant in the input vector. However, since we did not want to generalize the observation to this experiment, we observed the results with both 2 and 4 features with the SVM classifier. Once again, the energy and entropy were found to be unnecessary. Therefore, table 18, table 19, and table 20 refer to the obtained results with 2 features, mean and interquartile, with k-NN, SVM and ANN classifiers, respectively. Relying on the frequency domain information slightly improved the overall performance. The recorded accuracies for data samples B-E and D-E are higher compared to the previous method. Although, the best data combination is still A-E and the worst is still D-E. The best classifier was ANN with an average accuracy of 97.8% followed by k-NN and SVM with an average accuracy of 97.57% (k=5) and 97.53%, respectively. The main advantage of applying the DCT to the original signal before feature extraction over the previous method is the high sensitivity recorded when using the whole database, such that both sensitivity and specificity are greater than 96% with the best classifier ANN. C) Method 3: Feature extraction using DWT As in the previous experiment, Epilepsy detection, 37 different wavelets from 6 families were tested with k- NN and SVM. Table 21 and table 22 refer to the obtained results, using the DWT coefficients, with the best 6 performing wavelets in each data sample, with k-NN and SVM, respectively. Table 23 refers to the results obtained with the ANN classifier using only a single wavelet per data sample. Table 18: The obtained results for seizure detection with the k-NN classifier using the second method (two statistical features applied on the DCT coefficients). A-E B-E C-E D-E ABCD-E k = 3 Acc (%) 100 97.5 96.5 95.25 96.7 Sen (%) 100 97.5 98.5 97 92.5 Spe (%) 100 97.5 94.5 93.5 97.75 k = 5 Acc (%) 100 97.75 97 96 97.1 Sen (%) 100 98.5 99.5 98.5 95.5 Spe (%) 100 97 94.5 93.5 97.5 k = 8 Acc (%) 100 97.5 97.25 95.75 97.3 Sen (%) 100 98.5 99.5 99 97 Spe (%) 100 96.5 95 92.5 97.37 Table 19: The obtained results for seizure detection with the SVM classifier using the second method (two statistical features applied on the DCT coefficients). A-E B-E C-E D-E ABCD-E Acc (%) 99.75 96.75 98.25 96 96.9 Sen (%) 99.5 96 99 98 92 Spe (%) 100 97.5 97.5 94 98.12 Table 20: The obtained results for seizure detection with the ANN classifier using the second method (two statistical features applied on the DCT coefficients). A-E B-E C-E D-E ABCD-E Acc (%) 99.75 97.25 98.25 96.25 97.5 Sen (%) 100 97 99.5 97.5 96.5 Spe (%) 99.5 97.5 97 95 97.75 Table 21: The obtained results for seizure detection with the k- NN classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-E Db1 3 100 100 100 Db4 3 100 100 100 Bior2.2 3 100 100 100 Coif1 3 100 100 100 Sym2 3 100 100 100 Dmey 3 100 100 100 B-E Db1 2 97 94 100 Db2 1 97 94 100 Bior2.2 2 97 94 100 Bior2.4 3 96.75 94 99.5 Sym2 1 97 94 100 Sym4 3 96.75 93.5 100 C-E Bior2.2 3 99.5 100 99 Bior2.8 3 99.25 99 99.5 Bior3.3 2 99.75 99.5 100 Bior3.7 2 99.5 99 100 Coif1 3 99.25 99.5 99 Sym4 2 99.25 99 99.5 D-E Db1 2 98.25 97.5 99 Db3 3 98.5 99 98 Db5 3 98.25 98.5 98 Coif2 3 98.25 99.5 97 Sym3 3 98.5 99 98 Sym5 3 99 99.5 98.5 ABCD-E Db3 3 97.8 91.5 99.37 Bior2.2 2 97.9 92.5 99.25 Bior5.5 2 97.9 91 99.62 Coif1 1 97.8 91.5 99.37 Sym3 3 97.8 91.5 99.37 Sym5 3 98 92 99.5 Table 22: The obtained results for seizure detection with the SVM classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-E Db1 3 100 100 100 Db5 3 100 100 100 Bior2.6 3 100 100 100 Coif2 3 100 100 100 Sym5 3 100 100 100 Dmey 3 100 100 100 B-E Db1 2 97.75 95.5 100 Db2 3 97.75 96 99.5 Bior2.4 2 98 96.5 99.5 Bior2.6 2 98.25 96.5 100 Coif4 3 97.75 95.5 100 Sym2 3 97.75 96 99.5 C-E Bior2.2 1 99.5 100 94 Bior2.4 1 99.75 100 99.5 Bior2.6 1 99.5 100 99 Bior2.8 2 99.5 99.5 99.5 Bior3.1 3 99.5 100 99 Coif1 1 99.5 100 99 D-E Db1 3 96.5 100 93 Db7 3 96.75 99.5 94 Bior2.6 3 96.75 99.5 94 Bior3.1 3 97 99 95 Coif1 3 97.25 100 94.5 Coif5 3 96.5 99.5 93.5 ABCD-E Db1 1 97.5 95.5 98 Bior2.6 1 97.4 94.5 98.12 Coif1 1 97.6 95.5 98.12 Coif2 3 97.6 94.5 98.37 Sym2 2 97.4 95.5 97.87 Sym5 2 98 97.5 98.12 Table 23: The obtained results for seizure detection with ANN classifier using the third method (extracting statistical features from the DWT coefficients). Data sample Wavelet Level Acc (%) Sen (%) Spe (%) A-E Db1 3 100 100 100 B-E Db1 2 97.25 94.5 100 C-E Bior3.3 2 98.75 97.5 100 D-E Coif2 3 97.25 95 99.5 ABCD-E Sym5 3 98.2 91.5 99.87 EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 501 All three classifiers have led to perfect accuracy (100%) with data sample A-E. The wavelet choice with the latter is quite irrelevant. The best performing classifier was k- NN with an average accuracy of 98.75%, followed by SVM with an average accuracy of 98.65%, then ANN with an average accuracy of 98.29%. Again, it is worth noting that only one wavelet was tested with the ANN classifier for each data sample. Therefore, it is highly possible to record better accuracy with different wavelets, and the order is not final. The DWT based method has resulted in the best performance for seizure detection, such that all accuracies, regardless of the data sample and the classifier, were greater than 97%. However, the bior2.2 wavelet achieved the best average accuracy, 98.48% with k-NN. The lowest sensitivity recorded with the best classifier (k-NN) was 92% when using the whole database. Whereas, the specificity did not drop below 98.5%. For all three methods, it is safe to generalize that for the negative class, using set A instead of set B (healthy sets) and set C instead of set D (epileptic interictal sets) during the training leads to higher accuracy in seizure detection. As it was done in the previous experiment, Epilepsy detection, we tested the DWT based method with the separate EEG rhythms to see if we can narrow down the input to only one rhythm instead of the whole signal. The wavelet used is db7, and again, there is no guarantee that this is the best choice. Two classifiers were tested, SVM and k-NN. The former has the best performance with all rhythms except Gamma. Table 24 refer to the results obtained with the SVM classifier. Generally, the overall performance was good with all five rhythms. The highest average accuracies were achieved with the Beta and Theta rhythms, 97.82% and 97.78% respectively, followed by Alpha with an average accuracy of 96.85%. Then, Delta and Gamma rhythms with average accuracies 95.86% and 93.56%, respectively. The detection of epileptic seizures is higher in the frequency band 4 Hz to 30 Hz. The main difference between the results recorded with Theta and Beta rhythms is that higher accuracies (≥99%) were achieved with the Theta rhythm with the healthy sets (A and B) whereas, the results achieved with the interictal sets (C and D) were better with the Beta rhythm (≥98.25%). Also, the latter has the best average sensitivity, 97.1%, which is 1.3% higher than the sensitivity recorded with the Theta rhythm. However, the average specificity of the latter, 98.8% is 0.8% greater than the recorded average specificity with the Beta rhythm. The results achieved with the Beta rhythm are very close to those achieved with the whole signal. There is a loss of 0.93% in accuracy, a gain of 0.1% in sensitivity, and a loss of 1.6% in specificity. Here again, the drawn conclusions concern only this method. The fact that epileptic seizures were best detected with the Beta rhythm cannot be generalized to other researches with different methods. 3.2.6 Discussions In these experiments, we presented three methods for two types of problems concerning Epilepsy. The first one is the detection of the disease during seizure-free intervals from EEG data. The second is the identification of the epileptic seizures from the same data. The difference between the presented methods lies in the features extraction stage. In the first method, we directly used the original signal to extract 8 statistical features. In the second and third methods, an extra step is added. In the former, we first obtained the DCT coefficients then summarized the relevant information in 2 features, whereas in the latter, we used the DWT transformation on the signal then we extracted 16 features. We preferred to perform the classification with more than one model. Hence, we used three classifiers k-NN, SVM, and ANN. Several data samples were tested. For Epilepsy detection, the first method was proved to be the worst with an average accuracy of 77.72% using SVM as shown in table 25. The best accuracy achieved was 82.75%, for the A-C data sample. But, in most cases, the accuracy was less than 80%. The second method, based on the DCT, performed better. The accuracy was greater than 90% for three data samples and greater than 80% for the remaining three. The best overall performance was achieved with the last method based on the DWT with average accuracy 94.04% using ANN as shown in table 25. Table 24: The obtained results for seizure detection with the SVM classifier using the DWT coefficients after decomposing the EEG signal into 5 rhythms. A-E B-E C-E D-E ABCD-E Delta Rhythm Acc (%) 92.75 93.25 94.25 96.75 92.9 Sen (%) 86 87.5 91 94 90.17 Spe (%) 99.5 99 97.5 99.5 97 Theta Rhythm Acc (%) 99.75 99 96.5 95.75 97.9 Sen (%) 99.5 98.5 96 93.5 91.5 Spe (%) 100 99.5 97 98 99.5 Alpha Rhythm Acc (%) 100 91.5 98.25 98.5 96 Sen (%) 100 88.5 99 98 86 Spe (%) 100 94.5 97.5 99 98.5 Beta Rhythm Acc (%) 98.5 96 98.25 98.75 97.6 Sen (%) 99 94.5 100 98 94 Spe (%) 98 97.5 96.5 99.5 98.5 Gamma Rhythm Acc (%) 96.75 88.25 94.5 96 92.3 Sen (%) 94.5 98 98 97.5 91 Spe (%) 99 78.5 91 94.5 92.62 Table 25: The average accuracies obtained for Epilepsy detection using different feature extraction methods and classifiers. K-NN SVM ANN Statistical Parameters 73.36% 77.72% 73.7%. DCT 90.30% 89.72% 90.16%, DWT 93.88% 92.68%. 94.04% Table 26: The average accuracies obtained for Seizure detection using different feature extraction methods and classifiers. K-NN SVM ANN Statistical Parameters 97.29% 96.66% 97.11% DCT 97.57% 97.53%, 97.8% DWT 98.75% 98.65%, 98.29%. 502 Informatica 46 (2022) 491–504 D. Cherifi et al. For all data samples, with the k-NN classifier, the minimum accuracy recorded was 92.25%, the minimum sensitivity was 86.25%, and the minimum specificity was 97.5%. For seizure detection, all three methods had a decent performance. Although, the order was the same as in the first experiment. The least average accuracy recorded was 97.29% using the first method (with the k- NN classifier) as shown in table 26. The DCT didn't improve significantly the performance, since we noticed an average gain of only 0.51% in the accuracy (with the ANN classifier). The best performance was recorded with the DWT based method, where the average accuracy was 98.75%, the average sensitivity was 97%, and the average specificity was 99.6% (with the k-NN classifier). The last step in both experiments was to test the DWT based method on the five rhythms extracted from the EEG signal. We observed that for Epilepsy detection, almost the same performance could be achieved from only the Delta rhythm. Whereas for seizure detection, very close results to those recorded with the whole signal were achieved from the Beta rhythm. 4 Conclusion The EEG test gives information about the electrical activity carried out in the brain. It is the most suitable test for Epilepsy diagnosis since epileptic seizures are characterized by the abnormal brain activity and the unnaturally high spikes of voltage recorded during seizure. Many researches were carried out in order to automatize the diagnosis using machine learning. Most of them are based on seizure detection for Epilepsy diagnosis. Our contributions in this study are that we worked on the diagnosis during both ictal (during seizure) and interictal (seizure-free) activities in two different experiments; we have used three techniques for the feature extraction stage and three different classifiers to compare their performances, and we decomposed the EEG signal into five rhythms to deduce the best rhythm for the diagnosis. The first technique is based on the time domain information only, the second on the frequency domain information only and the third is based on both. Extracting statistical features directly from the time domain signal was the least performing technique especially during interracial intervals. Using the DCT on the signal then extracting statistical features from the coefficients improved considerably the performance compared to the previous technique. As a last method, we used a powerful analysis tool in the feature extraction stage, which is the DWT. The best performance was recorded with this technique. However, the experimental results showed that the choice of the mother wavelet, the order and the level of decomposition might be very difficult and no prior assumption over what is the best choice may be made before carrying out the experiment. In the classification stage, we used three different classifiers with each method, k-NN, SVM and ANN. With the DWT based method, k-NN had a better overall performance than SVM and was more stable to the wavelet, order and level changes. The last step in our study was to separate the five rhythms from the EEG signals by filtering to see if we could use only one rhythm as input before the feature extraction stage instead of the whole signal. The results showed that the Delta rhythm, which has the lowest frequency band is enough for Epilepsy detection from interictal intervals. Whereas, the Beta rhythm had the best performance among the five rhythms for seizure detection. However, these findings do not go beyond the database used which is the Bonn database with an augmentation scheme, and the method used which is the DWT based method. In this study and all the previous research carried out about the current topic, the seizures are detected after their occurrence. In the future, it will be interesting to investigate these findings in order to build a forecasting model able to detect the seizures before their occurrence. References [1] Mayo clinic (n.d.) Epilepsy. Available at: https://www.mayoclinic.org/diseases- conditions/epilepsy/diagnosis-treatment/drc- 20350098 [2] Gandhi, T., Panigrahi, B. K., & Anand, S. "A comparative study of wavelet families for EEG signal classification". Neurocomputing, Vol 74(17), pp. 3051-3057, 2011. https://doi.org/10.1016/j.neucom.2011.04.029 [3] Ullah, I., Hussain, M., Qazi, E. and Aboalsamh, H. "An Automated System for Epilepsy Detection using EEG Brain Signals based on Deep Learning Approach". Expert Systems with Applications, Vol.107, pp.61–71, Octobre 2018. http://dx.doi.org/10.1016/j.eswa.2018.04.021. [4] Nicolaou, N. and Georgia, J. "Detection of epileptic electroencephalogram based on permutation entropy and support vector machines". Expert Systems with Applications’, Vol. 39(1), pp. 202-209, 2012. https://doi.org/10.1016%2Fj.eswa.2011.07.008 [5] Parvez, M.Z. and Paul, M. "Features Extraction and Classification for Ictal and Interictal EEG Signals using EMD and DCT".15th International Conference on Computer and Information Technology (ICCIT), Chittagong, pp.132-137, Dec., 2012. http://dx.doi.org/10.1109/iccitechn.2012.6509719 [6] Bajaj, V. and Pachori, R.B. "Epileptic seizure detection based on the instantaneous area of analytic intrinsic mode functions of EEG signals". Biomedical Engineering Letters, Vol.3(1), pp.17–21, 2013. https://doi.org/10.1109/iciinfs.2014.7036624 [7] Sharaf, Ahmed I., Mohamed, A. and El-Henawy, Ibrahim M. "An Automated Approach for Epilepsy Detection Based on Tunable Q-Wavelet and Firefly Feature Selection Algorithm". International Journal of Biomedical Imaging. Vol.2018, pp.1–12, Sep.2018. https://doi.org/10.1155/2018/5812872 EEG Signal Feature Extraction and Classification for Epilepsy… Informatica 46 (2022) 491–504 503 [8] Martis, R.J., Acharya, U.R., Tan, J.H. et al. "Application of intrinsic time-scale decomposition (ITD) to EEG signals for automated seizure prediction". International Journal of Neural Systems. Vol.23(5), pp. 1557–1565, 2013. https://doi.org/10.1142/s0129065713500238 [9] Ahammad, N., Fathima, T., & Joseph, P. "Detection of Epileptic Seizure Event and Onset Using EEG". BioMed Research International, pp.1–7, 2014. http://dx.doi.org/10.1155/2014/450573 [10] Juárez-Guerra, E., Alarcon-Aquino, V. & Gómez- Gil, P. "Epilepsy Seizure Detection in EEG Signals Using Wavelet Transforms and Neural Networks". New Trends in Networking, Computing, E-learning, Systems Sciences, and Engineering, pp.261–269, 2014. http://dx.doi.org/10.1007/978-3-319-06764-3_33. [11] Lasefr, Z., Ayyalasomayajula, S. and Elleithy, K. "Epilepsy Seizure Detection Using EEG signals". IEEE 8th Annual Ubiquitous Computing, Electronics and Mobile Communication Conference (UEMCON), pp. 162-167, October 2017. https://doi.org/10.1109/uemcon.2017.8249018 [12] Peachap, A.B. and Tchiotsop D. (2019). "Epileptic seizures detection based on some new Laguerre polynomial wavelets, artificial neural networks and support vector machines". Informatics in Medicine Unlocked, Vol. 16, pp. 100209, 2019. http://dx.doi.org/10.1016/j.imu.2019.100209 [13] Preprocessing - NeurotechEDU. Available at: http://learn.neurotechedu.com/preprocessing/ [14] Salomon, D. Data Compression. Springer Berlin Heidelberg.;2000. http://dx.doi.org/10.1007/978-3-642-86092-8 [15] Sripathi, D. "Efficient Implementations of Discrete Wavelet Transforms Using FPGAs". Master thesis, Florida State University, Florida, 2003. [16] Corinthios,M. "Signals, Systems, Transforms, and Digital Signal Processing with MATLAB". CRC Press, September 3, 2018. https://doi.org/10.1201/9781315218533. [17] Expert System. What is Machine Learning? A definition. Available at: https://expert system.com/machine-learning-definition. [18] Cherifi D., Afoun L., Iloul Z., Boukerma B., Adjerid C., Boubchir L. and Nait-Ali A., "Multi-class EEG Signal Classification for Epileptic Seizure Diagnosis". In: Artificial Intelligence; Renewables Towards an Energy Transition. ICAIRES 2020. Lecture Notes in Networks and Systems, vol 174, pp 635-645. Springer, Cham, 2021. https://link.springer.com/chapter/10.1007/978-3-030- 63846-7_60#citeas [19] Alaliyat, S. "Video -based Fall Detection in Elderly's Houses". Master thesis, Gjøvik University College, 2008. Available at: https://www.researchgate.net/publication/26795394. [20] Zhang, Zhongheng. "Introduction to machine learning: k-nearest neighbors". Annals of translational medicine. Vol. 4, N11, June 2016. https://doi.org/10.21037/atm.2016.03.37. [21] Kantardzic, M. "Data Mining: Concepts, Models, Methods, and Algorithms". 3 rd edition. New Jersey: IEEE Press, John Wiley & Sons, 672 Pages, November 2019. [22] Pupale, R. "Support Vector Machines(SVM)-An Overview". Available at: https://tow ardsdatascience.com/https-medium-com- pupalerushikesh-svm-f4b42800e989. [23] Artificial neural network..Wikipedia, the free encyclopedia., Available at: https://en. wikipedia.org/wiki/Artificial_neural_network. [24] Cherifi Dalila, El affifi Omar Badis, Boushaba Saddek and Nait-Ali Amine. "Feature Level Fusion of Face and Voice Biometrics Systems Using Artificial Neural Network for Personal Recognition". An International Journal of Computing and Informatics (Informatica). Vol.44(1):85–96, March 2020. https://doi.org/10.31449/inf.v44i1.2596. [25] Satapathy, Sandeep Kumar, Alok Kumar Jagadev, and Satchidananda Dehuri. "An empirical analysis of different machine learning techniques for classification of EEG signal to detect epileptic seizure". An International Journal of Computing and Informatics (Informatica). Vol41(1): 99–110, 2017. https://www.informatica.si/index.php/informatica/art icle/view/838 [26] Healthy-Epileptic EEG Data, Department of Epileptology, University of Bonn, Germany. Available at: http://epileptologie- bonn.de/cms/front_content.php?idcat=193&lang=3& chang elang=3. [27] Siuly S., Li Y., Zhang Y. "EEG Signal Analysis and Classification, Techniques and Applications". Book Series title: Health Information Science. Publisher Springer International Publishing; 2016. https://doi.org/10.1007/978-3-319-47653-7.