Forecast of paroxysmal atrial fibrillation using a deep neural network edric GILON IRIDIA Universit´ e Libre de Bruxelles Brussels, Belgium cedric.gilon@ulb.be Jean-Marie GR ´ EGOIRE IRIDIA Universit´ e Libre de Bruxelles Brussels, Belgium jean-marie.gregoire@ulb.ac.be Hugues BERSINI IRIDIA Universit´ e Libre de Bruxelles Brussels, Belgium hugues.bersini@ulb.ac.be Abstract—Atrial fibrillation (AF) is the most common heart arrhythmia. It affects between 1% and 2% of the world popu- lation over 35 years old. This disease is linked to an increased risk of stroke and heart failure. AF is a progressive disease and, at first, paroxysmal AF episodes occur, last from seconds up to a week and then stop. The disease evolves to permanent state, where the heart is always in fibrillation and can’t be corrected. Forecasting paroxysmal AF episode a few seconds or minutes before its onset remains a hard challenge, but could lead to new treatment methods. For this study, we constructed a new long-term electrocardiogram (ECG) database (24 to 96 hours), composed of 10484 ECG. As a result of a careful analysis by a cardiologist, 250 AF onsets of paroxysmal AF have been detected in 140 ECG. We developed a deep neural network (DNN) model, composed of convolutional neural network (CNN) layers and bidirectional gated recurrent units (GRU) as recurrent neural network (RNN) layers. The model was trained for a supervised binary classification distinguishing between heartbeats series (RR intervals) that precede an AF onset and series distant from any AF. The model achieved an average area under the receiver operating characteristic (ROC) curve of 0.74. We evaluated the impact of heartbeat window size given as input, and the time period between the heartbeats window and the AF onset. We found that an input window of 300 heartbeats gives the best results and, not surprisingly, the closer the window is from the AF onset, the better the results. We concluded that RR intervals series contains information about the incoming AF episode, and that it can be exploited to forecast such episode. Index Terms—atrial fibrillation, heart rate variability, RR intervals, deep learning, deep neural network, convolutional neural network, recurrent neural network I. I NTRODUCTION Atrial fibrillation (AF) is the most common heart arrhythmia and the second most common heart disease after hypertension. This disease is characterised by irregular contractions of the atria, the two upper chambers of the heart. Between 30 and 50 million people are affected worldwide. The prevalence is estimated between 1% and 2% for the population over 35 years old, and AF is more frequent for people aged over 80 years old, for whom it is estimated between 10% and 17% [1] [2]. The number of affected patients continues to rise due to the global ageing of the world population. Indeed, the part of the population aged over 60 years old is expected to double by 2050 and is growing faster than all younger age groups [3]. AF is a progressive disease, and three types can be dis- tinguished: paroxysmal AF, persistent AF and permanent AF. The disease will first be present in paroxysmal state, where AF episodes start randomly and last from seconds up to a week. The heart recovers to normal sinus rhythm (NSR) without the need for a medical intervention. The disease then evolves to persistent state, where episodes last more than 7 days. A medical intervention, either drugs or surgery, is required to help the heart to recover to a normal state. Finally, the last state of the disease is permanent AF. When the disease reaches this state, the heart is continuously in AF, and never recovers to AF. One major danger of this disease is that it can be present but asymptomatic for years, before being revealed by one of its consequences. AF can lead to stroke, as blood clots can form in the heart and then be expelled into the body during AF episodes [4]. Patients with AF have an increased risk of stroke by a factor of 5. Other AF consequences are an increased risk of heart failure and death. AF is diagnosed by a cardiologist using an electrocar- diogram (ECG), in which signs of AF can be detected. In addition to ECG analysis, heart rate variability (HRV) was also studied for AF detection, as heartbeats become irregular during AF (Figure 1). HRV can be derived from the ECG and it corresponds to the series of time duration between heartbeats. This time duration is called RR interval and measured between two successive R waves, i.e. the most significant part of one ECG wave. For AF detection purpose, cardiologists can record ECG on an opportunistic basis (e.g. during regular cardiac check), or a systematic ECG records can be made for a given population (e.g. for all patients over 70 years old). In clinical practice, if there exists a suspicion of AF for a patient, a long-term ECG is recorded using an Holter monitor. The patient will carry the portable electrocardiograph for several days, and the whole ECG will be analysed afterward by a medical software and a cardiologist to detect signs of AF. In addition, cardiologists can also rely on risk scores (e.g. CHA 2 DS 2 VASc [5] or CHARGE-AF [6]) to identify at-risk patients in the population. These scores are based on the combination of multiple clinical parameters of the patient (e.g. age, sex, diabetes, hypertension). In recent years, machine learning (ML) algorithms and in particular deep learning (DL) algorithms have been used 978-1-7281-6926-2/20/$31.00 ©2020 IEEE