Oversampling Techniques to Improve Machine Learning Classification on a Heart Disease Dataset
DOI:
https://doi.org/10.33998/jms.2026.6.2.2842Keywords:
Oversampling, SMOTE, Random Oversampling, Machine Learning, Heart DiseaseAbstract
Class imbalance in heart disease datasets poses a critical challenge in machine learning applications, as models often become biased toward the majority class. This imbalance reduces accuracy and limits the model’s ability to identify minority cases, which are highly important in medical diagnosis. This study investigates the effectiveness of oversampling techniques, namely Random Oversampling and Synthetic Minority Over-sampling Technique (SMOTE), in enhancing the performance of three classification algorithms: K-Nearest Neighbors (KNN), Naive Bayes (NB), and Random Forest (RF). The dataset, obtained from Kaggle, consists of 918 records with 12 attributes representing patient health indicators related to heart disease prediction. The research process involved data preprocessing, baseline classification experiments, and re-experiments using the oversampling methods. The results show that all three algorithms benefited from oversampling, though the degree of improvement varied. KNN achieved its best performance with SMOTE, reaching 72.98% accuracy and an F1-score of 75.39%. Naive Bayes produced relatively stable results across both methods, with SMOTE slightly outperforming Random Oversampling, achieving the best F1-score of 73.56%. Random Forest demonstrated the highest overall performance when combined with Random Oversampling, recording 79.19% accuracy and an F1-score of 81.51%, surpassing both the baseline and SMOTE. These findings confirm that oversampling techniques can effectively improve classification performance but their impact depends on the characteristics of each algorithm. The novelty of this study lies in analyzing the interaction between oversampling strategies and classification models, offering practical guidance for selecting appropriate data balancing approaches in medical classification tasks
Downloads
References
Y. Zhu, B. Kong, R. Liu, and Y. Zhao, “Developing biomedical engineering technologies for reproductive medicine,” Smart Med., vol. 1, no. 1, 2022, doi: 10.1002/smmd.20220006.
A. W. Sugiyarto, A. M. Abadi, and Sumarna, “Classification of heart disease based on PCG signal using CNN,” Telkomnika (Telecommunication Comput. Electron. Control., vol. 19, no. 5, pp. 1697–1706, 2021, doi: 10.12928/TELKOMNIKA.v19i5.20486.
S. Rapacz, P. Chołda, and M. Natkaniec, “A method for fast selection of machine-learning classifiers for spam filtering,” Electron., vol. 10, no. 17, 2021, doi: https://doi.org/10.3390/electronics10172083.
M. Nur Riza Pahlevi and T. Badriyah, “Implementasi dan Optimasi Hyperparameter pada Model Machine learning untuk Prediksi Diabetes dengan Integrasi Aplikasi Telemedicine,” JEPIN (Jurnal Edukasi dan Penelit. Inform., vol. 11, no. 2, pp. 287–296, 2025.
K. M. Hasib et al., “A Survey of Methods for Managing the Classification and Solution of Data Imbalance Problem,” J. Comput. Sci., vol. 16, no. 11, pp. 1546–1557, 2020, doi: 10.3844/JCSSP.2020.1546.1557.
N. H. A. Malek, W. F. W. Yaacob, Y. B. Wah, S. A. Md Nasir, N. Shaadan, and S. W. Indratno, “Comparison of ensemble hybrid sampling with bagging and boosting machine learning approach for imbalanced data,” Indones. J. Electr. Eng. Comput. Sci., vol. 29, no. 1, pp. 598–608, 2023, doi: 10.11591/ijeecs.v29.i1.pp598-608.
L. K. Xin and N. binti A. Rashid, “Prediction of depression among women using random oversampling and random forest,” 2021 Int. Conf. Women Data Sci. Taif Univ. WiDSTaif 2021, 2021, doi: 10.1109/WIDSTAIF52235.2021.9430215.
P. Sampath et al., “Robust diabetic prediction using ensemble machine learning models with synthetic minority over-sampling technique,” Sci. Rep., vol. 14, no. 1, pp. 1–15, 2024, doi: 10.1038/s41598-024-78519-8.
X. W. Liang, A. P. Jiang, T. Li, Y. Y. Xue, and G. T. Wang, “LR-SMOTE — An improved unbalanced data set oversampling based on K-means and SVM,” Knowledge-Based Syst., vol. 196, 2020, doi: 10.1016/j.knosys.2020.105845.
P. Soltanzadeh and M. Hashemzadeh, “RCSMOTE: Range-Controlled synthetic minority over-sampling technique for handling the class imbalance problem,” Inf. Sci. (Ny)., vol. 542, pp. 92–111, 2021, doi: 10.1016/j.ins.2020.07.014.
R. K. Halder, M. N. Uddin, M. A. Uddin, S. Aryal, and A. Khraisat, “Enhancing K-nearest neighbor algorithm: a comprehensive review and performance analysis of modifications,” J. Big Data, vol. 11, no. 1, 2024, doi: 10.1186/s40537-024-00973-y.
T. Ige, C. Kiekintveld, A. Piplai, A. Waggler, O. Kolade, and B. H. Matti, “An investigation into the performances of the Current state-of-the-art Naive Bayes, Non-Bayesian and Deep Learning Based Classifier for Phishing Detection: A Survey,” 2024, [Online]. Available: http://arxiv.org/abs/2411.16751
M. Mohammadagha, “Hyperparameter Optimization Strategies for Tree-Based Machine Learning Models Prediction : A Comparative Study of AdaBoost , Decision Trees , and Random Forest”.
R. Chivukula, T. Jaya Lakshmi, S. S. Uday, and S. T. Pavani, “Classifying clinically actionable genetic mutations using KNN and SVM,” Indones. J. Electr. Eng. Comput. Sci., vol. 24, no. 3, pp. 1672–1679, 2021, doi: https://doi.org/10.11591/ijeecs.v24.i3.pp1672-1679.
M. S. Islam et al., “Machine Learning-Based Music Genre Classification with Pre-Processed Feature Analysis,” J. Ilm. Tek. Elektro Komput. dan Inform., vol. 7, no. 3, p. 491, 2022, doi: https://doi.org/10.26555/jiteki.v7i3.22327.
J. Zhang, Y. Li, F. Shen, Y. He, H. Tan, and Y. He, “Hierarchical text classification with multi-label contrastive learning and KNN,” Neurocomputing, vol. 577, no. January, p. 127323, 2024, doi: https://doi.org/10.1016/j.neucom.2024.127323.
L. V. Nguyen, Q. T. Vo, and T. H. Nguyen, “Adaptive KNN-Based Extended Collaborative Filtering Recommendation Services,” Big Data Cogn. Comput., vol. 7, no. 2, 2023, doi: https://doi.org/10.3390/bdcc7020106.
M. Nadeem et al., “Preventing Cloud Network from Spamming Attacks Using Cloudflare and KNN,” Comput. Mater. Contin., vol. 74, no. 2, pp. 2641–2659, 2023, doi: https://doi.org/10.32604/cmc.2023.028796.
Y. Yang and X. Liu, “A re-examination of text categorization methods”.
D. Berrar, “Bayes’ theorem and naive bayes classifier,” Encycl. Bioinforma. Comput. Biol. ABC Bioinforma., vol. 1–3, no. 2018, pp. 403–412, 2018, doi: 10.1016/B978-0-12-809633-8.20473-1.
J. K. Alwan, D. S. Jaafar, and I. R. Ali, “Diabetes diagnosis system using modified Naive Bayes classifier,” Indones. J. Electr. Eng. Comput. Sci., vol. 28, no. 3, pp. 1766–1774, 2022, doi: https://doi.org/10.11591/ijeecs.v28.i3.pp1766-1774.
S. Wang, J. Ren, and R. Bai, “A semi-supervised adaptive discriminative discretization method improving discrimination power of regularized naive Bayes,” Expert Syst. Appl., vol. 225, no. April, p. 120094, 2023, doi: 10.1016/j.eswa.2023.120094.
C. J. Anderson et al., “A novel naïve Bayes approach to identifying grooming behaviors in the force-plate actometric platform,” J. Neurosci. Methods, vol. 403, no. July 2023, p. 110026, 2024, doi: 10.1016/j.jneumeth.2023.110026.
M. Badar and M. Fisichella, “Fair-CMNB: Advancing Fairness-Aware Stream Learning with Naïve Bayes and Multi-Objective Optimization,” Big Data Cogn. Comput., vol. 8, no. 2, 2024, doi: https://doi.org/10.3390/bdcc8020016.
A. A. Khaleel, A. A. M. Al-Azzawi, and A. M. Alkhazraji, “Random forest for lung cancer analysis using Apache Mahout and Hadoop based on software defined networking,” Indones. J. Electr. Eng. Comput. Sci., vol. 32, no. 2, pp. 1086–1093, 2023, doi: https://doi.org/10.11591/ijeecs.v32.i2.pp1086-1093.
T. A. Assegie, R. Subhashni, N. K. Kumar, J. P. Manivannan, P. Duraisamy, and M. F. Engidaye, “Random forest and support vector machine-based hybrid liver disease detection,” Bull. Electr. Eng. Informatics, vol. 11, no. 3, pp. 1650–1656, 2022, doi: https://doi.org/10.11591/eei.v11i3.3787.
A. Sekulić, M. Kilibarda, G. B. M. Heuvelink, M. Nikolić, and B. Bajat, “Random forest spatial interpolation,” Remote Sens., vol. 12, no. 10, pp. 1–29, 2020, doi: https://doi.org/10.3390/rs12101687.
H. Syahputra and A. Wibowo, “Comparison of Support Vector Machine (SVM) and Random Forest Algorithm for Detection of Negative Content on Websites,” J. Ilm. Tek. Elektro Komput. dan Inform., vol. 9, no. 1, pp. 165–173, 2023, doi: https://doi.org/10.26555/jiteki.v9i1.25861.


