\documentclass[12pt]{article}
% package to activate greek language - the sequence languages appear below is IMPORTANT!!!
\usepackage[utf8]{inputenc} 
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{alphabeta}
%Times New Roman
\usepackage{newtxtext}
\usepackage{substitutefont}
\substitutefont{LGR}{\rmdefault}{txr}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{varioref}
\usepackage{multicol}
% package to handle graphics
\usepackage{graphicx}
% package to handle multiple figures in a minipage
\usepackage{subfigure}
% package to extend math capabilities
\usepackage{amsmath,amssymb,isotope}
%\usepackage[version=4]{mhchem}
%package to activate XeTeX font manager
%\usepackage{fontspec}
\usepackage{amsmath}
%article authblock
\usepackage{authblk}
\usepackage{framed, color}
%\usepackage{xcolor}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage{tcolorbox}
\usepackage{url}
\usepackage{cite}
% DOCUMENT LAYOUT
\usepackage{geometry} 
%\geometry{a4paper, textwidth=5.5in, textheight=8.5in, marginparsep=7pt, marginparwidth=.6in}
\geometry{a4paper}
\setlength\parindent{8mm}
\setlength\parskip{5mm}

% ---- CUSTOM AMPERSAND
\newcommand{\amper}{{\fontspec[Scale=.95]{Gentium Italic}\selectfont\itshape\&}}

% package to handle line spacing
\usepackage{setspace}

% HEADINGS
\usepackage{sectsty} 
\usepackage[normalem]{ulem} 
\sectionfont{\rmfamily\mdseries\upshape\Large}
\subsectionfont{\rmfamily\bfseries\upshape\normalsize} 
\subsubsectionfont{\rmfamily\mdseries\upshape\normalsize} 
% package for fancy style headers and footers
\usepackage{fancybox}
\usepackage{fancyhdr}
% PDF SETUP
% ---- FILL IN HERE THE DOC TITLE AND AUTHOR
%\usepackage[unicode]{hyperref}
\usepackage[bookmarks, colorlinks, breaklinks, unicode]{hyperref}  
\hypersetup{linkcolor=black,citecolor=black,filecolor=black,urlcolor=black} 
%%%%%%%%%%%%%%%%MATH constructs %%%%%%%%%%%%%%%%%%%%
\renewcommand\qedsymbol{$\blacksquare$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% redefine bullet symbols and section style
\renewcommand\thesection{\arabic{section}}
%\renewcommand{\labelitemi}{$\blacktriangleright$}
\renewcommand{\labelitemi}{$\bullet$}
\renewcommand{\labelitemii}{\normalfont\bfseries \textendash}
\renewcommand{\labelitemiii}{$\circ$}
\renewcommand{\labelitemiv}{\textperiodcentered}
% change captions especially for greek language - if the document is in ENGLISH, they should vanish
\addto\captionsenglish{%
  \renewcommand\prefacename{Πρόλογος}%
  \renewcommand\refname{Αναφορές}%
  \renewcommand\abstractname{Abstract}%
  \renewcommand\bibname{Βιβλιογραφία}%
  \renewcommand\chaptername{Κεφάλαιο}%
  \renewcommand\appendixname{Παράρτημα}%
  \renewcommand\contentsname{Περιεχόμενα}%
  \renewcommand\listfigurename{Κατάλογος Σχημάτων}%
  \renewcommand\listtablename{Κατάλογος Πινάκων}%
  \renewcommand\indexname{Ευρετήριο}%
  \renewcommand\figurename{Σχήμα}%
  \renewcommand\tablename{Πίνακας}%
  \renewcommand\partname{Μέρος}%
  \renewcommand\enclname{Συνημμένα}%
  \renewcommand\ccname{Κοινοποίηση}%
  \renewcommand\headtoname{Προς}%
  \renewcommand\pagename{Σελίδα}%
  \renewcommand\seename{βλέπε}%
  \renewcommand\alsoname{βλέπε επίσης}%
  }
%%%%%%%%%%%%%%% Line spreading
\linespread{1.0}
%Keywords definition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User DEFINED COLORS %%%%%%%%%%%%%%%%%%%%%
\definecolor{mypink1}{rgb}{0.858, 0.188, 0.478}
\definecolor{mypink2}{RGB}{219, 48, 122}
\definecolor{mypink3}{cmyk}{0, 0.7808, 0.4429, 0.1412}
\definecolor{mygray}{gray}{0.6}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand{\keywords}[1]{\textbf{\textit{Λέξεις κλειδιά---}} #1}
%Date definition
\def\mydate{\leavevmode\hbox{\twodigits\day-\twodigits\month-\the\year}}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
%Horizontal green rule definition
%%%%%%%%% END OF PREAMBLE %%%%%%%%%%%%
\renewcommand\Authand{ }
\renewcommand\Authands{, } % To remove "and"
\pagestyle{fancy} 
\headheight=12pt %fancy headers
\fancyhf{}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%% BAZΩ TITΛΟ %%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Machine Learning Algorithms for Epileptic Seizure}
\let\runtitle\@title
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ΒΑΖΩ ΣΥΓΓΡΑΦΕΙΣ %%%%%%%%%%%%%%%%%%%%%
\author{\small Δεσποινα Μιχαηλιδη}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ΒΑΖΩ ΑFFILIATION ΑΝΑ ΣΥΓΓΡΑΦΕΑ %%%%%%%%%%%%%%%%%%%%%%
\affil{\footnotesize Τμήμα Μαθηματικών, Πανεπιστήμιο Ιωαννίνων, \href{mailto:ma12522@uoi.gr}{ma12522@uoi.gr}}
%%%%%%%%%%%%%%%%%%%%%%%%%%  ΑΥΤΟΜΑΤΗ ΗΜΕΡΟΜΗΝΙΑ %%%%%%%%%%%%%%%%%%%
%\date{\today}
\date{\ 01-4-23}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% OΡΙΖΩ  Document ID %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\techrepid}{7\_\ 01-04-2023}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%EOF document ID
\makeatother
%\lhead{E.T. Lau \& M. Gaspari}
%\rhead{\runtitle}
%\lhead{\runtitle}
\fancypagestyle{allpages} {
\fancyhead[C]{%
  \begin{tabular}{ @{} p{\textwidth} @{} }
    \small\runtitle\\
    \hline
    \hfill\tiny\tiny T.R. -- \techrepid
  \end{tabular}}
\setlength{\headheight}{24.4pt}% Should be at least 24.4pt
\fancyfoot[C]{-- Σελ. \thepage \quad από ~\pageref{LastPage} --}
\renewcommand{\headrulewidth}{0pt}% Remove header rule
}
\fancypagestyle{firstpage}{%
  \lhead{\includegraphics[scale=0.4]{figures/logo.jpg}}
  \rhead{** Τεχνική Αναφορά No:\techrepid **}
\renewcommand{\headrulewidth}{4pt}% Remove header rule
}

