1 Introduction

EEG clearly sketches working of brain and contains valuable information relating to the neuro-physiological state of the patient. It is a non invasive technique that can be used extensively for the diagnosis of various pathological conditions of the brain. Presently EEG is analysed only by visual inspection and linear method of analysis with which only subtle information can be extracted. Brain being a highly dynamic and non linear system can be analysed in a better way by chaotic analysis.

Seizure is an event in which there is excessive and abnormal firing of the neurons in the cortex of the brain. Seizures can occur due to many causes—ranging from pathologies in the brain, imbalance in blood electrolytes, extreme temperature to infections or toxins affecting the brain. We generally say that these are ‘provoked’ type of seizures. Epilepsy is a specific condition in which a patient suffers from recurrent and unprovoked seizures. If an epileptic patient suffers from an attack of a seizure, he is said to be in an ‘ictal’ phase. The time period in which the patient does not have a seizure is referred to as an ‘interictal’ period. The duration of an interictal period depends upon the frequency of seizures, type of epilepsy and is quite variable from patient to patient [1].

Discrete wavelet transform has been widely used in biomedical signals as they are non stationary. The major advantage of discrete wavelet transform is that both time and frequency information can be extracted from it. The mother wavelet taken for this study is Daubechies wavelet and it has been used for the sub band decomposition. Chaotic features measure the complexity and chaoticity of the brain dynamics. Our study aims at understanding the non linear dynamics of EEG during the ictal and interictal phase of epilepsy.

2 Materials and methods

For conducting the wavelet analysis and chaotic analysis, EEG data has been taken from Government Medical College Thiruvananthapuram, Kerala. EEG data of epileptic patients during their ictal and interictal phase has been obtained and compared with that of normal healthy subjects. We conducted this study on 10 epileptic patients. The diagnosis of epilepsy was made by consultant neurologists. We obtained 10 ictal phase EEG epochs and 10 interictal phase EEG epochs from each of the 10 epilepsy patients. We compared the data with a control group of 20 normal individuals. EEG was taken for them for evaluation of syncope and was found to be normal. 5 epochs of EEG was obtained for each normal patient. All epochs were selected by consultant neurologists by identifying artifact free regions. Each EEG epoch has 6000 sampling points covering 12 seconds with sampling frequency 500 Hz. Cases with age more that 50 years and age less than 20 years were excluded. Cases with neurological diagnosis other than epilepsy were excluded. All EEG signals were recorded with 128 channel amplifier system and 12 bit A/D resolution with spectral bandwidth of 0.5–80 Hz for the acquisition system. The average reference montage was selected for all the EEG data used in this study. Figure 1 shows three sample EEG epochs of Ictal EEG, Interictal EEG and Normal EEG.

Fig. 1
figure 1

a Ictal EEG, b Interictal EEG, c Normal EEG

All the analysis related to this work were done using MATLAB R2013a which is a high level technical computing software and used extensively in the field of signal processing, numerical integration and many other application fields.

3 Methodology

The methodology used in this work consist of three steps (1) EEG is decomposed into its sub-bands delta, theta, alpha and beta using wavelet transform and their energies are calculated (2) Chaotic features Correlation dimension (CD) and largest Lyapunov exponent (LLE) are calculated for normal and epileptic EEG (3) SVM classifier is implemented based on chaotic features as well as energies of EEG sub-bands and classifier performance is evaluated.

3.1 Discrete wavelet transform (DWT)

Fourier transform is being employed for the EEG analysis to get spectral information but their time domain information is also relevant for its analysis. Multi-resolution analysis like wavelet transform gives a time frequency representation of the signal [2]. DWT of a time series signal like EEG is obtained by passing it through a series of high pass and low pass filters. The advantage for DWT is the low computation time and ease of implementation considering the samples to be passed through a low pass filter of impulse response of g[n] and a high pass filter of impulse h[n] [3].

