Building of Informatics, Technology and Science
Vol 8 No 2 (2026): September 2026

Komparasi Random Forest dan XGBoost Berbasis SMOTE dalam Penanganan Ketidakseimbangan Data untuk Prediksi Risiko Stroke

Chairunnisa Desti Arzety (Universitas Sriwijaya, Palembang)
Bayu Wijaya Putra (Universitas Sriwijaya, Palembang)
M Rudi Sanjaya (Universitas Sriwijaya, Palembang)
Dwi Rosa Indah (Universitas Sriwijaya, Palembang)



Article Info

Publish Date
22 Sep 2026

Abstract

Class imbalance is one of the main obstacles in building machine learning models for stroke prediction, as this condition tends to make models learn the characteristics of the majority class more dominantly than those of the minority class. This study aims to examine the comparison and evaluate the performance between the Random Forest and XGBoost algorithms in predicting stroke risk, by applying SMOTE as a data balancing technique. The study uses the Kaggle Stroke Prediction Dataset, consisting of 5,110 patient records. The research stages include data cleaning, categorical feature representation using TF-IDF, numerical feature normalization through Standard Scaling, data splitting using the Stratified Train-Test Split technique, application of SMOTE on the training data, and model development using the Random Forest and XGBoost algorithms. Model performance was evaluated using several metrics, namely Accuracy, Precision, Recall, F1-Score, ROC-AUC, Confusion Matrix, and Feature Importance. The test results show that XGBoost achieved a Recall of 0.1600, an F1-Score of 0.1702, and an ROC-AUC of 0.7877—all higher than those of Random Forest, which achieved a Recall of 0.0800, an F1-Score of 0.1111, and an ROC-AUC of 0.7068. Although these results represent an improvement over Random Forest, the still relatively low Recall and F1-Score values indicate that the model’s ability to detect stroke cases is not yet optimal and therefore requires further development. Furthermore, SMOTE was applied to balance the class distribution in the training data so that the model’s learning process would give greater attention to the minority class. This study contributes by implementing a consistent preprocessing pipeline, including data cleaning, Standard Scaling, TF-IDF-based categorical feature representation, Stratified Train-Test Split, and SMOTE on the training data, enabling a more objective comparison of Random Forest and XGBoost through the use of comprehensive evaluation metrics on an imbalanced stroke prediction dataset.

Copyrights © 2026






Journal Info

Abbrev

bits

Publisher

Subject

Computer Science & IT

Description

Building of Informatics, Technology and Science (BITS) is an open access media in publishing scientific articles that contain the results of research in information technology and computers. Paper that enters this journal will be checked for plagiarism and peer-rewiew first to maintain its quality. ...