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.
Copyrights © 2026