Comparative Analysis of Decision Tree and Random Forest for Indonesian Food Prices
Abstract
Food price fluctuations in Indonesia represent a persistent macroeconomic challenge, directly affecting national inflation and purchasing power, thereby necessitating an accurate forecasting system for risk mitigation. This study compares Decision Tree Regression and Random Forest Regression using 36,064 observations from Satu Data Indonesia, covering 27 commodities across 38 provinces (January 2021–2026). The data were processed through currency normalization, linear temporal indexing, and label encoding, followed by optimization using GridSearchCV. Baseline evaluation showed that Random Forest (R² = 0.9804; MAPE = 4.30%) outperformed Decision Tree (R² = 0.9678; MAPE = 7.97%). The optimized Random Forest model achieved peak performance with R² = 0.9842, MAE = IDR 1,468, and MAPE = 3.77%. Feature importance analysis revealed that commodity category dominated predictive influence at 91.46%, exceeding spatial and temporal factors. In conclusion, the optimized Random Forest model demonstrates strong operational superiority and substantial potential for integration into a national food price monitoring system to support food security policies.