Automated Epileptic Seizure Detection in Scalp EEG Based on Spatial-Temporal Complexity

Epilepsy is a group of neurological disorders characterized by epileptic seizures, wherein electroencephalogram (EEG) is one of the most common technologies used to diagnose, monitor, and manage patients with epilepsy. A large number of EEGs have been recorded in clinical applications, which leads to visual inspection of huge volumes of EEG not routinely possible. Hence, automated detection of epileptic seizure has become a goal of many researchers for a long time. A novel method is therefore proposed to construct a patient-specific detector based on spatial-temporal complexity analysis, involving two commonly used entropy-based complexity analysis methods, which are permutation entropy (PE) and sample entropy (SE). The performance of spatial-temporal complexity method is evaluated on a shared dataset. Results suggest that the proposed epilepsy detectors achieve promising performance: the average sensitivities of PE and SE in 23 patients are 99% and 96.6%, respectively. Moreover, both methods can accurately recognize almost all the seizure-free EEG.The proposed method not only obtains a high accuracy rate but also meets the real-time requirements for its application on seizure detection, which suggests that the proposed method has the potential of detecting epileptic seizures in real time.


Introduction
Epilepsy affects more than 50 million individuals worldwide [1] and is characterized by the spontaneous and unforeseeable occurrence of seizures [2], which may result in a general convulsion or a lack of attention.Frequent seizures bring individual's risk of continuing physical injuries and may even lead to death.Electroencephalography (EEG) is an effective and noninvasive technique for directly recording the brain electrical activity and diagnosing clinical brain diseases [3].Abnormal epileptic waveforms appear in EEG signal during the epileptic seizure phase.For epilepsy patients, long-term EEG recording lasting several days is usually applied to localizing the epileptogenic foci in clinic.As a result, a large number of EEG data are recorded and then visually inspected by physicians for identifying seizure information in epilepsy patients.However, visual inspection of long EEG recordings by neurologists is a very cumbersome, time-consuming, costly work, especially considering a large number of epilepsy patients.Furthermore, routine visual assessment of EEG is not a very objective process.Therefore, there is a great need for detection of epilepsy seizures automatically in order to reduce diagnosis time drastically.
It is well known that brain is a chaotic dynamical system and the brain data tend to exhibit complex fluctuations that contain information about the underlying dynamics [4,5].Therefore, nonlinear analysis could better facilitate revealing the mechanisms and characteristics of EEG.It has been found that the EEG from the location of epileptic foci owes strong indications of nonlinear determinism, while that from other zones exhibits linear stochastic dynamics [6], suggesting that nonlinear analysis of EEG in epilepsy may provide useful information for seizure detection.With the rapid development of nonlinearity theory, information entropy analysis is becoming a predominant field to study nonlinear dynamics of EEG signal.One big advantage is that 2 Complexity it only needs hundreds of points to describe the entire system, compared with other nonlinear algorithms such as Lyapunov exponent which usually requires more than thousands of data points to obtain correct results [7].
Entropy represents the predictability (irregularity) of systems in information theory.Lower values of entropy always relate to less randomness and larger system order.Thus, many complexity concepts are related to entropy.Recently, entropybased complexity methods have been used to analyze epileptic EEG data.Approximate entropy (ApEn) was first used to study normal and epileptic EEG data in [8].A modified algorithm of ApEn, called sample entropy (SampEn), was then introduced for automatic epileptic seizure detection in EEG recordings [9].Generally, ApEn is inherently biased because of incorrectly counting self-matches, while the calculation of SampEn overcomes this limitation, resulting in better performance in detecting seizures [10].However, both these two algorithms are based on the amplitude of EEG data, which leads them to be vulnerable to the selection of reference electrode and the artifacts in EEG data [11].Li et al. used another order pattern based entropy method (called permutation entropy, PE) as an indicator to predict the epileptic seizures in genetic absence epilepsy rats, and the results showed that PE can successfully detect preseizure phase in 169 of 314 seizures (54%), which was higher than SE (21%) in [12].Permutation entropy was also applied to analyzing EEG data in patients with epilepsy, which demonstrated that the EEG during the seizure-free phase is characterized by a higher value of permutation entropy than the EEG during the seizure phase [13,14].
Though the entropy-based complexity methods have shown promising results on detection of epileptic seizures [3,12,15,16], it is still an open problem how to bring out the full potential of complexity to enhance the reliability and accuracy of EEG analysis.Meanwhile, some methods only have promising results for selected patients with seizure of single type (such as temporal lobe seizure); the reproducibility and reliability of the results have been questioned when being tested on other patients with numerous seizure types [17].Furthermore, the characteristics of EEG vary significantly across patients.And this cross-patient variability in seizure and nonseizure activity causes patient nonspecific classifiers to exhibit poor accuracy or long delays in declaring the onset of a seizure.To overcome these problems, in this study, a generalized spatial-temporal complexity method is proposed to develop a high-performance patient-specific seizure detector.In our detector, the potential reason of high accuracy is a completely automated process for constructing a feature vector that unifies in a single feature space with the spatial properties of the electrical activity and time evolution of complexity in brain.Previous patient-specific methods classified spatial and temporal features separately and required a skilled individual in interpreting the brain electrical activity to specify how such features should be integrated [18,19].
In his study, both PE and SE are adopted to implement the proposed spatial-temporal complexity detector.To validate the performance of the proposed method, a shared dataset from CHB-MIT is used [20].Results show that the proposed epilepsy detectors achieve promising performance: the average sensitivities of PE and SE in 23 patients are 99% and 96.6%, respectively.Moreover, both the PE and SE-based detector can accurately recognize almost all the seizure-free EEG.As the proposed seizure detection method not only obtains high accuracy rate but also has a very fast computational speed, this suggests its huge potential on detecting epileptic seizures in real time.

