<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Automatic detection of interictal spikes using data
mining models. Journal of neuroscience methods</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Analysis of Electroencephalograms: Application of Artificial Neural Networks for Detection of Epileptic Discharges</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Rokas Mykolas Deveikis</string-name>
          <email>rokas.deveikis@mif.stud.vu.lt</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tadas Meškauskas</string-name>
          <email>tadas.meskauskas@mif.vu.lt</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Mathematics and Informatics, Vilnius University</institution>
          ,
          <country country="LT">Lithuania</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2006</year>
      </pub-date>
      <volume>150</volume>
      <issue>1</issue>
      <fpage>105</fpage>
      <lpage>110</lpage>
      <abstract>
        <p>- Algorithms based on multilayer feedforward and recurrent neural networks were employed to automatically detect epileptic discharges (spikes) in unprocessed electroencephalograms (EEG). Results were compared to two separate benchmarks: analysis provided by an expert and output of algorithm based on mathematical morphological filters [3]. Feedforward neural network was able to on average detect ~95% of spikes detected by the expert and ~60% of spikes detected by an aforementioned algorithm. Recurrent neural network was able to on average detect ~93% and 80% spikes respectively. While in some cases artificial neural network was able to outperform algorithm based on morphological filter in terms of detected spikes, the main issue remains the high number of false positives and in particular low-amplitude spike-like waveforms that cannot be utilised for diagnostic purposes.</p>
      </abstract>
      <kwd-group>
        <kwd>Electroencephalograms</kwd>
        <kwd>Epileptiform discharge</kwd>
        <kwd>Artificial neural network</kwd>
        <kwd>Machine Learning</kwd>
        <kwd>Epilepsy</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>Early and accurate diagnostics of epilepsy is one of the key
factors in order to prescribe proper treatment and improve the
quality of life for patients and caretakers alike.
Electroencephalograms (EEG) remain one of the main tools
used for diagnostic purposes and can be accurately analysed by
professionals; however, such process is time consuming and
inefficient. While many algorithms are employed to support
manual EEG analysis, issues like classification quality or
inflexibility still limit practical application.</p>
      <p>
        Despite that currently there are many algorithms designed
for automatic EEG analysis, in many cases it’s still done
manually by visually inspecting recording [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Given that EEG
recordings can last from few minutes to several hours,
nonetheless are composed of 21 or more channels and can be
affected by various noises [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], such analysis remains difficult
and time consuming. While aforementioned algorithms
certainly help in EEG analysis, they are not always reliable to
identify elements of interest and in most cases are hardcoded to
detect specific elements thus making them non-reusable for
other diagnostic purposes (see [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]).
      </p>
      <p>The main purpose of this research is to analyse how
Copyright held by the author(s).
machine learning and in particular artificial neural networks
can be employed for the automatic EEG analysis. The main
motivation behind selection of this method is an opportunity to
develop an algorithm that can potentially solve problems
mentioned earlier and improve identification of various EEG
elements. Nonetheless, it would be much easier to adjust such
algorithm for diagnostic of other medical conditions. Case
study is done with spikes common to benign childhood
epilepsy with centrotemporal spikes (referred as Rolandic
epilepsy from now on), yet described methods can potentially
be applied for diagnostic purposes of other types of epilepsy
and brain injuries alike.</p>
      <p>The paper is organized into three main parts: first of all we
will discuss the current state of research in an automatic EEG
analysis. Secondly we will describe data collection and
preparation procedures as well as main research methods.
Finally we will present how multilayer feedforward neural
network and recurrent neural network was able to deal with
aforementioned research goals.</p>
    </sec>
    <sec id="sec-2">
      <title>II. RELATED WORK</title>
      <p>
        Idea to develop algorithm for automatic EEG analysis dates
back to 1970s. In 1972 Carrie JR. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] published paper
describing one of the first automatic algorithms aimed to detect
epileptic discharges (also called spikes) visible in EEG.
Algorithm was based on calculation of certain spike features,
namely specifications of spike peak and sharpness. Later
Guedes de Oliveira, et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] described method to identify EEG
spikes based on spike curves and a certain threshold was
applied to separate spikes from non-spikes. One of more recent
works was published by A.V. M. Misiūnas, et al. where
mathematical morphological filters were employed to identify
EEG spikes associated with Rolandic epilepsy [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Based on
expert evaluations – this algorithm is able to identify ~90%
EEG spikes. This algorithm was also used in this paper for
comparison purposes.
      </p>
      <p>While aforementioned algorithms present good results in
certain cases they all face several issues:
1) Sensitivity to noise. In most cases results are highly
affected by noise, which highly depends not only on how
recording was performed but on device itself</p>
      <sec id="sec-2-1">
        <title>2) Being hardcoded for one specific problem. Therefore</title>
        <p>application for other purposes remains limited and in many
