Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk...

30
DEGREE PROJECT, IN , SECOND LEVEL COMPUTER SCIENCE STOCKHOLM, SWEDEN 2015 Detecting Epileptic Seizures OPTIMAL FEATURE EXTRACTION FROM EEG FOR SUPPORT VECTOR MACHINES EDWARD GRIPPE AND MATTIAS LÖNNERBERG KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND COMMUNICATION

Transcript of Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk...

Page 1: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

DEGREE PROJECT, IN , SECOND LEVELCOMPUTER SCIENCE

STOCKHOLM, SWEDEN 2015

Detecting Epileptic Seizures

OPTIMAL FEATURE EXTRACTION FROM EEGFOR SUPPORT VECTOR MACHINES

EDWARD GRIPPE AND MATTIAS LÖNNERBERG

KTH ROYAL INSTITUTE OF TECHNOLOGY

SCHOOL OF COMPUTER SCIENCE AND COMMUNICATION

Page 2: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

KTH Computer Science and Communication

Detecting Epileptic Seizures: Optimal Feature

Extraction from EEG for Support Vector Machines

EDWARD GRIPPE MATTIAS LÖNNERBERG

Supervisor: Pawel Herman Examiner: Örjan Ekeberg

Page 3: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Abstract Epilepsy is a chronic neurological brain disorder causing the affected to have seizures. Looking at EEG recordings, an expert is able to identify epileptic activity and diagnose patients with epilepsy. This process is time consuming and calls for automatization. The automation process is done through feature extraction and classification. The feature

extraction finds features of the signal and the classification uses the features to classify the signal as epileptic or not. The accuracy of the classification varies depending on both which features is chosen to represent each signal and which classification method is used. One

popular method for classification of data is the SVM. This report tests and analyses six feature extraction methods with a linear SVM to see which method resulted in best classification performance when classifying epileptic EEG data. The results showed that two different

methods resulted in classification accuracies significantly higher than the rest. The wavelet based method for feature extraction got a classification accuracy of 98.83% and the Hjorth features method got a classification accuracy of 97.42%. However the results of these two methods was too similar to be considered significantly different and therefore no conclusion

could be drawn of which was the best.

Page 4: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta på EEG­data, identifiera epileptisk activitet och diagnostisera epilepsi hos

patienter. Detta är tidskrävande vilket fordrar en automatisering. Automatiseringen görs genom egenskapsextraktion och och klassificering. Egenskapsextraktionen finner egenskaper hos signalen och klassificeringen använder egenskaperna till att klassificera signalen som epileptisk eller inte. Träffsäkerheten av klassificeringen varierar beroende på både vilka

egenskaper som representerat signalen och vilken klassifikator som använts. En vanlig metod för klassificering är SVM. Denna rapport testar och analyserar sex metoder för

egenskapsextraktion med en linjär SVM för att hitta vilken metod som presterar bäst för klassificering för epileptisk EEG data. Resultaten visade att två metoder presterade bättre än

de andra. Wavelet baserad metoden fick en träffsäkerhet på 98.83% och Hjorth egenskaperna fick 97.42%. Dessa resultat var dock för lika för att kallas betydelsefullt olika.

Därför kunde ingen slutsats dras om vilken den bästa var.

Page 5: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Table of Contents Abstract Referat Table of Contents 1. Introduction

1.1 Scope 1.2 Problem Statement

2. Background 2.1 Epileptic Seizures 2.2 EEG based diagnostics 2.3 Methods for detecting Epileptic seizure activity in EEG

2.3.1 Feature Extraction Methods 2.3.1.1 Time Domain 2.3.1.2 Time­Frequency Domain 2.3.1.3 Nonlinear Methods

2.3.2 Classification 2.3.2.1 Support Vector Machine

2.4 State of the Art 3. Method

3.1 Data Set Description 3.1.1 Data pre­processing

3.2 Feature Extraction 3.2.1 Empirical Mode Decomposition (EMD) 3.2.2 Hjorth Parameters 3.2.3 Welch’s Method 3.2.4 Discrete Wavelet Transform (DWT) 3.2.5 Approximate Entropy (ApEn) 3.2.6 Hurst Exponent (H)

3.4 Results analysis 3.4.1 Accuracy, Sensitivity and Specificity 3.4.2 Analysis of Variance

4. Results 5. Discussion 6. Conclusions 7. References

Page 6: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