\begin{document}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The abstract in english
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
Epileptic seizure is a brain deregulation episode. This brain derugulation can be diagnosed by using different machine learning algorithms, such as k-Nearest Neighbor and Support Vector Machines. Researchers have proposed recognition of epileptic seizure with artificial neural network(ANN) algorithms. The wearable device of electroencephalogram(EEG) was used in a study conducted to the neurology department of a hospital for the prediction of epileptic seizures. EEG data set represents of signals belong to healthy and epileptic patients. EEG signals show information for the frequency and are seperated into α, β, δ, θ spectral components and provide a range of frequency components. EEG spectrum contains some characteristic waveforms with four frequency bands. These are δ(0.5-4 Hz), θ(4-8 Hz), α(8-13 Hz), β(13-30 Hz). The frequency components of the EEG are extracted by using the discrete wavelet transform(DWT), which is a method of frequency analysis. Coefficients of wavelet transform are used for the recognition of epileptic seizures in EEG signals. Then these are applied as inputs for different machine algorithms, such as (ANN). By placing electrodes to the patient's head we can get EEG data from him. The frequency of the EEG makes EEG curves that show the activation with the time parameter. In the end, EEG signals are analyzed, find potential epileptic seizures and send notices to the patient's mobile phone.
\end{abstract}
\fancyhf{}
\thispagestyle{firstpage}
\newpage
\fancyhf{}
\thispagestyle{firstpage}
\section*{\begin{center} Περίληψη \end{center}}
Η επιληπτικη κριση ειναι ενα επεισοδιο απορρυθμισης του εγκεφαλου. Αυτη η απορρυθμιση του εγκεφαλου μπορει να διαγνωστει χρησιμοποιωντας διαφορετικους αλγοριθμους μηχανικης μαθησης, οπως ειναι οι k-Nearest Neighbor και Support Vector Machines. Ερευνητες εχουν προτεινει αναγνωριση της επιληπτικης κρισης με αλγοριθμους τεχνητων νευρωνικων δικτυων(ΑΝΝ algorithms). Η φορητη συσκευη του ηλεκτροεγκεφαλογραφηματος(EEG) χρησιμοποιηθηκε σε μια μελετη που διεξηχθει στο νευρολογικο τμημα ενος νοσοκομειου για την προβλεψη των επιληπτικων κρισεων. Το συνολο δεδομενων του EEG αντιπροσωπευει σηματα, τα οποια ανηκουν σε υγιεις και επιληπτικους ασθενεις. Τα σηματα του EEG δινουν πληροφορια για τη συχνοτητα και χωριζονται σε α,β,δ,θ φασματικα εξαρτηματα και παρεχουν ενα ευρος απο στοιχεια συχνοτητας. Το φασμα του EEG περιεχει καποιες χαρακτηριστικες κυμματομορφες με 4 ζωνες συχνοτητων. Αυτες ειναι δ(0.5-4 Hz), θ(4-8 Hz), α(8-13 Hz), β(13-30 Hz). Τα στοιχεια συχνοτητων του EEG εξαγονται χρησιμοποιωντας το διακριτο μετασχηματισμο κυμματιδιων(DWT), το οποιο ειναι μια μεθοδος αναλυσης της συχνοτητας. Συντελεστες μετασχηματισμου κυμματιδιων χρησιμοποιουνται για την αναγνωριση επιληπτικων κρισεων σε σηματα EEG. Μετα εφαρμοζονται ως εισοδοι σε διαφορετικους αλγοριθμους οπως ο ANN(Artificial Neural Network). Τοποθετωντας ηλεκτροδια στο κεφαλι του ασθενη μπορουμε να παρουμε δεδομενα απο αυτων. Η συχνοτητα του EEG δημιουργει καμπυλες EEG οι οποιες δειχνουν τη δραστηριοτητα με παραμετρο το χρονο. Στο τελος, τα σηματα EGG αναλυονται, βρισκουν πιθανες επιληπτικες κρισεις και στελνονται ειδοποιησεις στα κινητα τηλεφωνα των ασθενων. 
\newpage
\tableofcontents
\vspace{10mm}
\keywords{epileptic seizure, discrete wavelet transform, classification, artificial neural networks, support vector machines, EEG}
%===================================================================================
\newpage
\pagestyle{allpages}