cases – impossible.</p>
        <p>
          Machine learning algorithms (and especially artificial
neural networks) are in many cases employed to address
similar problems. Main advantage of such method is that it’s
not necessary to specify spike duration and morphology [8]
therefore neural network can be quickly adjusted (trained) to
analyse signals recorded with different electroencephalographs
and employed to detect spikes with different durations and
morphologies. Research related to application of neural
networks for EEG analysis can mostly fall within two distinct
categories: pre-processed EEG data (see. Gabor and Seyal,
1992 [
          <xref ref-type="bibr" rid="ref10">11</xref>
          ]; Webber et al., 1996 [9]) and raw EEG data (see
Ozdamar and Kalayci, 1998 [
          <xref ref-type="bibr" rid="ref9">10</xref>
          ]). Ozdamar and Kalayci was
able to design a neural network that can correctly classify EEG
elements (with main purpose of spike-detection) with
sensitivity of ~94%, however Webber et al. [9] was not able to
replicate such results (and found true positives to be ~76% and
sensitivity ~40%).
        </p>
        <p>
          Cheng-We and Hsiao-Wen [
          <xref ref-type="bibr" rid="ref11">12</xref>
          ] used feedforward neural
network composed of 3 layers (with 30, 6 and 1 neuron
accordingly). They also tried to replicate research of Ozdamar
and Kalayci [
          <xref ref-type="bibr" rid="ref9">10</xref>
          ] and concluded that initial results was possibly
biased due to errorous data preparation. One of the main issues
authors encountered is overemphasis on 10th neuron. Authors
argue that this happened due to fixed location of spike centres,
where 10th element of supplied time-series always aligned to
spike centre, thus resulting I high numbers of false positives.
Authors tried to train neural network with varying coordinates
of spike centre relative to analysed section, yet were
unsuccessful to achieve satisfactory results and concluded that
at that point in time computing technologies were not viable to
apply neural networks for EEG analysis. Nonetheless this
emphasizes importance of data preparation and training
strategy.
        </p>
        <p>
          While it‘s rather difficult to analyse raw EEG data, much
better results were achieved while working with pre-processed
datasets. Nigam, and Graupe [
          <xref ref-type="bibr" rid="ref20">21</xref>
          ] employed feedforward
neural networks for spike detection, however signal was
preprocessed with non-linear filters. Authors were able to achieve
~96% classification accuracy thus implying that data
preprocessing is a good alternative. However, given that such
filters must be individually prepared for different EEG this
method has the same issues as discussed in previous chapters
therefore it’s not further analysed in this paper.
        </p>
        <p>III. CHARACTERISTICS OF ROLANDIC EPILEPSY EEG
SPIKES AND DATA COLLECTED FOR THIS REASERCH</p>
      </sec>
      <sec id="sec-2-2">
        <title>A. EEG spikes specific for Rolandic epilepsy</title>
        <p>
          Rolandic epilepsy is one of the most common types of
childhood epilepsy with ~23% of early school age (mean age
~7 years) children being affected [
          <xref ref-type="bibr" rid="ref12">13</xref>
          ]. In most cases, the
disease affects boys more than girls (with ration 5 to 1). EEG
readings of patients diagnosed with this type of epilepsy have
distinct sharp waveforms also called spikes. A typical spike is
characterized by high amplitude (more than twice higher than
average amplitude of normal brain activity prior spike) and
change of phase (see [
          <xref ref-type="bibr" rid="ref12">13</xref>
          ], [
          <xref ref-type="bibr" rid="ref13">14</xref>
          ]). There are also non-typical
EEG elements associated to epileptic discharges yet given that
those only constitute from 1% to 7% of all cases (see [
          <xref ref-type="bibr" rid="ref14">15</xref>
          ],
[
          <xref ref-type="bibr" rid="ref15">16</xref>
          ]); therefore, those are not further investigated. While
aforementioned spikes might slightly differ, common spike
characteristics remains similar among different patients.
        </p>
        <p>
          Spikes can be classified into two main categories based on
duration [
          <xref ref-type="bibr" rid="ref21">22</xref>
          ]:
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Spikes – duration of 20 – 70 ms.</title>
    </sec>
    <sec id="sec-4">
      <title>Sharp waves – duration of 70 – 200 ms.</title>
      <p>Both can be described as short term elements, clearly
distinguishable from normal brain activity with the main
component having negative phase in most cases. Both (spike
and sharp waves) have similar initial (or elevation) stage;
however, sharp waves have longer demotion stage. In this
paper spikes are not distinguished from sharp waves and are
analysed together.</p>
      <p>
        Second distinct characteristic can be defined as a
combination of three key measurements: amplitude, duration
and sharpness. Frost J.D. [
        <xref ref-type="bibr" rid="ref16">17</xref>
        ] analysed aforementioned
