<!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 />
    <article-meta>
      <title-group>
        <article-title>Arrhythmia Detection in ECG Signals Using a Multilayer Perceptron Network</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gaurav Kumar</string-name>
          <email>gaurav.kumar@mycit.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Urja Pawar</string-name>
          <email>urja.pawar@mycit.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ruairi O'Reilly</string-name>
          <email>ruairi.oreilly@cit.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Cork Institute of Technology</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Electrocardiography (ECG) is a form of physiological data used to record the electrical activity of the heart. Numerous researchers have proposed and developed methods to extract features from the ECG signal (for example, R-R segment, P-R segment). These features can be used to analyse and classify various forms of heart arrhythmia. In this work, a method for ECG classi cation that employs a generalised signal pre-processing technique and uses a Multi-Layer Perceptron network to classify arrhythmia per the AAMI EC57 standard accurately is presented. The method is trained and evaluated using PhysioNet's MIT-BIH dataset, and an average accuracy of 98.72% is achieved. The proposed methodology is comparable to state-of-the-art CNN models, both in terms of accuracy and e ciency.</p>
      </abstract>
      <kwd-group>
        <kwd>Arrhythmia Classi cation</kwd>
        <kwd>Multi-Layer Perceptron</kwd>
        <kwd>Convolutional Neural Networks</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>An Electrocardiogram (ECG) is a time-series signal used for recording the
electrical activity of the heart. ECG recordings require a cardiologist to interpret
and detect cardiac abnormalities or arrhythmia. A typical heart beats in a steady
rhythm. A heartbeat varies across individuals and within individuals depending
on a variety of conditions. The segments of a standard ECG signal consist of
waveforms like P, Q, R, S, T and U as depicted in Figure 1.</p>
      <p>The QRS complex which represents ventricular depolarisation and
contraction typically begins with a downward movement and is composed of Q, R and
S waves where the Q wave is a larger upwards de ection, a peak at R and then a
downwards S wave as depicted in Figure 1. The PR segment or interval indicates
the time endured by the wave to travel from the sinus node to the ventricles.
The RR interval represents the time between successive QRS complexes and is
used to calculate heart rate.</p>
      <p>
        Electrocardiography (ECG) monitoring is used in diagnosing and treating
patients with heart disorders. In order to detect and precisely categorise
abnormal beats in an ECG signal, high-level expertise in the domain are required.
This requirement introduces several constraints concerning the expert analysis
of ECG data: i) It is time-consuming and prone to human errors; ii) There are a
limited number of expert cardiologists available to diagnose the millions of
patients su ering from heart disorders; iii) The cost of diagnosis is expensive. These
constraints highlight the need for a reliable and low-cost means of analysing and
diagnosing an individual's cardiac health [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
      </p>
      <p>
        In addressing this need, numerous researchers have investigated the
