\documentclass[11pt,twoside]{article}\makeatletter

\IfFileExists{xcolor.sty}%
  {\RequirePackage{xcolor}}%
  {\RequirePackage{color}}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{ifxetex}
\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \catcode`⃥=\active \def⃥{\textbackslash}
  \catcode`❴=\active \def❴{\{}
  \catcode`❵=\active \def❵{\}}
  \def\textJapanese{\fontspec{Noto Sans CJK JP}}
  \def\textChinese{\fontspec{Noto Sans CJK SC}}
  \def\textKorean{\fontspec{Noto Sans CJK KR}}
  \setmonofont{DejaVu Sans Mono}
  
\else
  \IfFileExists{utf8x.def}%
   {\usepackage[utf8x]{inputenc}
      \PrerenderUnicode{–}
    }%
   {\usepackage[utf8]{inputenc}}
  \usepackage[english]{babel}
  \usepackage[T1]{fontenc}
  \usepackage{float}
  \usepackage[]{ucs}
  \uc@dclc{8421}{default}{\textbackslash }
  \uc@dclc{10100}{default}{\{}
  \uc@dclc{10101}{default}{\}}
  \uc@dclc{8491}{default}{\AA{}}
  \uc@dclc{8239}{default}{\,}
  \uc@dclc{20154}{default}{ }
  \uc@dclc{10148}{default}{>}
  \def\textschwa{\rotatebox{-90}{e}}
  \def\textJapanese{}
  \def\textChinese{}
  \IfFileExists{tipa.sty}{\usepackage{tipa}}{}
\fi
\def\exampleFont{\ttfamily\small}
\DeclareTextSymbol{\textpi}{OML}{25}
\usepackage{relsize}
\RequirePackage{array}
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar l\@ne \else
     \if \@nextchar r\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar (8 \else
       \if \@nextchar )9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
   \if \@nextchar p4 \else
    \if \@nextchar b5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}
\gdef\arraybackslash{\let\\=\@arraycr}
\def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\def\abbr{}
\def\corr{}
\def\expan{}
\def\gap{}
\def\orig{}
\def\reg{}
\def\ref{}
\def\sic{}
\def\persName{}\def\name{}
\def\placeName{}
\def\orgName{}
\def\textcal#1{{\fontspec{Lucida Calligraphy}#1}}
\def\textgothic#1{{\fontspec{Lucida Blackletter}#1}}
\def\textlarge#1{{\large #1}}
\def\textoverbar#1{\ensuremath{\overline{#1}}}
\def\textquoted#1{‘#1’}
\def\textsmall#1{{\small #1}}
\def\textsubscript#1{\@textsubscript{\selectfont#1}}
\def\textxi{\ensuremath{\xi}}
\def\titlem{\itshape}
\newenvironment{biblfree}{}{\ifvmode\par\fi }
\newenvironment{bibl}{}{}
\newenvironment{byline}{\vskip6pt\itshape\fontsize{16pt}{18pt}\selectfont}{\par }
\newenvironment{citbibl}{}{\ifvmode\par\fi }
\newenvironment{docAuthor}{\ifvmode\vskip4pt\fontsize{16pt}{18pt}\selectfont\fi\itshape}{\ifvmode\par\fi }
\newenvironment{docDate}{}{\ifvmode\par\fi }
\newenvironment{docImprint}{\vskip 6pt}{\ifvmode\par\fi }
\newenvironment{docTitle}{\vskip6pt\bfseries\fontsize{22pt}{25pt}\selectfont}{\par }
\newenvironment{msHead}{\vskip 6pt}{\par}
\newenvironment{msItem}{\vskip 6pt}{\par}
\newenvironment{rubric}{}{}
\newenvironment{titlePart}{}{\par }

\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}}
\newcolumntype{P}[1]{){\arraybackslash}p{#1}}
\newcolumntype{B}[1]{){\arraybackslash}b{#1}}
\newcolumntype{M}[1]{){\arraybackslash}m{#1}}
\definecolor{label}{gray}{0.75}
\def\unusedattribute#1{\sout{\textcolor{label}{#1}}}
\DeclareRobustCommand*{\xref}{\hyper@normalise\xref@}
\def\xref@#1#2{\hyper@linkurl{#2}{#1}}
\begingroup
\catcode`\_=\active
\gdef_#1{\ensuremath{\sb{\mathrm{#1}}}}
\endgroup
\mathcode`\_=\string"8000
\catcode`\_=12\relax

\usepackage[a4paper,twoside,lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in,marginparwidth=0.75in]{geometry}
\usepackage{framed}

\definecolor{shadecolor}{gray}{0.95}
\usepackage{longtable}
\usepackage[normalem]{ulem}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{marginnote}

\renewcommand{\@cite}[1]{#1}


\renewcommand*{\marginfont}{\itshape\footnotesize}

\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}

  \pagestyle{fancy}

\usepackage[pdftitle={Towards Automated Epileptic Seizure Detection for Lightweight Devices through EEG Signal Processing},
 pdfauthor={}]{hyperref}
\hyperbaseurl{}

	 \paperwidth210mm
	 \paperheight297mm
              
\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}
\clubpenalty=8000
\emergencystretch 3em
\hbadness=4000
\hyphenpenalty=400
\pretolerance=750
\tolerance=2000
\vbadness=4000
\widowpenalty=10000

