# Evaluating the Window Size’s Role in Automatic EEG Epilepsy Detection

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

## 3. Materials and Methods

- Alpha band (8–12 Hz)
- Beta band (12–25 Hz)
- Theta band (4–8 Hz)
- Delta band (1–4 Hz)

#### 3.1. The BFGS Method

Algorithm 1: The BFGS Algorithm |

1: Having a starting point ${x}_{0}$ and ${B}_{0}={I}_{n}$. Set the values for $s,\beta ,$ and $\sigma $. |

2: End if $\left(\right)open="\parallel "\; close="\parallel ">g\left({x}_{k+1}\right)$. |

3: Calculate the search direction using Formula (7). |

4: Calculate the difference ${s}_{k}={x}_{k+1}-{x}_{k}$ and ${y}_{k}+{g}_{k+1}-{g}_{k}$. |

5: Update ${B}_{k}$ by (3) in order to obtain ${B}_{k+1}$. |

6: $k=k+1$. |

7: Go to step 2. |

#### 3.2. The Multistart Method

Algorithm 2: The Multistart Algorithm |

1: $i=0$ and ${X}^{*}=$. |

2: Take a random sample x from S. |

3: Start a deterministic local search process at x and conclude at a local minimum ${x}^{*}$. |

4: Check if a new minimum is found. |

5: ${x}^{*}\notin {X}^{*}$ then |

6: $i\leftarrow i+1$. |

7: ${x}_{i}^{*}={x}^{*}$. |

8: ${X}^{*}\leftarrow {X}^{*}\cup \left\{{x}_{i}^{*}\right\}$. |

9: end. |

10: If ending criteria have been met, terminate the process. |

11: Go to step 2. |

#### 3.3. The Modified GA Method

Algorithm 3: The Real-Coded GA |

1: Create N random points in $\mathsf{\Omega}$ from the uniform distribution. |

2: Store the points in set S. |

3: $iter=0$. |

4: Evaluate each chromosome using its function value. |

5: If the termination criteria are achieved, stop the GA. |

6: Select $m\le N$ parents from S. |

7: Create m offspring using the selected parent chromosomes of the previous step. |

8: Mutate the offspring with probability ${p}_{m}$. |

9: Remove the m worst chromosomes and replace them with the offspring. |

10: Create a trial point $\tilde{x}$. If $f\left(\tilde{x}\right)\le f\left({x}_{h}\right)$ where ${x}_{h}$ is the current worst point in S, then replace ${x}_{h}$ with $\tilde{x}$. |

11: $iter=iter+1$. |

12: Go to step 4. |

#### 3.4. The K-NN Classifier

Algorithm 4: The K-NN Algorithm |

1: Classify $(X,Y,x)$. |

2: for $i=1$ to n do |

3: Calculate the Euclidean distance ${d}_{E}({X}_{i},x)$. |

4: end. |

5: Compute set I having the indices for the k smallest distances ${d}_{E}({X}_{i},x)$. |

6: Return majority label for ${Y}_{i}$ where $i\in I$. |

## 4. Results

## 5. Discussion

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

EEG | electroencephalogram |

K-NN | k-nearest neighbours |

BFGS | Broyden–Fletcher–Goldfarb–Shanno |

SLNN | single-layer neural network |

GA | genetic algorithm |

BCI | brain–computer interface |

MLP | multilayer perceptron |

t-f | time frequency |

PSD | power spectrum density |

ANNs | artificial neural networks |

CEEMDAN | complete ensemble empirical mode decomposition with adaptive noise |

LPBoost | linear programming boosting |

DWT | discrete wavelet transform |

MODWT | maximal overlap discrete wavelet transform |

PE | permutation entropy |

SVM | support vector machine |

CSI | combined seizure index |

PCA | principal component analysis |

## References

