Comparison of Naive Bayes and KNN Algorithms for Heart Attack Disease Classification

Authors

  • Syahril Arsad Universitas Muhammadiyah Pontianak
  • Sucipto Universitas Muhammadiyah Pontianak
  • Barry Caesar Octariadi Universitas Muhammadiyah Pontianak

DOI:

https://doi.org/10.59934/jaiea.v5i3.2218

Keywords:

Naive Bayes, K-Nearest Neighbors, classification, heart attack, artificial intelligence.

Abstract

This Heart attack is one of the leading causes of death worldwide and requires early diagnosis to reduce fatal risks. This study aims to compare the performance of the Naive Bayes and K-Nearest Neighbors (KNN) algorithms in classifying heart attack disease. The dataset used consists of medical records containing clinical parameters such as age, blood pressure, cholesterol level, and heart rate. The research methodology includes data preprocessing, splitting the dataset into training and testing sets, and evaluating performance using accuracy, precision, recall, and F1-score metrics. The results show that Naive Bayes demonstrates advantages in computational speed and performs well on smaller datasets, achieving an accuracy of 85%. In contrast, KNN provides better performance on larger datasets, reaching an accuracy of 90%, particularly when the optimal K value is applied. These findings indicate that algorithm selection for heart attack classification depends on dataset characteristics and specific implementation needs. This study is expected to contribute to the development of artificial intelligence–based clinical decision support systems for early heart attack diagnosis and improved healthcare outcomes.

Downloads

Download data is not yet available.

References

F. Sholekhah, A. D. Putri, R. Rahmaddeni, and L. Efrizoni, “Perbandingan Algoritma Naïve Bayes dan K-Nearest Neighbors untuk Klasifikasi Metabolik Sindrom,” MALCOM: Indonesian Journal of Machine Learning and Computer Science, vol. 4, no. 2, pp. 507–514, Feb. 2024, doi: 10.57152/malcom.v4i2.1249. .

M. G. Pradana, P. H. Saputro, and D. P. Wijaya, “KOMPARASI METODE SUPPORT VECTOR MACHINE DAN NAÏVE BAYES DALAM KLASIFIKASI PELUANG PENYAKIT SERANGAN JANTUNG,” Indonesian Journal of Business Intelligence (IJUBI), vol. 5, no. 2, p. 87, Dec. 2022, doi: 10.21927/ijubi.v5i2.2659.

C. A. Bahri et al., “ANALISIS FAKTOR RISIKO PEMICU SERANGAN JANTUNG DI INDONESIA, MENGGUNAKAN METODE KLASIFIKASI (DECISION TREE, NAIVE BAYES, DAN RANDOM FOREST),” 2025.

A. Samosir, M. Hasibuan, W. E. Justino, and T. Hariyono, “Komparasi Algoritma Random Forest, Naïve Bayes dan K-Nearest Neighbor Dalam klasifikasi Data Penyakit Jantung”.

Sahar, “Analisis Perbandingan Metode K-Nearest Neighbor dan Naïve Bayes Classiffier pada Data Set Penyakit Jantung,” Indonesian Journal of Data and Science (IJODAS), vol. 1, no. 3, pp. 79–86, 2020.

D. Sebagai et al., “PERBANDINGAN NAÏVE BAYES DAN K-NEAREST NIGHBOR (K-NN) UNTUK KLASIFIKASI PENYAKIT GAGAL JANTUNG TUGAS AKHIR.”

N. Prabu Nugraha, R. Azim, S. Zalffa Daffa, and P. Salma Ningayu, “Perbandingan Akurasi Metode Naïve Bayes dan Metode KNN untuk Memprediksi Gagal Ginjal Kronis.” [Online]. Available: https://archive.ics.uci.edu/ml/datasets/Chronic_Kidney_Disease.

J. Dwi Muthohhar and A. Prihanto, “Analisis Perbandingan Algoritma Klasifikasi untuk Penyakit Jantung,” Journal of Informatics and Computer Science, vol. 04, 2023..

M. Bagus Prayogi, I. Irawan, Y. I. Fajar, and K. Kunci, “3 RD MDP STUDENT CONFERENCE (MSC) 2024 Perbandingan Algoritma ID3, Naive Bayes, SVM Berbasis PSO Untuk Prediksi Serangan Jantung”.

“Komparasi Kinerja Algoritma K-Nearest Neighbors (KNN) dan Naive Bayes Dalam Klasifikasi Diagnosis Penyakit.”

A. Maharani and D. Lasut, “PERBANDINGAN K-NN DAN NAIVE BAYES UNTUK PREDIKSI KELANGSUNGAN HIDUP PASIEN GAGAL JANTUNG,” 2025. [Online]. Available: https://jurnal.ubd.ac.id/index.php/poters/index

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 Journal of Informatics, vol. 1, no. 1, pp. 11–21, Apr. 2025, doi: 10.37905/jji.v1i1.31158.

Y. Pratama, A. Prayitno, D. Azrian, N. Aini, Y. Rizki, and E. Rasywir, “Klasifikasi Penyakit Gagal Jantung Menggunakan Algoritma K-Nearest Neighbor,” Bulletin of Computer Science Research, vol. 3, no. 1, pp. 52–56, Dec. 2022, doi: 10.47065/bulletincsr.v3i1.203.

M. Anita, I. Grecea, D. Yulianti, and S. V. Pasaribu, “KLASIFIKASI FAKTOR RISIKO PENYAKIT JANTUNG MENGGUNAKAN MACHINE LEARNING”, doi: 10.52972/hoaq.vol16no1.

“KLASIFIKASI PENYAKIT KARDIOVASKULAR MENGGUNAKAN ALGORITMA K-NEAREST NEIGHBORS (KNN) SKRIPSI Oleh: VERA ARTANTI NIM. 200605110039 PROGRAM STUDI TEKNIK INFORMATIKA FAKULTAS SAINS DAN TEKNOLOGI UNIVERSITAS ISLAM NEGERI MAULANA MALIK IBRAHIM MALANG 2024.”

Downloads

Published

2026-06-02

How to Cite

Syahril Arsad, Sucipto, & Barry Caesar Octariadi. (2026). Comparison of Naive Bayes and KNN Algorithms for Heart Attack Disease Classification. Journal of Artificial Intelligence and Engineering Applications (JAIEA), 5(3), 3672–3676. https://doi.org/10.59934/jaiea.v5i3.2218

Issue

Section

Articles