A Fast Machine Learning Model For ECG-Based Heartbeat Classification and Arrhythmia Detection
A Fast Machine Learning Model For ECG-Based Heartbeat Classification and Arrhythmia Detection
A Fast Machine Learning Model For ECG-Based Heartbeat Classification and Arrhythmia Detection
We present a fully automatic and fast ECG arrhythmia classifier based on a simple
brain-inspired machine learning approach known as Echo State Networks. Our classifier
has a low-demanding feature processing that only requires a single ECG lead. Its training
and validation follows an inter-patient procedure. Our approach is compatible with an
online classification that aligns well with recent advances in health-monitoring wireless
devices and wearables. The use of a combination of ensembles allows us to exploit
parallelism to train the classifier with remarkable speeds. The heartbeat classifier is
evaluated over two ECG databases, the MIT-BIH AR and the AHA. In the MIT-BIH
AR database, our classification approach provides a sensitivity of 92.7% and positive
predictive value of 86.1% for the ventricular ectopic beats, using the single lead II, and a
Edited by:
Raul Vicente,
sensitivity of 95.7% and positive predictive value of 75.1% when using the lead V1’. These
Max-Planck-Institut für Hirnforschung, results are comparable with the state of the art in fully automatic ECG classifiers and even
Germany outperform other ECG classifiers that follow more complex feature-selection approaches.
Reviewed by:
Haroldo Valentin Ribeiro, Keywords: Echo State Networks, reservoir computing, arrhythmia classification, GPU, ECG
State University of Maringá, Brazil
Reinaldo Roberto Rosa,
National Institute of Space Research 1. INTRODUCTION
(INPE), Brazil
*Correspondence: Electrocardiogram (ECG) analysis has been established at the core of cardiovascular pathology
Miquel Alfaras diagnosis since its development in the twentieth century. The ECG signals reflect the electrical
[email protected] activity of the heart. Thus, heart rhythm disorders or alterations in the ECG waveform are evidences
of underlying cardiovascular problems, such as arrhythmias. Non-invasive arrhythmia diagnosis
Specialty section: is based on the standard 12-lead electrocardiogram, which measures electric potentials from 10
This article was submitted to electrodes placed at different parts of the body surface, six in the chest and four in the limbs. In order
Interdisciplinary Physics, to provide an effective treatment for arrhythmias, an early diagnosis is important. Early detection
a section of the journal
of certain types of transient, short-term or infrequent arrhythmias requires long-term monitoring
Frontiers in Physics
(more than 24 h) of the electrical activity of the heart. The fast development of the digital industry
Received: 14 May 2019 has allowed for improvements in devices, data acquisition and computer-aided diagnosis methods.
Accepted: 03 July 2019
The open access to ECG databases [1] has led to the development of many methods and
Published: 18 July 2019
approaches for computer-aided ECG arrhythmia classification over the last decades, fostering the
Citation:
productive cross-disciplinary efforts that engineers, physicists or non-linear dynamics researchers
Alfaras M, Soriano MC and Ortín S
(2019) A Fast Machine Learning
are no strangers to. Almost every computer-aided ECG classification approach involves four main
Model for ECG-Based Heartbeat steps, namely, the preprocessing of the ECG signal, the heartbeat detection, the feature extraction
Classification and Arrhythmia and selection and finally the classifier construction. The preprocessing of the ECG signal and
Detection. Front. Phys. 7:103. the heartbeat detection are out of the scope of this work, both widely studied, and the heartbeat
doi: 10.3389/fphy.2019.00103 detection is close to optimal results [2].
A large number of classifiers have been proposed for have recurrent connections, being able to take into account time
arrhythmia discrimination. The proposed techniques range dependencies between neighboring heartbeats. This property is
from simple classifiers, such as linear discriminants (LD) [3– beneficial since, in the case of a normal or an abnormal heartbeat,
5] or decision trees [5–7], to more sophisticated ones, such as there are more chances that the subsequent heartbeat will also be
traditional neural networks [8–13], Support Vector Machines a healthy or a pathological one. Moreover, the ESN method can
(SVM) [9, 14–18], conditional random fields [19], and more take advantage of the power of a parallel computing architecture,
recently deep learning techniques [13, 20–22]. In addition, many such as a graphics processing unit (GPU). Hence, we compare the
works have been devoted to finding the best combination of computation times between a GPU and a central processing unit
features, sometimes even developing complex signal processing (CPU), showing that the implementation in a GPU outperforms
methods, and to choosing the best subset (dimensionality its CPU counterpart in the classification of the heartbeats. The
reduction) for the arrhythmia classification [23]. On the one computation times of the GPU outperform those of the CPU even
hand, popular choices for the input features are morphological in the training part of the classifier, i.e., the entire system can be
features extracted from the time domain (such as inter-beat trained extremely fast with a GPU.
intervals, amplitudes, areas) [3, 14, 15, 24], frequency-domain Finally, it is worth noting that our classifier is based on a single
features [6, 7, 16, 17, 25], wavelet transforms [4, 8–11, 18, lead ECG. Long-term monitoring generally involves devices with
26], complex heartbeat representations [16] or higher order fewer electrodes than the standard 12 leads ECG in order to allow
statistics (HOS) [4, 6, 7, 9]. On the other hand, feature selection the patient to have a normal activity, requiring computer-aided
methods, such as the independent component analysis (ICA) techniques to analyze the huge amounts of data generated. We
[18, 26], principal component analysis (PCA) [18], particle show that our heartbeat classification method outperforms other
swarm optimization (PSO) [16], or the genetic algorithm— classifiers that rely on much more complicated feature selection
back propagation neural networks (GA-BPNN) [23], have techniques and complex calculations. We evaluate the proposed
been used. classifier in two different ECG databases and leads to test the
Despite the good performance in classifying arrhythmias robustness of the proposed algorithm.
achieved by these methods, many of them require long
computation times to optimize the classifiers. The use of
complex classification or preprocessing methods is not suitable 2. MATERIALS AND METHODS
for online calculations or demand a lot of computational
power. In this work, we present a fully automatic and fast 2.1. Databases
classifier of arrhythmias that can be implemented online The performance of the proposed heartbeat classification method
and analyze long sequences of ECG records efficiently. has been evaluated in two internationally recognized ECG
By loosening the requirements for feature extraction, we databases: the MIT-BIH arrhythmia (MIT-BIH AR) [28] and the
propose an implementation fundamentally based on raw AHA [29]. The MIT-BIH AR database is a golden standard to
signals, single lead information and heart rates that aims evaluate arrhythmia classifiers. This benchmark database consists
at reducing computation time while achieving low error of 48 half-hour ECG records sampled at 360 Hz. Each ECG
classification results. record contains two leads: lead II (modified limb lead II, obtained
Cardiologists use mostly the raw ECG to diagnose. The from electrodes on the chest) and lead V1’ (modified lead V1,
simplest and fastest method of feature extraction is then to and in some records V2, V4, or V5). The AHA database contains
extract sampled points from an ECG signal curve. However, one 154 ECG recordings of 3 h long but only the last 30 min have
should be aware of the fact that the amount of the extracted information about the beat class. The AHA ECG recordings have
features used to characterize the heartbeat can be a burden for the two leads (A,B) sampled at 250 Hz. The documentation of the
classification algorithm. For this reason, most of the works that AHA database does not provide the name of the leads.
use the raw signal perform a down sampling of the waveform or Both databases have annotations indicating the class of the
some feature selection in order to reduce the computation time heartbeat and its position verified by independent experts.
[3, 4, 15]. In order to circumvent this issue, a simple machine Following the standards and recommendations of the American
learning method is chosen to classify the arrhythmias. One of the National Standards Institute developed by the Association for
advantages of the proposed method is that the number of features the Advancement of Medical Instrumentation (AAMI) for the
barely affects the speed of the classification since the classifier evaluation of ECG classifiers [30], all the heartbeat annotation
parameters related to the input are not optimized and remain labels are converted to five heartbeat types: N (normal beats),
random, as it will be described in more detail later in the text. S (supraventricular ectopic beats), V (ventricular ectopic beats),
As a result, the raw waveform of the heartbeat can be used for the F (fusion beats), and Q (unclassifiable beats). The Q beats were
classification without compromising speed. This simple machine excluded in this research because they are not representative [31].
learning method also allows a fast retraining of the classifier if Also in accordance to the AAMI standard, ECG recordings with
new ECG data become available. paced beats are removed (i.e., four ECG records in the MIT-
In this work, we propose an ensemble of Echo State Networks BIH AR database and three ECG records in the AHA database
(ESNs) [27] as the classifier method, using the raw ECG are excluded from the analysis). It is worth mentioning that the
waveforms and time intervals between the heartbeats as the original annotations of the AHA database do not differentiate
input features. A particular advantage of the ESNs is that they between N and S beats.
2.1.1. Training and Test Datasets TABLE 1 | Distribution of the MIT-BIH AR database ECG recordings into the
Each database is split into two sets: one for training (DS1) and training (DS1) and testing (DS2) sets.
one for testing (DS2). This division of the data is chosen to Dataset MIT-BIH AR recordings
balance the presence of the different types of heartbeats and
number of subjects in each dataset. It takes into account the DS1 101, 106, 108, 109, 112, 114, 115, 116, 118, 119, 122, 124, 201,
inter-patient division, i.e., the subjects used to construct or 203, 205, 207, 208, 209, 215, 220, 223, 230
optimize the classifier (DS1) are different from the subjects used DS2 100, 103, 105, 111, 113, 117, 121, 123, 200, 202, 210, 212, 213,
to evaluate it (DS2). It has been demonstrated [3] that models 214, 219, 221, 222, 228, 231, 232, 233, 234
True positives (TP) indicate correctly predicted positive class • Stage 1–Processing of the ECG recordings: this procedure
and true negatives (TN) indicate correctly predicted negative involves the filtering, heartbeat detection, heartbeat
class heartbeats. A good classifier is the one that minimizes false segmentation, and feature extraction. We include
negatives (FN) and false positives (FP). morphological and time intervals between heartbeats in
The F1 score is the harmonic mean of Se and PPV, F1 = our model.
2(Se · PPV)/(Se + PPV). The F1 score is used to choose the • Stage 2–Classification between SVEB+ and VEB+ classes: we
optimum parameters of our classifier during the training phase. use an ensemble of ESNs with ring topology to perform this
classification task.
2.3. The Heartbeat Classifier We discuss the classification procedure in stage 2 in more detail
The proposed heartbeat classifier is based on an Echo State
later in the text.
Network (ESN). It classifies the heartbeats of the processed ECG
recordings in two classes based on morphology: SVEB+ and
VEB+. SVEB+ class includes normal (N) and supraventricular 2.4. Processing of the ECG and Feature
ectopic (S or SVEB) heartbeats. These heartbeats have a Extraction
normal morphology and a supraventricular origin as opposed In order to accomplish arrhythmia classification, minor
to VEB+ heartbeats that present ventricular origin or abnormal preprocessing needs to be applied to the source ECG records. In
our system, the processing of the ECG recordings includes the to extract features. In our case, we use the raw waveform of each
following steps: heartbeat around the heartbeat position to represent it. The raw
data of each beat was represented by an equal number of samples
1. ECG re-sampling: ECG signals are processed with a common
from each side from the point of the beat annotation. In order to
sampling rate of 250 Hz. The AHA database (250 Hz) keeps
learn from the temporal characteristics of each beat, information
its original sampling rate and the MIT-BIH AR database (360
about the RR intervals is also added to the heartbeat features.
Hz) is resampled to 250 Hz using the PhysioToolkit software
The RR intervals are features used in almost all the methods
package [1].
to classify arrhythmic heartbeats. For instance, it is well-known
2. ECG filtering: All ECG recordings are filtered in a bandwidth ν
that VEB heartbeats are characterized by shorter RR intervals
(Hz) ∈ [0.5, 35], to correct the baseline and remove unwanted
than the N heartbeats. We found that using the logarithm of
high frequency noise. A Butterworth high-pass filter (with a
the RR intervals, as in Llamedo and Martinez [33], leads to a
cutoff frequency νc = 0.5 Hz) and a finite impulse response
slightly better performance of the classifier. All the features that
filter of 12th order (35 Hz, at 3-dB point) are used, following
characterize the ith heartbeat are listed below:
standard procedure.
3. Heartbeat detection: To determine the position of the • 60 raw samples of the segmented heartbeat waveform centered
heartbeats, the annotated positions provided by the databases around the position annotated for the heartbeat.
are used. In the MIT-BIH AR database the annotation position • ln(RR(i)): logarithm of the current RR interval.
occurs at the largest of the local extrema of the QRS complex. • ln(RR(i + 1)): logarithm of the next RR interval.
Beat detection is beyond the scope of this study. Highly • ln(RRmean ) logarithm of an average of the previous 250 RR
accurate automated beat detection methods have already been intervals (averaging over the n available RR intervals when
reported [32]. n < 250).
4. RR calculation: The RR interval is defined as the time interval
At the end of the processing and feature extraction stage,
between successive heartbeats. The RR interval associated to a
each heartbeat is represented as a d-dimensional vector
heartbeat i, RR(i), corresponds to the time difference between
containing three features related to the RR intervals and 60
the heartbeat i and the previous heartbeat (i − 1).
morphological features, which are simply the samples of the
5. Heartbeat segmentation: The ECG signal is segmented around
ECG waveform around the position annotated for each heartbeat.
the annotated position given by each database. The size of the
This d-dimensional vector (d = 63) is the input for the
segmented heartbeat is 240 ms (60 samples at 250 Hz) and it is
classification algorithm.
centered around the annotation position.
6. Heartbeat normalization: Each segmented heartbeat is 2.5. Classification Algorithm: Echo State
normalized between [−1, 1]. This scaling operation
results in a signal that is independent of the original Network
ECG recording amplitude. Our classifier is built upon an ESN with a ring topology.
ESNs are a popular implementation of Reservoir Computing
After processing the ECG recordings, each heartbeat is (RC). RC is an established paradigm in machine learning
represented by a set of features. One of the main goals related to that has been successfully applied in a variety of different
the feature selection in our model is to avoid complicated features tasks [27, 34]. This computing paradigm is made of three
with a high computational cost, since we aim to design a fast and layers: input, reservoir and output (see general ESN scheme
real-time heartbeat classifier. Therefore, we focus on simple ways in Figure 2A. In the case of the ESN, the reservoir is a
recurrent neural network with random input and random to N × Hb, where d, Hb, and N are the number of input features,
connection weights between the neurons. Thanks to the heartbeats, and network neurons, respectively. The mapping
recurrence of the network, current reservoir responses depend from the input into the reservoir is done through a random input
on the previous state of the reservoir, yielding an ESN matrix WinN×d generated from a uniform distribution ∈ [−1, 1].
capable of performing context-dependent computations. The Hence, the ECG data original features vector ud×Hb is modified
reservoir benefits from a high-dimensional non-linear mapping according to:
of the input, so that the reservoir response is easier to
classify than the original input by means of a simple linear XN×Hb = (Win
N×d × ud×Hb ). (5)
regression technique.
At the input stage, the ECG data must be fed into the reservoir Once the first data is fed into the reservoir, the input proceeds
network. In this process, dimensions must change from d × Hb sequentially and further reservoir responses are computed
FIGURE 2 | Schematic illustration of (A) traditional ESN, depicting the high-dimensional non-linear mapping of the input to a reservoir with random and sparse internal
node connectivity and (B) ring ESN, depicting the high-dimensional non-linear mapping of the input to a reservoir with a specific ring topology internal node
connectivity. Weights optimized during the learning process are indicated by black arrows (Wout ), whereas random weights are depicted with red arrows (Win ).
Random (A) or predefined (B) weights are depicted with blue arrows (W). Although it is not explicitly depicted in the figure, the d-dimensional input x is augmented
with an additional constant node accounting for the bias term.
FIGURE 3 | Performance map of the F1 score obtained for the MIT-BIH AR and AHA databases from a 5-fold cross-validation on the set DS1. The number of neurons
is N = 500 and the results have been averaged over 100 different input random matrices. η ranges from 0 to 1 and γ from 0.1 to 1. Top panels correspond to the
MIT-BIH AR database lead II (left) and V1’ (right). Bottom panels correspond to the AHA database lead A (left) and B (right). Each performance map adapts the color
range so that optimal values can be easily identified by visual inspection.
iteratively. The reservoir matrix response r for the nth heartbeat is converted into a binary one by means of a decision threshold
for the standard ESN is obtained as follows: of 0.5.
In most of the ESN approaches, the connection matrix W
r(n) = F(γX(n) + ηWr(n − 1)), (6) is a sparse random matrix. This general form is schematically
represented in Figure 2A. However, it has recently been shown
where W is the random connection square matrix, with that simpler ESN with ring topologies perform as well as those
dimensions N × N, F is the ESN activation function and γ and with a standard random connection matrix [37]. The ring ESN
η are the input and connection scaling parameters, respectively. presents fixed random connections at the input layer Win and
For the standard ESN, W is also generated from a uniform fixed deterministic weights between internal reservoir neurons,
distribution ∈ [−1, 1] and defines the connection weights with a connection matrix W of only non-zero elements in the
between the internal neurons. For the non-linear function, we lower sub-diagonal Wi+1,i = 1 and at the upper-right corner
choose the classical sigmoid function with exponent −4 and a W1,N = 1. The ring ESN is schematically illustrated in Figure 2B.
bias of 0.5, i.e., F(x) = 1+e1−4x − 0.5. Reservoir computers with In this work, we use a ESN with ring topology for convenience.
these sigmoid functions have shown optimal results solving The simplicity of the ring ESN allows for an easy exploration
different tasks [35]. Other activation functions, such as rectifiers of the system parameters in contrast to the computationally
can also be used. demanding trial and error process in ESNs with random
In this method, only the connections between the reservoir topologies [37]. Moreover, this simplicity also allows an easy
responses and the output are optimized using, usually, some hardware implementation of the ring ESN using delay-coupled
simple linear regression. The response of the ESN to the input, systems [38–41].
r(n), is used to calculate the expected output, ŷ(n), according to:
ŷ(n) = Wout r(n), (7) 2.6. Parameter Optimization of the ESN for
the SVEB+ and VEB+ Classification
where Wout The ring ESN topology allows for a simple optimization
l×N are the output weights of the ESN and l the
number of output nodes. The output weights are computed by procedure, in contrast to the complex trial and error ESN
minimizing the squared error between the train outputs and construction with random topologies. The typical model
their corresponding target class values, usually employing a construction decisions in a ring ESN include: setting the network
linear regression method [36]. In addition, the normal equation size (N), the scaling parameters γ and η and the random input
formulation is adopted. For the heartbeat classifier we have found connections (Win ). In this heartbeat arrhythmia classification
that due to the experimental noise present in the original data, task, the data are very imbalanced [the number of VEB+ cases
simple linear regression results are similar to ridge regression is much smaller than the SVEB+ ones (see Table 3)], and the
results. For this reason, we prefer the use of linear regression. system is prone to have a high accuracy but a poor classification
In this work we deal with a classification task that requires a performance. Thus, the criterion to choose the optimum ring
binary output, e.g., 0 and 1, for the SVEB+ and VEB+ classes, ESN parameters to discriminate between the SVEB+ and VEB+
respectively. Thus, the continuous output given by Equation (7) classes is the one that maximizes the F1 score over the training
set DS1.
The optimal η and γ values for each lead and database are
determined via a 5-fold cross-validation over the corresponding
training set. Figure 3 shows the performance of the combinations
of the pair (η, γ) with a fixed number of neurons N = 500
for the MIT-BIH AR and the AHA databases. To avoid an
undesired dependence on the sparsity and randomness of the
input connections, we average over 100 different input random
matrices (Win ). The parameter pair that yields the best overall
classification is η = 0.2 and γ = 0.1. It is worth mentioning
that the memory of past heartbeats helps the classification of
heartbeats because the case of η = 0 (where ESN has no recurrent
connections and it is just a feed-forward neural network with
one hidden layer) is out of the optimum performance area.
This suggests that the memory of past heartbeats helps the
classification of present heartbeats. Once the pair (η, γ) is set,
their optimal values are used to explore the dependence on the
number of neurons (N) via a 5-fold cross-validation over the
corresponding training set. The F1 score as a function of the
FIGURE 4 | Performance (F1 score) obtained from a 5-fold cross-validation on number of neurons for the value pair (η = 0.2, γ = 0.1) is
the set DS1 as a function of the number of neurons (N). Results for η = 0.2,
γ = 0.1, which have been averaged over 100 different input random matrices.
represented in Figure 4. As expected, the performance improves
with the number of neurons but it starts to saturate for network
TABLE 5 | Cross database VEB+ performance over the test set DS2 using an TABLE 6 | Technical specifications of the CPU and GPU used in this work.
ensemble of 30 ring ESNs.
CPU GPU
Train (DS1) Test (DS2) Se (%) PPV (%) Sp (%) Acc (%)
Processor Intel(R) Core(TM) i7-4790K NVIDIA TITAN X Pascal
AHA A AHA A 90.4 94.9 99.5 98.6 (3584 CUDA cores)
AHA B 87.2 92.4 99.2 98.1 Clock frequency 4,400 MHz 1,417 MHz
MIT-BIH AR II 78.2 98.5 99.9 98.3 Memory 32 GB 12 GB
MIT-BIH AR V1’ 71.5 80.6 98.7 96.7 Max. Mem. Bandwidth 25.6 GB/s 480 GB/s
AHA B AHA A 82.2 97.1 99.7 98.1
AHA B 87.9 89.6 98.9 97.8
MIT-BIH AR II 84.9 97.2 99.8 98.7
MIT-BIH AR V1’ 79.1 43.4 91.9 91.0 specific technical details for the CPU and GPU are summarized
MIT-BIH AR II AHA A 69.4 20.5 71.4 71.2 in Table 6.
AHA B 58.8 23.9 80.0 78.0 Although ensembles are inherently independent,
MIT-BIH AR II 84.4 95.8 99.7 98.6 making them good candidates for parallel multi-processor
MIT-BIH AR V1’ 39.9 17.5 85.2 81.9 implementations, the presence of large matrix products and
MIT-BIH AR V1’ AHA A 77.0 49.6 91.7 90.3 non-linear mapping functions in the reservoir paradigm also
AHA B 74.7 49.1 91.8 90.1 makes serial implementations suitable for the exploration of
MIT-BIH AR II 72.6 97.6 99.9 97.9
computationally fast approaches. These approaches, such as
MIT-BIH AR V1’ 81.5 76.2 98.0 96.8
GPU implementations, are capable of reducing the latency and
increasing the throughput.
In order to explore the computational time and reservoir size
(N) dependence, a series of training and classification procedures
times. However, ensembles are inherently parallel, which can for the MIT-BIH AR database are analyzed. Linear regressions
make them much more efficient at training and test time if one are carried out by means of lower-upper decomposition.
has access to a computer with multiple processors. C++ implementations benefit from the Eigen library 1 , while
As part of our study, we assess the generalization capability of C++/CUDA use cuSolver, cuBLAS products and a CUDA kernel
our SVEB+ and VEB+ classifier by evaluating the performance implemented for the non-linear mapping.
of the classifier on a lead and/or database different from the Figure 6 shows the computational times of a training and
one used to train it. The results are shown in Table 5. The a testing realization for the DS1 and DS2 sets of the MIT-
best generalization capability is obtained when the classifier is BIH AR databases, respectively, vs. the number of neurons. The
trained either with the AHA lead A or lead B, performing GPU and CPU comparison highlights the advantage of using
relatively well for all the analyzed leads in the test. The bigger a GPU implementation, with significantly lower training times.
size and the richer variety of the AHA database is likely the The depicted computational times include, on the one hand,
reason of the better generalization capability of the classifiers the random non-linear mapping of the input onto the reservoir
trained with the AHA leads than those trained with the MIT and, on the other hand, the calculation of the output weights
leads. The classification into SVEB+ and VEB+ is based mainly Wout over the entire train dataset. The insets in Figure 6 show
on the morphological shape of the lead. In spite of this lead the computational time for the final classification product steps
dependency, the classifier can to some extent generalize to other that calculate the output in the test dataset. As expected, the
leads. It is worth mentioning that the MIT-BIH AR cross database processing time increases with the number of neurons, especially
performance is relatively poor, specially for the lead II. Some in the training procedure. The influence of small sized products
ECG recordings of MIT-BIH AR lead V1’ are V2 or V5, which on cuBLAS scaling, intrinsic to the library, can be seen in
could lead to a better generalization capability of the lead V1’ but the piece-wise linear trend present in the GPU Classification
also to a worse performance in the intra-lead classification when product. The reported computational times account for 11 h of
compared with the other intra-lead performances (see Table 4). ECG recordings, allowing the exploration of different parameter
regimes and providing fast classifications clearly suitable for
real-time scenarios that may include statistical ensembles.
3.2. Computational Times
Besides providing a detailed characterization of the arrhythmia 3.3. Comparison With Other Heartbeat
heartbeat classifier based on ESNs, our study also aims Arrhythmia Classifiers
at achieving computational times that allow for real-time The MIT-BIH AR database is by far the most used to evaluate
processing of ECG data. In particular, we have implemented the methods on the ventricular arrhythmia classification. However,
ESN classifiers described here independently in an unparallelized making a fair comparison between heartbeat classifiers is a
C++ version for the CPU and a C++/CUDA version for difficult task. For instance, classifiers sharing heartbeats for the
the GPU. C++ refers to the object oriented programming
language and CUDA is a parallel computing platform developed 1 Eigen v3.3—Gaël Guennebaud, Benoît Jacob et al.
by the company Nvidia to interface with their GPUs. The http://eigen.tuxfamily.org/
FIGURE 6 | Dependence of the computational times as a function of the number of neurons for (Left) GPU and (Right) CPU implementations. NM stands for
Non-linear Mapping and consists in the input-random matrix multiplication and the application of the non-linear function in accordance with the ESN. The single test
and training times shown are over the whole DS1 and DS2 sets of one lead of the MIT-BIH AR database, respectively.
VEB
Only the best fully automatic work result is reported. All the classifiers have been trained over the set DS1 and tested over DS2, except the ones marked with*. Rahhal et al. [22] and
Krasteva et al. [5] test against all the MIT-BIH AR database. Rahhal et al. [22] trains over the DS1 and Krasteva et al. [5] uses three databases (AHA, MIT-BIH-SV, and EDB) to train the
model. See the text for a description of the different methods and features.
same subjects in the training and test set have unrealistically Focusing on the detection of ventricular arrhythmia, we
better evaluation results than classifiers that follow the inter- compare the VEB (V) performance instead of the VEB+ (V+F),
patient procedure [7]. Semi-automatic heartbeat classifiers (that as the VEB+ performance is usually not reported in the literature.
require some assistance for expert cardiologist) also have a better The VEB performance has then been calculated in our algorithm
performance than the fully automatic approaches [33]. Thus, to without taking into account the F heartbeats, which are rather
be as fair as possible, we only compared our method with other rare. Table 7 compares the VEB detection performance of
fully automatic heartbeat classifiers that make the test over the state-of-the-art algorithms with the method proposed in this
DS2 set of the MIT-BIH AR database and whose train set does manuscript. Table 7 also provides information about the features
not share subjects with the testing set. and classifiers used by the different approaches. In most cases,
the computational cost of these methods, either during the In this work, heartbeats are classified as SVEB+ and VEB+.
training or the test phases, is not mentioned. Table 7 presents a Future work will focus on the extension of these results to
wide variety of methods, such as Multilayer Perceptron (MLP), the five heartbeat classes recommended by the AAMI. Another
temporal vectorcardiogram (TVCG), Expectation-maximization important aspect not covered in our study is the fixed heartbeat
clustering algorithm (EMC), Gaussian mixture modeling window length that can be inappropriate in the case of fast and
(GMM), Enhanced expectation maximization (EM), Orthogonal slowly varying heart rhythms when changing physical activity.
Stockwell Transform (DOST), Deep Belief Networks (DBN), and Thus, there is a need to study adaptive beat size segmentation.
synchrosqueezing transform (SST). The understanding of the exact relation between underlying
Our method outperforms or shows state-of-the-art results physiology and features is a potential question to address.
with methods that used much more complicated procedures However, there are no conclusive guidelines about which features
to extract and select the heartbeat features for the VEB class. should be used to diagnose arrhythmias from the ECG using
Some of the methods with better performance than the method computer aided systems.
proposed here are not well-suited for real-time applications, as
the feature extraction stage can not be implemented online, such DATA AVAILABILITY
as in [43] or imply a high computational cost [6]. Moreover, our
approach outperforms the other single lead classifiers reported The MIT-BIH AR publicly available dataset was part of the
for the VEB classification based on the MIT-BIH AR lead V1’, analysis presented in this work. This database can be found here:
showing a better generalization capability than the other methods https://physionet.org/physiobank/database/mitdb/.
based on a single lead. Finally, the excessive false alarm rate
(low PPV) is a major problem for clinical use since it diminishes AUTHOR CONTRIBUTIONS
the confidence in the algorithm. The approach discussed in this
manuscript has the best PPV for the VEB class among the single MA implemented the classifier and performed the computational
lead classifiers. realizations. SO and MS designed and supervised the project. All
authors contributed to the discussion of the results and to the
4. DISCUSSION writing of the manuscript.
in a heartbeat classification system. PLoS ONE. (2015) 13:e0140123. 27. Jaeger H, Haas H. Harnessing nonlinearity: predicting chaotic systems
doi: 10.1371/journal.pone.0140123 and saving energy in wireless communication. Science. (2004) 304:78–80.
6. Sultan Qurraie S, Ghorbani Afkhami R. ECG arrhythmia classification using doi: 10.1126/science.1091277
time frequency distribution techniques. Biomed Eng Lett. (2017) 7:325–32. 28. Moody GB, Mark RG. The impact of the MIT-BIH arrhythmia database. IEEE
doi: 10.1007/s13534-017-0043-2 Eng Med Biol Mag. (2001) 20:45–50. doi: 10.1109/51.932724
7. Ghorbani Afkhami R, Azarnia G, Tinati MA. Cardiac arrhythmia 29. Emergency Care Research Institute. American Heart Association (AHA)
classification using statistical and mixture modeling features of ECG signals. Ventricular Arrhythmia ECG Database. Plymouth Meeting, PA: Emergency
Pattern Recognit Lett. (2016) 70:45–51. doi: 10.1016/j.patrec.2015.11.018 Care Research Institute (2003).
8. Dokur Z, Ölmez T. ECG beat classification by a novel hybrid neural 30. ANSI/AAMI. Testing and Reporting Performance Results of Cardiac Rhythm
network. Comput Methods Programs Biomed. (2001) 66:167–81. and ST Segment Measurement Algorithms. Arlington, VA: American National
doi: 10.1016/S0169-2607(00)00133-4 Standards Institute, Inc (ANSI), Association for the Advancement of Medical
9. Elhaj FA, Salim N, Harris AR, Swee TT, Ahmed T. Arrhythmia recognition Instrumentation (AAMI), ANSI/AAMI/ISO EC57, 1998-(R)2008 (2008).
and classification using combined linear and nonlinear features of 31. Llamedo M, Martinez JP. Heartbeat classification using feature selection
ECG signals. Comput Methods Programs Biomed. (2016) 127:52–63. driven by database generalization criteria. IEEE Trans Biomed Eng. (2011)
doi: 10.1016/j.cmpb.2015.12.024 58:616–25. doi: 10.1109/TBME.2010.2068048
10. Martis RJ, Acharya UR, Min LC. ECG beat classification using PCA, LDA, 32. Martinez JP, Almeida R, Olmos S, Rocha AP, Laguna P. A wavelet-based ECG
ICA and discrete wavelet transform. Biomed Signal Process Control. (2013) delineator: evaluation on standard databases. IEEE Trans Biomed Eng. (2004)
8:437–48. doi: 10.1016/j.bspc.2013.01.005 51:570–81. doi: 10.1109/TBME.2003.821031
11. Inan OT, Giovangrandi L, Kovacs GTA. Robust neural-network- 33. Llamedo M, Martinez JP. An automatic patient-adapted ECG heartbeat
based classification of premature ventricular contractions using classifier allowing expert assistance. IEEE Trans Biomed Eng. (2012) 59:2312–
wavelet transform and timing interval features. IEEE Trans 20. doi: 10.1109/TBME.2012.2202662
Biomed Eng. (2006) 53:2507–15. doi: 10.1109/TBME.2006. 34. Lukoševičius M, Jaeger H. Reservoir computing approaches to
880879 recurrent neural network training. Comput Sci Rev. (2009) 3:127–49.
12. Javadi M, Ebrahimpour R, Sajedin A, Faridi S, Zakernejad S. Improving doi: 10.1016/j.cosrev.2009.03.005
ECG classification accuracy using an ensemble of neural network 35. Ortín S, Pesquera L. Reservoir computing with an ensemble of time-
modules. PLoS ONE. (2011) 6:e24386. doi: 10.1371/journal.pone. delay reservoirs. Cognit Comput. (2017) 9:327–36. doi: 10.1007/s12559-017-
0024386 9463-7
13. Kiranyaz S, Ince T, Gabbouj M. Real-time patient-specific ECG classification 36. Lukoševičius M. A practical guide to applying echo state networks. In:
by 1-D convolutional neural networks. IEEE Trans Biomed Eng. (2016) Montavon G, Orr GB, Müller KR, editors. Neural Networks: Tricks of the
63:664–75. doi: 10.1109/TBME.2015.2468589 Trade. 2nd ed. Berlin; Heidelberg: Springer Berlin Heidelberg (2012). p.
14. Zhang Z, Dong J, Luo X, Choi KS, Wu X. Heartbeat classification 659–86. doi: 10.1007/978-3-642-35289-8_36
using disease-specific feature selection. Comput Biol Med. (2014) 46:79–89. 37. Rodan A, Tino P. Minimum complexity echo state network. IEEE Trans
doi: 10.1016/j.compbiomed.2013.11.019 Neural Netw. (2011) 22:131–44. doi: 10.1109/TNN.2010.2089641
15. Huang H, Liu J, Zhu Q, Wang R, Hu G. A new hierarchical method for inter- 38. Appeltant L, Soriano MC, Van der Sande G, Danckaert J, Dambre J,
patient heartbeat classification using random projections and RR intervals. Schrauwen B, et al. Information processing using a single dynamical node as
Biomed Eng Online. (2014) 13:90. doi: 10.1186/1475-925X-13-90 complex system. Nat Commun. (2011) 2:468. doi: 10.1038/ncomms1476
16. Garcia G, Moreira G, Menotti D, Luz E. Inter-patient ECG heartbeat 39. Paquot Y, Duport F, Smerieri A, Dambre J, Schrauwen B, Haelterman
classification with temporal VCG optimized by PSO. Sci Rep. (2017) 7:10543. M, et al. Optoelectronic reservoir computing. Sci Rep. (2012) 2:287.
doi: 10.1038/s41598-017-09837-3 doi: 10.1038/srep00287
17. Raj S, Ray KC, Shankar O. Cardiac arrhythmia beat classification using DOST 40. Brunner D, Soriano MC, Mirasso C, Fischer I. Parallel photonic information
and PSO tuned SVM. Comput Methods Programs Biomed. (2016) 136:163–77. processing at gigabyte per second data rates using transient states. Nat
doi: 10.1016/j.cmpb.2016.08.016 Commun. (2013) 4:1364. doi: 10.1038/ncomms2368
18. Ye C, Kumar BVKV, Coimbra MT. Heartbeat classification using 41. Ortín S, Soriano MC, Pesquera L, Brunner D, San-Martín D, Fischer I,
morphological and dynamic features of ECG signals. IEEE Trans Biomed Eng. et al. A unified framework for reservoir computing and extreme learning
(2012) 59:2930–41. doi: 10.1109/TBME.2012.2213253 machines based on a single time-delayed neuron. Sci Rep. (2015) 5:14945.
19. De Lannoy G, François D, Delbeke J, Verleysen M. Weighted conditional doi: 10.1038/srep14945
random fields for supervised interpatient heartbeat classification. IEEE Trans 42. Osowski S, Linh TH. ECG beat recognition using fuzzy hybrid neural network.
Biomed Eng. (2012) 59:241–7. doi: 10.1109/TBME.2011.2171037 IEEE Trans Biomed Eng. (2001) 48:1265–71. doi: 10.1109/10.959322
20. Wu Z, Ding X, Zhang G. A novel method for classification of ECG 43. Teijeiro T, Felix P, Presedo J, Castro D. Heartbeat classification using
arrhythmias using deep belief networks. Int J Comput Intell Appl. (2016) abstract features from the abductive interpretation of the ECG.
15:1650021. doi: 10.1142/S1469026816500218 IEEE Journal of Biomedical and Health Inform. (2018) 22:409–20.
21. Acharya UR, Oh SL, Hagiwara Y, Tan JH, Adam M, Gertych A, et al. A deep doi: 10.1109/JBHI.2016.2631247
convolutional neural network model to classify heartbeats. Comput Biol Med. 44. Herry CL, Frasch M, Seely AJE, Wu HT. Heart beat classification from
(2017) 89:389–96. doi: 10.1016/j.compbiomed.2017.08.022 single-lead ECG using the synchrosqueezing transform. Physiol Meas. (2017)
22. Rahhal MMA, Bazi Y, Alhichri H, Alajlan N, Melgani F, Yager RR. 38:171–87. doi: 10.1088/1361-6579/aa5070
Deep learning approach for active classification of electrocardiogram
signals. Inf Sci. (2016) 345:340–54. doi: 10.1016/j.ins.2016. Conflict of Interest Statement: MA is currently employed by company PLUX
01.082 S.A. This research was entirely conducted while he was an IFISC researcher.
23. Li H, Yuan D, Ma X, Cui D, Cao L. Genetic algorithm for the optimization
of features and neural networks in ECG signals classification. Sci Rep. (2017) The remaining authors declare that the research was conducted in the absence of
7:41011. doi: 10.1038/srep41011 any commercial or financial relationships that could be construed as a potential
24. Ortín S, Soriano MC, Alfaras M, Mirasso CR. Automated real-time method for conflict of interest.
ventricular heartbeat classification. Comput Methods Programs Biomed. (2019)
169:1–8. doi: 10.1016/j.cmpb.2018.11.005 Copyright © 2019 Alfaras, Soriano and Ortín. This is an open-access article
25. Zidelmal Z, Amirou A, Ould-Abdeslam D, Merckle J. ECG beat classification distributed under the terms of the Creative Commons Attribution License (CC BY).
using a cost sensitive classifier. Comput Methods Programs Biomed. (2013) The use, distribution or reproduction in other forums is permitted, provided the
111:570–7. doi: 10.1016/j.cmpb.2013.05.011 original author(s) and the copyright owner(s) are credited and that the original
26. Ye C, Kumar BVK, Coimbra MT. An automatic subject-adaptable heartbeat publication in this journal is cited, in accordance with accepted academic practice.
classifier based on multiview learning. IEEE J Biomed Health Inform. (2016) No use, distribution or reproduction is permitted which does not comply with these
20:1485–92. doi: 10.1109/JBHI.2015.2468224 terms.