- World Health Organization. Epilepsy; WHO: Geneva, Switzerland, 2020. [Google Scholar]
- Ramsay, R.E.; Rowan, A.J.; Pryor, F.M. Special considerations in treating the elderly patient with epilepsy. Neurology
**2004**, 62, S24–S29. [Google Scholar] [CrossRef] [PubMed] - Acharya, U.R.; Sree, S.V.; Swapna, G.; Martis, R.J.; Suri, J.S. Automated EEG analysis of epilepsy: A review. Knowl.-Based Syst.
**2013**, 45, 147–165. [Google Scholar] [CrossRef] - Tzallas, A.T.; Tsipouras, M.G.; Tsalikakis, D.G.; Karvounis, E.C.; Astrakas, L.; Konitsiotis, S.; Tzaphlidou, M. Automated Epileptic Seizure Detection Methods: A Review Study. In Epilepsy; Stevanovic, D., Ed.; IntechOpen: Rijeka, Croatia, 2012; Chapter 4. [Google Scholar] [CrossRef] [Green Version]
- Cross, D.J.; Cavazos, J.E. The role of sprouting and plasticity in epileptogenesis and behavior. In Behavioral Aspects of Epilepsy; DEMOS: New York, NY, USA, 2007. [Google Scholar]
- Buck, D.; Baker, G.A.; Jacoby, A.; Smith, D.F.; Chadwick, D.W. Patients’ experiences of injury as a result of epilepsy. Epilepsia
**1997**, 38, 439–444. [Google Scholar] [CrossRef] [PubMed] - Iasemidis, L.D.; Shiau, D.S.; Sackellares, J.C.; Pardalos, P.M.; Prasad, A. Dynamical resetting of the human brain at epileptic seizures: Application of nonlinear dynamics and global optimization techniques. IEEE Trans. Biomed. Eng.
**2004**, 51, 493–506. [Google Scholar] [CrossRef] - Soikkeli, R.; Partanen, J.; Soininen, H.; Pääkkönen, A.; Riekkinen Sr, P. Slowing of EEG in Parkinson’s disease. Electroencephalogr. Clin. Neurophysiol.
**1991**, 79, 159–165. [Google Scholar] [CrossRef] - Wieser, H.G.; Schindler, K.; Zumsteg, D. EEG in Creutzfeldt–Jakob disease. Clin. Neurophysiol.
**2006**, 117, 935–951. [Google Scholar] [CrossRef] - Neto, E.; Biessmann, F.; Aurlien, H.; Nordby, H.; Eichele, T. Regularized linear discriminant analysis of EEG features in dementia patients. Front. Aging Neurosci.
**2016**, 8, 273. [Google Scholar] [CrossRef] [Green Version] - Miltiadous, A.; Tzimourta, K.D.; Giannakeas, N.; Tsipouras, M.G.; Afrantou, T.; Ioannidis, P.; Tzallas, A.T. Alzheimer’s Disease and Frontotemporal Dementia: A Robust Classification Method of EEG Signals and a Comparison of Validation Methods. Diagnostics
**2021**, 11, 1437. [Google Scholar] [CrossRef] - Christodoulides, P.; Miltiadous, A.; Tzimourta, K.D.; Peschos, D.; Ntritsos, G.; Zakopoulou, V.; Giannakeas, N.; Astrakas, L.G.; Tsipouras, M.G.; Tsamis, K.I.; et al. Classification of EEG signals from young adults with dyslexia combining a Brain Computer Interface device and an Interactive Linguistic Software Tool. Biomed. Signal Process. Control
**2022**, 76, 103646. [Google Scholar] [CrossRef] - Aspiotis, V.; Miltiadous, A.; Kalafatakis, K.; Tzimourta, K.D.; Giannakeas, N.; Tsipouras, M.G.; Peschos, D.; Glavas, E.; Tzallas, A.T. Assessing Electroencephalography as a Stress Indicator: A VR High-Altitude Scenario Monitored through EEG and ECG. Sensors
**2022**, 22, 5792. [Google Scholar] [CrossRef] - Miltiadous, A.; Aspiotis, V.; Sakkas, K.; Giannakeas, N.; Glavas, E.; Tzallas, A.T. An experimental protocol for exploration of stress in an immersive VR scenario with EEG. In Proceedings of the 2022 7th South-East Europe Design Automation, Computer Engineering, Computer Networks and Social Media Conference (SEEDA-CECNSM), Ioannina, Greece, 23–25 September 2022; pp. 1–5. [Google Scholar] [CrossRef]
- Fix, E.; Hodges, J. Discriminatory Analysis, Nonparametric Discrimination: Consistency Properties; Technical Report, TX, Tech. Rep. 4; USAF School of Aviation Medicine, Randolph Field: Dayton, OH, USA, 1951. [Google Scholar]
- Hery, M.A.; Ibrahim, M.; June, L. BFGS method: A new search direction. Sains Malays.
**2014**, 43, 1591–1597. [Google Scholar] - Lagaris, I.E.; Tsoulos, I.G. Stopping rules for box-constrained stochastic global optimization. Appl. Math. Comput.
**2008**, 197, 622–632. [Google Scholar] [CrossRef] - Tsoulos, I.G. Modifications of real code genetic algorithm for global optimization. Appl. Math. Comput.
**2008**, 203, 598–607. [Google Scholar] [CrossRef] - Andrzejak, R.G.; Lehnertz, K.; Mormann, F.; Rieke, C.; David, P.; Elger, C.E. Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state. Phys. Rev. E
**2001**, 64, 061907. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Naghsh-Nilchi, A.R.; Aghashahi, M. Epilepsy seizure detection using eigen-system spectral estimation and Multiple Layer Perceptron neural network. Biomed. Signal Process. Control
**2010**, 5, 147–157. [Google Scholar] [CrossRef] - Tzallas, A.T.; Tsipouras, M.G.; Fotiadis, D.I. Epileptic seizure detection in EEGs using time–frequency analysis. IEEE Trans. Inf. Technol. Biomed.
**2009**, 13, 703–710. [Google Scholar] [CrossRef] - Martinez-del Rincon, J.; Santofimia, M.J.; del Toro, X.; Barba, J.; Romero, F.; Navas, P.; Lopez, J.C. Non-linear classifiers applied to EEG analysis for epilepsy seizure detection. Expert Syst. Appl.
**2017**, 86, 99–112. [Google Scholar] [CrossRef] [Green Version] - Hassan, A.R.; Subasi, A. Automatic identification of epileptic seizures from EEG signals using linear programming boosting. Comput. Methods Programs Biomed.
**2016**, 136, 65–77. [Google Scholar] [CrossRef] - Juarez-Guerra, E.; Alarcon-Aquino, V.; Gomez-Gil, P. Epilepsy seizure detection in EEG signals using wavelet transforms and neural networks. In New Trends in Networking, Computing, E-Learning, Systems Sciences, and Engineering; Springer: Berlin/Heidelberg, Germany, 2015; pp. 261–269. [Google Scholar]
- Hossain, M.S.; Amin, S.U.; Alsulaiman, M.; Muhammad, G. Applying deep learning for epilepsy seizure detection and brain mapping visualization. ACM Trans. Multimed. Comput. Commun. Appl. (TOMM)
**2019**, 15, 1–17. [Google Scholar] [CrossRef] - Shoeb, A.H. Application of Machine Learning to Epileptic Seizure Onset Detection and Treatment. Ph.D. Thesis, Massachusetts Institute of Technology, Boston, MA, USA, 2009. [Google Scholar]
- Nicolaou, N.; Georgiou, J. Detection of epileptic electroencephalogram based on permutation entropy and support vector machines. Expert Syst. Appl.
**2012**, 39, 202–209. [Google Scholar] [CrossRef] - Shoeb, A.H.; Guttag, J.V. Application of machine learning to epileptic seizure detection. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), Haifa, Israel, 21–24 June 2010; pp. 975–982. [Google Scholar]
- Guo, L.; Rivero, D.; Pazos, A. Epileptic seizure detection using multiwavelet transform based approximate entropy and artificial neural networks. J. Neurosci. Methods
**2010**, 193, 156–163. [Google Scholar] [CrossRef] [PubMed] - Subasi, A. Epileptic seizure detection using dynamic wavelet network. Expert Syst. Appl.
**2005**, 29, 343–355. [Google Scholar] [CrossRef] - Ghosh-Dastidar, S.; Adeli, H.; Dadmehr, N. Principal component analysis-enhanced cosine radial basis function neural network for robust epilepsy and seizure detection. IEEE Trans. Biomed. Eng.
**2008**, 55, 512–518. [Google Scholar] [CrossRef] [PubMed] - Adeli, H.; Ghosh-Dastidar, S.; Dadmehr, N. A wavelet-chaos methodology for analysis of EEGs and EEG subbands to detect seizure and epilepsy. IEEE Trans. Biomed. Eng.
**2007**, 54, 205–211. [Google Scholar] [CrossRef] - Ghosh-Dastidar, S.; Adeli, H.; Dadmehr, N. Mixed-band wavelet-chaos-neural network methodology for epilepsy and epileptic seizure detection. IEEE Trans. Biomed. Eng.
**2007**, 54, 1545–1551. [Google Scholar] [CrossRef] - Guo, L.; Rivero, D.; Dorado, J.; Rabunal, J.R.; Pazos, A. Automatic epileptic seizure detection in EEGs based on line length feature and artificial neural networks. J. Neurosci. Methods
**2010**, 191, 101–109. [Google Scholar] [CrossRef] - Hassan, A.R.; Siuly, S.; Zhang, Y. Epileptic seizure detection in EEG signals using tunable-Q factor wavelet transform and bootstrap aggregating. Comput. Methods Programs Biomed.
**2016**, 137, 247–259. [Google Scholar] [CrossRef] - Tsoulos, I.G.; Gavrilis, D.; Glavas, E. Neural network construction using grammatical evolution. In Proceedings of the 5h IEEE International Symposium on Signal Processing and Information Technology, Athens, Greece, 18–21 December 2005; pp. 827–831. [Google Scholar]
- Broyden, C.G. The convergence of a class of double-rank minimization algorithms 1. general considerations. IMA J. Appl. Math.
**1970**, 6, 76–90. [Google Scholar] [CrossRef] [Green Version] - Broyden, C.G. The convergence of a class of double-rank minimization algorithms: 2. The new algorithm. IMA J. Appl. Math.
**1970**, 6, 222–231. [Google Scholar] [CrossRef] - Fletcher, R. A new approach to variable metric algorithms. Comput. J.
**1970**, 13, 317–322. [Google Scholar] [CrossRef] [Green Version] - Goldfarb, D. A family of variable-metric methods derived by variational means. Math. Comput.
**1970**, 24, 23–26. [Google Scholar] [CrossRef] - Shanno, D.F. Conditioning of quasi-Newton methods for function minimization. Math. Comput.
**1970**, 24, 647–656. [Google Scholar] [CrossRef] - Armijo, L. Minimization of functions having Lipschitz continuous first partial derivatives. Pac. J. Math.
**1966**, 16, 1–3. [Google Scholar] [CrossRef] [Green Version] - Wolfe, P. Convergence conditions for ascent methods. SIAM Rev.
**1969**, 11, 226–235. [Google Scholar] [CrossRef] - Wolfe, P. Convergence conditions for ascent methods. II: Some corrections. SIAM Rev.
**1971**, 13, 185–188. [Google Scholar] [CrossRef] - Goldstein, A.A. On steepest descent. J. Soc. Ind. Appl. Math. Ser. Control
**1965**, 3, 147–151. [Google Scholar] [CrossRef] - Powell, M. A tolerant algorithm for linearly constrained optimization calculations. Math. Program.
**1989**, 45, 547–566. [Google Scholar] [CrossRef] - Pardalos, P.M.; Romeijn, H.E.; Tuy, H. Recent developments and trends in global optimization. J. Comput. Appl. Math.
**2000**, 124, 209–228. [Google Scholar] [CrossRef] [Green Version] - Kaelo, P.; Ali, M. Integrated crossover rules in real coded genetic algorithms. Eur. J. Oper. Res.
**2007**, 176, 60–76. [Google Scholar] [CrossRef] - Miller, B.L.; Goldberg, D.E. Genetic algorithms, tournament selection, and the effects of noise. Complex Syst.
**1995**, 9, 193–212. [Google Scholar] - Michalewicz, Z.; Hartley, S.J. Genetic algorithms+data structures=evolution programs. Math. Intell.
**1996**, 18, 71. [Google Scholar] - Wang, J.G.; Neskovic; Cooper. An adaptive nearest neighbor algorithm for classification. In Proceedings of the 2005 International Conference on Machine Learning and Cybernetics, Guangzhou, China, 18–21 August 2005; Volume 5, pp. 3069–3074. [Google Scholar]
- Tay, B.; Hyun, J.K.; Oh, S. A machine learning approach for specification of spinal cord injuries using fractional anisotropy values obtained from diffusion tensor images. Comput. Math. Methods Med.
**2014**, 2014, 276589. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Tzimourta, K.D.; Astrakas, L.G.; Gianni, A.M.; Tzallas, A.T.; Giannakeas, N.; Paliokas, I.; Tsalikakis, D.G.; Tsipouras, M.G. Evaluation of window size in classification of epileptic short-term EEG signals using a Brain Computer Interface software. Eng. Technol. Appl. Sci.
**2018**, 8, 3093–3097. [Google Scholar] [CrossRef] - Thangavel, P.; Thomas, J.; Sinha, N.; Peh, W.Y.; Yuvaraj, R.; Cash, S.S.; Chaudhari, R.; Karia, S.; Jin, J.; Rathakrishnan, R.; et al. Improving automated diagnosis of epilepsy from EEGs beyond IEDs. J. Neural Eng.
**2022**, 19, 066017. [Google Scholar] [CrossRef]