characteristics among spikes with a duration up to 70 ms and
developed CPS (composite spike parameter) index that can
help to detect Rolandic EEG spikes. The author defined
sharpness as second derivative of voltage at spike peak and
normalized by amplitude. Among all spikes analysed by author
mean values of amplitude, duration and sharpness were
160,9μV, 74ms. and 0.022 respectively.
      </p>
      <sec id="sec-4-1">
        <title>B. Data description and preparation</title>
        <p>For this research EEG readings of 20 patients was used.
Among those data of 3 patients was analysed by expert. In each
of the files aforementioned expert (a paediatric neurologist)
marked spikes and elements that visually resemble spikes but
are definitely not. In total coordinates of 499 spikes were
collected.</p>
        <p>Considering spike characteristics discussed previously, also
given that sharp waves and spikes can be both associated with
Rolandic epilepsy – a fixed spike length of 200 ms (maximum
length of sharp wave) will be used in this research. Nonetheless
sub-elements will not be separated in any way and will be
treated as one typical epileptic discharge associated with
Rolandic epilepsy. EEG readings used in this paper was
presented in .edf (European data format) type files recorded in
256Hz sample rate (1 element in time series is equal to 3.90625
ms). Further data analysis was done in fixed-duration sections.
In order to prepare such sections, 200 ms. (maximum spike
duration used in this research) was approximated to 50
elements in time series or roughly 196 ms. Each section with
spike was prepared by choosing 25 elements backwards from
spike centre and 25 elements forward, thus ensuring that spike
centre (peak) and centre of section will align.</p>
        <p>While expert tried to mark spikes at the exact centre it was
proven to be difficult to point exact coordinates, therefore data
was further post-processed by shifting positions of spike
centres to lowest voltage value in the section. While
theoretically spike peaks can have positive phase it was not the
case for this data therefore no further adjustments was done.
Example is presented in figure 1</p>
        <p>FIG 1. EXAMPLE OF INITIAL (SOLID VERTICAL LINE) AND
ADJUSTED (DASSHED VERTICAL LINE) SPIKE CENTERS</p>
        <p>
          Waveforms that morphologically resemble spikes, however
have lower amplitude, were not included to initial sample.
Those can be considered a non-typical spikes. While those
sometimes can be associated with Rolandic epilepsy, however,
as discussed with expert, final diagnosis is never based on such
“non-typical“ elements. Summary of amplitude characteristics
of all spikes is presented in table I where it is evident that
average amplitude is approximately 12% lower when
compared to research of Frost J.D. [
          <xref ref-type="bibr" rid="ref16">17</xref>
          ] with ~35% lower
standard deviation. Both can be explained by usage of different
measuring device, however deviations remains insignificant.
        </p>
        <p>
          As discussed in previous chapter data pre-processing can
potentially improve detection quality, however we decided to
keep it to a minimum, mostly because EEG data pre-processing
methods used for feature extraction or denoising are in most
cases designed to work with specific data (eg.
Electrooculogram (EOG) induced noise can be successfully
removed in pre-procesing stage by applying regression based
methods [
          <xref ref-type="bibr" rid="ref22">23</xref>
          ] or filters based on independent component
analysis [
          <xref ref-type="bibr" rid="ref23">24</xref>
          ] however such approach requires to have data with
separate EOG measurements which is not always available).
However, main purpose of this research is to develop algorithm
that can be employed to analyse data from various sources with
minimal adjustments as well as to potentially work with
extraction of other EEG features. Nonetheless, working with
raw EEG allows to evaluate neural network’s ability to deal
with variability in data. Considering aforementioned arguments
only 50Hz notch filter was applied in order to reduce noise
created by power supply.
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>IV. NEURAL NETWORK DESIGN In this paper we employ and compare two neural network architectures: multi-layered feedforward neural network and recurrent neural network based on LSTM model.</title>
      <sec id="sec-5-1">
        <title>A. Training data</title>
        <p>As discussed in paragraph III data from 3 patients and 4
EEG channels were used for initial training of neural networks.
Given that main purpose of this analysis is to be able to
identify spikes in full EEG channel data was prepared in
following manner. Each channel was divided into sections each
consisting of 50 elements based on rolling window i.e. each
section starts with element n and ends at n+50 while next
section starts at n+1 and ends at n+1+50. Under such rules each
channel is represented by number of sections equal to number
of elements in channel.</p>
        <p>In the next step segments was classified into two main
categories with corresponding numeric values:
0.</p>
      </sec>
      <sec id="sec-5-2">
        <title>Non-spikes</title>
      </sec>
      <sec id="sec-5-3">
        <title>1. Spikes</title>
        <p>Data of full EEG channel was used for training. Each
section was classified as spike, if centre of that section falls
within interval:</p>
        <p>[v – Section size * 0,425; v + section size* 0, 425]</p>
        <p>Where v – centre of actual spike, section size – section size
