Optimizing Agricultural Commodity Price Forecasts Using an Ensemble Stacking Method Based on Market and Product Characteristics


  • Abdul Karim * Mail Universitas Labuhanbatu, Rantau Prapat, Indonesia
  • Kusmanto Kusmanto Universitas Al Washliyah Labuhanbatu, Rantau Prapat, Indonesia
  • (*) Corresponding Author
Keywords: Commodity Price Prediction; Machine Learning; Gradient Boosting; Stacking Ensemble; Random Forest

Abstract

Commodity price prediction is a vital aspect of supporting decision-making because price fluctuations can create uncertainty for businesses and stakeholders. This study aims to compare the performance of several machine learning algorithms for commodity price prediction, namely Random Forest, XGBoost, Support Vector Regression (SVR), Gradient Boosting, and Stacking Ensemble. Model performance was evaluated using Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and the coefficient of determination (R²). The experimental results show that Gradient Boosting achieved the best overall performance, with an RMSE of 219.07 and an R² of 0.9968, while Random Forest had the lowest MAE of 65.98. The Stacking Ensemble also demonstrated competitive performance, achieving an RMSE of 253.07 and an R² of 0.9958. In contrast, SVR produced the lowest performance, with an RMSE of 1,919.65 and an R² of 0.7555. Based on these results, Gradient Boosting was selected as the most optimal model because it provided the lowest prediction error and the highest ability to explain data variation. These findings demonstrate that selecting an appropriate machine learning algorithm plays a crucial role in improving commodity price prediction performance.

References

K. Kurumatani, “Time series forecasting of agricultural product prices based on recurrent neural networks and its evaluation method,” SN Applied Sciences 2020 2:8, vol. 2, no. 8, pp. 1434–, Jul. 2020, doi: 10.1007/S42452-020-03225-9.

E. Rahmani, M. Khatami, and E. Stephens, “Using Probabilistic Machine Learning Methods to Improve Beef Cattle Price Modeling and Promote Beef Production Efficiency and Sustainability in Canada,” Sustainability 2024, Vol. 16, p. 1789, Vol. 16, No. 5, p. 1789, Feb. 2024, doi: 10.3390/SU16051789.

N. Zhang, Q. An, S. Zhang, and H. Ma, “Price Prediction for Fresh Agricultural Products Based on a Boosting Ensemble Algorithm,” Mathematics 2025, Vol. 13, p. 71, vol. 13, no. 1, p. 71, Dec. 2024, doi: 10.3390/MATH13010071.

E. Rahmani, M. Khatami, and E. Stephens, “Using Probabilistic Machine Learning Methods to Improve Beef Cattle Price Modeling and Promote Beef Production Efficiency and Sustainability in Canada,” Sustainability 2024, Vol. 16, p. 1789, Vol. 16, No. 5, p. 1789, Feb. 2024, doi: 10.3390/SU16051789.

C. Liu, L. Zhou, L. Höschle, and X. Yu, “Food price dynamics and regional clusters: machine learning analysis of egg prices in China,” *China Agricultural Economic Review*, vol. 15, no. 2, pp. 416–432, May 2023, doi: 10.1108/CAER-01-2022-0003.

R. Gupta and C. Pierdzioch, “Multi-Task Forecasting of the Realized Volatilities of Agricultural Commodity Prices,” Mathematics 2024, Vol. 12, p. 2952, vol. 12, no. 18, p. 2952, Sep. 2024, doi: 10.3390/MATH12182952.

X. Han, T. Yuan, D. Wang, Z. Zhao, and B. Gong, “How to Understand High Global Food Prices? Using SHAP to Interpret Machine Learning Algorithms,” PLoS One, vol. 18, no. 8, p. e0290120, Aug. 2023, doi: 10.1371/JOURNAL.PONE.0290120.

A. Thaker, L. H. Chan, and D. Sonner, “Forecasting Agricultural Commodity Futures Prices Using Convolutional Neural Networks: An Application to Wheat Futures,” Journal of Risk and Financial Management 2024, Vol. 17, p. 143, vol. 17, no. 4, p. 143, Apr. 2024, doi: 10.3390/JRFM17040143.

C. Sun, M. Pei, B. Cao, S. Chang, and H. Si, “A Study on an Agricultural Commodity Price Prediction Model Based on Secondary Decomposition and a Long Short-Term Memory Network,” Agriculture 2024, Vol. 14, p. 60, Vol. 14, No. 1, p. 60, Dec. 2023, doi: 10.3390/AGRICULTURE14010060.

