Electrocardiogram Generation with a Bidirectional LSTM-CNN Generative
Total Page:16
File Type:pdf, Size:1020Kb
www.nature.com/scientificreports OPEN Electrocardiogram generation with a bidirectional LSTM-CNN generative adversarial network Received: 11 January 2019 Fei Zhu1,2, Fei Ye1, Yuchen Fu3, Quan Liu1 & Bairong Shen4 Accepted: 2 April 2019 Heart disease is a malignant threat to human health. Electrocardiogram (ECG) tests are used to help Published: xx xx xxxx diagnose heart disease by recording the heart’s activity. However, automated medical-aided diagnosis with computers usually requires a large volume of labeled clinical data without patients' privacy to train the model, which is an empirical problem that still needs to be solved. To address this problem, we propose a generative adversarial network (GAN), which is composed of a bidirectional long short- term memory(LSTM) and convolutional neural network(CNN), referred as BiLSTM-CNN,to generate synthetic ECG data that agree with existing clinical data so that the features of patients with heart disease can be retained. The model includes a generator and a discriminator, where the generator employs the two layers of the BiLSTM networks and the discriminator is based on convolutional neural networks. The 48 ECG records from individuals of the MIT-BIH database were used to train the model. We compared the performance of our model with two other generative models, the recurrent neural network autoencoder(RNN-AE) and the recurrent neural network variational autoencoder (RNN-VAE). The results showed that the loss function of our model converged to zero the fastest. We also evaluated the loss of the discriminator of GANs with diferent combinations of generator and discriminator. The results indicated that BiLSTM-CNN GAN could generate ECG data with high morphological similarity to real ECG recordings. Cardiovascular diseases are the leading cause of death throughout the world. Approximately 32.1% of the annual global deaths reported in 2015 were related with cardiovascular diseases1. Due to increases in work stress and psychological issues, the incidences of cardiovascular diseases have kept growing among young people in recent years. As an efective method, Electrocardiogram (ECG) tests, which provide a diagnostic technique for recording the electrophysiological activity of the heart over time through the chest cavity via electrodes placed on the skin2, have been used to help doctors diagnose heart diseases. However, as vast volumes of ECG data are generated each day and continuously over 24-hour periods3, it is really difcult to manually analyze these data, which calls for automatic techniques to support the efcient diagnosis of heart diseases. Machine learning is employed frequently as an artifcial intelligence technique to facilitate automated anal- ysis. Many machine learning techniques have been applied to medical-aided diagnosis, such as support vector machines4, decision trees5, random conditional felds6, and recently developed deep learning methods7. However, most of these methods require large amounts of labeled data for training the model, which is an empirical prob- lem that still needs to be solved. For example, large volumes of labeled ECG data are usually required as training samples for heart disease classifcation systems. Moreover, when machine learning approaches are applied to per- sonalized medicine research, such as personalized heart disease research, the ECGs are ofen categorized based on the personal features of the patients, such as their gender and age. Tus, the problems caused by lacking of good ECG data are exacerbated before any subsequent analysis. Furthermore, maintaining the privacy of patients is always an issue that cannot be igored. However, the personal information and private clinical data obtained from patients are still likely to be illegally leaked. An optimal solution is to generate synthetic data without any private details to satisfy the requirements for research. 1School of Computer Science and Technology, Soochow University, Suzhou, 215006, China. 2Provincial Key Laboratory for Computer Information Processing Technology, Soochow University, Suzhou, 215006, China. 3School of Computer Science and Engineering, Changshu Institute of Technology, Changshu, 215500, China. 4Institutes for Systems Genetics, West China Hospital, Sichuan University, Chengdu, 610041, China. Correspondence and requests for materials should be addressed to B.S. (email: [email protected]) SCIENTIFIC REPORTS | (2019) 9:6734 | https://doi.org/10.1038/s41598-019-42516-z 1 www.nature.com/scientificreports/ www.nature.com/scientificreports Figure 1. Architecture of the GAN. Hence, it is very necessary to develop a suitable method for producing practical medical samples for disease research, such as heart disease. Several previous studies have investigated the generation of ECG data. McSharry et al. proposed a dynamic model based on three coupled ordinary diferential equations8, where real synthetic ECG signals can be generated by specifying heart rate or morphological parameters for the PQRST cycle. Cliford et al. used a nonlinear model to generate 24-hour ECG, blood pressure, and respiratory signals with realistic linear and nonlinear clinical characteristics9. Cao et al. designed an ECG system for generating conventional 12-lead signals10. However, most of these ECG generation methods are dependent on mathematical models to create artifcial ECGs, and therefore they are not suitable for extracting patterns from existing ECG data obtained from patients in order to generate ECG data that match the distributions of real ECGs. Te generative adversarial network (GAN) proposed by Goodfellow in 2014 is a type of deep neural network that comprises a generator and a discriminator11. Te generator produces data based on the noise data sampled from a Gaussian distribution, which is ftted to the real data distribution as accurately as possible. Te inputs for the discriminator are real data and the results produced by the generator, where the aim is to determine whether the input data are real or fake. During the training process, the generator and the discriminator play a zero-sum game until they converge. GAN has been shown to be an efcient method for generating data, such as images. In this study, we propose a novel model for automatically learning from existing data and then generating ECGs that follow the distribution of the existing data so the features of the existing data can be retained in the synthesized ECGs. Our model is based on a GAN architecture which is consisted of a generator and a discrimi- nator. In the generator part, the inputs are noise data points sampled from a Gaussian distribution. We build up two layers of bidirectional long short-term memory (BiLSTM) networks12, which has the advantage of selectively retaining the history information and current information. Moreover, to prevent over-ftting, we add a dropout layer. In the discriminator part, we classify the generated ECGs using an architecture based on a convolutional neural network (CNN). Te discriminator includes two pairs of convolution-pooling layers as well as a fully con- nected layer, a sofmax layer, and an output layer from which a binary value is determined based on the calculated one-hot vector. We used the MIT-BIH arrhythmia data set13 for training. Te results indicated that our model worked better than the other two methods, the deep recurrent neural network-autoencoder (RNN-AE)14 and the RNN-variational autoencoder (RNN-VAE)15. Related Work Generative Adversarial Network. Te GAN is a deep generative model that difers from other generative models such as autoencoder in terms of the methods employed for generating data and is mainly comprised of a generator and a discriminator. Te generator produces data based on sampled noise data points that follow a Gaussian distribution and learns from the feedback given by the discriminator. Te discriminator learns the probability distribution of the real data and gives a true-or-false value to judge whether the generated data are real ones. Te two sub-models comprising the generator and discriminator reach a convergence state by playing a zero-sum game. Figure 1 illustrates the architecture of GAN. Te solution obtained by GAN can be viewed as a min-max optimization process. Te objective function is: minmax VD(,GE)[=+xp∼∼()xzlog(Dx)] EDpz()[log(1 − ((Gz)))], GD data z (1) where D is the discriminator and G is the generator. When the distribution of the real data is equivalent to the distribution of the generated data, the output of the discriminator can be regarded as the optimal result. GAN has been successfully applied in several areas such as natural language processing16,17, latent space learn- ing18, morphological studies19, and image-to-image translation20. RNN. Recurrent neural network has been widely used to solve tasks of processing time series data21, speech recognition22, and image generation23. Recently, it has also been applied to ECG signal denoising and ECG classi- fcation for detecting obstructions in sleep apnea24. RNN typically includes an input layer, a hidden layer, and an output layer, where the hidden state at a certain time t is determined by the input at the current time as well as by the hidden state at a previous time: hfti=+()Wxht Whhh th−1 + b , (2) SCIENTIFIC REPORTS | (2019) 9:6734 | https://doi.org/10.1038/s41598-019-42516-z 2 www.nature.com/scientificreports/ www.nature.com/scientificreports Figure 2. Illustration of the RNN-AE architecture. ogth=+()Whot bo , (3) where f and g are the activation functions, xt and ot