1. Introduction Epilepsy affects 65 million people in the world. It is a chronic neurological brain disorder which causes unpredictable seizures. As a seizure causes the affected person to lose control of his or her muscles, they can lead to dangerous situations for the patient if they occur at the wrong time. If the person is driving or swimming, a seizure could even be life threatening. This makes diagnosing people with epilepsy important, so they can be properly medicated and get the help available to live a normal life. Epileptic patients show abnormal brain activity a normal person do not have. This abnormal activity can be divided into three classes: ictal activity which is brain activity occurring during an epileptic seizure, inter­ictal activity which is brain activity occurring in between seizures and pre­ictal activity which is brain activity occurring just before an epileptic seizure. To successfully diagnose a patient with epilepsy it has proven very successful to measure the brain activity and look for these abnormalities. To measure a patient's brain activity electroencephalography (EEG) is used. EEG measure the brain's electrical activity by placing electrodes on the scalp. An experienced neurophysicist then manually looks through the EEG recording to identify ictal and interictal activity. The manual process of identifying ictal and interictal activity from EEG recordings is, however, very time consuming and different experts often come to different conclusions (Tzallas et al., 2012). It would therefore be useful to automate the process. Research done on the techniques for automating seizure detection has mainly concerned the two­class problem of detecting epilepsy by classifying the ictal and normal stages of the EEG while some studies has focused on the three­class problem of detecting the normal, pre­ictal/interictal and ictal stages. Almost all methods for detecting epileptic activity in EEG recordings are divided in two main steps, feature extraction (FE) and classification (Tzallas et al., 2013). FE is the process of creating a set of parameters that describes the raw EEG data. The classification step is the process of classifying these set of parameters to either have come from normal or epileptic activity. Several combinations of different FE and classification techniques have been tried to detect epileptic EEG activity (Acharya et al., 2013). Research done on the subject of classifying epileptic activity have presented classification procedures for the two­class problem with classification accuracies over 95% (see section 2.6). The classifiers use the features from the signal to guess which class any signal should belong to. Then, if the features are different enough between the various classes, the classifiers’ guess is correct. This is however rarely the case as there usually are exceptions where a signal’s features are closer to the wrong class. So what features should one extract from the signal to minimize the amount of these exceptions?

1.1 Problem Statement As the different classifiers work differently, the same extracted features will result in different performance when combined with other classifiers, making some features have great

Page 7: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

classification accuracy with one classifier and much worse with an other. Therefore it is a good idea to investigate different features in combination with the same classifier and optimize its performance instead of optimizing all classifiers at the same time. Support Vector Machine (SVM) has proven to be one of the most effective classifiers (Acharya, 2013). It is also one of the most used, making it a fitting classifier to use for investigating how extracting different features affect the classification accuracy. This report aims to give a better understanding of the consequences from using different methods for extracting features, when using a SVM as the classifier, to classify EEG signals. The report will also result in a compilation of FE­methods and their respective performances together with a SVM classifier. To achieve these goals this report will try to answer the question: What signal features are the most optimal to extract to achieve the greatest accuracy with a SVM when using EEG for detecting the ictal state of epilepsy?

Page 8: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

2. Background

2.1 Epileptic Seizures Epilepsy is a chronic neurological brain disorder affecting around 1% (65 million people) of the worlds population with developing countries generally having a higher rate (Thurman et al., 2011). Epilepsy is characterized by seizures which in turn are episodes of recurrent convulsions. These episodes can occur with frequencies as high as several times a day to as low as once a year (Acharya et al., 2013). The seizures are due to a sudden malfunction of the electrophysiological system of the brain which causes groups of brain cells to enter a mode of hyperactivity that lead to uncontrolled spasms of muscles. During this mode of hyperactivity the brain cells (neurons) starts to discharge in an abnormal, excessive and synchronized manner (Acharya et al., 2013; Tzallas et al., 2012). The spasms can range from being only a slight twitching of a muscle to severe convulsions lasting for a longer period of time. After an epileptic seizure it is common for the patient to feel symptoms such as confusion, feeling tired, having headaches and difficulty with speaking. Moreover people often does not remember what has happened during this period (Panayiotopoulos, 2010). The occurrence of a seizure for an epileptic is highly unpredictable and can therefore lead to dangerous situations for the patient. This in turn can lead to the patient being restricted in his everyday life, like not being allowed to drive or having to avoid situations in which the event of an attack would be dangerous. According to Acharya et al. (2010) an epileptic person are also two to three times more likely to die prematurely than a person without epilepsy. Hence the study of understanding epilepsy is very important.

However seizures are not always due to epilepsy, but can occur as a result of other causes such as low blood sugar, low oxygen, abnormal sodium, calcium, and potassium (Acharya et al., 2010). These seizure events are not related to epilepsy and differentiating them from epileptic seizures is hard.

2.2 EEG based diagnostics Since epilepsy is due to an abnormal brain activity analyzing the patterns of EEG signals has proven a very useful method for detecting epilepsy due to EEG signals being a direct reflection of the electrophysiological conditions of the brain at a given time (Acharya et al., 2010). EEG uses electrodes to directly read the electric activity in the cerebral cortex (Acharya et al., 2013), the brain’s outer layer, through electrodes directly placed on the scalp (see Figure 1). This procedure results in a data set representing the brain’s activity at a given time. EEG data has been used in several forms of research where information of the patient’s current neurological condition is of use, such as epilepsy, sleeping disorders, dementia, anesthesia and Creutzfeldt–Jakob disease (Lima et al., 2010; Acharya et al., 2013). Moreover the understanding of EEG data has played an important role in the domain of brain computer

Page 9: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

interface which is research concerning communication­channels between brain and computer (Lima et al., 2010).

