Using deep convolutional neural networks to predict patients age based on ECGs from an independent test cohort


  • Bjørn-Jostein Singstad Simula Research Laboratory
  • Belal Tavashi Department of Biomedical Engineering, Ankara University



ECG, Convolutional Neural Networks, Age prediction


Electrocardiography is one of the most frequently used methods to evaluate cardiovascular diseases. However, the last decade has shown that deep convolutional neural networks (CNN) can extract information from the electrocardiogram (ECG) that goes beyond traditional diagnostics, such as predicting a persons age. In this study, we trained two different 1-dimensional CNNs on open datasets to predict age from a persons ECG.

The models were trained and validated using 10 seconds long 12-lead ECG records, resampled to 100Hz. 59355 ECGs were used for training and cross-validation, while 21748 ECGs from a separate cohort were used as the test set. We compared the performance achieved on the cross-validation with the performance on the test set. Furthermore, we used cardiologist annotated cardiovascular conditions to categorize the patients in the test set in order to assess whether some cardiac condition leads to greater discrepancies between CNN-predicted age and chronological age.

The best CNN model, using an Inception Time architecture, showed a significant drop in performance, in terms of mean absolute error (MAE), from cross-validation on the training set (7.90 ± 0.04 years) to the performance on the test set (8.3 years). On the other hand, the mean squared error (MSE) improved from the training set (117.5 ± 2.7 years^2) to the test set (111 years^2). We also observed that the cardiovascular condition that showed the highest deviation between predicted and biological age, in terms of MAE, was the patients with pacing rhythm (10.5 years), while the patients with prolonged QT-interval had the smallest deviation (7.4 years) in terms of MAE.

This work contributes to existing knowledge of age prediction using deep CNNs on ECGs by showing how a trained model performs on a test set from a separate cohort to that used in the training set.


E. A. P. Alday, A. Gu, A. J. Shah, C. Robichaux,A.-K. I. Wong, C. Liu, F. Liu, A. B. Rad,A. Elola, S. Seyedi, Q. Li, A. Sharma, G. D.Clifford, and M. A. Reyna. Classification of 12-lead ECGs: the PhysioNet/Computing in Cardiology Challenge 2020. Physiological Measurement, 41(12):124003, Dec. 2020. ISSN 0967-3334. doi: 10.1088/1361-6579/abc960. URL https:// Publisher: IOP Publishing.

Z. I. Attia et al. Age and Sex Estimation Using Artificial Intelligence From Standard 12-Lead ECGs. Circulation: Arrhythmia and Electrophysiology, 12(9):e007284, Sept. 2019a. doi: 10. 1161/CIRCEP.119.007284. Publisher: American Heart Association.

Z. I. Attia et al. An Artificial Intelligence-Enabled ECG Algorithm for the Identification of Patients with Atrial Fibrillation during Sinus Rhythm: a Retrospective Analysis of Outcome Prediction. The Lancet, 394(10201):861–867, Sept. 2019b. doi: 10.1016/S0140-6736(19)31721-0.

R. Bousseljot, D. Kreiseler, and A. Schnabel. Nutzung der EKG-Signaldatenbank Cardiodat der PTB ¨uber das Internet. Biomedizinische Technik/Biomedical Engineering, pages 317–318, July 2009. doi: 10.1515/bmte.1995.40.s1.317.

C.-H. Chang, C.-S. Lin, Y.-S. Luo, Y.-T. Lee, and C. Lin. Electrocardiogram-Based Heart Age Estimation by a Deep Learning Model Provides More Information on the Incidence of Cardiovascular Disorders. Frontiers in Cardiovascular Medicine, 9, 2022. ISSN 2297-055X. URL

H. Ismail Fawaz et al. InceptionTime: Finding AlexNet for Time Series Classification. Data Mining and Knowledge Discovery, 34(6):1936–1962, Nov. 2020. ISSN 1573-756X. doi: URL

A. O. Ladejobi et al. The 12-lead electrocardiogram as a biomarker of biological age. European Heart Journal - Digital Health, 2(3):379–389, Sept. 2021. ISSN 2634-3916. doi: 10.1093/ehjdh/ztab043. URL

E. M. Lima et al. Deep neural networkestimated electrocardiographic age as a mortality predictor. Nature Communications, 12(1):5117, Aug. 2021. ISSN 2041-1723. doi: 10.1038/s41467021-25351-7.URL Number: 1 Publisher:Nature Publishing Group.

F. Liu et al. An Open Access Database for Evaluating the Algorithms of Electrocardiogram Rhythm and Morphology Abnormality Detection. Journal of Medical Imaging and Health Informatics, 8(7):1368–1373, Sept. 2018. doi:10.1166/jmihi.2018.2442.

S. Raghunath. Prediction of mortality from 12-lead electrocardiogram voltage data using a deep neural network. Nature Medicine, 26(6):886–891, June 2020. ISSN 1546-170X. doi: 10.1038/s41591-020-0870-z. URL Number: 6 Publisher: Nature Publishing Group.

M. A. Reyna, N. Sadr, E. A. P. Alday, A. Gu, A. J. Shah, C. Robichaux, A. B. Rad, A. Elola, S. Seyedi, S. Ansari, H. Ghanbari, Q. Li, A. Sharma, and G. D. Clifford. Will Two Do? Varying Dimensions in Electrocardiography: The PhysioNet/Computing in Cardiology Challenge 2021. In 2021 Computing in Cardiology (CinC), volume 48, pages 1–4, Sept. 2021. doi: 10.23919/CinC53138.2021.9662687. ISSN: 2325-887X.

B.-J. Singstad and E. M. Muten. Assessing the Impact of Downsampled ECGs and Alternative Loss Functions in Multi-Label Classification of 12-Lead ECGs. Nov. 2022. doi: 10.1101/2022.11.16.22282373. URL

H. Smulyan. The Computerized ECG: Friend and Foe. The American Journal of Medicine, 132(2):153–160, Feb. 2019. doi: 10.1016/j.amjmed.2018.08.025.

V. Tihonenko, A. Khaustov, S. Ivanov, A. Rivin, and E. Yakushenko. St Petersburg INCART 12-lead arrhythmia database. PhysioBank PhysioToolkit and PhysioNet, 2008.

P. Wagner et al. PTB-XL, a Large Publicly Available Electrocardiography Dataset. Scientific Data, 7(1):154, May 2020. doi:

J. Zheng and et al. Optimal Multi-Stage Arrhythmia Classification Approach. Scientific Reports,10(1):2898, Feb. 2020. doi: 10.1038/s41598-020-59821-7.8