Comparison of Naïve Bayes, K-Nearest Neighbors, and Decision Tree Methods for Classifying Heart Disease Risk Factors

Authors

  • Ahmad Jihad Al Fayed Magister Teknologi Informasi, Universitas Pembangunan Panca Budi, Medan, Indonesia
  • Surya Darma Film and Televisi, Universitas Potensi Utama, Medan, Indonesia
  • Zailani Sinabariba Magister Teknologi Informasi, Universitas Pembangunan Panca Budi, Medan, Indonesia
  • Maruli Magister Teknologi Informasi, Universitas Pembangunan Panca Budi, Medan, Indonesia

Keywords:

Classification, Heart Disease, Naïve Bayes, K-Nearest Neighbors, Decision Tree

Abstract

Heart disease is the leading cause of death and poses a major challenge to global health systems. The classification of heart disease risk factors is crucial for preventing serious indications, but the challenge is that detection of this disease is often hampered because the classification process is not yet sufficiently accurate. This study aims to develop a heart disease risk classification model using a machine learning approach on a 2025 dataset consisting of 6025 patient data with 14 features. After going through the data collection stage and determining the attributes for comparing the performance of machine learning algorithms (Naive Bayes, K-Nearest Neighbors, and Decision Tree), it was found that the Decision Tree algorithm provided the best performance with an accuracy of 86%, followed by the K -Nearest Neighbors algorithm with an accuracy of 78% and the Naive Bayes algorithm with an accuracy of 76%.

References

W. H. O. (WHO), “Cardiovascular diseases,” World Health Organization (WHO). [Online]. Available: https://www.who.int/health-topics/cardiovascular%0Adiseases#tab=tab_1

M. Anita, I. G. D. Yulianti, and S. V. Pasaribu, “Klasifikasi Faktor Risiko Penyakit Jantung Menggunakan Machine Learning,” HOAQ (High Educ. Organ. Arch. Qual. J. Teknol. Inf., vol. 16, no. 1, pp. 68–78, 2025.

Kementerian Kesehatan Republik Indonesia. “Profil Kesehatan Indonesia Tahun 2022.” Jakarta: Kemenkes RI, 2022.

Winda Sinthya Naomi, Intje Picauly, and Sarci Magdalena Toy, “FAKTOR RISIKO KEJADIAN PENYAKIT JANTUNG KORONER(Studi Kasus di RSUD Prof. Dr. W. Z. Johannes Kupang),” Media Kesehat. Masy., vol. 3, no. 1, pp. 99–107, 2021.

S. N. N. Arif, A. M. Siregar, S. Faisal, and A. R. Juwita, “Klasifikasi Penyakit Serangan Jantung Menggunakan Metode Machine Learning K-Nearest Neighbors (KNN) dan Support Vector Machine (SVM),” J. Media Inform. Budidarma, vol. 8, no. 3, p. 1617, 2024.

S. C. Dewi, C. E. Putra, and A. G. Nugraheni, “Implementasi Metode K-Nearest Neighbors (KNN) dan Naïve Bayes untuk Klasifikasi Penyakit Jantung,” Technol. Informatics Insight J., vol. 3, no. 2, pp. 76–94, 2024.

J. Han, M. Kamber, and J. Pei, Data Mining: Concepts and Techniques, 3rd ed., Elsevier, 2012.

P.-N. Tan, M. Steinbach, and V. Kumar, Introduction to Data Mining, 2nd ed., Pearson, 2019.

J. R. Quinlan, C4.5: Programs for Machine Learning, Morgan Kaufmann Publishers, 1993.

M. Hasan and A. M. Abdulazeez, “A Review of Heart Disease Classification Based on Machine Learning Algorithms,” Indonesian Journal of Computer Science, vol. 13, no. 2, Apr. 2024.

K. Kartianom, A. Arpandi, G. K. Kassymova, and O. Ndayizeye, “Prediction model of teacher candidate student graduation status: Decision Tree C4.5, Naive Bayes, and k-NN,” Ekspose J. Penelit. Huk. dan Pendidik., vol. 21, no. 2, pp. 1419–1427, 2022.

M. Kurniawan Khamdani, N. Hidayat, and R. K. Dewi, “Implementasi Metode K-Nearest Neighbor Untuk Mendiagnosis Penyakit Tanaman Bawang Merah,” J. Pengemb. Teknol. Inf. dan Ilmu Komput., vol. 5, no. 1, pp. 11–16, 2021.

D. Cahyanti, A. Rahmayani, and S. A. Husniar, “Analisis performa metode Knn pada Dataset pasien pengidap Kanker Payudara,” Indones. J. Data Sci., vol. 1, no. 2, pp. 39–43, 2020.

A. Yudhana, S. Sunardi, and A. J. S. Hartanta, “Algoritma K-Nn Dengan Euclidean Distance Untuk Prediksi Hasil Penggergajian Kayu Sengon,” Transmisi, vol. 22, no. 4, pp. 123–129, 2020.

F. S. Pattiiha and H. Hendry, “Perbandingan Metode K-NN, Naïve Bayes, Decision Tree untuk Analisis Sentimen Tweet Twitter Terkait Opini Terhadap PT PAL Indonesia,” JURIKOM (Jurnal Ris. Komputer), vol. 9, no. 2, p. 506, 2022.

J. R. Quinlan, C4.5: Programs for Machine Learning, San Mateo, CA: Morgan Kaufmann Publishers, 1996.

F. A. Sianturi, “Analisa Decision Tree Dalam Pengolahan Data Siswa,” MEANS (Media Informasi Analisa dan Sistem), vol. 3, no. 2, pp. 166–172, 2018.

S. Saifullah, M. Zarlis, Z. Zakaria, and R. W. Sembiring, “Analisa Terhadap Perbandingan Algoritma Decision Tree Dengan Algoritma Random Tree Untuk Pre-Processing Data,” Jurnal Sains Komputer & Informatika (J-SAKTI), vol. 1, no. 2, pp. 180–186, Sept. 2017

D. A. Langga and Dkk, “Perbandingan Algoritma Naive Bayes Dengan Algoritma K-Nearest Neighbor Untuk Prediksi Penyakit Jantung,” J. Chem. Inf. Model., vol. 53, no. 9, pp. 1689–1699, 2019.

J. D. Muthohhar and A. Prihanto, “Analisis Perbandingan Algoritma Klasifikasi untuk Penyakit Jantung,” J. Informatics Comput. Sci., vol. 04, pp. 298–304, 2023.

M. S. Tuloli, T. S. Kinanti, and L. N. Amali, “Perbandingan Algoritma C4.5, Naive Bayes, dan K- Nearest Neighbors untuk Prediksi Penyakit Jantung,” Jambura J. Informatics, vol. 1, no. 1, pp. 11–21, 2025.

S. C. Dewi, C. E. Putra, and A. G. Nugraheni, “Implementasi Metode K-Nearest Neighbors (KNN) dan Naive Bayes untuk Klasifikasi Penyakit Jantung,” Technology and Informatics Insight Journal, vol. 3, no. 2, pp. 76–94, 2024.

Downloads

Published

2025-07-15

How to Cite

Ahmad Jihad Al Fayed, Surya Darma, Zailani Sinabariba, & Surya Maruli P Pardede. (2025). Comparison of Naïve Bayes, K-Nearest Neighbors, and Decision Tree Methods for Classifying Heart Disease Risk Factors. Journal of Computer Science and Research (JoCoSiR), 3(3), 81–88. Retrieved from https://journal.aptikomsumut.org/index.php/jocosir/article/view/80