Comparison of the K-Nearest Neighbor and Random Forest Methods in Classifying the Best Selling Medicines at Khan Pharmacy Matang Glumpang Dua - Anya Regina Putri; Rozzi Kesuma Dinata; Maryana (Journal of Advanced Computer Knowledge and Algorithms, 2026)
Khan Matang Glumpang Dua Pharmacy faces difficulties in analyzing drug sales patterns that affect inventory efficiency and customer satisfaction. The need to anticipate demand and reduce the risk of stockouts or excess stock requires an effective classification system for best-selling drugs. This study aims to test the K-Nearest Neighbor (KNN) and Random Forest methods to perform and find the best classification model. The data used in this study consisted of 382 data points. This study compared two classification models on pharmacy sales data. The K-Nearest Neighbor (KNN) model was tested using the parameter k=3, while the Random Forest model was tested with 100 trees and a max depth of 5. The results showed that the KNN and Random Forest (RF) algorithms. The Random Forest (RF) model outperformed KNN on all metrics: RF achieved an Accuracy and F1-Score of 94.81%, while KNN recorded an Accuracy of 93.51% and an F1-Score of 93.44%.