Application of the K-Nearest Neighbor (K-NN) Algorithm for Disease Classification Based on Eye Images

  • St. Nadira Zalzabila Zalzabila Universitas Negeri Makassar
  • Sudarmin Universitas Negeri Makassar
  • Zulkifli Rais Universitas Negeri Makassar
Keywords: Klasifikasi Citra, K-Nearest Neighbor (K-NN), Penyakit Mata, Gray Level Co-occurrence Matrix (GLCM).

Abstract

Eye diseases are one of the health issues that can lead to a decline in visual acuity if not detected and treated at an early stage. With advances in digital image processing and machine learning technologies, eye images can be utilised as a source of information to support the automated classification of eye diseases. This study aims to apply the K-Nearest Neighbour (K-NN) algorithm to classify eye diseases based on eye images. The dataset used in this study consists of 4,217 eye images categorised into four classes: cataract, glaucoma, diabetic retinopathy, and normal. The research stages included image pre-processing, comprising conversion to greyscale images, normalisation, segmentation, and resizing. Next, texture features were extracted using the Gray Level Co-occurrence Matrix (GLCM) method to obtain features representing the characteristics of the eye images. The data were then split into training and test sets in an 80:20 ratio before classification was carried out using the K-NN algorithm. The evaluation results show that the K-NN algorithm with K = 7 achieved an accuracy rate of 81 per cent, indicating that the model is able to classify the majority of eye images accurately.

References