EEG Datasets.
In this paper, the performance of our proposed method was tested on a shared dataset, which has been widely used during the past few years.The EEG dataset was recorded from pediatric subjects with intractable seizures at Children's Hospital Boston.This database contains 22 subjects (17 females, ages 1.5-19; 5 males, ages [3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22] and can be downloaded from the PhysioNet website: http://www .physionet.org/pn6/chbmit/.The International 10-20 system of EEG electrode positions and nomenclature was used to collect these EEG recordings.All signals were sampled at 256 samples per second with 16-bit resolution and filtered within a frequency band from 0.5 Hz to 25 Hz.To characterize their seizures, patients were monitored for up to several days after the suspension of antiseizure medication.More details about the dataset can be found from [20]. Generally, seizure detection can be translated into a binary classification problem: ictal (the seizure phase) and interictal EEG (the seizure-free phase), in spite of the fact that the underlying physiological activity is multiclass.This is because it is neither easy nor practical for an expert to identify and label the subclasses of the seizure and seizurefree phases.In addition, dividing an EEG recording into two encompassing classes, seizure-free and seizure, is also consistent with standard clinical practices.In this database, EEG signal has been marked as "seizure" by experts in all channels from seizure start to end; EEG recordings out of the period of "seizure" were considered as "seizure-free." In this shared dataset, epilepsy patients were monitored for up to several days, resulting in that each patient contains between 9 and 42 continuous EDF files (also called records).In most cases, the record contains exactly one hour of digitized EEG data, except for a few records that contain two-or four-hour EEG data.Only the records containing at least a seizure (called seizure records) are used to train or validate the performance of our seizure detector.For each seizure record in a single subject, 300 interictal EEG epochs (4 seconds) are randomly selected from the seizure-free phase and 3 ictal EEG epochs (4 seconds) are randomly selected from the seizure phase.Why much more interictal EEG epochs are chosen is because seizure is a rare event relative to seizure-free event.In addition, only the first 20-second EEG of seizures are considered in this study, since this period is more clinically meaningful.Previous work demonstrated that artifact removal before seizure detection can improve the classification accuracy [21], while this work would not do any preprocessing to show the robustness of the proposed detector.].There will be !possible order patterns  (also known as motifs) for  different numbers.As shown in Figure 1, there are 6 different motifs for  = 3, which include "slopes," "peaks," and "troughs."When (  ) denotes the frequency of occurrence for motif   in the time series, the relative frequency is thus (  ) = (  )/( − ( − 1)).The permutation entropy is defined as In practical use, PE is often normalized by PE/log 2 (!).The smallest value of PE is 0, which means that the time series is absolutely regular; the largest value of PE is 1, which means the time series is completely random.In other words, the smaller the PE is, the more regular the time series is.In the calculation of PE, only considering the ordinal patterns, the PE value is thus irrelevant to the amplitude of time series, meaning less sensitive to noise embedded in time series.In the EEG application, PE should be extracted from a reasonably short time epoch as EEG is nonstationary.However, EEG cannot be segmented into very short physiologically relevant units.For the sake of compromise, two-second long epoch is used in this study.
The calculation of PE depends on two parameters: embedding dimension () and time lag ().In general, a too small  will lead few possible motifs and thus a low sensitivity.On the other hand, there will be a high biased entropy when  is too high, since every motif will occur just a few times.In all, it was shown that the choice of  depends on the length of data (), with ! ≪ .As the length of each epoch is just 512 points (2 seconds),  = 3 is appropriate for this study.As for the time lag , the choice is critical for the frequency behavior of the signal.As some high frequency components will be discarded for  > 2,  = 1 is adopted in this study.
Following the onset of most seizure, brain dynamics develop rhythmic activity that is typically slow and monotonous, which means that ictal EEG is more regular than interictal EEG.As illustrated in Figure 2, the black curve in Figure 2(c) represents the time evolution of the PE values of FP1-F3 channel (Figure 2(b)), which was involved in a seizure and selected from a multichannel EEG recording in Patient I (Figure 2(a)).From Figure 2(b), it can be found that EEG wave following a seizure (onset at 2589 s) is slow and regular than the preceding EEG.And the corresponding PE values in the seizure phase are lower than those in seizure-free phase.