T. Chen and C. Guestrin, “XGBoost: A scalable tree boosting system,” Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Aug. 13–17, 2016, pp. 785–794, Aug. 2016, doi: 10.1145/2939672.2939785;CSUBTYPE:STRING:CONFERENCE.

C. Liu, L. Zhou, L. Höschle, and X. Yu, “Food price dynamics and regional clusters: a machine learning analysis of egg prices in China,” *China Agricultural Economic Review*, vol. 15, no. 2, pp. 416–432, Feb. 2023, doi: 10.1108/CAER-01-2022-0003.

A. Thaker, L. H. Chan, and D. Sonner, “Forecasting Agricultural Commodity Futures Prices Using Convolutional Neural Networks: An Application to Wheat Futures,” Journal of Risk and Financial Management 2024, Vol. 17, p. 143, Vol. 17, No. 4, p. 143, Apr. 2024, doi: 10.3390/JRFM17040143.

M. Sari, S. Duran, H. Kutlu, B. Guloglu, and Z. Atik, “Various optimized machine learning techniques to predict agricultural commodity prices,” Neural Computing and Applications 2024 36:19, vol. 36, no. 19, pp. 11439–11459, Apr. 2024, doi: 10.1007/S00521-024-09679-X.

P. L. Brignoli, A. Varacca, C. Gardebroek, and P. Sckokai, “Machine learning to predict grain futures prices,” Agricultural Economics (United Kingdom), vol. 55, no. 3, pp. 479–497, May 2024, doi: 10.1111/AGEC.12828;WGROUP:STRING:PUBLICATION.

M. H. D. M. Ribeiro and L. dos Santos Coelho, “An ensemble approach based on bagging, boosting, and stacking for short-term prediction in agribusiness time series,” Appl. Soft Comput., vol. 86, p. 105837, Jan. 2020, doi: 10.1016/J.ASOC.2019.105837.

P. Oktoviany, R. Knobloch, and R. Korn, “A machine learning-based price trend prediction model for agricultural commodities using external factors,” Decisions in Economics and Finance 2021 44:2, vol. 44, no. 2, pp. 1063–1085, Nov. 2021, doi: 10.1007/S10203-021-00354-7.

N. Zhang, Q. An, S. Zhang, and H. Ma, “Price Prediction for Fresh Agricultural Products Based on a Boosting Ensemble Algorithm,” Mathematics 2025, Vol. 13, p. 71, vol. 13, no. 1, p. 71, Dec. 2024, doi: 10.3390/MATH13010071.

Z. Budiarso, H. Listiyono, and A. Karim, “Optimizing LSTM with Grid Search and Regularization Techniques to Enhance Accuracy in Human Activity Recognition,” Journal of Applied Data Sciences, vol. 5, no. 4, pp. 2002–2014, Nov. 2024, doi: 10.47738/jads.v5i4.433.

Retno Andani Sundari, Poningsih, and A. Karim, “Enhancing Lung Cancer Detection: Optimizing CNN Architectures through Hyperparameter Tuning,” https://jurnal.iaii.or.id/index.php/RESTI/article/view/6357/1127. Accessed: Dec. 19, 2025. [Online]. Available: https://jurnal.iaii.or.id/index.php/RESTI/article/view/6357/1127

A. Theofilou, S. A. Nastis, A. Michailidis, T. Bournaris, and K. Mattas, “Predicting Prices of Staple Crops Using Machine Learning: A Systematic Review of Studies on Wheat, Corn, and Rice,” Sustainability 2025, Vol. 17, p. 5456, vol. 17, no. 12, p. 5456, Jun. 2025, doi: 10.3390/SU17125456.

J. C. M. Sánchez, H. G. A. Mesa, A. T. Espinosa, S. R. Castilla, and F. G. Lamont, “Improving wheat yield prediction through variable selection using Support Vector Regression, Random Forest, and Extreme Gradient Boosting,” Smart Agricultural Technology, vol. 10, p. 100791, Mar. 2025, doi: 10.1016/J.ATECH.2025.100791.

R. L. Manogna, V. Dharmaji, and S. Sarang, “Enhancing agricultural commodity price forecasting with deep learning,” Scientific Reports 2025 15:1, vol. 15, no. 1, pp. 20903–, Jul. 2025, doi: 10.1038/s41598-025-05103-z.


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel Optimizing Agricultural Commodity Price Forecasts Using an Ensemble Stacking Method Based on Market and Product Characteristics

Dimensions Badge
Article History
Submitted: 2026-08-20
Published: 2026-08-31
Abstract View: 0 times
PDF Download: 0 times
Issue
Section
Articles