$$Ylow\left[ n \right] = x\left[ n \right]*g\left[ n \right] = \mathop \sum \limits_{k = - \infty }^{\infty } x\left[ k \right] \cdot g\left[ {n - k} \right]$$
(1)
$$Yhigh\left[ n \right] = x\left[ n \right]*h\left[ n \right] = \mathop \sum \limits_{k = - \infty }^{\infty } x\left[ k \right] \cdot h\left[ {n - k} \right]$$
(2)

This low pass filter output is again passed through a set of high pass and low pass filter thus downsampling it by 2. Then the filter outputs are

$$Ylow\left[ n \right] = x\left[ n \right]*g\left[ n \right] = \mathop \sum \limits_{k = - \infty }^{\infty } x\left[ k \right] \cdot g\left[ {2n - k} \right]$$
(3)
$$Yhigh\left[ n \right] = x\left[ n \right]*h\left[ n \right] = \mathop \sum \limits_{k = - \infty }^{\infty } x\left[ k \right] \cdot h\left[ {2n + 1 - k} \right]$$
(4)

When the EEG signal is decomposed by 6-level discrete wavelet transform as shown in Fig. 2 the various sub-bands can be obtained [4]. Delta sub-band less than 4 Hz (A6), theta from 4 to 7 Hz (D6), alpha from 8 to 13 Hz (D5), beta from 13 to 30 Hz (D4) and gamma greater than 30 Hz (D3) are obtained as shown in Fig. 3.

Fig. 2
figure 2

Structure of wavelet decomposition

Fig. 3
figure 3

Various EEG sub-bands after discrete wavelet transform

3.2 Chaotic analysis

All physiological signals are non stationary and cannot be analysed completely by the classical time-domain analysis or frequency-domain techniques. Many studies have proved promising results for the chaotic analysis of such signals.

The EEG signal can be represented as a time series vector x[n] = {x1, x2……….xN} recorded at various time instants where N is the total numbers of data points and the subscripts are indicating the time instants of the data point. Phase space reconstruction, being the first step in chaotic analysis of time-series, is done using Taken’s method [5]. The one-dimensional EEG time series x (n) is viewed in an m- dimensional Euclidean space as,

$$X_{m} \left( n \right) = \left[ {x\left( n \right), x\left( {n + \tau } \right), \ldots , x\left( {n + \left( {m - 1} \right)\tau } \right)} \right]$$
(5)

where τ is the time delay and m is the embedding dimension. An important property of dissipative deterministic dynamical systems is that, if the system is observed for a long time, the trajectory will converge to a subspace of the total state space. This subspace is a geometrical object which is called the attractor of the system. It is called attractor since it ‘attracts’ trajectories from all possible initial conditions. The strange or chaotic attractor is a very complex object with fractal geometry as shown in Fig. 4. The dynamics corresponding to a strange attractor is called deterministic chaos.

Fig. 4
figure 4

Chaotic attractor

3.2.1 Correlation dimension

Nonlinear systems gravitate towards the specific regions in phase that is known as attractors. The attractor states the response of the system as the time progress. The attractor has two main properties complexity and chaoticity. Complexity is a measure of geometrical properties of the attractor and is characterized by the magnitude of attractor dimension which need not an integer value. Complexity of the system corresponds to the correlation dimension (CD) of the system. Fractal dimension can be measured using correlation dimension. Brain, being a non-linear system can be assessed in this manner using its signal EEG. The pattern of neuronal firing is less organized and has greater complexity for normal healthy subjects. The complexity value decreases when the signal goes from normal to epileptic seizure. That means the value of CD generally decreases during this period. Natarajan et al. [6] states that minimum embedding dimension should be greater than CD for any chaotic attractor.