**Table 1.**Experimental Results expressed in classification accuracy for the four algorithms employed regarding time windows ranging from 1 to 24 s. BFGS stands for Broyden–Fletcher–Goldfarb–Shanno algorithm. GA stands for genetic algorithm, K-NN stands for k-nearest neighbours.

Epoch (s) | BFGS | Multistart | GA | K-NN |
---|---|---|---|---|

1 s | 56.86% | 57.68% | 56.91% | 68.9% |

2 s | 65.06% | 65.56% | 65.06% | 75.14% |

3 s | 69.7% | 69.57% | 69.01% | 76.66% |

4 s | 72.62% | 70.53% | 70.06% | 76.99% |

5 s | 75.69% | 73.46% | 71.96% | 77.89% |

6 s | 74.63% | 76.37% | 75.44% | 79.53% |

7 s | 74.76% | 75.84% | 74.43% | 79.1% |

8 s | 76.06% | 75.55% | 74.95% | 78.41% |

9 s | 76.25% | 77.64% | 76.5% | 79.88% |

10 s | 76.96% | 77.12% | 76.38% | 80.05% |

11 s | 76.42% | 79.01% | 77.2% | 79.08% |

12 s | 76.55% | 78.26% | 77.06% | 79.84% |

13 s | 77.04% | 78.04% | 76.05% | 78.56% |

