Penerapan Algoritma K-Nearest Neighbor (K-NN) untuk Analisis dan Prediksi Dini Penyakit Stroke
Main Article Content
Abstract
Stroke is one of the leading causes of death and long-term disability worldwide, making early detection efforts based on data analysis essential to minimize the associated risks. This study applies the K-Nearest Neighbor (K-NN) algorithm as a classification method to predict the likelihood of stroke occurrence based on medical and lifestyle attributes. The research stages include data preprocessing, normalization, Euclidean distance calculation between training and testing data, selection of the optimal K value, and classification based on the nearest neighbors. The dataset was divided using a ratio of 0.9 for training data and 0.1 for testing data. The experimental results show that the K-NN algorithm achieved an accuracy of 60% in predicting stroke risk. Although the obtained accuracy is categorized as moderate, the results indicate that K-NN is capable of capturing basic patterns within a heterogeneous stroke dataset. With further optimization of parameters and improved preprocessing techniques, the K-NN algorithm has the potential to be developed as a supportive method for data-driven early stroke detection systems in digital health applications.
Article Details

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
References
Ahad, A., Puspitasari, I., Zheng, J., Ullah, S., Ullah, F., Bakhsh, S. T., & Pires, I. M. (2025). Machine Learning Stroke Prediction in Smart Healthcare : Integrating Fuzzy K-Nearest Neighbor and Artificial Neural Networks with Feature Selection Techniques. https://doi.org/10.32604/cmc.2025.062605
Eldora, K., & Fernando, E. (2024). Comparative Analysis of KNN and Decision Tree Classification Algorithms for Early Stroke Prediction : A Machine Learning Approach. 6(1), 313–338. https://doi.org/10.51519/journalisi.v6i1.664
Hodges, C. B., & Barbour, M. (2025). A 2025 Vision for Building Access to K-12 Online and Blended Learning in Pre-service Teacher Education. 30(2022), 201–216.
Hussain, I., Qureshi, M., Ismail, M., Iftikhar, H., Zywio, J., & L, J. L. (2024). Heliyon Optimal features selection in the high dimensional data based on robust technique : Application to different health database. 10(September). https://doi.org/10.1016/j.heliyon.2024.e37241
Jakarta, M. M. (n.d.). Penerapan Algoritma K-Nearest Neighbor ( KNN ) untuk Memprediksi Stroke pada Rumah Sakit Pusat Otak Nasional Prof . 26(1), 144–153.
Khairi, Z., Yanti, R., Fitri, T. A., & Fatdha, E. (2025). Optimasi Algoritma Knn Menggunakan Smote Untuk Prediksi Stroke. 164–175. https://doi.org/10.33364/algoritma/v.22-2.2474
Maskuri, M. N., Sukerti, K., & Bhakti, R. M. H. (2022). Penerapan Algoritma K-Nearest Neighbor ( KNN ) untuk Memprediksi Penyakit Stroke. 4(1), 130–140.
Nopitasari, E. F., Putri, S., Alkadri, A., Wahid, R., Insani, S., & Barat, K. (2025). Implementasi Data Mining untuk Klasifikasi Penyakit Stroke Menggunakan Algoritma K-Nearest Neighbor revolusioner untuk deteksi dini penyakit ( Bintang , 2024 ), dengan algoritma K-Nearest limitasi yang mengurangi kemampuan klasifikasinya ( Maulana , 2024 ), termasuk sensitivitas prediksi stroke , beberapa kesenjangan kritikal masih perlu diatasi yang menciptakan urgensi. 5(September), 344–365.
Review, T. (2021). Studying Stroke Thrombus Composition After Thrombectomy. November, 3718–3727. https://doi.org/10.1161/STROKEAHA.121.034289
Roman, M., Naz, I., Luqman, M. A., Ali, J., & Jan, M. S. (2024). Stroke Disease Prediction Using K-Nearest Neighbor And Decision Tree Algorithms With Machine Learning Pre-Processing Techniques. 4, 2015–2027.
Saifaldeen, D. A., & Member, A. M. A. (2024). DRL-Based IRS-Assisted Secure Hybrid Visible Light and mmWave Communications. IEEE Open Journal of the Communications Society, 5(February), 3007–3020. https://doi.org/10.1109/OJCOMS.2024.3395425
Setiawan, A., Waleska, R. F., & Purnama, M. A. (2024). KOMPARASI ALGORITMA K-NEAREST NEIGHBOR ( K-NN ), SUPPORT VECTOR MACHINE ( SVM ), DAN DECISION TREE DALAM KLASIFIKASI PENYAKIT STROKE. 7(1), 107–114.
Shourov, S. H. (2024). COMPARATIVE ANALYSIS OF NEURAL NETWORK ARCHITECTURES FOR MEDICAL IMAGE CLASSIFICATION : EVALUATING PERFORMANCE. 04(01), 1–42. https://doi.org/10.63125/feed1x52
Siregar, A. H. (2023). Penerapan K-Nearest Neighbors ( KNN ) dalam Memprediksi dan Menghitung Akurasi Data Penyakit Stroke. 2(4).
Yoon, E., Member, S., & Kwon, S. (2023). An Efficient Application of Turbo Coding for OFDM In-Phase / Quadrature Index Modulation. IEEE Access, 11(April), 37031–37040. https://doi.org/10.1109/ACCESS.2023.3266288