Heart Disease Prediction Using Logistic Regression and Random Forest with SHAP Explainability

Authors

  • Dimas Prayogi Universitas Pembangunan Panca Budi

Keywords:

heart disease prediction, logistic regression, random forest, shap explainability, machine learning

Abstract

This study presents a web-based Heart Disease Prediction System developed using Logistic Regression and Random Forest algorithms, enhanced with SHAP explainability. The system predicts the likelihood of heart disease based on key clinical parameters such as age, sex, chest pain type, blood pressure, cholesterol, and heart rate. SHAP values are integrated to provide transparent and interpretable explanations of model predictions. The Random Forest model demonstrated superior performance in capturing nonlinear relationships compared to Logistic Regression. The web application offers an interactive and user-friendly interface that displays correlation heatmaps, feature importance plots, and SHAP visualizations to aid in clinical interpretation. The results indicate that chest pain type, ST depression, and exercise-induced angina are among the most influential predictors. The proposed system successfully achieves accurate and explainable heart disease prediction, contributing to early diagnosis and decision support in healthcare.

References

R. Jagannathan, S. A. Patel, M. K. Ali, and K. M. V. Narayan, “Global updates on cardiovascular disease mortality trends and attribution of traditional risk factors,” Curr. Diab. Rep., vol. 19, no. 7, p. 44, 2019.

A. Ogunpola, F. Saeed, S. Basurra, A. M. Albarrak, and S. N. Qasem, “Machine learning-based predictive models for detection of cardiovascular diseases,” Diagnostics, vol. 14, no. 2, p. 144, 2024.

A. Hussain and A. Aslam, “Cardiovascular disease prediction using risk factors: A comparative performance analysis of machine learning models,” J. Artif. Intell., vol. 6, no. 1, pp. 129–152, 2024.

S. Mohan, C. Thirumalai, and G. Srivastava, “Effective heart disease prediction using hybrid machine learning techniques,” IEEE access, vol. 7, pp. 81542–81554, 2019.

W. Alsabhan and A. Alfadhly, “Effectiveness of machine learning models in diagnosis of heart disease: a comparative study,” Sci. Rep., vol. 15, no. 1, p. 24568, 2025.

O. W. Ikpea and D. Han, “Performance of Machine Learning Algorithms for Heart Disease Prediction: Logistic Regressions Regularized by Elastic Net, SVM, Random Forests, and Neural Networks,” 2022.

D. K. Sharipov and A. D. Saidov, “Modified SHAP approach for interpretable prediction of cardiovascular complications,” Проблемы вычислительной и прикладной математики, no. 2 (64), pp. 114–122, 2025.

N. A. Khan, M. F. Bin Hafiz, and M. A. Pramanik, “Enhancing predictive modelling and interpretability in heart failure prediction: a SHAP-based analysis,” Int. J. Informatics Commun. Technol., vol. 14, no. 1, p. 11, 2025.

T. Kavzoglu and A. Teke, “Predictive performances of ensemble machine learning algorithms in landslide susceptibility mapping using random forest, extreme gradient boosting (XGBoost) and natural gradient boosting (NGBoost),” Arab. J. Sci. Eng., vol. 47, no. 6, pp. 7367–7385, 2022.

P. Linardatos, V. Papastefanopoulos, and S. Kotsiantis, “Explainable ai: A review of machine learning interpretability methods,” Entropy, vol. 23, no. 1, p. 18, 2020.

H. Wang, Q. Liang, J. T. Hancock, and T. M. Khoshgoftaar, “Feature selection strategies: a comparative analysis of SHAP-value and importance-based methods,” J. Big Data, vol. 11, no. 1, p. 44, 2024.

Y. Ji, H. Shang, J. Yi, W. Zang, and W. Cao, “Machine learning-based models to predict type 2 diabetes combined with coronary heart disease and feature analysis-based on interpretable SHAP,” Acta Diabetol., pp. 1–16, 2025.

M. Khorasani, M. Abdou, and J. H. Fernández, “Web application development with streamlit,” Softw. Dev., vol. 498, p. 507, 2022.

R. Moscato, Web App Development Made Simple with Streamlit: A web developer’s guide to effortless web app development, deployment, and scalability. Packt Publishing Ltd, 2024.

M. W. Martinez et al., “Exercise-induced cardiovascular adaptations and approach to exercise and cardiovascular disease: JACC state-of-the-art review,” J. Am. Coll. Cardiol., vol. 78, no. 14, pp. 1453–1470, 2021.

S. P. Crispino et al., “The Complementary Role of Cardiopulmonary Exercise Testing in Coronary Artery Disease: From Early Diagnosis to Tailored Management,” J. Cardiovasc. Dev. Dis., vol. 11, no. 11, p. 357, 2024.

F. Yu, C. Wei, P. Deng, T. Peng, and X. Hu, “Deep exploration of random forest model boosts the interpretability of machine learning studies of complicated immune responses and lung burden of nanoparticles,” Sci. Adv., vol. 7, no. 22, p. eabf4130, 2021.

N. Rane, S. Choudhary, and J. Rane, “Explainable artificial intelligence (XAI) in healthcare: interpretable models for clinical decision support,” Available SSRN 4637897, 2023.

Q. Xu et al., “Interpretability of clinical decision support systems based on artificial intelligence from technological and medical perspective: A systematic review,” J. Healthc. Eng., vol. 2023, no. 1, p. 9919269, 2023.

Downloads

Published

2025-07-12

How to Cite

Dimas Prayogi. (2025). Heart Disease Prediction Using Logistic Regression and Random Forest with SHAP Explainability. Journal of Computer Science and Research (JoCoSiR), 3(3), 67–72. Retrieved from https://journal.aptikomsumut.org/index.php/jocosir/article/view/72