14 s | 77.81% | 78.26% | 77.13% | 79.01% |

15 s | 79.75% | 78.98% | 78.41% | 78.68% |

16 s | 77.35% | 80.98% | 78.59% | 79.52% |

17 s | 77.7% | 78.05% | 77.82% | 79.92% |

18 s | 78.5% | 79.24% | 78.10% | 79.92% |

19 s | 80.7% | 79.71% | 78.47% | 79.49% |

20 s | 80.92% | 81.59% | 80.78% | 80.00% |

21 s | 80.92% | 81.23% | 81.06% | 79.25% |

22 s | 80.04% | 80.88% | 81.00% | 81.17% |

23 s | 80.69% | 80.88% | 80.89% | 78.88% |

24 s | 80.25% | 80.43% | 79.98% | 79.04% |

**Table 2.**Area under the ROC, area under the PRC, and kappa statistic regarding the classification performance of the K-NN algorithm.

Epoch (s) | AOC | PRC | k-Stat |
---|---|---|---|

1 s | 78.91% | 48.6% | 62.21% |

2 s | 79.89% | 50.2% | 68.74% |

3 s | 80.68% | 50.1% | 75.23% |

4 s | 86.44% | 53.3% | 71.95% |

5 s | 85.92% | 56.8% | 74.62% |