application of machine learning techniques to ECG in order to automate the detection
of abnormalities in ECG signals [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. The resultant models have demonstrated
precision in identifying and classifying the wave morphologies of ECG signals
which plays a signi cant role in the detection of abnormalities.
      </p>
      <p>
        In this work, a Multi-Layer Perceptron (MLP) model is proposed which is
trained on a pre-processed version of PhysioNet's MIT-BIH dataset. The trained
model has achieved an accuracy of 98.72%, which is comparable to
state-of-theart methods [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ][
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] in ECG classi cation. It is envisaged that this model will
enable a su ciently accurate analysis with a low computational cost such that
analysis can be carried out in real-time on low-end devices. The model could,
therefore, contribute to the incorporation of automated analysis solutions for
conditions such as heart disorders into devices such as activity trackers with the
intent of reducing the health impact on the general public.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        Several machine learning algorithms have been proposed and adapted for the
accurate classi cation of ECG data, an excellent overview of which is presented
in [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. This section demonstrates the most relevant techniques and their
applications in the eld of ECG classi cation.
      </p>
      <sec id="sec-2-1">
        <title>Application of Arti cial Neural Networks (ANN) In this paper, [11],</title>
        <p>su cient accuracy was achieved with a short learning time. A new arrhythmia
classi cation algorithm was proposed, which had a fast learning speed and high
accuracy by making use of Morphology Filter, Principle Component Analysis
(PCA) and Extreme Learning Machine (ELM). The accuracy levels 98.00% in
terms of average sensitivity, 97.95% in terms of average speci city was achieved.
Additionally, a comparative study was performed in terms of learning rate using
an ELM, comparing back propagation neural network (BPNN), radial basis
function network (RBFN) and support vector machines (SVM). It was observed that
the learning time of the proposed algorithm using ELM was about 290, 70, and
3 times faster than an algorithm using a BPNN, RBFN and SVM, respectively.</p>
        <p>
          Vishwa et al. [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] implemented an ANN (Arti cial Neural Network) based
classi cation system to detect heart disorders through ECG analysis using
estimated feed-forward ANN and back-propagation learning algorithms. The
approach was performed on a subset of arrhythmia classes in the MIT-BIH database
resulting in an accuracy of 96.77%.
        </p>
        <p>
          In order to classify ECG data, automatic extraction of both time interval
and morphological features was carried out in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. Linear Discriminant Analysis
(LDA) and Arti cial Neural Networks (ANN) were used for classi cation. The
ANN (in the form of an MLP) proved to be the more accurate of the two
classi ers with a training accuracy of 85.07% and 70.15% on unseen data. Principal
Component Analysis (PCA) was used for feature selection and dimensionality
reduction.
        </p>
        <p>
          Jadhav et al. [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] used Modular Neural Networks (MNN) to classify ECG
signals into normal and abnormal classes. The UCI arrhythmia dataset was used
for this experiment. The hidden layers in the network were varied, and the model
was trained on di erent subsets of the training data. The model was capable of
achieving an accuracy of 82.22% on the unseen or test dataset.
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>Application of Convolutional Neural Networks In [2], researchers used</title>
        <p>
          Convolutional Neural Network (CNN) to detect arrhythmia in ECG heartbeats.
The CNN was trained using the MIT-BIH dataset. An accuracy of 93.5% was
achieved. The dataset was pre-processed by: i) Removing noise from the ECG
signals with the help of wavelet lters; ii) Segmenting the ECG signal into
Rpeak beats and; iii) Normalising each segment to scale the amplitude of the
beat. The annotations in the dataset were divided into ve categories namely:
non-ectopic (N), supraventricular ectopic (S), ventricular ectopic (V), fusion (F),
and unknown (Q) as per the Association for the Advancement of Medical
Instrumentation (AAMI) standard [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ].
        </p>
        <p>Data Augmentation was practised to address the imbalance in the dataset.
Synthetic data was generated for the minority classes to prevent the model from
over- tting on the majority class. The CNN model contained one input layer,
one output layer and eight hidden layers of Convolutional, max-pooling and
fully-connected layers.</p>
        <p>
          In [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ], researchers extracted R-R features from the MIT-BIH dataset and
used these features as input to the model. The data is then subjected to a series
of convolution layers applying 1-D convolution. The predictor network consists of
ve residual blocks, followed by two fully-connected layers and a softmax layer to
predict output class probabilities. Each residual block contains two convolutional
layers, two ReLU activation layers, a residual skip connection, and a pooling
layer. In total, the resulting network is a deep network consisting of 13 weight
layers.
        </p>
        <p>In a residual block, a layer can either feed the data into the next layer or the
layers 2-3 steps away. In other words, the model may train the layers in a residual
block or may skip the training of those layers by using skip connection. This
ability makes the model more dynamic and overcomes some of the drawbacks of
having extra layers (such as over- tting and slow learning) in the network.</p>
        <p>The TensorFlow computational library for model training and evaluation was
employed. For the softmax layer, cross-entropy was used as the loss function.
Adam optimiser was used to train the network, with the learning rate,
beta1 and beta-2 of 0.001, 0.9, and 0.999, respectively. Learning rate is decayed
exponentially with the decay factor of 0.75 every 10000 iterations.</p>
        <p>The performance of the arrhythmia classi er was tested on 4079 heartbeats