EEG recordings from an epileptic patient differ from recordings from a normal person and shows three types of abnormal activity not present at non­epileptic patients, pre­ictal activity (signals recorded just before an epileptic seizure), interictal activity (signals recorded between two epileptic seizures) and ictal activity (signals recorded during an epileptic seizure) (Acharya et al., 2013). To diagnose a patient with epilepsy it is common to perform extensive EEG monitoring of the patient with a neurophysiologist visually looking through the recordings for ictal and interictal activity. However this visual inspection is very time consuming and since it is a highly subjective process it is also common for two experts to come to different conclusions looking at the same recording (Tzallas et al. 2012). For these reasons an automated method for identifying ictal and interictal activity in EEG recordings would be a very useful tool for detecting and diagnosing epilepsy.

2.3 Methods for detecting Epileptic seizure activity in EEG Research done on the techniques for automating the process of detecting epilepsy in EEG recordings has mainly concerned the two­class problem of detecting epilepsy by classifying the ictal stage and normal stage of the EEG while some studies has focused on the three­class problem of detecting the normal, pre­ictal/interictal and ictal stages. Tzallas et al. (2013) wrote a literature review on methods developed for epileptic seizure detection and subdivides all methods into two main stages: FE and classification.

Page 10: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

2.3.1 Feature Extraction Methods FE entails finding a number of properties of the signal, for example frequency or wavelength etc., to describe the signal in a different way in order to make the classification step easier. This selection of discriminative features is the basis of almost all methods for epileptic seizure detection (Tzallas et al., 2013). Some authors has approached the problem of FE by looking at the specific physical phenomena that needs to be detected. Gotman (1999) referred to the fact that during an epileptic seizure many neurons fire synchronously and features should therefore be based on a measurement of this synchronicity. Other authors choose features based on the fact that epileptic seizures often are visible in EEG recordings as rhythmic discharges or multiple spikes. According to Tzallas et al. (2013) features based on fourier transform and wavelet transform have been used to measure these rhythmic discharges. They also state that other FE­methods used for epilepsy detection have extracted features that do not have any relation to the physiological characteristics of epileptic activity such as statistical features, features based on principal components analysis (PCA), independent component analysis (ICA), eigenvector methods and entropy based methods. There are three different general categories when it comes to the FE step in the automation process in which all methods can be placed.

2.3.1.1 Time Domain Methods falling under this category are based on the time as its axis when choosing their features. The important methods for time domain analysis are linear analysis and component analysis (Acharya et al., 2013). Using methods in the time domain one can find features such as frequency and wavelength of the recordings. One time domain method that is investigated further in this report is Empirical Mode Decomposition (EMD) which has been specified by (Li et al., 2013). This method splits the data into several Intrinsic Mode Functions (IMF) and extracts the fluctuation and variation of these functions as features. It has proven to be a successful signal processing method in several different areas and is, compared to other methods, intuitive and direct (Li et al., 2013). This method is described further below, under the method section (3.2.1). Another time domain method that will be examined further in this report is the Hjorth parameters. Hjorth parameters is a set of three parameters that together describes any given signal proposed by Bo Hjorth (1970). The three parameters are called Activity, Mobility and Complexity and are all based on the variance of the signal. These parameters are very easy to implement and fast to calculate. This method is described further under the method section (3.2.2).

2.3.1.2 Time-Frequency Domain Time­frequency domain FE­methods are methods that aim to describe a signal based on its frequency properties rather than time (Acharya et al., 2013). Methods in this category usually starts with transforming the signal from a function of time to a function of frequency (see

Page 11: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Figure 2) usually using Fourier transform (FT) or wavelet transform (WT). Then features are extracted from this frequency domain function. Subasi & Gursoy (2010) used the WT transform and then calculated parameters using PCA, ICA and linear discriminant analysis (LDA) as their method of choice for FE. These parameters were then used together with an SVM to classify epileptic activity resulting in a classification accuracy of 98.75% for the PCA parameters, 99.50% for the ICA parameters and 100% for the LDA parameters. In this report a WT based method is investigated which uses a multilevel wavelet transform that transform the signal into several subcomponent signals and then calculate three parameters from each subcomponent. This method will be explained further under the method section (3.2.4). The report also investigates the performance of Welch’s method which is a FT based method for FE. Welch’s method is one of the most popular methods for calculating power spectra of any time sequence (Faust et al., 2008). The method is further described under the method section (3.2.3).

Page 12: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

2.3.1.3 Nonlinear Methods According to Acharya et al. (2013) the functioning of the brain on a microscopic level i.e. the interplay of neurons is extremely non­linear and therefore suggest that non­linear methods may better suit to when extracting features. Several non­linear methods has been used for detecting epileptic seizures, these are Higher Order Spectra, Correlation Dimension, entropies like Approximate Entropy (ApEn) and Sample Entropy, Largest Lyapunov Exponent, Fractal Dimension, Hurst Exponent (H), and Recurrence Quantification Analysis (Acharya et al., 2013). In this report ApEn is one of the tested FE­methods. ApEn is a statistical method that describes the regularity of a signal by measuring how well the its value at any point in time can be predicted using a small window of of data points just before that time (Acharya et al. 2013). It is known that the ApEn value is much lower during an epileptic seizure (Srinivasan et al., 2007) making it appropriate as a FE­method. According to Srinivasan et al. (2007) it has also been shown that an accuracy of 100% can be achieved using this method, with an

