Feature-Based Pistachio Classification: A 28-Dimensional Dataset with KNN - Steven Alexander Pasaribu Pasaribu; Reza permana Olivera Simbolon; Bonfilio Delatersia Nainggolan (Cv. Data Sinergi Digital, 2025)
Pistachio (Pistacia vera L.) is a high-value horticultural crop in which accurate variety classification is essential for quality assurance and trade. Conventional classification methods relying on visual inspection are subjective, labor-intensive, and inadequate for large-scale industrial deployment. This study evaluates the effectiveness of the k-Nearest Neighbors (KNN) algorithm for pistachio variety classification using a feature-based dataset comprising 2,148 samples and 28 morphological and color descriptors. Experimental results indicate that the optimized KNN configuration (k = 5, Euclidean distance metric, distance-based weighting) attained a test accuracy of 97% and a macro F1-score of 0.97, while both ROC-AUC and average precision values approached 0.99. The confusion matrix demonstrated only marginal misclassifications, confirming the high discriminative capability of the handcrafted features. These findings underscore that feature-based approaches remain competitive with, and in some contexts superior to, deep learning methods by providing interpretable, computationally efficient, and robust solutions. The proposed model offers practical potential for integration into industrial pistachio sorting systems and broader agricultural informatics applications, supporting scalable and cost-effective automation in crop quality assessment