<!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>Detecting Heart Disease Symptoms Using Machine Learning Methods</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Diera Pirova</string-name>
          <email>di.pirova@yandex.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Andrey Mashkov Samara State Technical University Samara</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Samara State Technical University Samara</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2020</year>
      </pub-date>
      <fpage>260</fpage>
      <lpage>263</lpage>
      <abstract>
        <p>-This paper explores the possibility of application of machine learning methods for detecting the signs of cardiovascular diseases. The ECG Heartbeat Categorization Dataset that contains electrocardiogram data of various heart rhythms is taken for the study. The paper describes classification of five various arrhythmia types by the use of machine learning methods. The classification has used such methods as the random forest algorithm, the decision tree and the convolutional neural network. The results of the study show the highest accuracy of the neural network that equals to 0.9347.</p>
      </abstract>
      <kwd-group>
        <kwd>machine learning</kwd>
        <kwd>heart electrocardiography</kwd>
        <kwd>random forest</kwd>
        <kwd>neural network</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        Cardiovascular diseases (CVD) are one of the most
significant mortality causes in the modern world. The
forecasting of cardiovascular diseases is a major concern in
the area of analyzing of clinical data [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In modern society,
heart disease prevention problems have medical and social
significance and remain paramount due to the prevalence rate,
large percentage of disablement and extremely heavily
mortality that is specific to the people of working age.
Millions of people experience irregular heartbeats that in some
cases may cause death. Therefore, an accurate and
inexpensive diagnosis of arrhythmic heartbeat is critical.
      </p>
      <p>
        Neural network technologies are aimed at resolving
various complicated tasks that include a number of issues in
medicine.First of all, the use of neural networks relates to the
fact that a researcher receives a large amount of different
factual materials that do not already have any mathematical
models. Application of the machine learning can improve the
accuracy of medical visualization and diagnostics of
pathologies. With the use of various algorithms, machine
learning methods are suited to address the tasks with unknown
mechanisms of situation-based developments and
dependencies between inputs and outputs [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>The objective of the paper is to analyze the application of
machine learning methods for detecting the
electrocardiograms with indicators of some abnormal heart
rhythms. The scientific novelty of the research lies with the
use of the convolutional neural network for the analysis of
constantly incoming data and the testing of machine learning
methods to compare the accuracy of algorithms. The
experiment shows that deep neural networks are better suited
for solving the problem of classification of heart rhythms.</p>
      <p>
        In order to deal with the issues arising from the manual
analysis of electrocardiogram signals, many scientists
considered the application of machine learning methods for
accurate detection of abnormalities in the signal. For example,
the study [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] examined the heart disease prediction model
using hybrid random forest linear model (HRFLM). The
model represented various combination of signs and several
recognized classification methods and included the analysis of
multiple signs such as gender, weight and so on, excluding
electrocardiogram analysis. The work [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] described the
approaches to the design and use of deep neural networks for
improving accuracy of diagnosis of heart diseases. The deep
neural network architecture was developed and optimized to
diagnose heart diseases. Like much of the study described in
[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], that work did not consider electrocardiogram records as
experimental variables. It is important to emphasize that many
studies related to computer-assisted diagnosis of various
diseases exist, for example [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] and [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Dr. Ana C.
Calderon and Dr. Simon Thorne, specialists from the the
Department of Computing at Cardif Metropolitan University,
examined the benefits of machine learning to medical
diagnostics and data analysis. Scientists studied various
methods of using neural networks in the diagnosis and surgical
planning of diseases and came to the conclusion that with
application of such methods doctors are ensured with more
reliable decision making, greater productivity and fewer
medical errors. The useful capacity of neural networks as the
basis for supporting clinical decisions is also evident. They are
capable of representing complex relationships found in data
that are not immediately obvious for a human examination [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
The research [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] considers the use of artificial neural networks
for identifying and characterizing pathologies in blood
vessels. According to the results of the study, the models of
neural networks were designed suitable to solve the set tasks
with an error of not more than 9%.
      </p>
      <p>Our study consists of two stages. Data pre-processing at
the first stage solves the problem of unbalanced classes. We
have processed each electrocardiogram signal by Gaussian
noise overlaying.</p>
      <p>The second stage represents the resolution of the
multiclass classification task with the use of various machine
learning methods such as random forest, the decision tree and
the convolutional neural network.</p>
    </sec>
    <sec id="sec-2">
      <title>II. PRE-PROCESSING OF THE SIGNAL</title>
      <p>
        For the analysis of the electrocardiogram, we have
selected the MIT-BIH Arrhythmia database with 48 half-hour
excerpts of two-channel ambulatory electrocardiogram
recordings obtained from 47 subjects as the data source. It is
important to note that this study uses pre-processed data from
the MIT-BIH Arrhythmia database presented in the Kaggle
platform (ECG Heartbeat Categorization Dataset) [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>The training dataset contains information on 87 thousand
heartbeats. Each heartbeat falls within one of five following
categories:
1.</p>
    </sec>
    <sec id="sec-3">
      <title>Normal beat;</title>
    </sec>
    <sec id="sec-4">
      <title>2. Supraventricular premature beat;</title>
    </sec>
    <sec id="sec-5">
      <title>3. Premature ventricular contraction;</title>
    </sec>
    <sec id="sec-6">
      <title>4. Fusion of ventricular and normal beat;</title>
    </sec>
    <sec id="sec-7">
      <title>Unclassifiable beat.</title>
      <p>In all our experiments, we have used electrocardiogram
lead II re-sampled with the sampling frequency of 125 Hz as
the input signal.</p>
      <p>For further interpretation of the data, we show an example
of input data for each class.</p>
      <p>
        At the next step, we have added Gaussian noise with the
mathematical expectation of 0 and the dispersion of 0.05 [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]
for transforming data of each object of sampling.
      </p>
      <p>Figure 4 and Figure 5 show data before and after
transformation of data respectively. Such transformation is
necessary to summarize the data and remove duplicates.</p>
      <p>The major part of the dataset (72471) falls under the
regular rhythm. Figure 2 shows the bar chart of number of
examples depending from classes (0 - Normal beat, 1
Supraventricular premature beat, 2 - Premature ventricular
contraction, 3 - Fusion of ventricular and normal beat, 4
Unclassifiable beat).</p>
      <p>
        Figure 2 demonstrates the big difference between the
numbers of input data for each of the classes. We have used
the method described in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] for solving the problem of
unbalanced classes. We have balanced the sampling using the
resampling method from the Scikit-learn library.
      </p>
      <p>As the result, after data pre-processing, we have received
the sampling consisting of 100 thousand heartbeats uniformly
ranged into classes.</p>
      <p>III. DEVELOPMENT AND TRAINING OF MACHINE LEARNING</p>
      <p>METHODS</p>
      <p>We have built the models based on such methods as the
random forest algorithm, the decision tree and the
convolutional neural network for detecting the signs of
cardiovascular diseases. The paper describes in detail the
operation principle of each of the methods:</p>
      <p>
        Decision Trees are a non-parametric supervised learning
method used for classification and regression. The goal is to
create a model that predicts the value of a target variable by
learning simple decision rules inferred from the data features
[
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>
        The random forest consists of many decision trees. The
random forest is used in statistics, data analysis and machine
learning. Figure 6 demonstrates the model of this algorithm.
Each individual tree is a rather simple model with branches,
nodes and leaves. Attributes are recorded in the nodes and
objective function depends on the attribute values. Further,
values of the objective function get into the leaves through the
branches. As part of the classification process for a new case
we have to go down the tree through the branсhes all the way
until a leaf, moving through all attribute values based on the
logical principle “if-then” In accordance with these
conditions, a target variable receives one or another value or
class (the target variable gets into the specific list). The
objective of the decision tree construction is to develop a
model that predicts the value of the target variable depending
on several variables at the input [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>We apply decision tree and random forest algorithms with
the use of the Scikit-learn library for the Python programming
language. The paper considers the n_estimators parameter (the
number of trees in the forest) for random forest. We have
selected this parameter in experimental studies and it equals
to 50.</p>
      <p>In recent years, convolutional neural networks are gaining
popularity. In this paper, the model of convolutional neural
network contain 1 convolution consisting of 32 feature maps.
Then the batch-normalization layer comes that normalizes
previously obtained data. The normalized data have
mathematical expectation of 0 and dispersion of 1. Sub
Nyquist sampling layer (MaxPooling1D) compresses the
obtained data twice and the Flatten layer shrinks the
compressed data into 1D dimension array. Three cascade fully
connected layers containing 64, 32 and 5 neurons respectively
follow these layers. At the output, we have five neurons that
show the probability of belonging to each class. Figure 7
shows the described neural network architecture.</p>
      <p>The neural network is introduced through the Keras library
in Python programming language and we have trained it with
the use of Adam (Adaptive Moment Estimation) optimizer.</p>
      <p>
        Adam is an update to the RMSProp optimizer. This
optimization algorithm uses running averages of both the
gradients and the second moments of the gradients. Given
parameters of the weight - w ( t ) , where t indexes current
training iteration are updated according to the following
algorithm [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]:
m w(t 1)   1 m w(t )  (1   1 )  w L( t ) ;
v w(t 1)   2 v w(t )  (1   2 ) (  w L( t ) ) 2 ;
      </p>
      <p>m ( t 1)
mˆ w  1  w t 1 ;</p>
      <p>1
v ( t 1)
vˆ w  w
1   t 1 ;</p>
      <p>
        2
w ( t 1)  w ( t )  
mˆ w
  vˆw
where ϵ is a small scalar used to prevent division by 0 , and
 1 and  2 are the forgetting factors for gradients and second
moments of gradients, respectively. Squaring and
squarerooting is done elementwise [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
      <p>We select ReLU function as the activation function on
each layer except the last one. For the last layer we use
Softmax function that is often applied in neural networks to
show unnormalized network outputs into a probability
distribution over the predicted output classes. Softmax
function is as follows:
 S o ft m a x ( z ) i 
, 
e zi
5
 e z j
j 1
where z i is an unnormalized input vector.</p>
      <p>We use logloss as an error function:</p>
      <p>1 q l
 lo g lo s s     y ij lo g a ij ,  
q i 1 j 1
where q is a number of elements in sampling, l is a number
of classes, a ij is a response (probability) of the algorithm on
the object i to the question on its belonging to class j ,
y ij  1 if object i belongs to class j , if not y ij  0 .</p>
      <p>Each of the above-mentioned methods has its own
advantages and disadvantages. In this paper, we present the
training of all models mentioned above to identify which
model solves the classification problem more accurately.</p>
    </sec>
    <sec id="sec-8">
      <title>IV. EXPERIMENTAL STUDIES</title>
      <p>For experimental studies, we have launched the program
based on test sampling consisting of 21,892 heartbeat records.</p>
      <p>We have started up the training process of the neural
network in 15 epochs. Figure 8 shows a graph of the accuracy
of neural network training depending upon an epoch for each
training and validation set.</p>
      <p>For each model, we consider Accuracy characteristic that
is formed through the ratio of the total number of correctly
predicted objects ( P ) to the total number of objects ( N ) :
A c c u r a c y </p>
      <p>P</p>
      <p>.</p>
      <p>N</p>
      <p>Table 1 shows the training results (Accuracy for validation
data).</p>
      <p>Table 1 demonstrates that the convolutional neural
network has showed the best result.</p>
      <p>As the neural network results further show, we have
calculated the normalized confusion matrix that presents the
proportion of correct and incorrect predictions for each class.
Table 2 demonstrates the values of the confusion matrix.</p>
      <p>Table 2 indicates that the neural network classifies
Supraventricular premature beat much worse. This is simply
ause of the small data amount of this class. The neural network
identifies Unclassifiable beat more accurately. This appears to
be due to the specificity of the electrocardiogram data in this
class.</p>
    </sec>
    <sec id="sec-9">
      <title>V. CONCLUSION</title>
      <p>In this paper, we compare various machine learning
algorithms for detecting the signs of cardiovascular diseases.
We have pre-processed all signals in accordance with Section
2 before applying the algorithms. The study shows that the
convolutional neural network classifies heart rhythms better
(0.9347) than other algorithms. The random forest algorithm
also demonstrates excellent results (0.9090) that are a bit
worse than the results of the neural networks. The decision
tree presents the worst results (0.7870). The significance of
the study lies in the feasibility of application of the achieved
results in predicting the possible development of
cardiovascular diseases. The findings obtained in the present
study can be used to create medical or other expert systems
based on artificial neural networks under conditions of low
volume of statistical material.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Jin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Zheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Yu</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Yan</surname>
          </string-name>
          , “
          <article-title>Study of cardiovascular disease prediction model based on random forest in eastern China,”</article-title>
          <source>Sci Rep</source>
          , vol.
          <volume>10</volume>
          , pp.
          <fpage>5240</fpage>
          -
          <lpage>5245</lpage>
          ,
          <year>2020</year>
          . DOI:
          <volume>10</volume>
          .1038/ s41598-020-62133-5.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>O.</given-names>
            <surname>Obulesu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mahendra</surname>
          </string-name>
          and
          <string-name>
            <surname>M. ThrilokReddy,</surname>
          </string-name>
          <article-title>"Machine Learning Techniques and Tools: A Survey,"</article-title>
          <source>International Conference on Inventive Research in Computing Applications (ICIRCA)</source>
          , Coimbatore, pp.
          <fpage>605</fpage>
          -
          <lpage>611</lpage>
          ,
          <year>2018</year>
          . DOI:
          <volume>10</volume>
          .1109/ ICIRCA.
          <year>2018</year>
          .
          <volume>8597302</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Mohan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Thirumalai</surname>
          </string-name>
          and G. Srivastava, “
          <source>Effective Heart Disease Prediction Using Hybrid Machine Learning Techniques,” IEEE Access</source>
          , vol.
          <volume>7</volume>
          , pp.
          <fpage>81542</fpage>
          -
          <lpage>81554</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>N.</given-names>
            <surname>Tomov</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Tomov</surname>
          </string-name>
          , “
          <article-title>On Deep Neural Networks for Detecting Heart Disease</article-title>
          ,” CoRR abs/
          <year>1808</year>
          .07168, pp.
          <fpage>1</fpage>
          -
          <lpage>10</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>N.Y.</given-names>
            <surname>Ilyasova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.V.</given-names>
            <surname>Kupriyanov</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.A.</given-names>
            <surname>Paringer</surname>
          </string-name>
          , “
          <article-title>Formation of features for improving the quality of medical diagnosis based on discriminant analysis methods,” Computer Optics</article-title>
          , vol.
          <volume>38</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>851</fpage>
          -
          <lpage>855</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>A.V.</given-names>
            <surname>Gaidel</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.S.</given-names>
            <surname>Pervushkin</surname>
          </string-name>
          , “
          <article-title>Research of the textural features for the bony tissue diseases diagnostics using the roentgenograms</article-title>
          ,”
          <source>Computer Optics</source>
          , vol.
          <volume>37</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>113</fpage>
          -
          <lpage>119</lpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.D.</given-names>
            <surname>Bragin</surname>
          </string-name>
          and
          <string-name>
            <given-names>V.G.</given-names>
            <surname>Spitsyn</surname>
          </string-name>
          , “
          <article-title>Motor imagery recognition in electroencephalograms using convolutional neural networks</article-title>
          ,
          <source>” Computer Optics</source>
          , vol.
          <volume>44</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>482</fpage>
          -
          <lpage>487</lpage>
          ,
          <year>2020</year>
          . DOI:
          <volume>10</volume>
          .18287/
          <fpage>2412</fpage>
          -6179-CO-
          <volume>669</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Calderon</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Thorne</surname>
          </string-name>
          , “
          <article-title>Neural Networks for Medical Applications</article-title>
          ,” ITNOW, vol.
          <volume>60</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>46</fpage>
          -
          <lpage>49</lpage>
          ,
          <year>2018</year>
          . DOI:
          <volume>10</volume>
          .1093 /itnow/bwy022.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S.</given-names>
            <surname>Moccia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.D.</given-names>
            <surname>Momi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.S.</given-names>
            <surname>Mattos</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Hadji</surname>
          </string-name>
          , “
          <article-title>Blood vessel segmentation algorithms - Review of methods, datasets and evaluation metrics,” Computer Methods</article-title>
          and Programs in Biomedicine, pp.
          <fpage>158</fpage>
          ,
          <year>2018</year>
          . DOI:
          <volume>10</volume>
          .1016/j.cmpb.
          <year>2018</year>
          .
          <volume>02</volume>
          .001.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>S.</given-names>
            <surname>Fazeli</surname>
          </string-name>
          , “ECG Heartbeat Categorization Dataset,”
          <year>2020</year>
          [Online]. URL: https://www.kaggle.com/shayanfazeli/heartbeat.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D.</given-names>
            <surname>Gregoire</surname>
          </string-name>
          , “
          <source>Arrhythmia on ECG Classification using CNN”</source>
          ,
          <year>2020</year>
          [Online]. URL: https://www.kaggle.com/gregoiredc/arrhythmia
          <article-title>-onecg-classification-using-cnn/notebook.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>L.</given-names>
            <surname>Tian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Ning</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Qi</surname>
          </string-name>
          and
          <string-name>
            <given-names>Z.</given-names>
            <surname>Han</surname>
          </string-name>
          , “
          <article-title>Sentense Paraphrase Detection Using Classification Models</article-title>
          ,” FIRE International Workshop, Kolkata, India, pp.
          <fpage>171</fpage>
          -
          <lpage>172</lpage>
          ,
          <year>2016</year>
          . DOI:
          <volume>10</volume>
          .1007/978-3-
          <fpage>319</fpage>
          -73606-8.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>L.</given-names>
            <surname>Balles</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Hennig</surname>
          </string-name>
          , “Dissecting Adam: The Sign,
          <source>Magnitude and Variance of Stochastic Gradients,” 6th International Conference on Learning Representations, Canada</source>
          , pp.
          <fpage>16</fpage>
          -
          <lpage>18</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>