(about 819 from each class) which were not used in the network training phase.
Data augmentation was used to balance the number of beats in each category.
The nal accuracy which they were able to achieve was 93.4% on the MIT-BIH
arrhythmia dataset.</p>
        <p>The learned representations or weights ( lters in the case of a CNN) were
used to classify MI in the PTB Diagnostic dataset. This experiment involved
freezing the learned weights till the last convolution layer of the CNN network
and training only the last two fully-connected layers with 32 neurons each. The
model achieved an accuracy, precision and recall of 95.9%, 95.2% and 95.1% in
MI classi cation, respectively. The network was trained for approximately two
hours on a GeForce GTX 1080Ti processor.</p>
        <p>
          In summary, a variety of machine learning algorithms and their application
to ECG data is evident in the literature. CNN's demonstrate state-of-the-art
accuracy but are expensive in terms of the computation time required to train.
To detect arrhythmias in real-time, the proposed model needs to be accurate as
well as computationally inexpensive. As such, a generalised signal pre-processing
approach, as described in [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ], is adopted, and an MLP model is proposed to
classify ECG heartbeats accurately.
3
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Methods</title>
      <p>This section presents the design and implementation of the proposed MLP
network and its comparison with a state-of-the-art Convolutional Neural Network
(CNN) for ECG beat classi cation. An overview of the proposed MLP network
is depicted in Figure 3.</p>
      <p>The rst layer is the input layer through which the data will be fed to the
network. The number of neurons in the input layer is 187 (equal to the
number of features/columns in the data). The following network consists of 4 sets
of Fully-connected (Dense), Batch Normalization and ReLU activation layers.
Number of neurons in each of the fully-connected layers are 50, 150, 900 and
400, respectively. The last layer of the network is the fully-connected output
layer of 5 neurons (equal to the number of distinct classes in the dataset) with
an activation function of SoftMax (as this is a multi-class classi cation problem).
3.1</p>
      <sec id="sec-3-1">
        <title>MIT-BIH Dataset</title>
        <p>
          The MIT-BIH dataset [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] consists of ECG recordings of 49 distinct subjects
recorded at the sampling rate of 360Hz. Each record contains a recording of 30
minutes from two leads namely modi ed limb lead II (MLII) and one out of the
modi ed leads V1, V2, V3, V4 or V5. The dataset contains more than 109,000
beats annotated individually, belonging to one of possible 15 beat types.
        </p>
        <p>
          The R-R interval of the ECG signal is widely used in the literature for the
classi cation of ECG signals. M. Kachuee etal: [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] extracted the R-R intervals
from the ECG signals of the MIT-BIH dataset. These features are then used
for arrhythmia classi cation. The annotations available in the MIT-BIH dataset
contains ve di erent beat categories as denoted in Table 1.
        </p>
        <p>
          The researchers in [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] used 47 recordings for the experiment and
downsampled the sampling frequency of the MIT-BIH dataset from 360Hz to 125Hz.
The steps followed to extract ECG beats from the original signal are: i)
Extracting the R-R intervals by splitting the original continuous ECG signal to windows
of 10 seconds and selecting a 10-second window from the signal; ii)
Normalising the amplitude of the extracted signal to a range between zero and one; iii)
Extracted the set of local maximums with a threshold of 0.9 representing ECG
R-peaks and; iv) Padding the extracted R-R interval with zeros making sure
that all the extracted beats are of identical length.
        </p>
        <p>
          The advantages of this pre-processing include: i) It is useful in extracting R-R
intervals from signals with distinct morphologies (shapes); ii) No lter is applied
to extract the beats that make an assumption about the signal morphology (for
example, Fourier lter makes an assumption that the actual signal frequencies
fall at low frequencies while noise at high); iii) All the extracted beats have
identical length which is essential for being used as input to the successive processing
parts. The pre-processed MIT-BIH dataset has been made available on Kaggle
[
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] by [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] and is used for training the proposed MLP network. It provides the
extracted R-R features from the dataset along with a prede ned 80:20 split for
training and testing.
3.2
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>Pre-processing</title>
        <p>The MIT-BIH training data is highly imbalanced i.e. the distribution of instances