Aziza, L. N., Astuti, R. Y., Maulana, B. A., & Hidayati, N. (2024). Penerapan Algoritma K-Nearest Neighbor untuk Klasifikasi Ketahanan Pangan di Provinsi Jawa Tengah. MALCOM: Indonesian Journal of Machine Learning and Computer Science, 4(2), 404–412. https://doi.org/10.57152/malcom.v4i2.1201
Baloch, L., Bazai, S. U., Marjan, S., Aftab, F., Aslam, S., Neo, T. K., & Amphawan, A. (2023). A Review of Big Data Trends and Challenges in Healthcare. In International Journal of Technology (Vol. 14, Nomor 6, hal. 1320–1333). Faculty of Engineering, Universitas Indonesia. https://doi.org/10.14716/ijtech.v14i6.6643
Eka Pratiwi, N., Suryadi, L., Ardhy, F., & Riswanto, P. (2022). Penerapan Data Mining Prediksi Penjual Mebel Terlaris Menggunakan Metode K-Nearest Neighbor (K-NN) (Studi Kasus: Toko Zerita Meubel). In Jurnal Sistem Informasi Musirawas) Lusi Suryadi, Ngajiyano (Vol. 7, Nomor 2).
Firnando, D., & Suryana, E. (2023). Cataract Disease Diagnostic Expert System Using Forward Chaining Method Sistem Pakar Diagnosa Penyakit Katarak Menggunakan Metode Forward Chaining. In Jurnal Media Computer Science (Vol. 2, Nomor 1).
Gunawan, R., Fathurrahman, R., Widyaningrum, A. I. S., Issandra, F., Abdurachman, M. A., Putra, Y. E., & Naufal. (2025). Pendekatan Transfer Learning untuk Klasifikasi Penyakit Mata Menggunakan Citra dengan CNN InceptionV3. Jurnal CoSciTech (Computer Science and Information Technology), 6(1), 60–67. https://doi.org/10.37859/coscitech.v6i1.8509
Ilmi, N., Novitri, A., & Pratama, H. R. (2024). Detection of Diabetic Retinopathy using Local Binary Pattern Variant and K-Nearest Neighbor. Journal of Informatics and Communication Technology (JICT), 6(1), 168–177. https://doi.org/10.52661/j_ict.v6i1.279
Kusuma, D. P. D. (2020). MACHINE LEARNING. DEEPUBLISH CV. BUDI UTAMA. https://repository.deepublish.com/media/publications/593576-machine-learning-teori-program-dan-studi-5c99fd07.pdf
Mughnyanti, M., & Subhan, H. N. G. (2023). Data Mining Manhattan Distance dan Euclidean Distance Pada Algoritma X-Means Dalam Klasifikasi Minat dan Bakat Siswa. remik, 7(1), 835–842. https://doi.org/10.33395/remik.v7i1.12162
Pamuji, R. I., Sani, D. A., & Hariyanto, R. (2025). Klasifikasi Jenis Penyakit Mata Katarak Menggunakan Metode K-Nearest Neighbors (KNN). CESS (Journal of Computer Engineering, System and Science), 10(2), 690–701. https://doi.org/10.24114/cess.v10i2.67786
Pauji, A., Aisyah, S., Surip, A., Saputra, R., & Ali, I. (2022). Implementasi Algoritma K-Nearest Neighbor Dalam Menentukan Penerima Bantuan Langsung Tunai. KOPERTIP : Jurnal Ilmiah Manajemen Informatika dan Komputer, 4(1), 21–27. https://doi.org/10.32485/kopertip.v4i1.114
Prabowo, A., Erwanto, D., & Rahayu, P. N. (2021). Klasifikasi Kesegaran Daging Sapi Menggunakan Metode Ekstraksi Tekstur GLCM dan KNN Freshness Classification of Beef Using GLCM Texture Extraction Method and KNN. Jurnal Elektro Lucea, 7(1).
Putri, G. R., Maulana, M. A., & Lestari, T. (2023). Identifikasi Mata Juling dan Mata Normal Pada Anak Dengan Metode Convolutional Neural Network (CNN) (Vol. 13, Nomor 2). https://jurnal.umj.ac.id/index.php/just-it/index
Putri, I. P. (2021). Analisis Performa Metode K-Nearest Neighbor (KNN) dan Crossvalidation pada Data Penyakit Cardiovascular. Indonesian Journal of Data and Science (IJODAS), 2(1), 21–28.
Rashad, I., Isnanto, R. R., & Widodo, C. E. (2023). Klasifikasi Penyakit Jantung Menggunakan Algoritma Analisis Diskriminan Linier. J. Sistem Info. Bisnis, 13(1), 29–36. https://doi.org/10.21456/vol13iss1pp29-36
Setiawan, M. R. (2019). Klasifikasi citra makanan menggunakan K-Nearest Neighbor dengan fitur bentuk simple morphological shape descriptors dan fitur warna grayscale histogram [Universitas Brawijaya]. https://repository.ub.ac.id/id/eprint/168843/1/Muhammad Rizky Setiawan.pdf
Subandi, R., Herman, & Yudhana, A. (2023). Pre-Processing Pada Klasifikasi Citra Medis Pneumonia. Decode: Jurnal Pendidikan Teknologi Informasi, 4(1), 86–93. https://doi.org/10.51454/decode.v4i1.198
Sudipa, I. G. I., Andi Putra, T. E., Jurnaidi Wahidin, A., Alfa Syukrilla, W., Khrisna Wardhani, A., Heryana, N., Indriyani, T., Willyanto Santoso Tutuk Indriyani, L., & Willyanto Santoso, L. (2023). DATA MINING. www.globaleksekutifteknologi.co.id
Sugriyono, S., & Siregar, M. U. (2020). Preprocessing kNN algorithm classification using K-means and distance matrix with students’ academic performance dataset. Jurnal Teknologi dan Sistem Komputer, 8(4). https://doi.org/10.14710/jtsiskom.2020.13874
Suwanda, A. E., & Juniati, D. (2022). Klasifikasi Penyakit Mata Berdasarkan Citra Fundus Retina Menggunakan Dimensi Fraktal Box Counting Dan Fuzzy K-Means. Jurnal Penelitian Matematika dan Pendidikan Matematika, 10.
Wang, E. Y., Kong, X., Wolle, M., Gasquet, N., Ssekasanvu, J., Mariotti, S. P., Bourne, R., Taylor, H., Resnikoff, S., & West, S. (2023). Global Trends in Blindness and Vision Impairment Resulting from Corneal Opacity 1984–2020. Ophthalmology, 130(8), 863–871. https://doi.org/10.1016/j.ophtha.2023.03.012
Yuliarni, T. (2024). Deteksi penyakit mata menggunakan Algoritma Reinforcement Learning [Universitas Negeri makassar]. https://lib.unm.ac.id/storage/file_thesis/obF4ug7avU32mB5CmpZBZ1Ouit6r2qx9gHwvshVs.pdf
Ujianto, N, T,, Gunawan, Fadillah, H,, Fanti, A, P,, Saputra, A, D,, & Ramadhan, I, G, (2025), Penerapan algoritma K-Nearest Neighbors (KNN) untuk klasifikasi citra medis, IT-Explore: Jurnal Penerapan Teknologi Informasi Dan Komunikasi, 4(1), 33–43, https://doi,org/10,24246/itexplore,v4i1,2025,pp33-43
Pertiwi, A, A,, & Utomo, A, N, (2023), Implementation of Support Vector Machine (Svm) Method on Fundus Image of Retina of the Eye for the Detection ofGlaucoma, Jurnal Rekayasa Informasi, 12(1), 19–27,
Published
2026-09-30
How to Cite
Zalzabila, S. N. Z., Sudarmin, & Zulkifli Rais. (2026). Application of the K-Nearest Neighbor (K-NN) Algorithm for Disease Classification Based on Eye Images. VARIANSI: Journal of Statistics and Its Application on Teaching and Research, 8(02), 269 - 279. https://doi.org/10.35580/variansiunm621
Section
Articles