Heart failure is a chronic condition where the heart is unable to pump blood optimally, posing a risk of serious complications and death. Early detection is crucial to reduce these risks and can be performed using classification methods with a data mining approach. This study compares two algorithms, Random Forest and Extreme Gradient Boosting (XGBoost), to determine the best algorithm for classifying heart failure disease using two testing techniques: percentage split (80% training data, 20% testing data) and k-fold cross validation (k = 10, alternating 1 fold as test data and 9 folds as training data). The dataset consists of two classes, where 0 represents heart failure and 1 represents no heart failure. Using percentage split, XGBoost achieved an accuracy of 87.07%, while Random Forest reached 91.95%. Meanwhile, in k-fold cross validation, XGBoost achieved 96.43% accuracy, and Random Forest performed best with 98.17% accuracy. Therefore, Random Forest with k-fold cross validation is highly suitable for heart failure classification, although XGBoost also shows good performance with accuracy above 85%. For future research, it is recommended to test the algorithms on more diverse datasets to evaluate their performance across various data conditions.
Copyrights © 2025