or in this case 200 ms.</p>
        <p>Coefficient 0,425 represents 42,5 % and is calculated under
main assumption that at least ¾ of spike must be visible in
order to correctly classify segment it as spike. Therefore
(assuming that all elements of specific segment falls within
interval [0 ms.; 200 ms.] with spike centre being at 100 ms.)
the earliest point when ¾ of shortest possible spike (20ms) can
be visible in this segment is when x coordinate of spikes’
centre is equal to 15 ms. (3/4 * 20 ms. = 15 ms.) and latest
point is 185 ms. (200 ms. – 15 ms.). This gives interval of [15
ms.; 185 ms.] or ~21 element. Summary of data used for
training is presented in TABLE II.</p>
      </sec>
      <sec id="sec-5-4">
        <title>B. Measuring Classification quality</title>
        <p>At this point it‘s important to establish criteria to evaluate
algorithm performance. Typical binary classification accuracy
is not suitable here for several reasons:</p>
        <p>First of all, given that in typical 60 second EEG channel
(that is consisted of 15360 segments), only less than 1% of
those segments can be typically classified as spikes, simple
binary accuracy will provide relatively good results despite that
spikes was not necessarily found. Nonetheless main purpose of
such algorithms is spike detection. Also when using binary
classification accuracy, a case where multiple sections was
detected next a single spike, is treated in a same manner as
when multiple sections were detected next to different spikes.
Yet again – given that main purpose is to detect all spikes this
would not represent desired performance.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Therefore 3 main criteria was defined:</title>
      <sec id="sec-6-1">
        <title>1) Ratio of all detected spikes with spikes detected by</title>
        <p>expert (true spikes)</p>
      </sec>
      <sec id="sec-6-2">
        <title>2) Elements (group of sections) falsely classified as spikes</title>
      </sec>
      <sec id="sec-6-3">
        <title>3) Spikes falsely classified as non-spikes</title>
        <p>Given that exact coordinates of spikes were well-known
following methodology was employed:
1)</p>
        <p>All algorithms were design in a way that only sections
that were classified as spikes will be outputted. If
section was classified as spike it‘s coordinate is
adjusted in following manner:</p>
        <p>xn = xo + section size / 2
where xn – new coordinate of segment;
xo – old coordinate of segment (number of first
element);
section size – 200 ms
2) Each xn is then compared to known spike coordinates.</p>
        <p>Whenever it falls within aforementioned interval of:
[v – section size * 0,425; v + section size* 0, 425]</p>
        <p>(where v – centre of actual spike)
that section is considered correctly classified and spike
is considered detected.</p>
        <p>According to our evaluation methodology - each spike can
be only detected once, therefore more sections (classified as
spikes) around single spike will not inflate result. All sections
outside interval are classified as non-spikes. Those sections
were further grouped in order to assess number of false
positives where each group was composed of up to 42 sections
starting from first false positive section, with last one being not
further than 42 elements while ignoring true positives.</p>
      </sec>
      <sec id="sec-6-4">
        <title>C. Application of Multilayer Feedforward Neural Network</title>
        <p>In order to design optimal structure of neural network
(number of neurons in hidden layers) a k-fold cross validation
was employed (with k = 3). Due to non-standard measurement,
data was not shuffled but instead neural network was trained
with data from two patients, while tested on data from third
one. As in typical cross validation such technique was repeated
3 times. In order to have a starting point several researches
were taken into consideration:</p>
        <p>
          Based on research by Cheng-Wen Ko and Hsiao-Wen Chu
[
          <xref ref-type="bibr" rid="ref11">12</xref>
          ] a network architecture consisting of 3 layers with 30
(segment size), 6 and 1 neurons accordingly were chosen;
        </p>
        <p>
          Cheng-wen et. al. [
          <xref ref-type="bibr" rid="ref17">18</xref>
          ] used four layered neural network
with 4,5 and 1 neurons (input layer is excluded since it always
holds number of neurons equals to segment size)
        </p>
        <p>
          Weng and Khorasani [
          <xref ref-type="bibr" rid="ref18">19</xref>
          ] used four layered neural network
with 9, 90 and 1 neurons.
        </p>
        <p>
          Mirchandani and Cao [
          <xref ref-type="bibr" rid="ref19">20</xref>
          ] presented an idea that number of
neurons in hidden layer can be calculated using following
formula:
        </p>
        <p>H = log2 M</p>
        <p>Where H – number of neurons in hidden layer, M – largest
number of linear separable regions in input data (in this M = 50
– 1 = 49).</p>
        <p>Using aforementioned researches as a starting point and
