Prediksi Penyakit Jantung Berbasis Random Forest dengan GridSearchCV dan SHAP Menggunakan Dataset Publik UCI Cleveland
Abstract
Cardiovascular disease remains the leading cause of death globally, with 19.2 million fatalities recorded in 2023, making the development of automated data-driven prediction systems an urgent necessity. This study develops a heart disease prediction model based on Random Forest optimized using Grid Search Cross-Validation (GridSearchCV) and supplemented with SHapley Additive exPlanations (SHAP) analysis for clinical interpretability on the UCI Cleveland Heart Disease dataset (297 samples, 13 clinical features). Three methodological contributions are implemented: (1) a reproducible preprocessing pipeline with post-split StandardScaler to prevent data leakage, (2) deterministic and exhaustive hyperparameter search using GridSearchCV with 216 combinations and Stratified 10-Fold Cross Validation, and (3) SHAP analysis at the global level based on training data and at the local level based on test data to produce clinically interpretable predictions. The optimal hyperparameter configuration obtained is n_estimators = 100, max_depth = None, min_samples_leaf = 4, min_samples_split = 2, and max_features = 'sqrt'. The Tuned RF model achieves an AUC-ROC of 0.9453 and CV AUC of 0.9010, outperforming the RF Baseline (AUC-ROC 0.9414; CV AUC 0.8804) on key discrimination metrics with greater stability. SHAP analysis identifies cp (mean |SHAP| = 0.1031), thal (0.0976), and ca (0.0805) as the three most influential clinical features, consistent with established cardiological diagnostic indicators. The integration of GridSearchCV and SHAP produces a model that is not only accurate but also transparent in supporting medical decision-making.
Downloads
References
M. Di Cesare et al., “World-Heart-Report-2023,” Geneva, 2023. [Online]. Available: https://world-heart-federation.org/wp-content/uploads/World-Heart-Report-2023.pdf
Global Burden of Cardiovascular Diseases and Risks 2023 et al., “Global, Regional, and National Burden of Cardiovascular Diseases and Risk Factors in 204 Countries and Territories, 1990-2023,” J. Am. Coll. Cardiol., vol. 86, no. 22, pp. 2167–2243, 2025, doi: 10.1016/j.jacc.2025.08.015.
L. H. Goh et al., “The epidemiology and burden of cardiovascular diseases in countries of the Association of Southeast Asian Nations (ASEAN), 1990–2021: findings from the Global Burden of Disease Study 2021,” Lancet Public Health, vol. 10, no. 6, pp. e467–e479, 2025, doi: 10.1016/S2468-2667(25)00087-8.
G. N. Ahamad et al., “Influence of Optimal Hyperparameters on the Performance of Machine Learning Algorithms for Predicting Heart Disease,” Processes, vol. 11, no. 3, 2023, doi: 10.3390/pr11030734.
S. A. T. Al Azhima, D. Darmawan, N. F. A. Hakim, I. Kustiawan, and M. Al Qibtiya, “Hybrid Machine Learning Model Untuk Memprediksi Penyakit Jantung Dengan Metode Logistic Regression Dan Random Forest,” Jurnal Teknologi Terpadu, vol. 8, no. 1, pp. 40–46, 2022
N. H. Alfajr and S. Defiyanti, “Prediksi Penyakit Jantung Menggunakan Metode Random Forest Dan Penerapan Principal Component Analysis (Pca),” Jurnal Informatika dan Teknik Elektro Terapan, vol. 12, no. 3S1, 2024, doi: 10.23960/jitet.v12i3s1.5055.
A. Masbakhah, U. Sa’adah, and M. Muslikh, “Heart Disease Classification Using Random Forest and Fox Algorithm as Hyperparameter Tuning,” Journal of Electronics, Electromedical Engineering, and Medical Informatics, vol. 7, no. 4, pp. 964–976, 2025, doi: 10.35882/jeeemi.v7i4.932.
A. Adadi and M. Berrada, “Peeking Inside the Black-Box: A Survey on Explainable Artificial Intelligence (XAI),” IEEE Access, vol. 6, no. c, pp. 52138–52160, 2018, doi: 10.1109/ACCESS.2018.2870052.
Md. A. Talukder, A. S. Talaat, M. Kazi, and A. Khraisat, “XAI-HD: an explainable artificial intelligence framework for heart disease detection,” Artif. Intell. Rev., vol. 58, no. 12, p. 385, 2025, doi: 10.1007/s10462-025-11385-6.
S. M. Lundberg and S.-I. Lee, “A Unified Approach to Interpreting Model Predictions,” in Advances in Neural Information Processing Systems, Curran Associates, Inc., 2017, pp. 4765–4774. doi: 10.48550/arXiv.1705.07874.
H. El-Sofany, B. Bouallegue, and Y. M. A. El-Latif, “A proposed technique for predicting heart disease using machine learning algorithms and an explainable AI method,” Sci. Rep., vol. 14, no. 1, pp. 1–18, 2024, doi: 10.1038/s41598-024-74656-2.
A. Janosi, M. Steinbrunn, William Pfisterer, and R. Detrano, “Heart Disease,” UCI Machine Learning Repository. [Online]. Available: https://archive.ics.uci.edu/dataset/45/heart+disease
A. Géron, Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow Concepts, Tools, and Techniques to Build Intelligent Systems, 3rd ed. Sebastopol: O’Reilly Media, 2022.
S. Kapoor and A. Narayanan, “Leakage and the reproducibility crisis in machine-learning-based science,” Patterns, vol. 4, no. 9, p. 100804, 2023, doi: 10.1016/j.patter.2023.100804.
L. Breiman, “Random Forests,” Mach. Learn., vol. 45, no. 1, pp. 5–32, 2001, doi: 10.1023/A:1010933404324.
N. Nasution, M. A. Hasan, and F. Bakri Nasution, “Predicting Heart Disease Using Machine Learning: An Evaluation of Logistic Regression, Random Forest, SVM, and KNN Models on the UCI Heart Disease Dataset,” IT Journal Research and Development, vol. 9, no. 2, pp. 140–150, 2025, doi: 10.25299/itjrd.2025.17941.
G. Louppe, L. Wehenkel, A. Sutera, and P. Geurts, “Understanding variable importances in Forests of randomized trees,” in Advances in Neural Information Processing Systems, 2013, pp. 1–9. [Online]. Available: https://www.researchgate.net/publication/264046801_Understanding_variable_importances_in_Forests_of_randomized_trees
R. Muzayanah, D. A. A. Pertiwi, M. Ali, and M. A. Muslim, “Comparison of gridsearchcv and bayesian hyperparameter optimization in random forest algorithm for diabetes prediction,” Journal of Soft Computing Exploration, vol. 5, no. 1, pp. 86–91, 2024, doi: 10.52465/joscex.v5i1.308.
S. Rasheed, G. K. Kumar, D. M. Rani, M. V. V. P. Kantipudi, and M. Anila, “Heart Disease Prediction Using GridSearchCV and Random Forest,” EAI Endorsed Trans. Pervasive Health Technol., vol. 10, pp. 1–8, 2024, doi: 10.4108/eetpht.10.5523.
S. Sathyanarayanan, “Confusion Matrix-Based Performance Evaluation Metrics,” African Journal of Biomedical Research, vol. 27, no. 4, pp. 4023–4031, 2024, doi: 10.53555/ajbr.v27i4s.4345.
C. Molnar, Interpretable Machine Learning: A Guide for Making Black Box Models Explainable, 2nd ed. Christoph Molnar, 2022. [Online]. Available: https://christophm.github.io/interpretable-ml-book/
A. Yazdani, K. D. Varathan, Y. K. Chiam, A. W. Malik, W. Azman, and W. Ahmad, “A novel approach for heart disease prediction using strength scores with significant predictors,” BMC Med. Inform. Decis. Mak., vol. 21, no. 1, p. 194, 2021, doi: 10.1186/s12911-021-01527-5.
Bila bermanfaat silahkan share artikel ini
Berikan Komentar Anda terhadap artikel Prediksi Penyakit Jantung Berbasis Random Forest dengan GridSearchCV dan SHAP Menggunakan Dataset Publik UCI Cleveland
Pages: 1267-1277
Copyright (c) 2026 Anggi Setiyawan, Sulistiyasni Sulistiyasni, Muhammad Akbar Setiawan

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under Creative Commons Attribution 4.0 International License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (Refer to The Effect of Open Access).






