Sample Entropy.
Sample entropy (SE), a modification of approximate entropy (AE), is usually used to assess the complexity of physiological signals [10].SE has two advantages over AE: data length independence and a relative trouble-free implementation.For a given embedding dimension , time lag , and tolerance , SE is the negative logarithm of the probability that if two sets of simultaneous data points of length  have distance <  then two sets of simultaneous data points of length  + 1 also have distance < .
Given a time series (  ,  = 1, 2, . . ., ), we can construct delay vectors (, ) = [  ,  + , . . .,  +(−1) ] at time  with embedding dimension, , and time lag, .If the distance between two vectors is defined as ((, ), (,   )), the number of vector pairs in delay vectors of length ,  + 1 having ((, ), (,   )) <  is counted and denoted by  and , respectively.The sample entropy can be defined as It should be noted that A always has a value smaller or equal to B, meaning that SE is always either zero or a positive value.A small value of SE also indicates more self-similarity and regularity in the dataset.In general,  = 0.2 * std () is most common used and offers very good performances [9,11].To keep consistency with PE,  = 3 and  = 1 are set for SE.

Spatial Features.
The identity of the EEG channels involved in seizure can further differentiate seizure EEG from seizure-free EEG.This is because seizure types in this database belong to partial seizure or focal onset seizure (such as temporal lobe seizure), which has a focal origin.Hence, only a set of EEG channels develop rhythmic activity after the seizure onset.Moreover, the identity of the EEG channel involved and the structure of the rhythmic activity differ across individuals.For example, Figures 2 and 3 illustrate seizures from different patients.Patients I's seizure in Figure 2 begins at the 2589th second and is characterized by the appearance of rhythmic activity most prominent on the channels FP1-F3.Patients II's seizure in Figure 3 begins at the 1015th second and rhythmic activity develops most prominently on channels P8-O2 and FT9-FT10 with the increase in amplitude and decrease in frequency.
In spite of the fact that seizures vary across individuals, the seizures of any given individual exhibit considerable consistency, provided that they emerge from the same brain region.Figure 4 illustrates another seizure from Patient I.It should be noted that the spatial and rhythm character of this seizure is similar to the seizure shown in Figure 2. To automatically capture the spatial complexity information contained within each two-second EEG epoch at time  = , permutation entropies were extracted from each  = 23.EEG channels are concatenated, forming a feature vector   with  elements as shown in the middle portion of Figure 5.

Time Evolution.
Though the spatial complexity feature   can capture the dynamics of multichannel EEG adequately, it is still unable to explore how an epoch relates to those in the recent past, as the extraction of   is only based on the current epoch.Hence,   cannot reflect how a seizure emerges from background EEG nor how it evolves.In order to extract such evolution information, a stacked feature vector H  , called spatial-temporal complexity, is constructed by concatenating the spatial features from  nonoverlapping consecutive 2-second epochs, as shown on the right side of Figure 5.
It should be noted that encoding the temporal evolution of EEG as H  is not equal to forming a single feature vector   from a longer epoch.This is because the former preserves the discrete events, while the latter smears the complexity signatures of those events.In general, when an EEG abnormality is considered as a seizure, it should persist and evolve for at least 4-10 seconds.To incorporate this domain knowledge,  is set as 2 in this study so that the classifier considers the evolution of feature vectors over 4 seconds.

Classification.
To evaluate the detectability of the proposed spatial-temporal complexity, discriminant analysis (DA) [23] is used to classify a feature vector into the representative of seizure or seizure-free activity.DA performs classification by minimizing the within-class covariance and simultaneously maximizing the between-class covariance.There are two reasons why we choose DA in this work: (1) DA has preferable performance than other classifiers (such as decision tree and support vector machine) in seizure detection [3,15]; (2) DA is a nonparameter classification method, which is very convenient for clinicians to build the basis for patient-specific detection.In addition, quadratic discriminant analysis (QDA) is used to distinguish between seizure and seizure-free phases in this work, as QDA has more predictability power than linear discriminant analysis (LDA).
To estimate the classification performance for a patient, a leave-one-out cross-validation scheme is adopted; we considered to evaluate the performance based on leaving out hour-long records rather than second-long epochs, as the latter would cause misleadingly good results by including the features of training data close to temporal proximity to those in the test data.Let   (median   = 5) denote the number of seizure records.We train the detector on the epochs selected from   − 1 seizure records, and then the detector is tested in the remaining seizure record.This process is repeated   times so that each seizure record is tested.The average values of performance measures (such as sensitivity and specificity) over the   folds are taken as the final estimates of the classifier performance.In this study, the sensitivity and specificity are defined as the proportion of ictal EEG and interictal EEG that are correctly identified, respectively.