False nearest neighbour (FNN) method is used to choose the appropriate embedding dimension. If the embedding dimension m is sufficiently high (more than twice the dimension of the systems attractor), the series of reconstructed vectors constitute an ‘equivalent attractor’. The method of estimating the embedding dimension from the phase space patterns proposed by Grassberger et al. [7] is followed in this work. The probability of two points on the trajectory that are separated by a distance r indicates the correlation integral function C(r). Our values support this as the minimum embedding dimension is identified as 10 and time delay is 1. Figures 5 and 6 show the computation of correlation integral and correlation dimension.

Fig. 5
figure 5

Correlation integral v/s normalized distance

Fig. 6
figure 6

Estimation of correlation dimension

Correlation integral C(r)

$$C(r) = \frac{1}{{N^{2} }}\mathop \sum \limits_{x = 1}^{N} \mathop \sum \limits_{y = 1, x \ne 1}^{N} \theta \left( {r - \left| {X_{x} - X_{y} } \right|} \right)$$
(6)
$$CD = \mathop {\lim }\limits_{r \to 0} \frac{\log C(r)}{\log ( r)}$$
(7)

where N is the number of data points in phase space, r is the radial distance around each reference point Xi, Xx, Xy is the points of the trajectory in the phase space, Θ is the Heaviside function.

3.2.2 Largest Lyapunov exponent

Largest Lyapunov exponent corresponds to chaoticity of a system. Lyapunov exponent λ measures the rate at which the trajectories separate from one another. LLE (λmax) of the attractor is a measure of the convergence or divergence of nearby trajectories in phase space. It provides a quantitative and qualitative characterization of dynamical behaviour of the system. For diverging trajectory, system has more than one positive Lyapunov exponents, then the future state of the system with an uncertain initial condition cannot be predicted. This type of system is known as chaotic. A positive Lyapunov exponent effectively represents a loss of system information [8]. For converging trajectories, the corresponding Lyapunov exponents are negative. A zero exponent means that orbits maintain their relative positions and they are on stable attractors. Finally, a positive exponent implies the orbits are on a chaotic attractor. An embedding dimension of 10 and a delay of 1 is used for calculating LLE. The algorithm proposed by Wolf et al. [9] is used to extract LLE from EEG data.

Consider two EEG data points X0 and X0 + δx0 each of which will generate an orbit in that space using some system of equations and the separation between the two orbits will be a function of time. Sensitive dependence can arise only in some portions of a system, this separation is also a function of the location of the initial value and has the form δx(X0,t). In a system with attracting fixed points or attracting periodic points δx(X0,t) diminishes asymptotically with time. For chaotic points, the function δx(X0,t) will behave erratically. Thus it is useful to study the mean exponential rate of divergence of two initially close orbits using the formulae,

$$\lambda = \mathop {\lim }\limits_{t \to \infty } \frac{1}{t}\ln \frac{{|\delta x\left( {X_{0} ,t} \right)|}}{{|\delta X_{0} |}}$$
(8)

3.3 Classification with support vector machine (SVM)

In binary classification, support vector machine is one of the commonly employed supervised learning models. For pattern classification, SVM is a powerful tool and it is based on the statistical learning theory and structural risk minimisation. The algorithm involves training with feature vectors Xi of signals of two different classes for normal and interictal to learn a decision boundary that separates these two classes. Once the decision boundary is learned, the SVM algorithm determines the class membership of a newly observed feature vector Xi based on which side of the boundary the vector falls. Classifier performance can be analysed by the computation of sensitivity, specificity and accuracy [10].

Sensitivity Number of true positives/the total number of interictal segments labelled by the trained neurologist. True positive represents an interictal segment that is identified by the EEG experts and correctly detected as ‘interictal’ by the algorithm.

$$SN = \frac{TP}{TP + FN}\; \times \;100$$
(9)

Specificity Number of true negatives/the total number of normal segments labelled by the trained neurologist. True negative represents a segment labelled as normal both by the algorithm and by the trained neurologist.

$$SP = \frac{TN}{TN + FP} \times 100$$
(10)

