Prediksi Harga Komoditas Hortikultura Pangan Strategis Menggunakan Random Forest dengan Analisis SHAP
DOI:
https://doi.org/10.30998/jrami.v7i03.1804Keywords:
Random Forest Regression, SHAP, price forecasting, horticultural commodities, climateAbstract
Price fluctuations in strategic horticultural food commodities can affect food and economic stability. This study aims to predict the prices of shallots, garlic, red chilies, and bird’s eye chilies in Central Java Province using Random Forest Regression based on historical prices and climate variables, and to interpret climate variable contributions using Shapley Additive Explanations (SHAP). Price data were obtained from the National Strategic Food Price Information Center (PIHPS), while climate data were collected from four BMKG stations during 2018–2025. The model used 16 features, including historical prices, average temperature (TAVG), average humidity (RH_AVG), rainfall (RR), rolling features, and calendar variables. Evaluation was conducted using MAE, RMSE, and MAPE at H+1, H+7, and H+30 forecasting horizons. The results show that the best performance was achieved for garlic price prediction at H+1, with a MAPE of 1.69%, while the highest error occurred for red chili at H+30, with a MAPE of 26.72%. SHAP analysis shows that TAVG was dominant in chili commodities, while RR and RH_AVG had greater influence on shallots and garlic. These findings indicate that Random Forest and SHAP can support short-term price prediction with interpretable climate variable contributions.
Downloads
References
Antad, S., Bag, V., Waghmode, O., Wattamwar, S., Wagh, A., & Zite, A. (2024). Kisan Dhan-Crop Price Prediction Using Random Forest. In Communications on Applied Nonlinear Analysis (Vol. 31).
Ardian, M., Khomsah, S., Pandiya, R., Di, J., No, P., 128, K. P., Selatan, K., & Banyumas, J. (2024). Perbandingan Model Regresi Untuk Memprediksi Harga Jual … 549. https://hargajateng.org/tabel-harga-.
Bifarin, O. O. (2023). Interpretable machine learning with treebased shapley additive explanations: Application to metabolomics datasets for binary classification. PLoS ONE, 18(5 May). https://doi.org/10.1371/journal.pone.0284315.
Ibrahim, M. N. R. (2025). Price Forecasting of Shallots Using the Machine Learning Approach of Random Forest Regression Supporting Price Stabilization. Jurnal Keteknikan Pertanian, 13(3), 449–461. https://doi.org/10.19028/jtep.013.3.449-461.
Kaewchada, S., Ruang-On, S., Kuhapong, U., & Songsri-In, K. (2023). Random forest model for forecasting vegetable prices: a case study in Nakhon Si Thammarat Province, Thailand. International Journal of Electrical and Computer Engineering, 13(5), 5265–5272. https://doi.org/10.11591/ijece.v13i5.pp5265-5272
Kumar, A., Kailasam, A. S., Rai, A., Khanna, M., Shukla, S., Das, S., & Chakraborti, A. (2025). The Impact of Meteorological Factors on Crop Price Volatility in India: Case studies of Soybean and Brinjal. http://arxiv.org/abs/2503.11690.
Lestari, D. R., Bangun, E. A. S., Gaol, F. L., & Matsuo, T. (2025). Machine Learning-Based Forecasting of Agricultural Commodity Prices Using Ensemble Models. Journal of Human, Earth, and Future, 6(4), 887–899. https://doi.org/10.28991/hef-2025-06-04-09.
Schonlau, M., & Zou, R. Y. (2020). The random forest algorithm for statistical learning. Stata Journal, 20(1), 3–29. https://doi.org/10.1177/1536867X20909688.
Ridwansyah Matondang, M., & Krisnamurthi, B. (2024). Price Fluctuations and Volatility of National Strategic Food Commodities. 8(1), 134. http://ejournal2.undip.ac.id/index.php/agrisocionomics.
Talekar, B. (2020). A Detailed Review on Decision Tree and Random Forest. Bioscience Biotechnology Research Communications, 13(14), 245–248. https://doi.org/10.21786/bbrc/13.14/57.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Valencia Patrice Gracia Pangaribuan, Bayu Sulistiyanto Ipung Sutejo, Gerry Firmansyah, Arief Ichwani (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.