Characteristics of Seizure EEG.
To investigate the characteristics of EEG with seizure, we firstly compare the complexity of seizure EEG and seizure-free EEG.As different patients in this dataset may have different seizure types, only the channel where the rhythmic activity develops most prominently is considered for each patient in this part.The distribution of PE and SE of seizure-free and seizure EEG for all 23 patients is illustrated in Figure 6.It can be found that the PE values of seizure EEG (0.57 ± 0.036) are much lower than those of seizure-free EEG (0.62 ± 0.03), and the SE values of seizure EEG (0.35 ± 0.1) are also much lower than those of seizure-free EEG (0.46±0.11).To investigate whether their distributions are significantly different, the paired test is then performed.And the result shows that both the differences of PE ((22) = 9.66,  < 0.001) and SE ((22) = 7.73,  < 0.001) are significant, which means that the complexity of seizure EEG is significantly lower than that of seizure-free EEG.Epileptogenic processes are hypothesized to result from an abnormal hypersynchronization of the electrical activity of different zones in the brain.In the underlying complex network, a "critical" node associated with a "critical area" (i.e., the epileptogenic zone) starts a recruitment procedure of other areas until the brain triggers the seizure in order to reset this unbearable condition [24].The neuronal hypersynchronization is expected to affect the complexity of the EEG signal itself: indeed, an excess of synchronization of the nodes of the underlying complex network may also anticipate a substantial complexity's reduction of the EEG signal.Together with our findings, complexity of scalp EEG can be used as an indicator to monitor the dynamics of brain state.very small as there are 900 interictal EEG (300 * 3, 3 seizure records in patient 17).

Discussion and Conclusion
Epileptic seizures involve most of the cerebral cortex, and the dynamic mechanism of the transition from the seizure-free phase to the seizure phase is highly complicated.Moreover, for different patients and different seizure onset, the involved cortical areas and the time course in the seizure transition are different.Therefore, an efficient and robust seizure detection method which is able to distinguish between seizure-free EEGs and seizure EEGs in a fast and precise way is highly desirable [9].In this paper, a novel method for automatic detection of epileptic seizure is proposed based on the spatialtemporal complexity of scalp EEG.As the proposed feature Complexity can take full advantage of spatial information to represent different seizures, it can be directly used to construct patientsspecific detectors.The results show that our proposed detector can accurately identify 88.9% seizure EEG at least for a single patient and almost all the seizure-free EEG.
Although both the PE and SE-based spatial-temporal complexity methods have exciting performance in seizure detection, the detectability of PE still outperforms that of SE.PE is associated with the order structure of vectors in a phase space while SE is based on the similarity of vectors in a phase space, which means that PE is less sensitive to noise embedded in EEG recordings [25].Furthermore, the advantage of PE is that it can be applied to clinical realtime online monitoring of epileptic seizures because of its simple implementation and fast computation.Therefore, the high identification performance and the low computational cost make it possible to build a real-time detection system of epileptic seizures on the basis of the spatial-temporal PE method.

Figure 2 :
Figure 2: (a) The continuous multichannel EEG recording (23 channels) with a seizure in Patient I. (b) The EEG channel FP1-F3 involved in seizure activity.(c) Time evolution of the values of PE for FP1-F3 channel.The length of window is 1 s, and the step is 1/8 s.Almost all of the PE values in seizure state are lower than those in seizure-free state.

Figure 3 :Figure 4 :
Figure 3: The continuous scalp EEG recordings with a seizure in Patient II.The EEG channels (P8-O2, FT9-FT10) involved in a seizure were marked as red.

Figure 5 :
Figure 5: The extraction process of spatial-temporal permutation entropy.

Figure 6 :
Figure 6: Boxplot of permutation entropy (a) and sample entropy (b) for interictal and ictal EEG on all the 23 patients.On each box, the central mark is the median, the edges of the box are the 25th and 75th percentiles, and the plus signs represent outliers which are more than 1.5 times the interquartile range.

Figure 8 :
Figure 8: Specificity of our patient-specific detector.