Supervised Machine Learning Algorithms untuk Klasifikasi Penyakit Jantung
DOI:
https://doi.org/10.30865/jurikom.v13i1.9481Keywords:
K-Nearest Neighbors, Support Vector Machine, Random Forest, Heart Disease Classification, Machine LearningAbstract
Heart disease is one of the leading causes of death worldwide, requiring accurate predictive methods to support early detection and clinical decision making. This study aims to analyze and compare the performance of three supervised machine learning algorithms, namely K-Nearest Neighbors (KNN), Support Vector Machine (SVM), and Random Forest (RF), in classifying heart disease using the Cleveland Heart Disease dataset consisting of 303 patient records with 13 clinical features. The research stages include data preprocessing, splitting the dataset into 80% training data and 20% testing data, model training, and hyperparameter optimization using GridSearchCV with 5-fold cross-validation. After optimization, prediction was performed using test data followed by performance evaluation to assess generalization ability. Model performance was evaluated using accuracy, precision, recall, F1-score, AUC-ROC, and confusion matrix. The results show that KNN and Random Forest achieved the highest accuracy of 90.16%. The KNN model obtained a recall value of 1.0000, indicating perfect sensitivity in detecting positive cases, while Random Forest demonstrated a more balanced performance between precision and recall with the highest AUC value of 0.9481. Based on these findings, KNN is considered the most suitable model for medical screening purposes, as it successfully detected all positive heart disease patients without producing false negatives. This study is expected to serve as a reference for implementing clinical databased machine learning as a decision support tool for early heart disease detection.
References
[1] H. B. Novitasari et al., “K-nearest neighbor analysis to predict the accuracy of product delivery using administration of raw material model in the cosmetic industry (PT Cedefindo),” in Journal of Physics: Conference Series, Institute of Physics Publishing, Nov. 2019. doi: 10.1088/1742-6596/1367/1/012008.
[2] A. Rohman and S. Mujiyono, “Komparasi Algoritma Machine Learning dan Ensemble Methods dalam Prediksi Penyakit Jantung dengan Dataset yang Bervariasi,” 2022.
[3] Y. Amelia, “PERBANDINGAN METODE MACHINE LEARNING UNTUK MENDETEKSI PENYAKIT JANTUNG,” 2023. [Online]. Available: http://jom.fti.budiluhur.ac.id/index.php/IDEALIS/index
[4] U. Aisyah Pringsewu, A. Jurnaidi Wahidin, A. Eko Setiawan, and P. Bintoro, “Aisyah Journal of Informatics and Electrical Engineering MACHINE LEARNING UNTUK KLASIFIKASI PENYAKIT JANTUNG”, [Online]. Available: http://jti.aisyahuniversity.ac.id/index.php/AJIEE
[5] E. Sahelvi, P. Cikita, R. M. Sapitri, R. Rahmaddeni, and L. Efrizoni, “Perbandingan Algoritma K-Nearest Neighbors dan Random Forest untuk Rekomendasi Gaya Hidup Sehat dalam Mencegah Penyakit Jantung,” MALCOM: Indonesian Journal of Machine Learning and Computer Science, vol. 5, no. 3, pp. 830–840, Jun. 2025, doi: 10.57152/malcom.v5i3.1972.
[6] A. Y. Agusyul and F. Firmansyah, “Prediksi Penyakit Jantung Menggunakan Algoritma Random Forest,” Jurnal Minfo Polgan, vol. 12, no. 2, Nov. 2023, doi: 10.33395/jmp.v12i2.13214.
[7] R. Ridwan, H. H. Handayani, S. A. P. Lestari, and Y. Cahyana, “Evaluasi Kinerja Algoritma Random Forest Dan Gradient Boosting Untuk Klasifikasi Penyakit Jantung,” Jurnal Komtika (Komputasi dan Informatika), vol. 9, no. 1, pp. 112–124, Jun. 2025, doi: 10.31603/komtika.v9i1.13450.
[8] S. A. Putri, N. Selayanti, M. Kristanaya, M. P. Azzahra, M. G. Navsih, and K. M. Hindrayani, “Penerapan Machine Learning Algoritma Random Forest Untuk Prediksi Penyakit Jantung,” Seminar Nasional Sains Data, vol. 2024, [Online]. Available: https://www.kaggle.com/datasets/fedesoriano/heart-failure-prediction.
[9] G. Ayu, P. Febriyanti, and A. Baita, “Comparison of Support Vector Machine and Decision Tree Algorithm Performance with Undersampling Approach in Predicting Heart Disease Based on Lifestyle,” 2025. [Online]. Available: http://jurnal.polibatam.ac.id/index.php/JAIC
[10] R. Hidayat, Y. S. Sy, T. Sujana, M. Husnah, H. T. Saputra, and F. Okmayura, “Implementasi Machine Learning Untuk Prediksi Penyakit Jantung Menggunakan Algoritma Support Vector Machine,” BIOS : Jurnal Teknologi Informasi dan Rekayasa Komputer, vol. 5, no. 2, pp. 161–168, Sep. 2024, doi: 10.37148/bios.v5i2.152.
[11] T. Z. Jasman, E. Hasmin, Sunardi, C. Susanto, and W. Musu, “Perbandingan Logistic Regression, Random Forest, dan Perceptron pada Klasifikasi Pasien Gagal Jantung,” CSRID (Computer Science Research and Its Development Journal), vol. 14, no. 3, pp. 271–286, Dec. 2022, doi: 10.22303/csrid.14.3.2022.271-286.
[12] F. Fredilio, J. Rahmad, S. H. Sinurat, D. R. H. Sitompul, D. J. Ziegel, and E. Indra, “Perbandingan Algoritma K-Nearest Neighbors (K-NN) dan Random Forest terhadap Penyakit Gagal Jantung,” Jurnal Teknologi Informatika dan Komputer, vol. 9, no. 1, pp. 471–486, Mar. 2023, doi: 10.37012/jtik.v9i1.1432.
[13] M. Sajid Abdillah, H. Mulyo, G. Wahyu, and N. Wibowo, “Heart Failure Classification Using a Hybrid Model Based on SVM and Random Forest,” Journal of Dinda Data Science, Information Technology, and Data Analytics, vol. 5, no. 2, pp. 208–219, 2025, [Online]. Available: http://journal.ittelkom-pwt.ac.id/index.php/dinda
[14] W. C. Wahyudin, T. Sutikno, R. Umar, and A. Ridwan, “Comparative Performance Analysis of Data Mining Models for Heart Disease Detection with Feature Selection Implementation Perbandingan Kinerja Model Data Mining Dalam Deteksi Penyakit Jantung Dengan Penerapan Feature Selection,” 2025.
[15] A. Setyawan, N. Sulistianingsih, and R. Rismayati, “Perbandingan Algoritma Machine Learning Untuk Deteksi Gagal Jantung Berbasis Seleksi Fitur RFECV dan Penyeimbangan Data SMOTE.”
[16] S. Yuliasari and A. Rahmatulloh, “Performance Analysis and Accuracy of Machine Learning Algorithms for Heart Disease Prediction Evaluasi Kinerja dan Akurasi Algoritma Machine Learning untuk Prediksi Penyakit Jantung,” Jurnal Informatika dan Teknologi Informasi, vol. 22, no. 3, pp. 98–106, 2025, doi: 10.31515/telematika.v22i3.14022.
[17] J. Homepage et al., “MALCOM: Indonesian Journal of Machine Learning and Computer Science Implementation of Hyperparameter Tuning for Classification Models in Heart Disease Risk Prediction Penerapan Hyperparameter Tuning pada Model Klasifikasi untuk Prediksi Risiko Penyakit Jantung,” vol. 5, pp. 1181–1189, 2025, doi: 10.57152/malcom.v5i4.2138.
[18] A. S. Prabowo and F. I. Kurniadi, “Analisis Perbandingan Kinerja Algoritma Klasifikasi dalam Mendeteksi Penyakit Jantung.”
[19] J. Dwi Muthohhar and A. Prihanto, “Analisis Perbandingan Algoritma Klasifikasi untuk Penyakit Jantung,” Journal of Informatics and Computer Science, vol. 04, 2023.
[20] F. S. Salam Nagalay, D. Rahma Aryanti, M. Liandani, F. Sains dan Teknologi, U. Wira Buana, and F. Ilmu Kesehatan, “PENGEMBANGAN APLIKASI PREDIKSI RISIKO PENYAKIT JANTUNG BERBASIS MODEL KLASIFIKASI RANDOM FOREST MENGGUNAKAN FRAMEWORK STREAMLIT,” Jurnal Kesehatan Wira Buana, vol. 9, pp. 2541–5387, 2025.
[21] M. A.-Z. Faradeya and E. R. Subhiyakto, “Klasifikasi Penyakit Gagal Jantung Menggunakan Algoritma Naive Bayes,” Jurnal Algoritma, vol. 22, no. 1, pp. 115–127, May 2025, doi: 10.33364/algoritma/v.22-1.2178.
[22] A. R. Ramadhan et al., “Comparison of Machine Learning Models for Heart Disease Classification with Web-Based Implementation,” 2024. [Online]. Available: http://jurnal.polibatam.ac.id/index.php/JAIC
[23] 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”.
[24] L. N. Farida and S. Bahri, “Klasifikasi Gagal Jantung menggunakan Metode SVM (Support Vector Machine),” Komputika : Jurnal Sistem Komputer, vol. 13, no. 2, pp. 149–156, Oct. 2024, doi: 10.34010/komputika.v13i2.11330.
[25] Ritwik_B3, “https://www.kaggle.com/datasets/ritwikb3/heart-disease-cleveland.”
[26] F. Handayani et al., “JEPIN (Jurnal Edukasi dan Penelitian Informatika) Komparasi Support Vector Machine, Logistic Regression Dan Artificial Neural Network dalam Prediksi Penyakit Jantung”.