employing k-fold cross validation optimal feedforward network
architecture was found to be 4 layers with following
distribution of neurons in each corresponding layer: 50, 25, 90,
1. Averaged results of cross validation is presented in table III
(TP and FP refers to True Positives and False Positives
respectively).</p>
        <p>While algorithm was able to detect ~95% spikes detected
by expert, there were ~30% of segments (not spikes) falsely
classified as spikes. Nonetheless ~48% difference of FP and TP
segments in channels indicated that results are highly
dependent upon channel. Nonetheless at this point analysis was
only performed on 3 EEG files therefore results are not good
representation of algorithm’s performance.</p>
        <p>In order to expand analysis results from single channel
were further processed. In order to ensure that each false
positive segment will represent a new spike results were
grouped. First of all true positives were properly identified and
matched to corresponding spikes. Then each false positive is
grouped so that each group was filled with segments that are no
further from the false positive (that is not part of any other
group) than 50 elements. E.g. whenever segment is classified
as false positive a new group is formed where that segment is a
first group member and all other segments that are distanced no
more than 50 elements from the first one are assigned to the
same group. One distant segment can have its’ own group.</p>
        <p>T3 channel of patient 2 was further processed using
aforementioned technique thus resulting in 53 false positive
groups that will be referred as 53 false positives from now on.
Further analysis of false positives revealed that such elements
can be classified into 3 main categories:</p>
      </sec>
      <sec id="sec-6-5">
        <title>1) Segments that are close to spike, however falls outside</title>
        <p>pre-defined range.</p>
      </sec>
      <sec id="sec-6-6">
        <title>2) Spike-like waveforms with low amplitude</title>
      </sec>
      <sec id="sec-6-7">
        <title>3) Elements that are not related to spikes</title>
        <p>Technically 1st group is classified correctly, however given
that spike peak is on the edge of the segment (at least 3/4 of
spike is not visible) it would be impossible to tell without any
further references that this is actually a spike therefore such
elements won‘t be included or reclassified. See fig.2 for
example.</p>
        <p>
          FIG 2. BARELY VISIBLE SPIKE CLASSIFIED AS FALSE POSITIVE
Despite all efforts – due to low amount of high quality data
it is difficult to came up to conclusions therefore data sample
(of 3 patients) was increased by 17 more EEG files without
spike coordinates. To prepare more results for validation an
algorithm based on morphological filters were employed [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ].
All 17 files were analysed and results were compared with ones
produced by algorithm based on neural network. Comparison
was done in the same manner as previously discussed.
        </p>
        <p>Summary of results are presented in table IV. All numbers
(True positives or false positives) are in relation to results of
algorithm based on morphological filters. Also 3 channels,
where aforementioned algorithm identified less than 10 spikes,
were removed from final results.
max
99%
100%</p>
        <p>On average feedforward neural network was able to detect
60% of spikes, detected by algorithm based on mathematical
morphological filters, however a lot of elements were falsely
identified as spikes (average of ~78%). Nonetheless in 11 out
of 17 (with 3 channels removed from initial sample) cases
neural network was able to detect more than 50% spikes with
86% detected spikes on average.</p>
        <p>At this point false several examples of positives were sent
to expert for detailed analysis. Due to limited time and
resources expert was able to analyse only 12 false positives
however this potentially reveals certain trend. Among 12
results were distributed in following order:


</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>2 were identified as spikes</title>
    </sec>
    <sec id="sec-8">
      <title>2 were identified as non-spikes</title>
    </sec>
    <sec id="sec-9">
      <title>8 were identified as either spike-like waveforms with low amplitude or true spikes, however expert was not able to correctly classify those with certainty.</title>
      <p>FIG 2. EXAMPLE OF SPIKE (CICRLED ON THE LEFT SIDE) AND
LOW AMPLITUDE SPIKE-LIKE WAVEFORM (ON THE RIGHT)</p>
      <p>Therefore we conclude that the main problem remains low
amplitude or low sharpness spike-like waveforms that are
constantly identified as spikes although are unwanted for
diagnostic purposes.</p>
      <p>To sum up we conclude that multilayer feedforward neural
network can potentially be used for primary analysis of EEG
with a purpose to identify spikes associated with Rolandic
epilepsy and can detect ~60% of spikes on average when
comparing with algorithm based on morphological operations
or ~95% when comparing to data prepared by expert. However
main problem remains low amplitude, spike-like waveforms
identified as spikes that can potentially be removed by certain
filters. Finally, algorithm discussed in this paragraph did not
detected spikes in channels where there potentially were no
spikes (or low number of spikes, eg. 1).</p>
      <sec id="sec-9-1">
        <title>D. Recurrent Neural Network</title>
        <p>Given that too many low-amplitude spike-like waveforms
were falsely classified as spikes, a recurrent neural network
was employed to address this issue. Main rationale for this type
of neural network is that it captures information from previous
elements therefore it‘s actually possible to estimate spike
amplitude relative to the background brain activity.</p>
        <p>
          Jezusefovich et. al [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] analysed more than 10000 recurrent