Page 13: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Artificial Neural Network (ANN) as the classifier. ApEn is further described under the method section (3.2.5). This report also explores the performance of H as this has been used in several reports (Yuan et al., 2011; Acharya et al., 2012) yielding very good accuracy when used in combination with other methods. H is a value that can be calculated which represents the predictability of a series (Qian & Rasheed, 2004). As it seems to have rarely been used as a standalone method, it should be an interesting method to explore further. This method is more thoroughly described under the method section (3.2.6)

2.3.2 Classification The second step of the automation process is the classification step where the extracted features of the given signal is classified to belong to one specific type of brain signal (normal, ictal, pre­ictal or interictal). As with methods used for the FE step there are many different methods that have been used for classifying epileptic EEG signals. According to the literature review by Tzallas et al. (2012) the classification methods used for epileptic seizure detection varies from simple methods like thresholding, ruled based decisions and linear classifiers to much more sophisticated methods like ANN, SVM and K­Nearest Neighbour classifiers.

2.3.2.1 Support Vector Machine According to Burges (1998) SVM is a common method used in different pattern recognitions applications such as handwritten digit recognition, speaker recognition and object recognition and has in these cases proven to perform on par with or better than competing methods with respect to generalization (generalization here refers to the ability to perform well on new unseen data after being trained). Given two sets of training data (in our case the feature set from normal and ictal signals) the SVM creates a hyperplane in feature­space that separates the two classes. Since this hyperplane often can be created successfully in several ways the SVM aims to create a hyperplane with as large margin as possible to the nearest point of both classes (Burges, 1998) (See Figure 3).

Page 14: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

However this separation is only possible if the two classes are linearly separable. If the data is not linearly separable. i.e. there is no hyperplane that separates the two classes without error points in the data (error point refers to a data point that falls on the wrong side of the hyperplane). In this case one wants to separate the two classes with the least number of errors. In order to achieve this Cortez & Vapnik (1995) formalized the soft­margin hyperplane that first creates a hyperplane with as few errors as possible. The error points are then removed from the training set so that a separation without errors is possible and then a new optimal hyperplane is constructed. Having defined this hyperplane it is then easy to classify unknown data by checking on which side of the hyperplane it is. Due to the high generalization performance of SVM:s and its ability to perform well on high dimensional data the SVM will be the classification method we use in this report.

2.4 State of the Art Reports on automation methods developed for detecting epileptic activity in EEG signals are plenty and using many different combinations of methods for FE and classification. Concerning the binary classification problem of detecting normal and ictal activity the review done by Acharya et al. (2013) shows that several reports have present results of classification accuracies above 95%. Srinivasan et al. (2005) were able to distinguish ictal and normal activity with 99.6% using a collection of both time­ and frequency­domain methods for FE and an Elman network for classification. Guo et al. (2010) used a combination of DWT and ApEn for FE and ANN for classification resulting in an accuracy of 99.85%. Subasi & Gursoy (2010) used DWT together with linear discriminant analysis for FE and SVM for classification and got a 100% accuracy rate.

Page 15: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

3. Method

3.1 Data Set Description The data set which has been used is the Bonn University EEG Database (Andrzejak et al., 2001) which is divided into 5 different sets of EEG signals labeled A­E. Each set contains 100 EEG signals where each signal contains 4096 data points recorded over 23.6 seconds. Set A and B contain signals from five healthy persons during a relaxed state with eyes open (Set A) and eyes closed (Set B). Set C, D and E are signals from five patients diagnosed with epilepsy. Set C and D contain EEG activity from epileptic patients during seizure free intervals while Set E only contains data during seizures. When testing the performance of FE algorithms, set B (signals from normal brain activity) and set E (signals from ictal activity) where used as the focus of the report was to differentiate the ictal state from a normal state.

3.1.1 Data pre-processing Each of the 200 signals (100 signals of normal activity + 100 signals of ictal activity) were split into 31 signal windows consisting of 256 data points each with a 50 % overlap. Then the windows from 120 randomly chosen signals (60 signals + 60 signals) were used for training the SVM. The windows of the remaining 80 signals were split into 5 smaller sets containing the windows of 16 signals each (8 signals + 8 signals). These 5 smaller sets were used for testing to determine the overall performance of the selected algorithm.

3.2 Feature Extraction In order to find which the optimal features for a SVM is for identifying epilepsy, we looked up 6 successful FE­methods, not considering the classification technique used. These methods were then implemented in MATLAB. When the FE algorithms were implemented, they were used to extract their respective features for all data in the defined training set and testing set. The SVM was then trained and tested with the sets for each respective FE­method.

3.2.1 Empirical Mode Decomposition (EMD) This method splits the signal into a number of Intrinsic Mode Functions (IMF). A function is defined as an IMF if it satisfies two conditions:

1. The difference in the amount of extreme points and zero crossings cannot be greater than one.

2. The mean value of the envelopes, defined by the functions local maxima and local minima, should at any point be zero.

The process of calculating all the IMFs for the data is described by Li Shufang et al. (2013) and is done in several steps using the original data and a copy of the data :(t)x (t) (t)r = x

1. Get all the local maxima of the function and connect all the local maxima with a cubic spline line as the upper envelope max(t)e

Page 16: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

