Jurnal Kecerdasan Buatan dan Teknologi Informasi
Vol. 5 No. 3 (2026): September 2026

K-Nearest Neighbors Classification Analysis of Rice Farmer Productivity Using Harvest Data for Agricultural Evaluation in Sayur Matinggi District

Ahmad Fauzan Purba (Universitas Harapan Medan)
Mulkan Azhari (Universitas Harapan Medan)



Article Info

Publish Date
20 Sep 2026

Abstract

Rice productivity evaluation in Sayur Matinggi District has traditionally relied on descriptive comparisons of harvest records, which do not provide a consistent classification of productivity levels across villages. This study develops a web-based analytical system using the K-Nearest Neighbors (KNN) algorithm to classify rice farmer productivity from harvest data collected in 19 villages during 2023-2025. The original wide-format dataset was transformed into 57 village-year observations. Productivity labels were constructed objectively using the 33rd and 66th quantiles of the production-to-harvested-area ratio, producing Low, Medium, and High classes. A stratified random split allocated 45 observations to training data and 12 observations to testing data. Three numerical attributes were used in the final model: harvested area, rice production, and cropping index. Min-Max normalization was applied before Euclidean-distance computation and majority voting. Evaluation of K values from 1 to 10 showed the highest accuracy at K=4 and K=5, both reaching 41.67%; K=4 was selected as the simpler model. At K=4, five of twelve testing observations were classified correctly. The confusion matrix showed a tendency to over-predict the Medium class, while macro-average precision, recall, and F1-score were 44.44%, 38.33%, and 34.43%, respectively. Functional black-box testing across twelve scenarios produced results consistent with the expected outputs. The findings indicate that the KNN workflow was implemented correctly, while the limited predictive accuracy is primarily associated with small sample size and weak class separability in the available harvest attributes.

Copyrights © 2026






Journal Info

Abbrev

JKBTI

Publisher

Subject

Computer Science & IT

Description

Jurnal Kecerdasan Buatan dan Teknologi Informasi or abbreviated JKBTI is a national journal published by the Ninety Media Publisher since 2022 with E-ISSN : 2964-2922 and P-ISSN : 2963-6191. JKBTI publishes articles on research results in the field of Artificial Intelligence and Information ...