per class is not uniform. The number of instances for the \Normal" class is
82.77% of the whole training dataset. Therefore, there is a high probability for
the model to over- t or gets biased towards the majority class (\Normal") and
generalises the other classes to be Normal as well. To prevent the problem of
overtting, Compute Class Weight function of Class Weight library with \balanced"
as a parameter is used. This function calculates the weights per class by weighing
classes inversely proportional to their frequency:
n
wj =</p>
        <p>knj</p>
        <p>Here, wj is the weight to class j, n is the number of observations, nj is the
number of observations in class j, and k is the total number of classes.
3.3</p>
      </sec>
      <sec id="sec-3-3">
        <title>Modelling</title>
        <p>To build the network Keras (a high-level neural network API), Sequential Model
is used. It is a linear stack of layers. Various layers can be added by specifying a
list of layer instances to the model. The input layer in Keras Sequential model is
de ned by specifying the dimension of input data which in this case is 187 (the
number of columns in the dataset). The number of rows is not speci ed because
it may vary for the training and test dataset.</p>
        <p>The rst hidden layer of the network is a Dense layer with 50 neurons. The
weights of this layer are initialised with an Identity matrix with a multiplicative
factor (gain) of 1. A Batch Normalisation layer follows this. The Batch
Normalisation layer is responsible for normalising the output of the hidden layer and
increasing the learning speed of the model. Finally, these normalised values are
passed to a ReLU activation layer which will decide based on polarity (negative
or positive) of the value whether the individual neuron is activated or not.</p>
        <p>The activated output from the rst hidden layer is then rendered to the next
three sets of Dense, Batch Normalisation and ReLU activation layers
(successively) of the MLP network. The activated output from the last hidden layer is
assigned to the output SoftMax activation layer with ve neurons to classify the
input data amongst one of the ve distinct classes of the MIT-BIH dataset.</p>
        <p>During the training phase of the network, the classi cations on input data
made by the model are compared with the actual labels (classes) to compute
the training loss in each iteration. The function used to calculate the loss in
the proposed network is Sparse Categorical Cross-Entropy, as it is a multi-class
classi cation problem and only one label or class is applicable per instance.</p>
        <p>Weights of hidden layers are updated or tuned by an Adam optimiser after the
training loss has been calculated. Tuning helps to decrease the overall training
loss in the next iteration or epoch of training. The learning rate (magnitude by
which the weights are updated) used to update the weights is 0.001.</p>
        <p>Apart from calculating loss and optimising weights, the model also evaluates
training performance in each epoch, i.e. determining the number of correctly
classi ed instances. The metric used for assessing the model's performance is
Accuracy.</p>
        <p>Loss, Optimizer and Metric are speci ed while compiling the model. The
compiled model is then trained on the training set (containing both the feature
and label data) of 87,554 instances of ECG beats for 100 epochs. At each epoch
predictions made on the validation set (also known as the test set) are evaluated;
this validates the performance of the model. The validation set contains 21,892
ECG beats and is not used in the training phase of the model.
3.4</p>
      </sec>
      <sec id="sec-3-4">
        <title>Architectural Design of the Proposed MLP and the CNN</title>
        <p>
          The proposed MLP network was then compared with a state-of-the-art CNN as
presented in [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. This CNN was chosen for comparison as it uses the generalised
signal pre-processing technique without any form of lters applied. Therefore,
both networks use the same pre-processed MIT-BIH dataset for training and
validation of the models and so a comparative analysis can be derived.
        </p>
        <p>The signi cant di erence between the two networks is in their architectural
design. The proposed MLP network employs dense or fully-connected layers to
process the input data while CNN makes use of convolutional layers. There
are in total six layers in the MLP network (one input layer, one output layer
and four hidden weighted layers - see Figure 3), whereas the CNN architecture
contains 15 layers (including input and output layer) of which 13 are weighted
(11 convolutional and two fully-connected).</p>
        <p>All convolutional layers in the CNN network apply 1-D convolution, and
each layer has 32 kernels or lters of size ve, and the two fully-connected layers
have 32 neurons each. However, the four dense hidden layers of the proposed
MLP network have 50, 150, 900 and 400 neurons, respectively. ReLU (Recti ed
Linear Unit) activation function is utilised to activate the neurons or lters in
both networks. The weights of the rst dense hidden layer of the MLP network
are explicitly initialised by an identity matrix with a multiplicative factor of 1,
whereas the Kernels or lters initialiser in the CNN model is not speci ed1.</p>
        <p>A batch normalisation layer (BNL) is employed after each hidden layer to
normalise the weighted sum output of each dense hidden layer in the proposed
network. The BNL helped the network to train faster and prevent over- tting.
No such standardisation technique appears to have been applied in the CNN
network rather 5 Max-Pooling layers one in each residual block is practised.</p>
        <p>The output layer of both the networks contains ve fully-connected neurons
with SoftMax activation function to classify the given instance amongst one
of the possible ve classes. Both the proposed MLP and the CNN is compiled
by employing Accuracy, Adam and Categorical Cross Entropy as the metric,
optimiser and the loss function respectively.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Results</title>
      <p>This section details the evaluation and testing of the proposed MLP network
and its comparison to a state-of-the-art CNN network.
4.1</p>
      <sec id="sec-4-1">
        <title>MLP: Mini-Batch Training</title>
        <p>
          Propagating the whole training set in a neural network in each iteration (epoch)
is referred to as batch training. It typically increases memory consumption and
1 Authors of [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] e-mailed querying implementation details. No reply to date.
the time to train the model. To address this, mini-batch training is practised.
Mini-batch training propagates xed subsets of the training data through the
network one by one. For instance, if the training data has 32,000 instances, and
the mini-batch size is 32, then there will be 1000 mini-batches.
        </p>
        <p>The advantages of using mini-batch training are: i) Reduced memory
consumption as only one batch of training data is loaded in the memory at a time;
ii) Reduced training time. The network weights are updated with each
propagation of a mini-batch while the weights are updated only once per epoch in batch
training. The default batch size of the Sequential Model API is 32. Depending
on the size of the training data, the batch size can be altered.</p>
      </sec>
      <sec id="sec-4-2">
        <title>Mini-Batch testing on MLP Network</title>
        <p>The proposed MLP network is trained with various batch sizes for 50 epochs.