\renewcommand\section{\@startsection {section}{1}{\z@}%
     {-1.75ex \@plus -0.5ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
     {-1.75ex\@plus -0.5ex \@minus- .2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
     {-1.5ex\@plus -0.35ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\large}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
     {-1ex \@plus-0.35ex \@minus -0.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\normalsize}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
     {1.5ex \@plus1ex \@minus .2ex}%
     {-1em}%
     {\reset@font\normalsize\bfseries}}


\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
 \@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\@ifundefined{c@section}{\newcounter{section}}{}
\@ifundefined{c@chapter}{\newcounter{chapter}}{}
\newif\if@mainmatter 
\@mainmattertrue
\def\chaptername{Chapter}
\def\frontmatter{%
  \pagenumbering{roman}
  \def\thechapter{\@roman\c@chapter}
  \def\theHchapter{\roman{chapter}}
  \def\thesection{\@roman\c@section}
  \def\theHsection{\roman{section}}
  \def\@chapapp{}%
}
\def\mainmatter{%
  \cleardoublepage
  \def\thechapter{\@arabic\c@chapter}
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \pagenumbering{arabic}
  \setcounter{secnumdepth}{6}
  \def\@chapapp{\chaptername}%
  \def\theHchapter{\arabic{chapter}}
  \def\thesection{\@arabic\c@section}
  \def\theHsection{\arabic{section}}
}
\def\backmatter{%
  \cleardoublepage
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \setcounter{secnumdepth}{2}
  \def\@chapapp{\appendixname}%
  \def\thechapter{\@Alph\c@chapter}
  \def\theHchapter{\Alph{chapter}}
  \appendix
}
\newenvironment{bibitemlist}[1]{%
   \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code
        \usecounter{enumiv}%
        \let\p@enumiv\@empty
        \renewcommand\theenumiv{\@arabic\c@enumiv}%
	}%
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m}%
  {\def\@noitemerr
    {\@latex@warning{Empty `bibitemlist' environment}}%
    \endlist}

\def\tableofcontents{\section*{\contentsname}\@starttoc{toc}}
\parskip0pt
\parindent1em
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\newenvironment{reflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemsep}{0pt}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\itshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{sansreflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\itemsep}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\upshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{specHead}[2]%
 {\vspace{20pt}\hrule\vspace{10pt}%
  \phantomsection\label{#1}\markright{#2}%

  \pdfbookmark[2]{#2}{#1}%
  \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}%
  }{}
      \def\TheFullDate{2017-01-15 (revised: 15 January 2017)}
\def\TheID{\makeatother }
\def\TheDate{2017-01-15}
\title{Towards Automated Epileptic Seizure Detection for Lightweight Devices through EEG Signal Processing}
\author{}\makeatletter 
\makeatletter
\newcommand*{\cleartoleftpage}{%
  \clearpage
    \if@twoside
    \ifodd\c@page
      \hbox{}\newpage
      \if@twocolumn
        \hbox{}\newpage
      \fi
    \fi
  \fi
}
\makeatother
\makeatletter
\thispagestyle{empty}
\markright{\@title}\markboth{\@title}{\@author}
\renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
               \topsep 2\p@ plus1\p@ minus1\p@
               \parsep 2\p@ plus\p@ minus\p@
               \itemsep 1pt}
}
\makeatother
\fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm}
\fancyhf{} 
\setlength{\headheight}{14pt}
\fancyhead[LE]{\bfseries\leftmark} 
\fancyhead[RO]{\bfseries\rightmark} 
\fancyfoot[RO]{}
\fancyfoot[CO]{\thepage}
\fancyfoot[LO]{\TheID}
\fancyfoot[LE]{}
\fancyfoot[CE]{\thepage}
\fancyfoot[RE]{\TheID}
\hypersetup{citebordercolor=0.75 0.75 0.75,linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\date{}
\usepackage{authblk}

\providecommand{\keywords}[1]
{
\footnotesize
  \textbf{\textit{Index terms---}} #1
}

\usepackage{graphicx,xcolor}
\definecolor{GJBlue}{HTML}{273B81}
\definecolor{GJLightBlue}{HTML}{0A9DD9}
\definecolor{GJMediumGrey}{HTML}{6D6E70}
\definecolor{GJLightGrey}{HTML}{929497} 

\renewenvironment{abstract}{%
   \setlength{\parindent}{0pt}\raggedright
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
   \textcolor{GJBlue}{\large\bfseries\abstractname\space}
}{%   
   \vskip8pt
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
}

\usepackage[absolute,overlay]{textpos}

\makeatother 
      \usepackage{lineno}
      \linenumbers
      
\begin{document}

             \author[1]{Mst Rafiatul  Jannat}

             \affil[1]{  Shandong University}

\renewcommand\Authands{ and }

\date{\small \em Received: 6 December 2016 Accepted: 5 January 2017 Published: 15 January 2017}

\maketitle


\begin{abstract}
        


Epileptic seizure is considered as one of the severe disorder of the nervous system.The quality of life hampered those have this disorder. An appropriate system which can detect the epilepsy will leverage the quality of life for the affected person. This paper mainly focuses on the development of a novel method to detect real-time epileptic seizure based on lightweight device such as 'Emotiv Epoc'. Weighted Permutation Entropy (WPE) value was computed to segment and extract the features. A threshold based algorithm which optimizes the battery consumption of the epoc device has also been proposed.

\end{abstract}


\keywords{epileptic seizure, k-means clustering, discrete wavelet transform, power optimization.}

\begin{textblock*}{18cm}(1cm,1cm) % {block width} (coords) 
\textcolor{GJBlue}{\LARGE Global Journals \LaTeX\ JournalKaleidoscope\texttrademark}
\end{textblock*}

\begin{textblock*}{18cm}(1.4cm,1.5cm) % {block width} (coords) 
\textcolor{GJBlue}{\footnotesize \\ Artificial Intelligence formulated this projection for compatibility purposes from the original article published at Global Journals. However, this technology is currently in beta. \emph{Therefore, kindly ignore odd layouts, missed formulae, text, tables, or figures.}}
\end{textblock*}


\let\tabcellsep& 	 	 		 \par
Abstract-Epileptic seizure is considered as one of the severe disorder of the nervous system. The quality of life hampered those have this disorder. An appropriate system which can detect the epilepsy will leverage the quality of life for the affected person. This paper mainly focuses on the development of a novel method to detect real-time epileptic seizure based on lightweight device such as 'Emotiv Epoc'. Weighted Permutation Entropy (WPE) value was computed to segment and extract the features. A threshold based algorithm which optimizes the battery consumption of the epoc device has also been proposed. 
\section[{I. Introduction}]{I. Introduction}\par
pilepsy is one of the most common disorders of the nervous system and affects people of all ages, races and ethnic backgrounds. Epileptic seizures are characterized by an unpredictable occurrence pattern and transient dysfunctions of the central nervous system, due to excessive and synchronous abnormal neuronal activity in the cortex \hyperref[b0]{[1]}. This activity could include several neurons of different locations and sizes. The clinical symptoms of epileptic seizures might affect the motor, sensory, and automatic functions of the body along with the consciousness, cognition, and memory of the patient \hyperref[b1]{[2]}. To diagnosis of epilepsy, EEG signal interpretation is considered as the most prominent testing tools due to painless, at a reasonable cost, and efficient temporal resolution of long-term monitoring \hyperref[b2]{[3]}. However for long EEG recording the visual interpretation becomes an expensive, intensive and tedious errorprone exercise and also result can be vary from different neurophysiologists in same recording \hyperref[b3]{[4]}. In a conventional system, EEG recording used to be conducted in well equipped hospitals which required equipments are at least bulky, expensive, and require professional setup and configuration. The development of several sophisticated, lightweight and accurate EEG recording devices with wireless transmission like 'Emotiv Epoc' \hyperref[b14]{[15]} becomes more practical for epileptic patients, offer movement freedom and lowering the infection risks due to percutaneous plugs. The availability of such kind of devices open the door for smartphone based epilepsy care. Today the smartphone has the strong processing capability with high speed wireless connectivity and being extensively used even in low and middle income countries and possible to capture the seizure event and it may serve like a physician having witnessed the event. Now there arises some question such as whether it will satisfy the physician expectation or not, how faster it will give the result against the physician.\par
In this paper we mainly focus on real-time EEG signal processing for epilepsy monitoring. Here we have designed and developed a novel method for preprocessing and classification step which is suitable for real-time epilepsy detection. Our classification algorithm is based on unsupervised learning and it needs to calibrate the system before running the detection. We also propose a method to optimize the power consumption of the portable device using motion detection algorithm.\par
The rest of this paper is organized as follows. Section 2 discusses the review of prior work related to the use of smartphone. Section 3 details the EEG processing pipeline for our approach and its components. Section 4 presents the experimental discussion and the power optimization algorithm, followed by the conclusion in Section 5. 
\section[{II. Related Work}]{II. Related Work}\par
Many researches were done by using offline data form laboratory to improve the feature extraction and classification module. However, a very few real-time work was done with the live EEG data using lightweight devices. In \hyperref[b3]{[4]}, they have evaluated the presently available applications of mobile phones in the day to day care of epileptic patients as a diagnostic, prognostic and therapeutic tool. Currently a variety of apps like the 'epilepsy society app' or 'my epilepsy diary' or 'epilepsy vault' are available in the market which can be used as seizure diaries allowing the patient or the caregiver to record the basic information regarding epilepsy and its management thus increasing awareness regarding the illness. Some sensor based devices such as 'Epdetect' or 'Smartmonitor's Smartwatch' which can be used to detect a seizure in progress by using inbuilt gyroscopic sensors, accelerometers and GPS modules for detecting a seizure and locale of seizure. César et al. \hyperref[b4]{[5]} showed the multi-centre quasiprospective assessment and evaluation of seizure prediction performance on a long-term EEG recording of 278 patients suffering from pharmaco-resistant partial epilepsy, also known as refractory epilepsy. They explained that computational intelligence techniques showed a high potential for seizure prediction.\par
Sang-Hong Lee et al. \hyperref[b5]{[6]} proposed new combined methods to classify normal and epileptic seizure EEG signals using wavelet transform (WT), phase-space reconstruction (PSR), and Euclidean distance (ED) based on a neural network with weighted fuzzy membership functions (NEWFM). From 24 initial extracted features, 4 minimum features with the highest accuracy were selected using a non-overlap area distribution measurement method supported by the NEWFM and this resulted in performance sensitivity, specificity, and accuracy of 96.33\%, 100\%, and 98.17\%, respectively.\par
An efficient feature extraction method was proposed by computing the spectral power of Hjorth's mobility components, which were effectively estimated by differentiating EEG signals in real-time \hyperref[b6]{[7]}. They used five epileptic patients EEG data and resulted in a detection rate of 99.46\% between interictal and epileptic EEG signals and 99.78\% between normal and epileptic EEG signals. Their results suggest that the spectral features of Hjorth's mobility components in EEG signals can represent seizure activity and may pave the way for developing a fast and reliable epileptic seizure detection method.\par
Noha S. Tawfik et al. \hyperref[b7]{[8]} introduced a new automated seizure detection model that integrates Weighted Permutation Entropy (WPE) and a Support Vector Machine (SVM) classifier model to enhance the sensitivity and precision of the detection process. The WPE algorithm relies on the ordinal pattern of the time series along with the amplitudes of its sample points. They implemented and tested on hundreds real EEG signals and the performance is compared based on sensitivity, specificity and accuracy. They did various experiments in different scenarios including healthy with eyes open, healthy with eyes closed, epileptic patients during no-seizure state from two different location of the brain. Their results claimed outstanding performance and revealed promising results in terms of discrimination of seizure and seizure free segments with manifests high robustness against noise sources.\par
In \hyperref[b8]{[9]}, the authors proposed the new features based on the phase space representation (PSR) for classification of epileptic seizure and seizure-free EEG signals. First of all EEG signals were decomposed using empirical mode decomposition (EMD) and then phase space reconstructed for obtained intrinsic mode functions (IMFs). They proposed new features based on the 2D and 3D PSRs of IMFs for classification of epileptic seizure and seizure-free EEG signals. Least squares support vector machine (LS-SVM) employed for classification of epileptic seizure and seizure-free EEG signals, and evaluated its classification performance using different kernels namely, radial basis function (RBF), Mexican hat wavelet and Morlet wavelet kernels.\par
In this work we designed and developed a realtime EEG signal processing using Weighted Permutation Entropy based segmentation and select optimum features from time domain and frequency domain and applied the unsupervised machine learning technique to detect the epileptic seizure. We also proposed a threshold based algorithm to optimize the power consumption of the light weight weight device as Emotiv epoc. 
\section[{III. Materials and Methods}]{III. Materials and Methods}\par
In our study we used CHB-MIT scalp EEG dataset which is publicly available in online \hyperref[b13]{[14]}. This database was collected at the Children's Hospital Boston, consists of EEG recordings from pediatric subjects with intractable seizures. Subjects were monitored for up to several days following withdrawal of anti-seizure medication in order to characterize their seizures and assess their candidacy for surgical intervention. The EEG data were recorded with respect to the international standard 10-20 system. Such recordings were collected from 24 patient subjects where 5 males-aged 3 to 22, 17 females-aged 1.5 to 19 and 1 unknown. All EEG recordings were sampled at 256 Hz with 16-bit resolution. Most files contain 23 EEG signals (24 or 26 in a few cases). In general, the dataset consisted of 916 h of continuously recorded EEG and 198 seizures. All recordings of every patient were divided into 1 h length. According to the annotation files accompanying the dataset, the duration of a seizure was at least 9 s in every EEG recording while the longest seizure was about 190 s long. In this study, we took total 8 minutes where 240 s before the seizure onset for the pre-ictal state and 240 s after the seizure onset for the ictal and post-ictal states from every EEG recoding including 23 channels (figure 2(a)). The whole procedure is shown in figure \hyperref[fig_2]{1}.  
\section[{a) Preprocessing}]{a) Preprocessing}\par
To reduce the computational cost and optimize the memory, firstly we resample the EEG raw data from higher frequency to a smaller frequency 128Hz. Band pass filter and notch filter has been applied to remove the artifacts. First of all we applied low pass filter with 0.1Hz and then followed by high pass filter with 60 Hz frequency. The power line interference has been eliminated by using 50Hz notch filter. This filter has been designed according to \hyperref[b9]{[10]}, the quality factor! is calculated by \hyperref[b0]{(1)} Here frequency f 0 at 50 Hz while the cutoff frequencies f 1 and f 2 at 49 Hz and 51 Hz, respectively. As the filtered signal still nonstationary so we segment the signal using Weighted Permutation Entropy (WPE) value which has been calculated according to \hyperref[b7]{[8,}\hyperref[b10]{11]}. The probability distribution of each pattern with weight ? can be represented as:\par
(2) here is the arithmetic mean of sequence given by: (4) WPE is then computed as:\par
(5)\par
We then obtain individual epochs by extracting the EEG signals in a time window [V,,V-] around each event marker and this WPE value is calculated for each window; any change in the dynamics of the system will be reflected in the variation of WPE with respect to moving window. The window length VW should be greater than N! for a reliable estimation of WPE (Figure 2  The approach to epileptic feature extraction was based on mobility, Fourier transform and wavelet transform. Twenty-five time-domain features were computed for all the selected electrodes, using consecutive 5 s windows without overlap.\par
For generating time-varying spectral features of the differentiated EEG signals, we applied Short-time Fourier transform (STFT). In the STFT analysis, the parameters of the sliding window were optimized, including the window size and the step size. Then we extracted the averaged powers ranging from 2 to 55 Hz with 2-Hz frequency resolution. For each frequency-bin, we calculated the ratio of the averaged power of differentiated signals to that of the original signals.\par
Those calculated ratios of all frequency-bins were constructed as a feature vector into classifiers. A discrete wavelet transform (DWT) was utilized to facilitate efficient time-frequency analysis. The segmented signal is decomposed into a set of coefficients describing the frequency content at given times. According to \hyperref[b11]{[12]}, the DWT can be defined as: (6) \hyperref[b6]{(7)} where is a smoothing operator, is the digital signal is the integral set, and and are coefficients for the corresponding low-pass and highpass filters. As the filtered signal at level i is downsampled, so we reduce the length of the signal at level i ? 1 by a factor of two and generating the detail ( ) and approximation coefficients ( ) at level i. In our work, using Daubechies 4 (DB4) we produced wavelet coefficients, including detail and approximation coefficients at levels 1-4. 
\section[{c) Classification}]{c) Classification}\par
For real time scenario, there is no way to first label or train the data while analyzing live EEG. So we adopted unsupervised classification techniques. That is, these techniques only depend on the information contained in the EEG data. Considering the flexibility of the computation we used K-means clustering technique which partitions the objects into K mutually exclusive clusters, such that objects within each cluster are as close to each other as possible, and as far from objects in other clusters as possible \hyperref[b9]{[10,}\hyperref[b15]{16]}. Grouping similar components of a signal enables physicians to localize seizure states quickly. The K-means algorithm minimizes the within-cluster sum of squares by Lloyd iteration to make the data to the same cluster more compact and dependent: (8) \hyperref[b8]{(9)} The central point of a cluster is recomputed as: \hyperref[b9]{(10)} The overall k-means algorithm summarized as: 1. Initialization a. Define the number of clusters (k) b. Designate a cluster center for each cluster, typically chosen from the available data pints 2. Assign each remaining data pint to the closet cluster centre. That data point is now a member of that cluster. 3. Calculate the new cluster centre from equation \hyperref[b9]{(10)}. 4. Calculate the sum of within-cluster sum of squares from equation \hyperref[b7]{(8)}. If this value has not significantly changed over a certain number of iterations, stop the iterations. Otherwise, go back to step 2. 
\section[{IV. Experimental Results}]{IV. Experimental Results}\par
We have divided the data as healthy (N), interictal (I) and epileptic (E). According to section 3 we have preprocessed and extracted features. These extracted features then fed to the k-means clustering algorithm and we analyzed the results. Our results showed 97.6 \% accuracy. Figure 4 showed the different error rate after applying k-means clustering technique. The statistical measurement showed in Table \hyperref[tab_0]{1}. Y -Z D [ = ? ] Y -Z\textasciicircum ( D [ ? 2 >', à- Z D [ = b ] ]?d Y -Z\textasciicircum ( D [ ? 2 >', ?- Z a -Z D [ , `? e ? ] b ] d i a i f = g(D > , h 3 ) i3 3<, ] ><, g D > , h 3 = (D > ? h 3 ) - ] 3<, h 3 = , i3 D j?i k\par
The Euclidean distance between the ith data point and the jth centroid is defined as follows: Emotiv Epoc device has limited battery life. We have developed a threshold based algorithm which will optimize the battery life (Figure  {\ref :} 3). In this case, user first needs to place his/her smartphone in arm using an arm hand. Then we will use the inbuilt motion sensor to check the frequency of the body movement. If the frequency movement fall under 2-5 Hz then we consider it as an ongoing seizure and we turn on the epoc device for 10 minutes. After 10 minutes the device will turn to sleep mode and send an acknowledgement to smartphone. So the smartphone is again becoming sensing mode and checking the body movement as described above.  
\section[{V. Conclusion}]{V. Conclusion}\par
Monitoring of epilepsy is considered a very challenging activity which requires a set of technical and essential processes including continuous acquisition of EEG signals, pre-processing, feature extraction and selection, seizures detection and classification and continuous visualization of the obtained results. The main contribution of this article lies in developing and implementing an automatic, efficient and scalable approach to monitor the unpredictable occurrence of epileptic seizures in a reasonable time. Our experimental results showed the feasibility to apply our technique in lightweight device such as Emotiv epoc.\begin{figure}[htbp]
\noindent\textbf{}\includegraphics[]{image-2.png}
\caption{\label{fig_0}K}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{}\includegraphics[]{image-3.png}
\caption{\label{fig_1}K}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{1}\includegraphics[]{image-4.png}
\caption{\label{fig_2}Figure 1 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{}\includegraphics[]{image-5.png}
\caption{\label{fig_3}}\end{figure}
    \begin{figure}[htbp]
\noindent\textbf{1} \par 
\begin{longtable}{P{0.45416666666666666\textwidth}P{0.07916666666666666\textwidth}P{0.1375\textwidth}P{0.09583333333333333\textwidth}P{0.08333333333333333\textwidth}}
\multicolumn{5}{l}{Towards Automated Epileptic Seizure Detection for Lightweight Devices through EEG Signal}\\
\tabcellsep \tabcellsep Processing\tabcellsep \tabcellsep \\
\tabcellsep \tabcellsep \tabcellsep \tabcellsep D D D D ) K\\
\tabcellsep \tabcellsep \tabcellsep \tabcellsep (\\
Precision\tabcellsep Recall\tabcellsep F-Measure\tabcellsep ROC Area\tabcellsep Class\\
0.98\tabcellsep 0.985\tabcellsep 0.983\tabcellsep 0.999\tabcellsep N\\
0.97\tabcellsep 0.97\tabcellsep 0.97\tabcellsep 0.997\tabcellsep I\\
0.98\tabcellsep 0.97\tabcellsep 0.975\tabcellsep 0.999\tabcellsep E\end{longtable} \par
 
\caption{\label{tab_0}Table 1 :}\end{figure}
 			\footnote{© 2017 Global Journals Inc. (US)} 			\footnote{Volume XVII Issue 1 Version I © 2017 Global Journals Inc. (US) Year 2017} 			\footnote{© 2017 Global Journals (US)} 			\footnote{Volume XVII Issue 1 Version I © 2017 Global Journals Inc. (US) Year 2017} 		 		\backmatter  			  				\begin{bibitemlist}{1}
\bibitem[ Emotiv EPOC / EPOC+]{b14}\label{b14} 	 		\textit{},  		 \url{https://emotiv.com/epoc.php}  	 	 		\textit{Emotiv EPOC / EPOC+}  		 	 
\bibitem[Noha et al. (2015)]{b7}\label{b7} 	 		‘A hybrid automated detection of epileptic seizures in EEG records’.  		 			S Noha 		,  		 			Tawfik 		,  		 			M Sherin 		,  		 			Mohamed Youssef 		,  		 			Kholief 		.  	 	 		\textit{Computers \& Electrical Engineering}  		 0045-7906.  		28 September 2015.  	 
\bibitem[El Menshawy et al. (2015)]{b9}\label{b9} 	 		\textit{An automatic mobile-health based approach for EEG epileptic seizures detection, Expert Systems with Applications},  		 			Mohamed El Menshawy 		,  		 			Abdelghani Benharref 		,  		 			Mohamed Serhani 		.  		15 November 2015. 42 p. .  	 
\bibitem[Kang et al. (2015)]{b6}\label{b6} 	 		‘An efficient detection of epileptic seizure by differentiation and spectral analysis of electroencephalograms’.  		 			Jae-Hwan Kang 		,  		 			Yoon Gi Chung 		,  		 			Sung-Phil Kim 		.  	 	 		\textit{Computers in Biology and Medicine}  		 0010-4825.  		1 November 2015. 66 p. .  	 
\bibitem[Akben et al. ()]{b2}\label{b2} 	 		‘Analysis of EEG signals under flash stimulation for migraine and epileptic patients’.  		 			S Akben 		,  		 			A Subasi 		,  		 			D Tuncel 		.  	 	 		\textit{Medical Systems}  		2011. 35 p. .  	 
\bibitem[Shoeb (2009)]{b13}\label{b13} 	 		\textit{Application of Machine Learning to Epileptic Seizure Onset Detection and Treatment},  		 			Ali Shoeb 		.  		September 2009.  		 			Massachusetts Institute of Technology 		 	 	 (PhD Thesis) 
\bibitem[Sharma and Pachori (2015)]{b8}\label{b8} 	 		\textit{Classification of epileptic seizures in EEG signals based on phase space representation of intrinsic mode functions, Expert Systems with Applications},  		 			Rajeev Sharma 		,  		 			Ram Bilas Pachori 		.  		15 February 2015. 42 p. .  	 
\bibitem[Lee et al. (2014)]{b5}\label{b5} 	 		‘Classification of normal and epileptic seizure EEG signals using wavelet transform, phase-space reconstruction, and Euclidean distance’.  		 			Sang-Hong Lee 		,  		 			Joon S Lim 		,  		 			Jae-Kwon Kim 		,  		 			Junggi Yang 		,  		 			Youngho Lee 		.  	 	 		\textit{Computer Methods and Programs in Biomedicine}  		 0169-2607.  		August 2014. 116  (1)  p. .  	 
\bibitem[Copyright Holder]{b16}\label{b16} 	 		\textit{Copyright Holder},  		Springer International Publishing Switzerland.  	 
\bibitem[Epilepsy Management at Primary Health Level in rural China: WHO/ILAE/IBE, Demonstration Project]{b1}\label{b1} 	 		\textit{Epilepsy Management at Primary Health Level in rural China: WHO/ILAE/IBE, Demonstration Project},  		 	 
\bibitem[César Alexandre Teixeira et al. (2014)]{b4}\label{b4} 	 		‘Epileptic seizure predictors based on computational intelligence techniques: A comparative study with 278 patients’.  		 			Bruno César Alexandre Teixeira 		,  		 			Mojtaba Direito 		,  		 			Michel Le Bandarabadi 		,  		 			Mario Van Quyen 		,  		 			Bjoern Valderrama 		,  		 			Andreas Schelter 		,  		 			Vincent Schulze-Bonhage 		,  		 			Francisco Navarro 		,  		 			António Sales 		,  		 			Dourado 		.  	 	 		\textit{Computer Methods and Programs in Biomedicine}  		 0169- 2607.  		May 2014. 114  (3)  p. .  	 
\bibitem[Ngugi et al. ()]{b0}\label{b0} 	 		‘Incidence of epilepsy: A systematic review and meta-analysis’.  		 			A Ngugi 		,  		 			S Kariuki 		,  		 			C Bottomley 		,  		 			I Kleinschmidt 		,  		 			J Sander 		,  		 			C Newton 		.  	 	 		\textit{Neurology}  		2011. 77  (10)  p. .  	 
\bibitem[Lakshmi Narasimhan Ranganathan et al. (2015)]{b3}\label{b3} 	 		‘Man Mohan Mehndiratta, Application of mobile phones in epilepsy care’.  		 			Lakshmi Narasimhan Ranganathan 		,  		 			Balasubramanian Somasundaram Aadhimoolam Chinnadurai 		,  		 			Bhanu Samivel 		,  		 			Kesavamurthy 		.  	 	 		\textit{International Journal of Epilepsy}  		 2213-6320.  		January-June 2015. 2  (1)  p. .  	 
\bibitem[Zhu et al. ()]{b15}\label{b15} 	 		\textit{Unsupervised Classification of Epileptic EEG Signals with Multi Scale K-Means Algorithm, Brain and Health Informatics},  		 			Guohun Zhu 		,  		 			Yan Li 		,  		 			( Peng 		,  		 			Shuaifang Paul) Wen 		,  		 			Ning Wang 		,  		 			Zhong 		.  		 \xref{http://dx.doi.org/10.1007/978-3-319-02753-1_16}{10.1007/978-3-319-02753-1\textunderscore 16}.  		October 29-31, 2013. 8211 p. .  	 
\bibitem[Rafiee et al. ()]{b12}\label{b12} 	 		‘Wavelet basis functions in biomedical signal processing’.  		 			J Rafiee 		,  		 			M A Rafiee 		,  		 			N Prause 		,  		 			M P Schoen 		.  	 	 		\textit{Expert Syst. Appl}  		2011. 38 p. .  	 
\bibitem[Fadlallah et al. ()]{b10}\label{b10} 	 		‘Weighted permutation entropy: a complexity measure for time series incorporating amplitude information’.  		 			B Fadlallah 		,  		 			B Chen 		,  		 			A Keil 		,  		 			J Principe 		.  	 	 		\textit{Phys Rev}  		2013. 87.  	 
\bibitem[Mallat ()]{b11}\label{b11} 	 		‘Zero crossings of a wavelet transform’.  		 			S Mallat 		.  	 	 		\textit{IEEE Trans. Inf. Theory}  		1991. 37  (4)  p. .  	 
\end{bibitemlist}
 			 		 	 
\end{document}