2. Do the same for the local minima as the lower envelope .min(t)e 3. Calculate the mean value of the envelope at every point .(t) emax(t) min(t))/2m = ( + e 4. Create a new curve using the difference between the original function and the mean

values . If does not satisfy the conditions for IMF, repeat 1­4 with(t) (t) (t)c = x −m (t)c the data .(t) (t)x = c

5. When satisfies the IMF conditions, add it as one of the IMFs for the function and(t)c let (t) (t) (t)r = r − c

6. End the process if is a monotonic function. Otherwise, go back to 1 with the data(t)r .(t) (t)x = r

After this process the method has given a number of IMFs like the graphs in Figure 4 from which the fluctuation indices can be extracted. The fluctuation index is defined as:iF

where is the amount of data points in the data set.iF = I1 ∑I

j=1IMF (j ) MF (j)| + 1 − I | I

This definition can in short be described as the average magnitude of the change in value from point to point in the function. As an ictal EEG generally will fluctuate more than a normal EEG, this will give a feature for which the ictal state data points and normal state data points should be separated and thereby classifiable.

Page 17: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

3.2.2 Hjorth Parameters Hjorth parameters is a set of descriptive parameters proposed by Bo Hjorth (1970) that are commonly used for FE of EEG­data (Oh et al., 2014). The set contains of three parameters, activity, mobility and complexity.

The activity parameter gives a measure of the square standard deviation (variance) of a signal and defined by the following function:

ctivity var(y(t))A =

Where y(t) is our EEG signal. This feature was then rescaled by dividing the activity feature for all signal windows by the minimum activity value.

The mobility parameter gives a measure of the mean frequency or the standard deviation of the slope with reference to the standard deviation of the amplitude and is defined by the function:

obility M =√ var(y(t))var(y(t) )dt

dy

The complexity parameter gives a measure of the signal’s change in frequency by comparing it to the softest possible curve shape, the sine wave. It is given by the function:

omplexityC = Mobility(y(t))Mobility(y(t) )dt

dy

Together these parameters can characterize an EEG signal in terms of amplitude, time scale and complexity (Hjorth, 1970).

3.2.3 Welch’s Method Welch’s method is a method that estimates the power spectrum of a series. The series is divided into segments that are allowed to overlap after which, a data window is applied to each segment. This will provide a set of modified periodograms. These periodograms are then averaged to give the Welch power spectrum(Faust et al., 2008). This is in this report implemented with 8 segments per EEG series where each segment overlapped 50 % of the next segment. Using Welch’s method gave a vector containing 129 features. The sum of the feature in all signal windows were then calculated to give a vector with a single feature for each signal window. The feature was then rescaled by dividing by the minimum value found in the feature vector.

Page 18: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

3.2.4 Discrete Wavelet Transform (DWT) The DWT transforms a signal into wavelet coefficients by correlating a wavelet (a small wave function) to the given signal. This is done by shifting the wavelet function along the time scale of the signal to obtain coefficients at all instances of time (Acharya et al., 2013). In this report the MATLAB standard implementation of multilevel 1­D wavelet decomposition were used with five decomposition levels and the Daubechies of order 4 (db4) as the wavelet function to extract the wavelet coefficients. The six feature vectors obtained from the wavelet decomposition was then reduced in dimensionality by extracting three parameters from each of the six feature vectors resulting in 18 extracted parameters describing the input signal. The three parameters used were:

1. Average of wavelet coefficients. 2. Standard deviation of wavelet coefficients. 3. Maximum of wavelet coefficients.

3.2.5 Approximate Entropy (ApEn) Approximate entropy (ApEn) is a method to measure the regularity of data by measuring the predictability of the current amplitude values of a signal based on its previous amplitude values (Srinivasan et al., 2007). The algorithm to determine the ApEn of a signal is shown in the following steps:

1. Let your signal containing of N data points be denoted by (1), u(2), ... , u(N).u 2. Form a sequence of vectors defined by(1), x(2), ..., (N ) in Rx x −m + 1 m

where m is the number of samples used for(i) (i), u(i ), ..., u(i )x = u + 1 +m − 1 prediction.

3. Let r represent the noise filter level that is defined as where SD is theDr = k × S standard deviation …….

4. Use the sequence defined in 2 to construct, for each i 1 ≤ i ≤ N −m + 1 (r) C im = N−m

∑N−m

j=1kj

where otherwise if maxk = 1 x(i) (j)| − x | ≤ r k = 0

5. Define (r)Φm = N−m

n(C (r))∑N−m

i=1l i

m

6. Then the approximate entropy is defined by: pEn (r) (r)A = Φm − Φ

m+1

3.2.6 Hurst Exponent (H) H is a measurement for statistical data and is a single value that represents the predictability of a series (Qian & Rasheed, 2004). The value of H is defined as: where is theH = log( )S

R

log(T) R difference between the cumulative maximum and minimum deviation from the mean value, S is the curve’s standard deviation and T is the duration of the data (Acharya et al., 2012). These are calculated in 5 steps (Qian & Rasheed, 2004):

Page 19: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

1. Calculate the mean of the data: , where is the original data and is the amount of data points in .(i)m = n

1 ∑n

i=1x x n x

2. Create a series adjusted around the mean of the data:y .(t) (t) , t , 2, ..., ny = x −m = 1

3. Calculate the cumulative series of the deviation:

(t) (i), t , 2, ..., nz = ∑t

i=1y = 1

4. Find the difference between the maximum and minimum value of for the entireR z series:

ax(z) in(z)R = m −m 5. Calculate the standard deviation of the whole series:S

S =√ (x(i) )n1 ∑n

i=1−m

After these steps, the values of R and S are used in the previously mentioned equation

using n as the value for T.H = log( )SR

log(T)

3.4 Results analysis

3.4.1 Accuracy, Sensitivity and Specificity The most important aspect of the implementations, when trying to identify seizures after they happened, is the classification accuracy. To represent the performance of the different techniques for FE, three different aspects of accuracy were measured: Sensitivity (TPR), specificity (SPC) accuracy (ACC). These are defined as: PRT = P

TP PCS = N

TN CCA = P+N

TP+TN Where TP is the amount of true positives, P is the amount of actual positives, TN is the amount of true negatives and N is the amount of actual negatives. P in this case represents the segments with ictal brain activity while N represents segments with normal activity. Thus, TPR is the percentage of ictal brain signals that are correctly identified and SPC is the percentage of normal signals that are correctly identified These aspects were calculated using the above formulas for each test using every FE­method for the SVM. This was easily done by having the data labelled before it was shuffled and tested, making it possible to know which of the SVM:s classification guesses were correct.

Page 20: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

3.4.2 Analysis of Variance One­way analysis of variance (one­way ANOVA) was used to test if there was a significant difference between the accuracy results of the different FE methods. The one­way ANOVA tests the null hypothesis that our measured classification accuracies are drawn from populations with the same mean value. The one­way ANOVA test calculates the variance of the accuracies obtained by each FE­method and the variance between the mean accuracy of each FE­method. The results of the ANOVA test is presented in an ANOVA Table (see Table 8) where the important result is the p­value. The p­value tells how possible it is that the measured accuracies of tested FE­methods all comes from the same population. A small p­value tells us this possibility is small and that there is a significant difference between the results of the methods. A high p­value (the limit is often set to be over 0.05) means that we can not reject the possibility that the results from the different FE­methods comes from the same population i.e. there is no significant difference between their results. Even if the p­value is small for the ANOVA test there is still a possibility that the results from one or several pairs of our tested FE­methods come from the same population. This means that even if we can say that all the tested methods results does not come from the same population there is still a possibility that two or more of our methods results does. To find out which of the tested FE­methods that really were significantly different a multiple comparison procedure were performed using Tukey’s honestly significant difference criterion. The result of this procedure is presented in a table with a p­value for each pair of FE­methods tested (see Table 9).

Page 21: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

4. Results Tables of results for each algorithm for each iteration of the method, average of each method in a separate table with comparison to other algorithms. Table 1: Results from 5 randomized tests using EMD with a linear SVM.

Empirical Mode Decomposition

ACC TPR SPC

Test 1 93.75% 92.34% 95.16%

Test 2 91.94% 89.52% 94.35%

Test 3 91.73% 89.92% 93.55%

Test 4 92.34% 91.53% 93.15%

Test 5 94.15% 92.74% 95.56%

Average 92.78% 91.21% 94.35%

Figure 5: Reflects the results in Table 1. Blue is ACC, red

is TPR and yellow is SPC. Table 2: Results from 5 randomized tests using Hjorth Parameters with a linear SVM.

Hjorth Parameters

ACC TPR SPC

Test 1 97.78% 98.39% 97.18%

Test 2 96.77% 95.16% 98.39%

Test 3 96.77% 97.58% 95.97%

Test 4 98.39% 98.39% 98.39%

Test 5 97.38% 97.18% 97.58%

Average 97.42% 97.34% 97.50%

Figure 6: Reflects the results in Table 2. Blue is ACC, red

is TPR and yellow is SPC.

Page 22: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Table 3: Results from 5 randomized tests using Welch’s Method with a linear SVM.

Welch's Method

ACC TPR SPC

Test 1 96.57% 95.56% 97.58%

Test 2 95.56% 93.55% 97.58%

Test 3 94.15% 92.74% 95.56%

Test 4 96.98% 95.97% 97.98%

Test 5 95.36% 94.76% 95.97%

Average 95.73% 94.52% 96.94%

Figure 7: Reflects the results in Table 3. Blue is ACC, red

is TPR and yellow is SPC. Table 4: Results from 5 randomized tests using DWT with a linear SVM.

Discrete Wavelet Transform

ACC TPR SPC

Test 1 99.19% 100.00% 98.39%

Test 2 99.60% 99.60% 99.60%

Test 3 98.59% 99.60% 97.58%

Test 4 97.98% 98.79% 97.18%

Test 5 98.79% 98.79% 98.79%

Average 98.83% 99.35% 98.31%

Figure 8: Reflects the results in Table 4. Blue is ACC, red

is TPR and yellow is SPC.

Page 23: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Table 5: Results from 5 randomized tests using ApEn feature with a linear SVM.

Approximate Entropy

ACC TPR SPC

Test 1 87.70% 87.50% 87.90%

Test 2 89.52% 89.11% 89.92%

Test 3 88.10% 89.92% 86.29%

Test 4 88.91% 87.50% 90.32%

Test 5 89.31% 91.13% 87.50%

Average 88.71% 89.03% 88.39%

Figure 9: Reflects the results in Table 5. Blue is ACC, red

is TPR and yellow is SPC. Table 6: Results from 5 randomized tests using Hurst Exponent with a linear SVM.

Hurst Exponent

ACC TPR SPC

Test 1 96.57% 97.18% 95.97%

Test 2 94.56% 92.34% 96.77%

Test 3 94.56% 93.55% 95.56%

Test 4 96.57% 95.97% 97.18%

Test 5 95.97% 95.97% 95.97%

Average 95.65% 95.00% 96.29%

Figure 10: Reflects the results in Table 6. Blue is ACC,

red is TPR and yellow is SPC.

Page 24: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Table 7: Compilation of the average accuracy, sensitivity and specificity for all the tested FE­methods.

Average Method Performance

Method ACC TPR SPC

Hjorth 97.42% 97.34% 97.50%

EMD 92.78% 91.21% 94.35%

Welch 95.73% 94.52% 96.94%

DWT 98.83% 99.35% 98.31%

H 95.65% 95.00% 96.29%

ApEn 88.71% 89.03% 88.39%

Figure 11: Reflects the results in Table 7. Blue is

ACC, red is TPR and yellow is SPC. Table 8: ANOVA Table displaying the results of the ANOVA test performed on the methods accuracy results .

ANOVA Table

Source SS df MS F p­value (Prob > F)

Columns 0.03291 5 0.00658 79.91 3.67E­14

Error 0.00198 24 0.00008

Total 0.03489 29

Page 25: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Table 9: Results from post­hoc ANOVA multiple comparison procedure. The p­value shows the possibility of accuracy means from a pair of methods are from the same population.

Multiple Comparison Method 1 Method 2 p­value

Hjorth EMD 0.0000

Hjorth Welch 0.0675

Hjorth DWT 0.1765

Hjorth Hurst 0.0501

Hjorth ApEn 0.0000

EMD Welch 0.0004

EMD DWT 0.0000

EMD Hurst 0.0005

EMD ApEn 0.0000

Welch DWT 0.0002

Welch Hurst 1.0000

Welch ApEn 0.0000

DWT Hurst 0.0001

DWT ApEn 0.0000

Hurst ApEn 0.0000

Page 26: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

5. Discussion The results show that the DWT features resulted in the highest performance concerning all three measures, ACC, SPC and TPR but that the differences between methods for FE used in this report perform on a relatively equal level. Concerning the relationship between TPR and SPC for each method, the results show that all of the tested FE­methods perform equally well on TPR and SPC, not performing much better on one of the categories. The ANOVA test show that the p­value of our results is very small and thus the results from the different methods are significantly different. This means that we are confident in saying that the tested methods results does not come from the same population. However it stills leaves the possibility that the results of one or several pairs of methods still come from the same population. And this gets obvious after the multiple comparison procedure. From the results (see Table 9) we see that the results of the two best performing performing methods, DWT and Hjorth, gives a p­value of 0.1765 which means that their results is not significantly different and therefore we can not say with certainty that one of the methods is better than the other. However the results of the DWT method is significantly different from the other four methods Welch, Hurst, Emd and ApEn making it the better method to use with an SVM according to our tests. Looking at Table 7 and 9, one can see that none of the method domains were very consistent when compared to each other. The time­frequency domain methods showed the most consistency in performance with only a difference of 3.2% in ACC between the methods. However, the multiple comparison showed that all methods were significantly different compared to the other method in the same domain. In each case where the ANOVA test showed that a pair was not significantly different, the two methods in the pair were from different domains. This shows that no specific category of methods for FE performs significantly better than the others overall. The performance of the nonlinear methods seem to vary more than the other domains. The nonlinear method H proves to have a performance almost identical to the method with the third best ACC, Welch’s method. Furthermore, it does not show a significant difference in the ANOVA test compared to Hjorth that has the second best performance. However, the worst performing method is the nonlinear ApEn. In Table 9 we see that the result of ApEn is significantly differen to all other methods, conclusively confirming that it performs worse than the others when paired with a linear SVM. Because we found no pattern or type of feature that definitely gives better classification, further research in the matter should be conducted. Many more FE­methods need to be tested to see if there is a pattern. The dataset used can be considered small so in order to validate the results of this report, and to get a better measure of the different methods

Page 27: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

performance further testing should also be done using a considerably larger dataset. The fact that the EEG data used from normal activity was recorded from persons in a relaxed state with their eyes closed gives rise to the question how these methods would perform if the testing data included EEG recordings taken from a person during everyday activities. This would be an interesting test to get an even better understanding of how the different methods perform.

6. Conclusions We found no FE­method that conclusively resulted in the most accurate classification. While DWT showed the highest accuracy, the difference was not statistically significant compared to Hjorth, however the DWT:s accuracy was significantly better than the other four methods making it a good choice for FE­method together with an SVM.

Page 28: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

7. References Acharya, U. R., Sree, S. V., Ang, P. C. A., Yanti, R., & Suri, J. S. (2012). Application of non­linear and wavelet based features for the automated identification of epileptic EEG signals. International journal of neural systems,22(02). Acharya, U. R., Sree, S. V., Swapna, G., Martis, R. J., & Suri, J. S. (2013). Automated EEG analysis of epilepsy: a review. Knowledge­Based Systems, 45, 147­165. Andrzejak, R. G., Lehnertz, K., Mormann, F., Rieke, C., David, P., & Elger, C. E. (2001). Indications of nonlinear deterministic and finite­dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state. Physical Review E, 64(6), 061907. Burges, C. J. (1998). A tutorial on support vector machines for pattern recognition. Data mining and knowledge discovery, 2(2), 121­167. Cortes, C., & Vapnik, V. (1995). Support­vector networks. Machine learning, 20(3), 273­297. Faust, O., Acharya, R. U., Allen, A. R., & Lin, C. M. (2008). Analysis of EEG signals during epileptic and alcoholic states using AR modeling techniques.IRBM, 29(1), 44­52. Gotman, J. (1999). Automatic detection of seizures and spikes. Journal of Clinical Neurophysiology, 16(2), 130­140. Guo, L., Rivero, D., Dorado, J., Munteanu, C. R., & Pazos, A. (2011). Automatic feature extraction using genetic programming: An application to epileptic EEG classification. Expert Systems with Applications, 38(8), 10425­10436. Guo, L., Rivero, D., Dorado, J., Rabunal, J. R., & Pazos, A. (2010). Automatic epileptic seizure detection in EEGs based on line length feature and artificial neural networks. Journal of neuroscience methods, 191(1), 101­109. Guo, L., Rivero, D., & Pazos, A. (2010). Epileptic seizure detection using multiwavelet transform based approximate entropy and artificial neural networks. Journal of neuroscience methods, 193(1), 156­163. Hjorth, B. (1970). EEG analysis based on time domain properties. Electroencephalography and clinical neurophysiology, 29(3), 306­310. Li, S., Zhou, W., Yuan, Q., Geng, S., & Cai, D. (2013). Feature extraction and recognition of ictal EEG using EMD and SVM. Computers in biology and medicine, 43(7), 807­816. Lima, C. A., Coelho, A. L., & Eisencraft, M. (2010). Tackling EEG signal classification with least squares support vector machines: a sensitivity analysis study. Computers in biology and medicine, 40(8), 705­714. Oh, S. H., Lee, Y. R., & Kim, H. N. (2014). A Novel EEG Feature Extraction Method Using Hjorth Parameter. International Journal of Electronics and Electrical Engineering, 2(2), 106­110.

Page 29: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

Orhan, U., Hekim, M., & Ozer, M. (2011). EEG signals classification using the K­means clustering and a multilayer perceptron neural network model. Expert Systems with Applications, 38(10), 13475­13481. Panayiotopoulos, C. P. (2010). Benign childhood focal seizures and related epileptic syndromes. In A clinical guide to epileptic syndromes and their treatment (pp. 339­375). Springer London. Qian, B., & Rasheed, K. (2004, November). Hurst exponent and financial market predictability. In Proceedings of The 2nd IASTED international conference on financial engineering and applications (pp. 203­209). Srinivasan, V., Eswaran, C., & Sriraam, A. N. (2005). Artificial neural network based epileptic detection using time­domain and frequency­domain features. Journal of Medical Systems, 29(6), 647­660. Srinivasan, V., Eswaran, C., & Sriraam, N. (2007). Approximate entropy­based epileptic EEG detection using artificial neural networks. Information Technology in Biomedicine, IEEE Transactions on, 11(3), 288­295. Subasi, A., & Gursoy, M. I. (2010). EEG signal classification using PCA, ICA, LDA and support vector machines. Expert Systems with Applications, 37(12), 8659­8666. Thurman, D. J., Beghi, E., Begley, C. E., Berg, A. T., Buchhalter, J. R., Ding, D., ... & Wiebe, S. (2011). Standards for epidemiologic studies and surveillance of epilepsy. Epilepsia, 52(s7), 2­26. Tzallas, A. T., Tsalikakis, D. G., Karvounis, E. C., Astrakas, L., Tzaphlidou, M., Tsipouras, M. G., & Konitsiotis, S. (2012). Automated epileptic seizure detection methods: a review study. INTECH Open Access Publisher. Übeyli, E. D. (2010). Least squares support vector machine employing model­based methods coefficients for analysis of EEG signals. Expert Systems with Applications, 37(1), 233­239. Wang, D., Miao, D., & Xie, C. (2011). Best basis­based wavelet packet entropy feature extraction and hierarchical EEG classification for epileptic detection.Expert Systems with Applications, 38(11), 14314­14320. Yuan, Q., Zhou, W., Li, S., & Cai, D. (2011). Epileptic EEG classification based on extreme learning machine and nonlinear features. Epilepsy research, 96(1), 29­38.

Page 30: Detecting Epileptic Seizures811913/FULLTEXT02.pdf · Referat Epilepsi är en kronisk, neurologisk hjärnstörning som orsakar anfall för den utsatte. En expert kan, genom att titta

www.kth.se