The performance of the model is evaluated based on the time taken to train and
accuracy achieved on the validation or test dataset. Using the batch size of
512 yielded the best performance of the MLP model in terms of accuracy and
speed. The accuracy achieved on validation dataset is 98.28% and the model
took 3.4 minutes to train. Table 2 denotes the performance of the MLP network
for di erent batch sizes.</p>
      </sec>
      <sec id="sec-4-3">
        <title>MLP: Kernel Initialiser testing on the MLP network</title>
        <p>Kernel initialiser (also known as weights initialiser) is a technique that helps to
assign initial values to the weights of hidden layers in the network. By default,
the weights initialiser for a Dense layer is Glorot-Uniform. This technique draws
samples from a uniform distribution within -limit to +limit where the limit is
de ned as:
limit =
r
f an</p>
        <p>6
in + f an
out</p>
        <p>Here, fan-in is the number of neurons in the previous layer and fan-out is
the number of neurons in the current later. The MLP network is tested on
various kernel initialiser techniques like glorot-uniform, glorot-normal, identity,
orthogonal, and random-uniform.
1. Glorot-Normal: This technique draws samples from a truncated normal
distribution centered on 0 with standard deviation de ned as:
stddev =
r
f an</p>
        <p>2
in + f an
out
Here, fan-in is the number of neurons in the previous layer and fan-out is
the number of neurons in the current later.
2. Identity: This technique generates an identity matrix of weights. It is used
only for 2-Dimensional matrices. If the resulting matrix is not square, it pads
the additional rows/columns with zeros.
3. Orthogonal: This technique generates a random orthogonal matrix of weights.
4. Random-Uniform: This technique initialises the weights with a uniform
distribution. It takes three arguments: (minval: the lower bound of the range
of random values to generate, maxval: the upper bound of the range of
random values to generate and seed: A seed is a python integer used to seed
the random generator. Mainly used for the similar production of values.)</p>
        <p>Out of all the above-mentioned kernel initialisers, identity initialisation