% include files with content. Changes the names according to your taste.
\section{Εισαγωγή}\label{s1}
\begin{enumerate}
\item The aim of this study is to diagonse epileptic seizures by using different machine learning algorithms, which detect epileptic seizure quicly and with high accuracy. Epileptic seizure associated with abnormal brain activities caused by a disorder of the brain central nervous system. Epilepsy is one of the most common disorders of the brain.\\

 One of every 10 people will have at least one epileptic seizure during a normal lifespan and a third of them will develop epilepsy. Worldwide epilepsy affects 50 millions people. According to a World Health Organization(WHO) survey, epilepsy accounts for 1\% of the global burden of disease, a figure equivalent to breast cancer in women and lung cancer in men.\\

 People with epilepsy, suffer from recurrent seizures that occur at unpredictable times and usually without warning. They have many symptoms, such as loss of awareness, unusual behavior and confusion~\cite{engel_epilepsy_2008}\\

 So what can we do to predict and face the epileptic seizure in time;
\item The most common way to undestand the epileptic seizure before it happens is through analysis of the electroencephalogram(EEG), that shows the brain's electrical activity. EEG data show information for the frequency. The frequency components of the EEG are extracted by using the discrete wavelet transform(DWT), which is a method of frequency  analysis for non-stationary signals. It is used for disintegrate the original EEG signals into specific subbands.
By using DWT it becomes easier to get the time and frequency information of a
signal together, which makes it practical to obtain the components in EEG.~\cite{sharmila_epilepsy_2018}
The above method is applied to the input of machine learning algorithms, such as Artificial Neural Networks(ANN), k-Nearest Neighbor(k-NN) and Support Vector Machines(SVM).\\

\end{enumerate}

\newpage
\pagestyle{allpages}
\bibliographystyle{plain}
\bibliography{biblio}
\cite{shoeb_application_nodate}
\cite{karlik_comparison_2014}
\cite{sharmila_epilepsy_2018}
\cite{f_seizure_2007}
\cite{noauthor_classification_1997}
\cite{k_adaptive_1996}
\cite{engel_epilepsy_2008}


\section{Περιγραφη του προβληματος και περιγραφη του αλγοριθμου και των δεδομενων εφαρμογης του}\label{s2}
The problem of this study is how we can detect the epileptic seizure by analyzing the brain activity. The most common way to do this, is by using the EEG device. So by placing elecrodes to the patient's head we get information from his brain. The electrodes are connected with special cables that transfer brain activity to the computer. Then the brain activity is recorded and analyzed. EEG signals show information for the frequency and are seperated into α, β, δ,
θ spectral components.The frequency of the EEG makes EEG curves that show the brain activity with the time parameter. The range of frequencies are between 1 and 30 Hz and amplitudes will vary between
20 and 100 μV. EEG spectrum contains waveforms with four frequency bands. These are δ(0.5-4 Hz), θ(4-8 Hz), α(8-13 Hz), β(13-30 Hz). Alpha
waves are observed when a person is in a state of relaxed wakefulness. During intense
mental activity beta waves are more prominent in frontal areas as well as other regions.
If a relaxed person is told to open their eyes, alpha activity decreasing and beta activity
increasing. Theta and delta waves are not seen in wakefullness and if they are it is a sign
of brain dysfunction.\\

