Prediction models to detect patients with heart diseases using neural networks and the Pytorch and TensorFlow libraries

Authors

DOI:

https://doi.org/10.36825/RITI.12.26.010

Keywords:

Heart Disease, Neural Networks, Pytorch, TensorFlow, Prediction Models

Abstract

Neural Networks are used to generate prediction models aimed at determining whether an individual has heart conditions. The PyTorch and TensorFlow libraries are applied to a dataset of patients related to heart diseases, containing 17 predictor variables. The purpose of this work is to compare the results obtained using the aforementioned libraries with Neural Networks, analyzing the behavior of loss functions and the outcomes from the confusion matrix when creating the prediction model. DownSampling and UpSampling techniques are employed to address the imbalance in the dataset, which consists of a total of 319,795 patients, of whom only 27,373 have heart disease. It was found that for this dataset, the best results with PyTorch are achieved in models of 100 epochs and above, with execution times of only a few seconds, while TensorFlow shows good results starting from models with 10 epochs, though its execution time is considerably longer. An analysis is conducted on the difference in computation time between PyTorch and TensorFlow.

References

Litjens, G., Kooi, T., Ehteshami Bejnordi, B., Adiyoso Setio, A. A., Ciompi, F., Ghafoorian, M., van der Laak, J., van Ginneken, B., Sánchez, C. I. (2017). A survey on deep learning in medical image analysis. Medical Image Analysis, 42, 60-88. https://doi.org/10.1016/j.media.2017.07.005

Poplin, R., Varadarajan, A. V., Blumer, K., Liu, Y., McConnell, M. V., Corrado, G. S., Peng, L., Webster, D. R. (2018). Prediction of cardiovascular risk factors from retinal fundus photographs via deep learning. Nature Biomedical Engineering, 2 (3), 158-164. https://doi.org/10.1038/s41551-018-0195-0

Cood., E. F. (1970). A relational model of data for large shared data banks. Communications of the ACM, 13 (6), 377-387. https://doi.org/10.1145/362384.362685

del Castillo Collazo, N., Contreras Arvizu, J. A., Durán Ortega, A. J. (2024). Uso de las técnicas DownSampling y UpSampling para abordar el desequilibrio de datos en la predicción de personas propensas a sufrir accidentes cerebrovasculares. Revista de Investigación en Tecnología de la Información (RITI), 12 (25), 66-78. https://doi.org/10.36825/RITI.12.25.007

Novac, O. C., Chirodea, M. C., Novac, C. M., Bizon, N., Oproescu, M., Stan, O. P., Gordan, C. E. (2022). Analysis of the Application Efficiency of TensorFlow and PyTorch in Convolutional Neural Network. Sensors, 22, 1-23. https://doi.org/10.3390/s22228872

Pytlak, K. (2022). Indicators of Heart Disease. https://www.kaggle.com/datasets/kamilpytlak/personal-key-indicators-of-heart-disease

Goodfellow, I., Bengio, Y., Courville, A. (2016). Deep Learning. MIT Press.

Murphy, K. P. (2012). Machine Learning: A Probabilistic Perspective. MIT Press.

Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Köpf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang. L., Bai, J., Chintala, S. (2019). PyTorch: An Imperative Style, High-Performance Deep Learning Library. 33rd International Conference on Neural Information Processing Systems, Vancouver BC Canada. https://dl.acm.org/doi/10.5555/3454287.3455008

Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J., Devin, M., Ghemawat, S., Irving, G., Isard, M., Kudlur, M., Levenberg, J., Monga, R., Moore, S., Murray, D. G., Steiner, B., Tucker, P., Vasudevan, V., Warden, P., Wicke, M., Yu, Y., Zheng, X. (2016). TensorFlow: A system for large-scale machine learning. 12th USENIX conference on Operating Systems Design and Implementation, Savannah, GA, USA. https://dl.acm.org/doi/10.5555/3026877.3026899

Nielsen, M. (2015). Neural Networks and Deep Learning. http://neuralnetworksanddeeplearning.com/

LeCun, Y., Bengio, Y., Hinton, G. (2015). Deep Learning. Nature, 521, 436-444. https://doi.org/10.1038/nature14539

Aldás, J., Uriel, E. (2017). Análisis Multivariante aplicado con R (2da Ed.). Ediciones Paraninfo.

del Castillo Collazo, N. (2020). Predicción en el diagnóstico de tumores de cáncer de mama empleando métodos de clasificación. Revista de Investigación en Tecnología de la Información (RITI), 8 (15), 96-104. https://doi.org/10.36825/RITI.08.15.009

Ashraf, M., Ahmad, S. M., Ganai, N. A., Shah, R. A., Zaman, M., Khan., S. A., Shah. A. A. (2021). Prediction of Cardiovascular Disease Through Cutting-Edge Deep Learning Technologies: An Empirical Study Based on TENSORFLOW, PYTORCH and KERAS. En D. Gupta, A. Khanna, S. Bhattacharyya, A. E. Hassanien, S. Anand, A. Jaiswal (Eds.) International Conference on Innovative Computing and Communications. Advances in Intelligent Systems and Computing (pp. 239-255). Springer. https://doi.org/10.1007/978-981-15-5113-0_18

Hannun, A. Y., Rajpurkar, P., Haghpanahi, M., Tison, G. H., Bourn, C., Turakhia, M. P., Ng, A. Y. (2019). Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nature Medicine, 25, 65-69. https://doi.org/10.1038/s41591-018-0268-3

Rajpurkar, P., Irvin, J., Zhu, K., Yang, B., Mehta, H., Duan, T., Ding, D., Bagul, A., Langlotz, C., Shpanskaya, K., Lungren, M. P., Ng, A. Y. (2017). CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning. arXiv. https://doi.org/10.48550/arXiv.1711.05225

Published

2024-11-12

How to Cite

del Castillo Collazo, N., Durán Ortega, A. J., & García Nocetti, D. F. (2024). Prediction models to detect patients with heart diseases using neural networks and the Pytorch and TensorFlow libraries. Revista De Investigación En Tecnologías De La Información, 12(26), 117–134. https://doi.org/10.36825/RITI.12.26.010