A New Triple-Weighted K-Nearest Neighbor Algorithm for Tomato Maturity Classification - Lidya, Lidya Ningsih; Arif, Arif Mudi Priyatno; dini, Addini Yusmar (Ikatan Ahli Informatika Indonesia (IAII), 2025)
As climatic products, tomatoes are highly sensitive to harvesting and processing. The sorting of tomatoes can be significantly improved by utilizing Hue Saturation Value (HSV) color features that are classified using neighboring algorithms, such as K-Nearest Neighbor (KNN), Weighted K-Nearest Neighbor (W-KNN), and DW-KNN. However, the DW-KNN algorithm does not consider the relative relationship between the farthest, nearest, and surrounding neighbors, which may impact the classification accuracy, particularly in datasets with uneven distributions. This study proposes a Triple Weighted K-Nearest Neighbor (TW-KNN) algorithm for tomato image classification. This algorithm effectively handles the problem of sensitivity and outliers in the data distribution and considers the relationship between neighboring distances. The classification data consisted of 400 tomato images with five maturity levels divided into training and testing sets using k-fold cross-validation. Tests were conducted using several variations of parameter k, namely 4, 6, 9, and 15, to evaluate the classification performance. The results show that the proposed TW-KNN algorithm consistently outperforms other methods by producing better classification results. This is demonstrated by an accuracy rate of 95.52% across different values of k. The superior performance of the TW-KNN highlights its ability to provide robust and stable classification results compared to conventional KNN variants. This finding indicates that the TW-KNN is more effective in consistently classifying tomato fruits, making it a promising approach for automated fruit sorting applications.