Penerapan Algoritma k-Nearest Neighbor untuk Klasifikasi Kondisi Lingkungan Pertanian Berbasis IoT : Penelitian - Panji Pangestu Saputra; Hasbi Firmansyah; Rizki Prasetyo Tulodo; Priyo Haryoko; Wahyu Asriyani (Lembaga Penelitian dan Pengabdian Masyarakat, 2026)
The development of the Internet of Things (IoT) has encouraged the adoption of smart technologies in agriculture to enable real-time environmental monitoring. This study aims to apply the k-Nearest Neighbor (k-NN) algorithm to classify agricultural environmental conditions into ideal and non-ideal categories based on IoT sensor data. The dataset used in this research was obtained from an open-source repository and consists of several environmental parameters, including temperature, humidity, and soil moisture. The research stages include data preprocessing, attribute and label determination, data normalization using the z-transformation method, and model evaluation through cross validation. The performance of the classification model was assessed using accuracy, precision, recall, and F-measure metrics. The experimental results indicate that the k-NN algorithm is capable of providing good classification performance in identifying agricultural environmental conditions. However, limitations were observed in detecting minority class instances, suggesting the need for further parameter optimization and model enhancement. This research is expected to serve as a foundation for the development of IoT-based smart agriculture systems to support more effective decision-making in agricultural environmental management.