produced the best results. An accuracy of 98.43% is achieved on the validation
dataset. The batch size used for this testing is 512. Table 3 denotes the
performance of the di erent initializers evaluated on the MLP network.
4.3</p>
      </sec>
      <sec id="sec-4-4">
        <title>MLP: Gradual Decay in Learning Rate</title>
        <p>This technique is used to reduce the learning rate of the model while training.
It monitors a metric or quantity, and if no improvement is seen for X number
of epochs, the learning rate is reduced. Validation accuracy is monitored during
the training of MLP network, and if no improvement in the validation
accuracy is observed for ve epochs, the learning rate is decreased by a factor of 1.
Reducing the learning rate by introducing a gradual decay improved the overall
performance of the MLP network (With Gradual Decay | Accuracy: 98.72% F1
score: 93.20%, Without Gradual Decay | Accuracy: 98.43% F1 score: 92.46%).
4.4</p>
      </sec>
      <sec id="sec-4-5">
        <title>Comparative Analysis of the MLP and CNN</title>
        <p>
          To evaluate the performance of the proposed MLP network a state-of-the-art
CNN [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] was selected. The CNN was trained on the pre-processed MIT-BIH
dataset for 50 epochs and the associated validation dataset used to evaluate
the performance of the model. The model took approximately 28 minutes to
train and achieved an accuracy of 98.6% on the validation dataset. In [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ], an
accuracy of 93.4% on the MIT-BIH dataset is reported. The increase of 5.4%
in the validation accuracy observed in this experimental is probably due to the
split used between the training and validation dataset.
        </p>
        <p>A slight variant of the replicated CNN was also trained to enable a more
transparent comparison. The techniques utilised by the MLP model to yield
better performance such as Batch-Normalization layer, mini-batch learning,
kernel initialisation, class-weight computation, and reducing learning rate were also
utilised by this instance of the CNN, referred to as CNN-REP*.</p>
        <p>Table 4 denotes the results of the three networks, the proposed MLP, the
replicated CNN and the improved replicated CNN. It is evident that: i) The
MLP network is less computationally expensive when compared to both CNNs
and demonstrates a reduced training time; ii) The proposed MLP outperformed
the replicated CNN network in terms of validation accuracy and F1 score while it
did not outperform CNN-Rep*. Figure 4 depicts the validation loss and accuracy
graph for the MLP and CNN-Rep network. iii) The performance enhancement
techniques utilised by CNN-Rep* resulted in a 44% decreased in training time
when compared to CNN-Rep and a .15% improvement in accuracy. While the
CNN-Rep* demonstrated an accuracy .07% better than the proposed MLP, it
took 4.68 times longer to train.</p>
      </sec>
      <sec id="sec-4-6">
        <title>Classi cation of ECG data in real-time</title>
        <p>
          This experiment intended to evaluate the classi cation of ECG data in real-time.