Accuracy Number of correctly identified segments/total number of segments.

$$AC = \frac{TP + TN}{TP + TN + FP + FN} \times 100$$
(11)

True positive (TP) and True negative (TN) represents the total number of correctly detected true positive events and true negative events. The False positive (FP) and False negative (FN) represents the total number of erroneously positive events and erroneously negative events.

4 Results and discussion

4.1 Wavelet analysis

Discrete wavelet analysis was performed on the data. EEG epochs of both normal and epileptic patients were decomposed into sub-bands namely delta, theta, alpha and gamma using DWT. Here as the sampling rate is 500 Hz, maximum frequency is taken to be 250 Hz. Therefore 6-level decomposition is carried out using dB2 as the mother wavelet [4].

Based on the results obtained, we can say that wavelet transform has good resolution and high performance for visualization of the epilepsy and it can be used in clinical research area. Here, we are emphasising the relevance of decreased values of energy for the different sub-bands in interictal EEGs compared to normal EEG. As interictal phase of an epileptic person is the seizure free period, these decreased values can be greatly utilized for the diagnosis of epilepsy. The result clearly shows that for all sub-bands, interictal EEG has lower value compared to that of normal EEG. Most of the related works have compared these features for normal and ictal cases. So this result clearly gives a new path for the automated diagnosis of epilepsy and is emphasising the values corresponding to interictal phase (Figs. 78, 9 and 10).

Fig. 7
figure 7

Box plot representing energy distribution in delta band for ictal, interictal and normal EEG

Fig. 8
figure 8

Box plot representing energy distribution in theta band for ictal, interictal and normal EEG

Fig. 9
figure 9

Box plot representing energy distribution in alpha band for ictal, interictal and normal EEG

Fig. 10
figure 10

Box plot representing energy distribution in beta band for ictal, interictal and normal EEG

4.2 Chaotic analysis

Chaotic analysis was performed on EEG epochs of normal subjects and epileptic patients and features were extracted. These results convey the information that the complexity of EEG and of brain dynamics is higher in the normal healthy condition of a person. The values of CD and LLE were calculated in Adeli et al. [11] from epileptic EEG available in the data base of University of Bonn. It reported similar results for CD but in case of LLE interictal had lower value compared to ictal. In this work, both correlation dimension and largest Lyapunov exponent were computed and were found to be the lowest for ictal phase, higher for interictal and even higher for normal healthy subjects (Figs. 11 and 12).

Fig. 11
figure 11

Box plot representing distribution of CD in ictal, interictal and normal EEG

Fig. 12
figure 12

Box plot representing distribution of LLE in ictal, interictal and normal EEG

We have implemented an SVM classifier for the diagnosis of epilepsy from EEG signal during the interictal state. The details of data set provided for training and testing of the classifier is provided in Table 1. The features utilized for classification with SVM include both the relative energies of sub-bands (delta, theta, alpha and beta) and chaotic features CD and LLE. These features were used to train the SVM classifier to classify the epileptic and normal persons. The greatest advantage is that both the sub-band energies and chaotic features can be utilised for this classification. Table 2 shows the sensitivity, specificity and accuracy values for classification based on both chaotic features and energies of EEG sub-bands.

Table 1 Data set for training and testing
Table 2 Classification performance based on EEG sub-band energies and chaotic features

5 Conclusion

This work tried to compute the chaotic features as well as the sub-band energies for ictal, interictal and normal EEG and to classify them using SVM based on these extracted features. Results show that the complexity, unpredictability and randomness of brain activity reduce considerably in an epileptic patient compared to a normal healthy subject. This work may be extended for the diagnosis of other pathological conditions. Here, we are emphasising the relevance of decreased values of chaotic features and sub-band energies in interictal EEG. Most of the works in the field have compared these features for normal and ictal cases. As interictal phase of an epileptic person is the seizure free period, all these values can be greatly utilized for the diagnosis of epilepsy.