Application of the K-Nearest Neighbor (KNN) Algorithm in Data Mining for Heart Disease Prediction

DOI: https://doi.org/10.33650/coreai.v7i1.13481
Authors

(1) * Nur Aida   (UNIVERSITAS IBRAHIMY SITUBONDO)  
        Indonesia
(*) Corresponding Author

Abstract


Cardiovascular (heart) disease is a leading cause of high global mortality rates. This is often exacerbated by low public awareness and limited access to cardiac screening facilities. To address these challenges, this study aims to apply the K-Nearest Neighbors (KNN) algorithm to classify heart disease and evaluate the resulting accuracy. The KNN algorithm was selected for its efficiency and ease of use in classifying large datasets; it works by measuring the distance between objects using the Euclidean distance formula. This classification model was built using RapidMiner 9.10 software. The data used was sourced from the Cleveland UCI Machine Learning Repository database available via Kaggle, consisting of a total of 303 patient records and characterized by 14 features used for prediction. The target variable (heart disease) was set as the classification label. Test results using cross-validation demonstrated that the KNN implementation is effective for predicting heart disease. This model achieved an accuracy of 64.03% with the parameter setting K=5. Further analysis of the confusion matrix identified 124 true-positive patients, with a maximum precision of 64.58%. Overall, these accuracy results confirm the potential and capability of the KNN method in classifying diagnostic data for heart disease patients.


Keywords

K-Nearest Neighbor; Klasifikasi; Penyakit Jantung; Data Mining; RapidMiner



Full Text: VIEW PDF



References


Adi, S., & Wintarti, A. (2022). Komparasi metode support vector machine (SVM), K-Nearest Neighbors (KNN), Dan Random Forest (RF) untuk prediksi penyakit gagal jantung. MATHunesa: Jurnal Ilmiah Matematika, 10(2), 258–268. https://doi.org/10.26740/mathunesa.v10n2.p258-268

Afdal, M., & Elita, L. R. (2022). Penerapan Text Mining Pada Aplikasi Tokopedia Menggunakan Algoritma K-Nearest Neighbor. Jurnal Ilmiah Rekayasa Dan Manajemen Sistem Informasi, 8(1), 78–87. https://doi.org/10.30865/jurikom.v13i3

Alici Davutoglu, E. (2023). MEDICAL BIOCHEMISTRY. INTERNATIONAL JOURNAL OF MEDICAL BIOCHEMISTRY, 6(1), 1-10. https://doi.org/10.30865/mib.v8i3.7844

Andiani, L., Sukemi, S., & Rini, D. P. (2020). Analisis penyakit jantung menggunakan metode knn dan random forest. Annual Research Seminar (ARS), 5(1), 165-169. https://doi.org/10.32639/p5e7b161

Arif, S. N. N. (2024). Klasifikasi Penyakit Serangan Jantung Menggunakan Metode Machine Learning K-Nearest Neighbors (KNN) dan Support Vector Machine (SVM). Jurnal Media Informatika Budidarma, 8(3). https://doi.org/10.30865/mib.v10i1

Dewi, S. C., Putra, C. E., & Nugraheni, A. G. (2024). Implementasi Metode K-Nearest Neighbors (KNN) dan Naive Bayes untuk Klasifikasi Penyakit Jantung. Technology and Informatics Insight Journal, 3(2), 76-94. https://doi.org/10.32639/p5e7b161

Dewi, S. P., Nurwati, N., & Rahayu, E. (2022). Penerapan Data Mining Untuk Prediksi Penjualan Produk Terlaris Menggunakan Metode K-Nearest Neighbor. Build. Informatics, Technol. Sci, 3(4), 639-648. https://doi.org/10.47065/bits.v3i4.1408

Gautama, K., & Arijanto, R. (2024). PENERAPAN DATA MINING UNTUK PREDIKSI PENJUALAN PRODUK TERLARIS MENGGUNAKAN METODE K-NEAREST NEIGHBOR PADA CV. NUANSA KARUNA LESTARI. JATI (Jurnal Mahasiswa Teknik Informatika), 8(6), 11184-11190. https://doi.org/10.36040/jati.v8i6.11189

Hakim, L., Sobri, A., Sunardi, L., & Nurdiansyah, D. (2025). Prediksi penyakit jantung berbasis mesin learning dengan menggunakan metode k-nn. Jurnal Digital Teknologi Informasi, 7(2), 14-20. https://doi.org/10.32502/digital.v7i2.9429

Homaidi, A., & Fatah, Z. (2024). Implementasi Metode K-Nearest Neighbors (KNN) untuk Klasifikasi Penyakit Jantung. G-Tech: Jurnal Teknologi Terapan, 8(3), 1720-1728. https://doi.org/10.33379/gtech.v8i3.4495

Islam, A., Mahmood, Z., & Khan, U. (2023). Double-diffusive stagnation point flow over a vertical surface with thermal radiation: Assisting and opposing flows. Science Progress, 106(1), 00368504221149798. https://doi.org/10.1177/00368504221149798

