Comparison of Random Forest and Support Vector Machine Algorithms for Heart Disease Prediction Using SMOTE and Hyperparameter Tuning Techniques - Randi Trinanda (Programming and Algorithm Fundamentals, 2026)
Heart disease remains one of the leading causes of death worldwide, making early and accurate detection a critical priority in healthcare. However, building an effective predictive model is challenged by the presence of class imbalance in medical datasets, where the number of healthy patients often exceeds disease cases, potentially biasing model performance toward the majority class. This study aims to compare the performance of Random Forest (RF) and Support Vector Machine (SVM) algorithms for heart disease prediction, incorporating Synthetic Minority Over-sampling Technique (SMOTE) to handle class imbalance and Hyperparameter Tuning to optimize each model's configuration. The dataset used consists of 2,026 patient records with 13 clinical features including age, blood pressure, cholesterol, EKG results, and thallium test results, with heart disease (Absence/Presence) as the target variable. Experiments were conducted in two scenarios: without SMOTE and Tuning as baseline, and with SMOTE and Hyperparameter Tuning as the optimized scenario. Results show that both models improved after optimization, with Random Forest achieving the best overall performance with an accuracy of 87.44%, recall of 0.8634, F1-Score of 0.8610, and AUC-ROC of 0.9449, outperforming SVM which reached an accuracy of 86.45% and AUC-ROC of 0.9396. These findings conclude that Random Forest combined with SMOTE and Hyperparameter Tuning is the most suitable model for heart disease prediction, particularly in minimizing false negatives which are clinically critical in medical diagnosis.