The results are indicative of a models suitability for real-time analysis. For this
experiment, ve ECG beats are extracted from the validation dataset and joined
to make a continuous stream of ECG data. A window of size 187 is constructed,
and a sliding window is used to analyse the ECG signal by one frame (column)
width from left to right. At each interval, the window contains 187 bits of ECG
data. The data obtained on sliding the window is analysed and classi ed by the
network. The proposed MLP network slightly outperformed the CNN network
in terms of average prediction time. The average prediction time for the MLP
Network was 3.12ms and 4.3ms for the CNN Network [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. Low-end devices, such
as activity trackers and smartwatches, have access to limited compute, memory
and storage. A model running on these devices will be competing for scarce
resources with the applications and services being utilised by the device. As such,
it is envisaged that the prediction time may vary, and this warrants the
computational complexity of the underlying model being considered as part of the
evaluation. A thorough assessment of trained models for arrhythmia detection
running on low-end and edge devices will be the subject of future work.
        </p>
        <p>
          Note: All experiments were performed using Google Co-laboratory (RAM:
12GB, Disk: 358GB, GPU: Tesla K80) and Keras computational library [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] for
model training and evaluation.
5
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>In this paper, an MLP for the real-time detection of arrhythmia in ECG data
is presented. In order to enhance the performance of the proposed model
techniques including mini-batch training, gradual reduction in learning rate,
batchnormalisation, kernel initialisation, and class-weight computation, are
implemented. The performance of the resultant model is compared with a
state-of-theart CNN. Classi cation of the ECG data in real-time is performed to compute
the average prediction time of the models.</p>
      <p>The training and validation of the models were carried out using the
MITBIH dataset. The proposed MLP outperformed a replicated state-of-the-art CNN
in ECG beat classi cation. An average accuracy of 98.72% was achieved with an
average time of 3.12 milliseconds to classify an ECG beat in real-time .</p>
      <p>The rationale for the comparative accuracy gains experienced by the MLP
is due to a combination of the pre-processing and/or implementation details
omitted from the CNN network. Another instance of the CNN was implemented
(CNN-Rep*) with the same hyper-parameters as those used by the MLP to
enable a more transparent comparison. CNN-Rep* outperformed the MLP
concerning accuracy ( 0.07%) but also required approximately 4.6 times the amount
of time to train.</p>
      <p>The MLP network demonstrated itself as relatively computationally
inexpensive approach and while this naturally implies it would take less time than a
CNN to classify an ECG beat in real-time it also highlights its appropriateness
for low-end devices, particularly with the level of accuracy demonstrated.
Acknowledgement: This material is based upon works supported by Science
Foundation Ireland under Grant No. SFI CRT 18/CRT/6222</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>1. A real time ECG signal processing application for arrhythmia detection on portable devices - Scienti c Figure on ResearchGate</article-title>
          . Available from: https://www. researchgate.net/figure/ECG-intervals-and-segments_fig1_
          <fpage>321455361</fpage>
          , accessed:
          <fpage>05</fpage>
          -
          <lpage>2019</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Acharya</surname>
            ,
            <given-names>U.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Oh</surname>
            ,
            <given-names>S.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hagiwara</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tan</surname>
            ,
            <given-names>J.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Adam</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gertych</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , San Tan, R.:
          <article-title>A deep convolutional neural network model to classify heartbeats</article-title>
          .
          <source>Computers in biology and medicine 89</source>
          ,
          <volume>389</volume>
          {
          <fpage>396</fpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Alexakis</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nyongesa</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Saatchi</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Harris</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Davies</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Emery</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ireland</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Heller</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Feature extraction and classi cation of electrocardiogram (ecg) signals related to hypoglycaemia</article-title>
          . In: Computers in Cardiology,
          <year>2003</year>
          . pp.
          <volume>537</volume>
          {
          <fpage>540</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Chollet</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          , et al.:
          <string-name>
            <surname>Keras</surname>
          </string-name>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Dastjerdi</surname>
            ,
            <given-names>A.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kachuee</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shabany</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Non-invasive blood pressure estimation using phonocardiogram</article-title>
          .
          <source>In: 2017 IEEE International Symposium on Circuits and Systems (ISCAS)</source>
          . pp.
          <volume>1</volume>
          {
          <issue>4</issue>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Esmaili</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kachuee</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shabany</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Nonlinear cu ess blood pressure estimation of healthy subjects using pulse transit time and arrival time</article-title>
          .
          <source>IEEE Transactions on Instrumentation and Measurement</source>
          <volume>66</volume>
          (
          <issue>12</issue>
          ),
          <volume>3299</volume>
          {
          <fpage>3308</fpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Fazeli</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>ECG Heartbeat Categorization Dataset</article-title>
          . https://www.kaggle.com/ shayanfazeli/heartbeat, accessed:
          <fpage>05</fpage>
          -
          <lpage>2019</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Goldberger</surname>
            <given-names>AL</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Amaral</surname>
            <given-names>LAN</given-names>
          </string-name>
          ,
          <string-name>
            <surname>G.L.H.J.I.P.M.R.M.J.M.G.P.C.K.S.H</surname>
          </string-name>
          .:
          <article-title>Physiobank, physiotoolkit, and physionet: Components of a new research resource for complex physiologic signals</article-title>
          .
          <source>IEEE Engineering in Medicine and Biology Magazine</source>
          <volume>101</volume>
          (
          <issue>23</issue>
          ),
          <volume>215</volume>
          {
          <fpage>220</fpage>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Jadhav</surname>
            ,
            <given-names>S.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nalbalwar</surname>
            ,
            <given-names>S.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ghatol</surname>
            ,
            <given-names>A.A.</given-names>
          </string-name>
          :
          <article-title>Modular neural network based arrhythmia classi cation system using ecg signal data</article-title>
          .
          <source>International Journal of Information Technology and Knowledge Management</source>
          <volume>4</volume>
          (
          <issue>1</issue>
          ),
          <volume>205</volume>
          {
          <fpage>209</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Kachuee</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fazeli</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sarrafzadeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Ecg heartbeat classi cation: A deep transferable representation</article-title>
          .
          <source>In: 2018 IEEE International Conference on Healthcare Informatics (ICHI)</source>
          . pp.
          <volume>443</volume>
          {
          <fpage>444</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Kim</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shin</surname>
            ,
            <given-names>H.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shin</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Robust algorithm for arrhythmia classi - cation in ecg using extreme learning machine</article-title>
          .
          <source>Biomedical engineering online 8</source>
          (
          <issue>1</issue>
          ),
          <volume>31</volume>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Martis</surname>
            ,
            <given-names>R.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Acharya</surname>
            ,
            <given-names>U.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lim</surname>
            ,
            <given-names>C.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mandana</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ray</surname>
            ,
            <given-names>A.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chakraborty</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Application of higher order cumulant features for cardiac health diagnosis using ecg signals</article-title>
          .
          <source>International journal of neural systems 23(04)</source>
          ,
          <volume>1350014</volume>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. for the Advancement of Medical Instrumentation,
          <string-name>
            <surname>A.</surname>
          </string-name>
          , et al.:
          <article-title>Testing and reporting performance results of cardiac rhythm and st segment measurement algorithms</article-title>
          .
          <source>ANSI/AAMI EC38</source>
          <year>1998</year>
          (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. Moody, G.B.,
          <string-name>
            <surname>Mark</surname>
            ,
            <given-names>R.G.</given-names>
          </string-name>
          :
          <article-title>The impact of the mit-bih arrhythmia database</article-title>
          .
          <source>IEEE Engineering in Medicine and Biology Magazine</source>
          <volume>20</volume>
          (
          <issue>3</issue>
          ),
          <volume>45</volume>
          {
          <fpage>50</fpage>
          (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Roopa</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Harish</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>A survey on various machine learning approaches for ecg analysis</article-title>
          .
          <source>International Journal of Computer Applications</source>
          <volume>163</volume>
          (
          <issue>9</issue>
          ),
          <volume>25</volume>
          {
          <fpage>33</fpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Society</surname>
          </string-name>
          , H.R.:
          <article-title>Heart diseases and disorders</article-title>
          . https://www.hrsonline.org/ Patient-Resources/Heart-Diseases-Disorders, accessed:
          <fpage>05</fpage>
          -
          <lpage>2019</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Vishwa</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lal</surname>
            ,
            <given-names>M.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dixit</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vardwaj</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Clasi cation of arrhythmic ecg data using machine learning techniques</article-title>
          .
          <source>IJIMAI</source>
          <volume>1</volume>
          (
          <issue>4</issue>
          ),
          <volume>67</volume>
          {
          <fpage>70</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>