Khodijah, K., Sriyanto, S., Aziz, R. Z. A., & Suhendro, S. (2024). Perbandingan Kinerja Lima Algoritma Klàsifikasi Dasar Untuk Prediksi Penyakit Jantung "CLASSIFIER: NB, DTC4. 5, KNN, ANN & SVM". Jaringan Sistem Informasi Robotik-JSR, 8(2), 230-234. https://doi.org/10.31539/intecoms.v7i5.12434

Low, I., Shu, J., Xiao, M.-L., & Zheng, Y.-H. (2023). Amplitude/operator basis in chiral perturbation theory. Journal of High Energy Physics, 2023(1), 1-33. https://doi.org/10.1007/JHEP01(2023)031

Nainggolan, J. K., Sinaga, F., Sitorus, A. M., Khairia, A., & Wijaya, B. A. (2025). Analisa Komparasi dengan Algoritma K-Nearest Neighbor (KNN) dan Support Vector Machine (SVM) untuk Prediksi Penyakit Jantung. Dinamik, 30(2), 297-306. https://doi.org/10.35315/dinamik.v30i2.10254

Nasien, D., Sirvan, S., Deny, D., Syahputra, R. S. R., Marunduri, A. A., & See, R. P. (2024). Klasifikasi Penyakit Jantung Menggunakan Decision Tree dan KNN Menggunakan Ektraksi Fitur PCA. JEKIN-Jurnal Teknik Informatika, 4(1), 18-24. https://doi.org/10.58794/jekin.v4i1.641

Nugroho, F. A. (2021). Perancangan sistem pakar diagnosa penyakit jantung dengan metode forward chaining. Jurnal Informatika Universitas Pamulang, 3(2), 75-79. https://doi.org/10.32493/informatika.v3i2.1431

Nursahid, W., Nugroho, B. I., & Syefudin, S. (2025). Optimalisasi Preprocessing Data Menggunakan Pendekatan CRISP-DM untuk Meningkatkan Kualitas Klasifikasi Penyakit Jantung. RIGGS: Journal of Artificial Intelligence and Digital Business, 4(3), 3621-3626. https://doi.org/10.31004/riggs.v4i3.2514

Permatasari, U. O. R., Jasri, M., & Shu. (2024). Prediksi Kelayakan Mahasiswa sebagai Penerima Beasiswa Bank Indonesia pada Tahap Seleksi Administrasi di Universitas Nurul Jadid menggunakan Algoritma K Nearest Neighbor. Journal of Electrical Engineering and Computer (JEECOM), 6(1), 252-260. https://doi.org/10.33650/jeecom.v6i1.8425

Putra, E. A., & Supriyanto, R. (2023). Analisis Algoritma Decesion Tree, KNN dan Naïve Bayes Pada Dataset Penyakit Jantung. Jurnal Ilmiah KOMPUTASI, 22(2), 273-284. https://doi.org/10.32409/jikstik.22.2.3353

Rahmadan, I., & Shudiq, W. J. (2024). Increasing student interest in learning through the implementation of the K-nearest neighbor algorithm in classifying learning preferences at SMAN 1 Kraksaan. Journal of Computer Networks, Architecture and High Performance Computing, 6(4), 1851-1862. https://doi.org/10.47709/cnahpc.v6i4.4526

Rahmadini, R., LorencisLubis, E. E., Priansyah, A., RWN, Y., & Meutia, T. (2023). Penerapan data mining untuk memprediksi harga bahan pangan di Indonesia menggunakan algoritma K-Nearest Neighbor. Jurnal Mahasiswa Akuntansi Samudra, 4(4), 223-235. https://doi.org/10.33059/jmas.v4i4.7074

Siregar, J., & Wijayanti, D. (2025). Integrasi Model Neural Network dengan SVM dan KNN untuk Deteksi Dini Penyakita Jantung pada Penderita Hypertensi. Technologia: Jurnal Ilmiah, 16(1), 104-109. https://doi.org/10.31602/tji.v16i1.17046

Tampubolon, G. C. (2023). ASSOCIATION BETWEEN SERUM ALP LEVELS AND PRE-OPERATIVE LDH TOWARDS CLINICAL PROGNOSIS OF OSTEOSARCOMA PATIENTS IN H. ADAM MALIK HOSPITAL, MEDAN. Sumatera Medical Journal, 6(1). https://doi.org/10.32734/sumej.v6i1.8991

Wadhwa, S. (2021). Performance comparison of classifiers on twitter sentimental analysis. Proceedings of ‏The 5th International Conference on Applied Research in Science, Technology and Knowledge, 50-61. https://doi.org/10.33422/3rd.ictle.2021.02.134


Dimensions, PlumX, and Google Scholar Metrics

10.33650/coreai.v7i1.13481


Refbacks

  • There are currently no refbacks.


Copyright (c) 2026 nur aida

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


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

COREAI: Jurnal Kecerdasan Buatan, Komputasi dan Teknologi Informasi

Published by Technic Faculty of Nurul Jadid University, Probolinggo, East Java, Indonesia.