Research Article

Application of Data Mining with K-Nearest Neighbors Algorithm for Shallot Price Prediction

Authors

  • Yuana Inka Dewi Br Sinulingga Informatics Study Program, Faculty of Science and Technology, Universitas Teknologi Yogyakarta, Indonesia
  • Donny Avianto Informatics Study Program, Faculty of Science and Technology, Universitas Teknologi Yogyakarta, Indonesia

Abstract

Shallots are an important and widely consumed bulb crop in Indonesia, both for medicinal and culinary purposes. However, shallot yield is substantially affected by its supply, often leading to significant price fluctuations that greatly impact consumers and producers, especially farmers. Farmers who cannot accurately predict shallot prices often incur losses when selling to shallot distributors. If this problem is not resolved, it may discourage farmers from cultivating shallots. Therefore, a prediction system is needed to forecast shallot prices in the future, thus helping farmers make the right decisions. This research uses the K-Nearest Neighbors (KNN) algorithm for shallot price prediction. KNN classifies data into specific categories based on the closest distance to a set of k patterns for each category, using the Euclidean distance formula to calculate the distance. The dataset consists of 303 entries with five features: farmer price, seller price, retail price, seed price, and yield. The test results of the Shallot Price Prediction System in North Sumatra Province, Indonesia, using the K-Nearest Neighbors Algorithm, showed the best performance when using 80% training data and 20% testing data, with a value of k=2, resulting in a Mean Absolute Error (MAE) of 25,786 and a Mean Squared Error (MSE) of 72. This system empowers farmers to predict the future price of shallots before selling their crops to distributors.

Article information

Journal

Journal of Computer Science and Technology Studies

Volume (Issue)

5 (4)

Pages

41-50

Published

2023-11-01

How to Cite

Dewi Br Sinulingga, Y. I., & Avianto, D. (2023). Application of Data Mining with K-Nearest Neighbors Algorithm for Shallot Price Prediction. Journal of Computer Science and Technology Studies, 5(4), 41–50. https://doi.org/10.32996/jcsts.2023.5.4.5

Downloads