neural network architectures and proven that there is no
alternative that can consistently outperform LSTM model and
GRU (gated recurrent unit). While there are not many
researches where LSTM was applied for EEG analysis,
considering previous statement this model was selected as
potentially offering the best performance.
        </p>
        <p>While working with the same data, first step was to identify
optimal network architecture. Same three-fold cross validation
was applied as previously discussed with feedforward neural
network. Optimal network depth (layers) was proven to be 1
input layer, 2 LSTM layers and 1 output layer (feedforward
neural network). Each LSTM layers had 90 units (also referred
as cells). Results of cross validation (when algorithm output
was compared to analysis performed by expert) are presented
in Table V. Only results of network with aforementioned
optimal structure is included. It is evident that while recurrent
neural network performed slightly worse in comparison to
feedforward neural network (eg.93% detected spikes versus
95%), deviation is minor and given low number of test and
training samples in each case we conclude that there are no
major differences in performance when testing on similar type
of data.</p>
        <p>
          Furthermore, research was repeated in a same manner as
previously (compared to results of algorithm based on
morphological filters [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]). Data of same 20 patients were used.
Results are presented in TABLE VI. Same as previously - all
numbers (True positives or false positives) are in relation to
results of algorithm based on morphological filters. Also 3
channels where aforementioned algorithm identified less than
10 spikes was excluded.
        </p>
        <p>At this point recurrent neural network was able to
detect mores spikes on average, however at the expense of
false positives with a small increase from 78% to 81%. After
visual analysis of false positives it was clear that same low
amplitude waveforms are dominant in this group as well
therefore it is evident that shift from feedforward to recurrent
neural network alone can’t significantly improve results.</p>
      </sec>
    </sec>
    <sec id="sec-10">
      <title>V. RESULTS AND DISCUSSION</title>
      <p>Two algorithms aimed to detect spikes in unprocessed EEG
data were analysed in this research.</p>
      <p>The algorithm based on recurrent neural network was able
to on average detect 78% of spikes (see table VI) when
comparing results to an algorithm based on mathematical
morphological filters. Also, it outperformed algorithm based on
feedforward neural network by ~10% (see table V) on average
in terms of detected spikes, but increased number of false
positives by 3% on average. While neither algorithm developed
in this paper is sufficient on its’ own for diagnostic purposes,
neural networks can be used for data preparation or primary
analysis.</p>
      <p>While neural networks can effectively classify EEG spikes
in some cases, the main issue is false positives and in particular
- low amplitude spike-like waveforms (see figure 2). While in
some cases such waveforms can be classified as spikes, those
are not used for diagnostic purposes thus are undesirable and
should be removed from the result set. It can possibly be
achieved by applying amplitude based filters thus making such
combined algorithm an effective tool for EEG analysis,
however, this is beyond scope of this paper and is
recommended for future research.</p>
    </sec>
    <sec id="sec-11">
      <title>ACKNOWLEDGMENT</title>
      <p>We deeply acknowledge paediatric neurologist MD Rūta