The original dataset used in this study consists of five different folders, each with 100 files, with each file representing a person.Each file is a recording of brain activity for 23.5 seconds. The corresponding time-series is sampled into 4097 data points. Each data point is the value of the EEG recording at a different point in time. So we have 500 people, each one has 4097 data point for 23.5 seconds. Each 4097 data points was splited and shuffled into 23 pieces.Every piece contains 178 data points for 1 second and each data point is the value of he EEG recording at a different point in time. So there are 23x500=11500 pieces of information, each information contains 178 data points for 1 second(column). The last column represents the variable y, which belongs to \{1,2,3,4,5\}. The variables X1, X2,....,X178 are explanatory and y is the response variable. \\
The frequency components of the EEG are extracted by using the discrete wavelet transform(DWT). This method is applied to the input of machine learning algorithms,(ANN), (k-NN) and (SVM).\\

Artificial Neural Network classifier is simulating working principle of the human brain. 
ANN algorithm is powerful about calculation and data mining takes its ability to learn that encountered in the process of training or learning is defined
as the inputs of ANN to produce appropriate response, if a person has epilepsy or
no. The design of Artificial Neural Networks is enables them to process informa-
tion in a similar way to our own biological brains, by drawing inspiration from our
own nervous system functions~\cite{karlik_comparison_2014}\\

Support Vector Machines algorithm gives optimal results in signal process-
ing.\\

K-Nearest Neighbors algorithm is a non-parametric classification method
that calculates class memberships based on k-closest training examples. EEG data
is classified with cross validation, by a majority vote of its neighbors, with the
object being assigned to the class most common amongst its k-nearest-neighbors.\\


\begin{figure}[ht]
\centering
\includegraphics[scale=1.2]{photo1.jpg}
\caption{Sample view of the epileptic seizure dataset}
\label{fig:1}
\end{figure}

\begin{figure}[ht]
\centering
\includegraphics[scale=0.3]{photo2.png}
\caption{EEG curves}
\label{fig:2}
\end{figure}



\section{Πειραματικο σεναριο}\label{s3}
In our study, we have EEG data from 400 patients of the hospital's neurology department. 200 EEG data belong to epileptic seizure patients and the other 200 EEG belong to normal patients. So we have two classes including normal and epilepsy for algorithms. DWT is the extraction method used. Training and testing data has been selected according to cross validation extracted of these data is applied to machine learning algorithms(ANN, SVM, K-NN)~\cite{karlik_comparison_2014} 
\\
\\
\begin{table}[h]\label{tbl:1}
\centering
\begin{tabular}{|c|c|}
\hline
Classifiers & DWT\\
\hline
ANN & 99.75\% \\
\hline
SVM & 99.5\% \\
\hline
K-NN & 100\% \\
\end{tabular}
\caption{Training data set accuracy rates of the classification methods}
\end{table}
\\
\newpage
The tables below show the precision value according to wavelet transform vector size(testing)
\begin{table}[h]\label{tbl:2}
\centering
\begin{tabular}{|c|c|}
\hline
True Epilepsy & True Normal \\
\hline
200 & 1\\
\hline
0 & 199 \\
\end{tabular}
\caption{Prediction Epilepsy with ANN algorithm with accuracy 99.75\%}
\end{table}
\begin{table}[h]\label{tbl:3}
\centering
\begin{tabular}{|c|c|}
\hline
True Epilepsy & True Normal \\
\hline
200 & 2 \\
\hline
0 & 198 \\
\end{tabular}
\caption{Prediction Epilepsy with SVM algorithm with accuracy 99.5\%}
\end{table}
\begin{table}[h]\label{tbl:4}
\centering
\begin{tabular}{|c|c|}
\hline
True Epilepsy & True Normal \\
\hline
200 & 0\\
\hline
0 & 200\\
\end{tabular}
\caption{Prediction Epilepsy with K-NN algorithm with accuracy 100\%}
\end{table}
\newpage
\section{Συμπερασματα}\label{s4}
Epileptic seizure is a serious disorder of the brain which must be prevented in time. For this reason, in this study, we learn how to detect the epileptic seizure. This happens by using the DWT, which is a method of frequency analysis. These method uses machine learning to costruct classifiers that are capable of rapid detection of seizure onset. In the end, the epileptic seizure data set was classified using different machine learning classification algorithms and that's how we now if a person has a seizure or no.


\label{LastPage}

\end{document}



