Research Article Predicting the Risk of Depression Based on ECG Using RNN Sumaiya Tarannum Noor , 1 Syeda Tasmiah Asad , 1 Mohammad Monirujjaman Khan , 1 Gurjot Singh Gaba , 2 Jehad F. Al-Amri , 3 and Mehedi Masud 4 1 Department of Electrical and Computer Engineering, North South University, Bashundhara, Dhaka 1229, Bangladesh 2 School of Electronics and Electrical Engineering, Lovely Professional University, Phagwara, India 3 Department of Information Technology, College of Computers and Information Technology, Taif University, P. O. Box 11099, Taif 21944, Saudi Arabia 4 Department of Computer Science, College of Computers and Information Technology, Taif University, P. O. Box 11099, Taif 21944, Saudi Arabia Correspondence should be addressed to Mehedi Masud; mmasud@tu.edu.sa Received 17 June 2021; Revised 15 July 2021; Accepted 21 July 2021; Published 29 July 2021 Academic Editor: Syed Hassan Ahmed Copyright©2021SumaiyaTarannumNooretal.isisanopenaccessarticledistributedundertheCreativeCommonsAttribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. is paper presents a model to predict the risk of depression based on electrocardiogram (ECG). is proposed model uses a Recurrent Neural Network (RNN) and Long Short-Term Memory (LSTM) autoencoder to predict normal, abnormal, and PVC heartbeats.eRNNmodelisadeeplearning-basedmodeltoclassifynormal,abnormal,andPVCheartbeats.eusedthemodel asaclassifier.emodelusesaheartratesdatasettopredictabnormalandPVCheartbeats.Asforthedataset,wehaveused5000 ECG samples. e model was trained on a training dataset and validation dataset. After that, it was tested on a test dataset. e modelistrainedonnormalheartbeatrates,sothemodelcanpredictanyheartbeatratesotherthannormal.Ourcontributionhere is to build a model that can differentiate between “normal,” “abnormal,” and “risky” heartbeats. Our model predicts “normal” heartbeatswith97.24%accuracyandcanpredict“PVC”heartbeatswith100%accuracy.Otherthantheaccuracy,weevaluatedour model on the training loss graphs. ese two types of training loss graphs were evaluated as “normal” versus “risky” and “abnormal”versus“risky.”ehaveseengreatresultsthereaswell.ebestlossesfor“normal,”“abnormal,”and“risky”are5.71, 33.36,and34.78.However,theseresultsmayimproveifalargerdatasetisused.Instudies,itwasfoundthatpatientssufferingfrom depression may have a different kind of heartbeat than the normal ones. In most cases, it is PVC (Premature Ventricular Contraction) heartbeats. erefore, the target is to predict abnormal heartbeats and PVC heartbeats. 1.Introduction ECG is a painless and common process. is ECG is ba- sically a graph of voltage versus time. e heart’s electric activity is shown in the graph, which is collected using an electrodeplacedontheskin.eseelectrodesareconductive pads that are attached to the body. Approximately 10 electrodes with adhesive are attached to the skin of your chest, arm, and legs. Many common heart problems are predicted through ECG. It is used to predict abnormal heart rhythm (arrhythmia), blocked or narrowed arteries in the heart caused by “coronary artery disease” that may cause chest pain or heart attack, the possibility of a previous heart attack, and functioning of a pacemaker. Heartbeat rate is the numberofpulsesaheartmakesperminute.Heartbeatrateis directly connected to our health. hile the heart beats, bloodcontainingoxygenandnutrientscirculatethroughour body. e heartbeat rate goes higher if one gets involved in the exercise. ere are two types of heartbeat rates: target heartbeat rate and maximum heartbeat rate. rough many studies [1–3], the authors took 75–100 the normal heartbeat rate of an adult. If the heart starts to beat in an irregular system, it can be considered an abnormal heart rate. R-on-T Premature Ventricular Contraction (R-on-T PVC) is caused by a ventricular ectopic focus (abnormal pacemaker sites within the heart). It produces an early and broad QRS Hindawi Computational Intelligence and Neuroscience Volume 2021, Article ID 1299870, 12 pages https://doi.org/10.1155/2021/1299870