Samaitienė for her input and expertise related to epilepsy and
data collection efforts. Also, I would like to thank MSc
Andrius Vytautas Misiukas Misiūnas for support and
methodological guidance.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>EEG SIGNAL</given-names>
            <surname>PROCESSING. Saeid Sanei</surname>
          </string-name>
          and
          <string-name>
            <surname>J.A</surname>
          </string-name>
          . Chambers Centre of Digital Signal Processing Cardiff University, UK
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Samaitienė</surname>
            <given-names>R.</given-names>
          </string-name>
          <article-title>Rolando epilepsija sergančiu vaiku EEG pakitimu, miego bei elgesio sutrikimu ir klinikiniu charakteristikų sąsajos</article-title>
          .
          <source>Vilniaus universitetas</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Misiūnas</surname>
            ,
            <given-names>A. V. M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Meškauskas</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Juozapavičius</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <article-title>On the implementation and improvement of automatic EEG spike detection algorithm</article-title>
          .
          <source>In: Proceedings of the Lithuanian Mathematical Society</source>
          , Ser. A, Lietuvos matematikos rinkinys,
          <volume>56</volume>
          , pp.
          <fpage>60</fpage>
          -
          <lpage>65</lpage>
          ,
          <year>2015</year>
          . ISSN:
          <fpage>0132</fpage>
          -
          <lpage>2818</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4] Wilson,
          <string-name>
            <given-names>S. B.</given-names>
            , &amp;
            <surname>Emerson</surname>
          </string-name>
          ,
          <string-name>
            <surname>R.</surname>
          </string-name>
          (
          <year>2002</year>
          ).
          <article-title>Spike detection: a review and comparison of algorithms</article-title>
          .
          <source>Clinical Neurophysiology</source>
          ,
          <volume>113</volume>
          (
          <issue>12</issue>
          ),
          <fpage>1873</fpage>
          -
          <lpage>1881</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Carrie</given-names>
            <surname>JR</surname>
          </string-name>
          .
          <article-title>A hybrid computer technique for detecting sharp EEG transients</article-title>
          .
          <source>Electroencephalography and clinical Neurophysiology</source>
          <year>1972</year>
          ;
          <volume>33</volume>
          (
          <issue>3</issue>
          ):
          <fpage>336</fpage>
          -
          <lpage>8</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>De</given-names>
            <surname>Oliveira</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. G.</given-names>
            ,
            <surname>Queiroz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            , &amp;
            <surname>Da Silva</surname>
          </string-name>
          ,
          <string-name>
            <surname>F. L.</surname>
          </string-name>
          (
          <year>1983</year>
          ).
          <article-title>Spike detection based on a pattern recognition approach using a microcomputer</article-title>
          .
          <source>Electroencephalography and clinical neurophysiology</source>
          ,
          <volume>56</volume>
          (
          <issue>1</issue>
          ),
          <fpage>97</fpage>
          -
          <lpage>103</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Jozefowicz</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zaremba</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Sutskever</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>An empirical exploration of recurrent network architectures</article-title>
          .
          <source>In Proceedings of the 32nd International Conference on Machine Learning (ICML-15)</source>
          (pp.
          <fpage>2342</fpage>
          -
          <lpage>2350</lpage>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Webber</surname>
            ,
            <given-names>W. R. S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lesser</surname>
            ,
            <given-names>R. P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Richardson</surname>
            ,
            <given-names>R. T.</given-names>
          </string-name>
          , &amp; Wilson,
          <string-name>
            <surname>K.</surname>
          </string-name>
          (
          <year>1996</year>
          ).
          <article-title>An approach to seizure detection using an artificial neural network (ANN)</article-title>
          .
          <source>Electroencephalography and clinical Neurophysiology</source>
          ,
          <volume>98</volume>
          (
          <issue>4</issue>
          ),
          <fpage>250</fpage>
          -
          <lpage>272</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Ozdamar</surname>
            <given-names>O</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kalayci</surname>
            <given-names>T.</given-names>
          </string-name>
          <article-title>Detection of spikes with artificial neural networks using raw EEG</article-title>
          .
          <source>Comput Biomed Res</source>
          <year>1998</year>
          ;
          <volume>31</volume>
          :
          <fpage>122</fpage>
          -
          <lpage>142</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Gabor</surname>
            ,
            <given-names>A. J.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Seyal</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>1992</year>
          ).
          <source>Automated interictal EEG spike detection using artificial neural networks. Electroencephalography and clinical Neurophysiology</source>
          ,
          <volume>83</volume>
          (
          <issue>5</issue>
          ),
          <fpage>271</fpage>
          -
          <lpage>280</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Beritelli</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Capizzi</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sciuto</surname>
            ,
            <given-names>G.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Napoli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Scaglione</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>2018</year>
          )
          <article-title>Automatic heart activity diagnosis based on gram polynomials and probabilistic neural networks</article-title>
          .
          <source>Biomedical Engineering Letters</source>
          ,
          <volume>8</volume>
          (
          <issue>1</issue>
          ), pp.
          <fpage>77</fpage>
          -
          <lpage>85</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Ko</surname>
            ,
            <given-names>C. W.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Chung</surname>
            ,
            <given-names>H. W.</given-names>
          </string-name>
          (
          <year>2000</year>
          ).
          <article-title>Automatic spike detection via an artificial neural network using raw EEG data: effects of data preparation and implications in the limitations of online recognition</article-title>
          .
          <source>Clinical neurophysiology</source>
          ,
          <volume>111</volume>
          (
          <issue>3</issue>
          ),
          <fpage>477</fpage>
          -
          <lpage>481</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Kramer</surname>
            <given-names>U</given-names>
          </string-name>
          (
          <year>July 2008</year>
          ).
          <article-title>"Atypical presentations of benign childhood epilepsy with centrotemporal spikes: a review"</article-title>
          .
          <source>J. Child Neurol</source>
          .
          <volume>23</volume>
          (
          <issue>7</issue>
          ):
          <fpage>785</fpage>
          -
          <lpage>90</lpage>
          . doi:
          <volume>10</volume>
          .1177/0883073808316363. PMID 18658078
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Gloor</surname>
            <given-names>P.</given-names>
          </string-name>
          <article-title>Contributions of electroencephalography and electrocorticography inthe neurosurgical treatment of the epilepsies</article-title>
          .
          <source>Adv Neurol</source>
          <year>1975</year>
          ;
          <volume>8</volume>
          :
          <fpage>59</fpage>
          -
          <lpage>105</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Fejerman</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Caraballo</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Tenembaum</surname>
            ,
            <given-names>S. N.</given-names>
          </string-name>
          (
          <year>2000</year>
          ).
          <article-title>Atypical Evolutions of Benign Localization‐Related Epilepsies in Children: Are They Predictable?</article-title>
          .
          <source>Epilepsia</source>
          ,
          <volume>41</volume>
          (
          <issue>4</issue>
          ),
          <fpage>380</fpage>
          -
          <lpage>390</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [17]
          <string-name>
            <surname>Panayiotopoulos</surname>
            ,
            <given-names>C. P.</given-names>
          </string-name>
          (
          <year>1999</year>
          ).
          <article-title>Benign childhood partial seizures and related epileptic syndromes</article-title>
          (Vol.
          <volume>15</volume>
          ). John Libbey Eurotext.
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Frost</surname>
            ,
            <given-names>J. D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hrachovy</surname>
            ,
            <given-names>R. A.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Glaze</surname>
            ,
            <given-names>D. G.</given-names>
          </string-name>
          (
          <year>1992</year>
          ).
          <article-title>Spike morphology in childhood focal epilepsy: relationship to syndromic classification</article-title>
          .
          <source>Epilepsia</source>
          ,
          <volume>33</volume>
          (
          <issue>3</issue>
          ),
          <fpage>531</fpage>
          -
          <lpage>536</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Ko</surname>
            ,
            <given-names>C. W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lin</surname>
            ,
            <given-names>Y. D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chung</surname>
            ,
            <given-names>H. W.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Jan</surname>
            ,
            <given-names>G. J.</given-names>
          </string-name>
          (
          <year>1998</year>
          ).
          <article-title>An EEG spike detection algorithm using artificial neural network with multi-channel correlation</article-title>
          .
          <source>In Engineering in Medicine and Biology Society</source>
          ,
          <year>1998</year>
          .
          <source>Proceedings of the 20th Annual International Conference of the IEEE (Vol. 4</source>
          , pp.
          <fpage>2070</fpage>
          -
          <lpage>2073</lpage>
          ). IEEE.
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [20]
          <string-name>
            <surname>Damaševičius</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Napoli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sidekerskienė</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Woźniak</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2017</year>
          ).
          <article-title>IMF mode demixing in EMD for jitter analysis</article-title>
          .
          <source>Journal of Computational Science</source>
          ,
          <volume>22</volume>
          , pp.
          <fpage>240</fpage>
          -
          <lpage>252</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [21]
          <string-name>
            <surname>Weng</surname>
            ,
            <given-names>W. D.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Khorasani</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          (
          <year>1996</year>
          ).
          <article-title>An adaptive structure neural networks with application to EEG automatic seizure detection</article-title>
          .
          <source>Neural Networks</source>
          ,
          <volume>9</volume>
          (
          <issue>7</issue>
          ),
          <fpage>1223</fpage>
          -
          <lpage>1240</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [22]
          <string-name>
            <surname>Mirchandani</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Cao</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          (
          <year>1989</year>
          ).
          <article-title>On hidden nodes for neural nets</article-title>
          .
          <source>IEEE Transactions on circuits and systems</source>
          ,
          <volume>36</volume>
          (
          <issue>5</issue>
          ),
          <fpage>661</fpage>
          -
          <lpage>664</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [23]
          <string-name>
            <surname>Nigam</surname>
            ,
            <given-names>V. P.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Graupe</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          (
          <year>2004</year>
          ).
          <article-title>A neural-network-based detection of epilepsy</article-title>
          .
          <source>Neurological Research</source>
          ,
          <volume>26</volume>
          (
          <issue>1</issue>
          ),
          <fpage>55</fpage>
          -
          <lpage>60</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [24] IFSECN,
          <article-title>International Federation of Societies for Electroencephalography and Clinical Neurophysiology. A glossary of terms most commonly used by clinical electroencephalographers</article-title>
          .
          <source>Electroencephalogr Clin Neurophysiol</source>
          <year>1974</year>
          ;
          <volume>37</volume>
          :
          <fpage>538</fpage>
          -
          <lpage>53</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [25]
          <string-name>
            <surname>Princy</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thamarai</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Karthik</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>Denoising EEG signal using wavelet transform</article-title>
          .
          <source>International Journal of Advanced Research in Computer Engineering &amp; Technology, 3.</source>
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [26]
          <string-name>
            <surname>Vorobyov</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Cichocki</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2002</year>
          ).
          <article-title>Blind noise reduction for multisensory signals using ICA and subspace filtering, with application to EEG analysis</article-title>
          .
          <source>Biological Cybernetics</source>
          ,
          <volume>86</volume>
          (
          <issue>4</issue>
          ),
          <fpage>293</fpage>
          -
          <lpage>303</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>