6 s | 85.45% | 54.0% | 76.38% |

7 s | 83.21% | 58.1% | 77.55% |

8 s | 87.21% | 60.9% | 77.19% |

9 s | 87.17% | 61.8% | 80.02% |

10 s | 86.57% | 64.3% | 78.84% |

11 s | 90.89% | 64.2% | 83.40% |

12 s | 90.49% | 64.8% | 82.32% |

13 s | 89.04% | 68.1% | 82.14% |

14 s | 88.88% | 68.3% | 82.85% |

15 s | 86.22% | 70.4% | 79.94% |

16 s | 85.45% | 70.1% | 80.15% |

17 s | 85.92% | 73.6% | 82.15% |

18 s | 84.70% | 73.0% | 84.29% |

19 s | 86.07% | 74.7% | 85.42% |

20 s | 92.22% | 78.5% | 85.49% |

21 s | 92.51% | 76.5% | 83.26% |

22 s | 88.70% | 77.3% | 82.44% |

23 s | 82.28% | 75.7% | 83.51% |

24 s | 88.37% | 73.7% | 80.00% |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Christou, V.; Miltiadous, A.; Tsoulos, I.; Karvounis, E.; Tzimourta, K.D.; Tsipouras, M.G.; Anastasopoulos, N.; Tzallas, A.T.; Giannakeas, N.
Evaluating the Window Size’s Role in Automatic EEG Epilepsy Detection. *Sensors* **2022**, *22*, 9233.
https://doi.org/10.3390/s22239233

**AMA Style**

Christou V, Miltiadous A, Tsoulos I, Karvounis E, Tzimourta KD, Tsipouras MG, Anastasopoulos N, Tzallas AT, Giannakeas N.
Evaluating the Window Size’s Role in Automatic EEG Epilepsy Detection. *Sensors*. 2022; 22(23):9233.
https://doi.org/10.3390/s22239233

**Chicago/Turabian Style**

Christou, Vasileios, Andreas Miltiadous, Ioannis Tsoulos, Evaggelos Karvounis, Katerina D. Tzimourta, Markos G. Tsipouras, Nikolaos Anastasopoulos, Alexandros T. Tzallas, and Nikolaos Giannakeas.
2022. "Evaluating the Window Size’s Role in Automatic EEG Epilepsy Detection" *Sensors* 22, no. 23: 9233.
https://doi.org/10.3390/s22239233