Optimizing K-Nearest Neighbor Using Ant Colony Optimization for Heart Disease Classification
DOI:
https://doi.org/10.32734/jocai.v10.i1-23647Keywords:
Classification, K-Nearest Neighbor, SMOTE, Ant Colony Algorithm, Heart DiseaseAbstract
Heart disease is one of leading causes of death globally, making early detection essential for improving clinical outcomes. This study presents a heart disease prediction approach using the K-Nearest Neighbor (KNN) algorithm, addressing class imbalance with Synthetic Minority Over-sampling Technique (SMOTE) and enhancing feature selection through Ant Colony Optimization (ACO). Exploratory data analysis identified age, gender, cholesterol, blood pressure, e xercise-Induced Angina (EIA), ST-segment depression, number of affected vessels, and thalassemia status as key indicators of disease severity. KNN model achieved 0.90 accuracy with balanced precision and recall. The employment of SMOTE improved sensitivity for the minority class, slightly reducing overall accuracy to 0.88. However, ACO as hyperparameter tuning KNN able to produce promising accuracy 0.91. This result indicate that combining KNN with metaheuristic optimization provides a reliable, interpretable method for heart disease prediction, offering valuable support for clinical decision-making and risk assessment.
Downloads
References
[1] T. A. Gaziano, “Cardiovascular Diseases Worldwide,” Public Heal. Approach to Cardiovasc. Dis. Prev. Manag., pp. 8–18, 2022, doi: 10.1201/b23266-2.
[2] N. E. Almansouri et al., “Early Diagnosis of Cardiovascular Diseases in the Era of Artificial Intelligence: An In-Depth Review,” Cureus, 2024, doi: 10.7759/cureus.55869.
[3] G. Guo, H. Wang, D. Bell, Y. Bi, and K. Greer, “KNN model-based approach in classification,” Lect. Notes Comput. Sci. (including Subser. Lect. Notes Artif. Intell. Lect. Notes Bioinformatics), vol. 2888, pp. 986–996, 2003, doi: 10.1007/978-3-540-39964-3_62.
[4] A. A. Amer, S. D. Ravana, and R. A. A. Habeeb, “Effective k-nearest neighbor models for data classification enhancement,” J. Big Data, vol. 12, no. 1, 2025, doi: 10.1186/s40537-025-01137-2.
[5] 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.
[6] D. Elreedy, A. F. Atiya, and F. Kamalov, “A theoretical distribution analysis of synthetic minority oversampling technique (SMOTE) for imbalanced learning,” Mach. Learn., vol. 113, no. 7, pp. 4903–4923, 2024, doi: 10.1007/s10994-022-06296-4.
[7] M. Altalhan, A. Algarni, and M. Turki-Hadj Alouane, “Imbalanced Data Problem in Machine Learning: A Review,” IEEE Access, vol. 13, pp. 13686–13699, 2025, doi: 10.1109/ACCESS.2025.3531662.
[8] M. Mujahid et al., “Data oversampling and imbalanced datasets: an investigation of performance for machine learning and feature engineering,” J. Big Data, vol. 11, no. 1, 2024, doi: 10.1186/s40537-024-00943-4.
[9] “mproving Heart Disease Severity Prediction Using SMOTE for Imbalanced Data.”
[10] M. Dorigo and C. Blum, “Ant colony optimization theory: A survey,” Theor. Comput. Sci., vol. 344, no. 2–3, pp. 243–278, 2005, doi: 10.1016/j.tcs.2005.05.020.
[11] M. Dorigo and T. Stützle, “The Ant Colony Optimization Metaheuristic,” Ant Colony Optim., pp. 25–64, 2018, doi: 10.7551/mitpress/1290.003.0004.
[12] Y. Sun, S. Wang, Y. Shen, X. Li, A. T. Ernst, and M. Kirley, “Boosting ant colony optimization via solution prediction and machine learning,” Comput. Oper. Res., vol. 143, 2022, doi: 10.1016/j.cor.2022.105769.
[13] A. Tsagaris, P. Kyratsis, and G. Mansour, “The Integration of Genetic and Ant Colony Algorithm in a Hybrid Approach,” Int. J. Intell. Syst. Appl. Eng., vol. 11, no. 2, pp. 336–342, 2023.
[14] J. A. Widians, R. Wardoyo, and S. Hartati, “A Hybrid Ant Colony and Grey Wolf Optimization Algorithm for Exploitation-Exploration Balance,” Emerg. Sci. J., vol. 8, no. 4, pp. 1642–1654, 2024, doi: 10.28991/ESJ-2024-08-04-023.
[15] B. Chen, L. Chen, and Y. Chen, “Efficient ant colony optimization for image feature selection,” Signal Processing, vol. 93, no. 6, pp. 1566–1576, 2013, doi: 10.1016/j.sigpro.2012.10.022.
[16] S. Arooj, S. ur Rehman, A. Imran, A. Almuhaimeed, A. K. Alzahrani, and A. Alzahrani, “A Deep Convolutional Neural Network for the Early Detection of Heart Disease,” Biomedicines, vol. 10, no. 11, 2022, doi: 10.3390/biomedicines10112796.
[17] N. M. AbdelAziz, G. A. Fouad, S. Al-Saeed, and A. M. Fawzy, “Deep Q-Network (DQN) Model for Disease Prediction Using Electronic Health Records (EHRs),” Sci, vol. 7, no. 1, 2025, doi: 10.3390/sci7010014.
[18] L. Hall, W. P. Kegelmeyer, N. Chawla, and K. Bowyer, “SMOTE: Synthetic Minority Over-sampling Technique,” J. Artif. Intell. Res., vol. 16, pp. 321–357, 2002, [Online]. Available: https://arxiv.org/pdf/1106.1813.pdf%0Ahttp://www.snopes.com/horrors/insects/telamonia.asp.
[19] D. Elreedy and A. F. Atiya, “A Comprehensive Analysis of Synthetic Minority Oversampling Technique (SMOTE) for handling class imbalance,” Inf. Sci. (Ny)., vol. 505, pp. 32–64, 2019, doi: 10.1016/j.ins.2019.07.070.
[20] M. Cover T and E. Hart P, “Nearest Neighbor Pattern Classification,” IEEE Trans. Inf. Theory, vol. 13, no. 1, pp. 21–27, 1967.
[21] Aman Kataria and M. D. Singh, “A Review of Data Classification Using K-Nearest Neighbour Algorithm ,” Int. J. Emerg. Technol. Adv. Eng. , vol. 3, no. 6, 2013.
[22] I. Arora, N. Khanduja, and M. Bansal, “Effect of Distance Metric and Feature Scaling on KNN Algorithm while Classifying X-rays,” CEUR Workshop Proc., vol. 3176, pp. 61–75, 2022.
[23] R. Mussabayev, “Optimizing Euclidean Distance Computation,” Mathematics, vol. 12, no. 23, 2024, doi: 10.3390/math12233787.
[24] M. Dorigo, M. Birattari, and T. Stützle, “Ant colony optimization artificial ants as a computational intelligence technique,” IEEE Comput. Intell. Mag., vol. 1, no. 4, pp. 28–39, 2006, doi: 10.1109/CI-M.2006.248054.
[25] M. Dorigo and D. C. Gianni, “Ant Colony Optimization: A New Meta-Heuristic,” Proc. 1999 Congr. Evol. Comput. (Cat. No. 99TH8406), pp. 1470–1477, 1992.
[26] D. Tests, “Basic Principles of ROC Analysis,” Semin. Nucl. Med., vol. VIII, no. 4, pp. 283–298, 1978.
[27] A. M. Carrington et al., “Deep ROC Analysis and AUC as Balanced Average Accuracy, for Improved Classifier Selection, Audit and Explanation,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 45, no. 1, pp. 329–341, 2023, doi: 10.1109/TPAMI.2022.3145392.
[28] S. Tharwat, “‘Classification assessment methods,’” Appl. Comput. Informatics, vol. 17, n, pp. 168–192, 2021.
[29] O. Rainio, J. Teuho, and R. Klén, “Evaluation metrics and statistical tests for machine learning,” Sci. Rep., vol. 14, no. 1, 2024, doi: 10.1038/s41598-024-56706-x.
[30] E. Diderholm, B. Andren, and G. Frostfeldt, “ST depression in ECG at entry indicates severe coronary lesions and large benefits of an early invasive treatment strategy in unstable coronary artery disease,” ACC Curr. J. Rev., vol. 11, no. 3, p. 12, 2002, doi: 10.1016/s1062-1458(02)00620-7.
[31] D. M. W. Powers, “Evaluation: from precision, recall and F-measure to ROC, informedness, markedness and correlation,” 2020, [Online]. Available: http://arxiv.org/abs/2010.16061.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Florentina Yuni Arini, Patcharanikarn Pongthanoo, Kansa Maulina Salsabila, Muhammad Raihan, Naufal Habib Muzakki

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.










