Ahmad Fauzan Purba
Universitas Harapan Medan

Published : 1 Documents Claim Missing Document
Claim Missing Document
Check
Articles

Found 1 Documents
Search

K-Nearest Neighbors Classification Analysis of Rice Farmer Productivity Using Harvest Data for Agricultural Evaluation in Sayur Matinggi District Ahmad Fauzan Purba; Mulkan Azhari
Jurnal Kecerdasan Buatan dan Teknologi Informasi Vol. 5 No. 3 (2026): September 2026
Publisher : Ninety Media Publisher

Show Abstract | Download Original | Original Source | Check in Google Scholar | DOI: 10.69916/jkbti.v5i3.512

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.