This study aims to implement the Random Forest algorithm for forecasting shallot prices in Makassar City using monthly historical data from January 2018 to December 2024, obtained from the Statistics Indonesia (Badan Pusat Statistik) of South Sulawesi Province. The analysis begins with identifying significant lags through the Partial Autocorrelation Function (PACF) plot, resulting in seven input variable schemes. Each scheme was tested using training and testing datasets. Model performance was evaluated using the Mean Absolute Percentage Error (MAPE). The results show that Scheme 1 (Lag 1) achieved the best performance with a MAPE value of 13.08%, which falls into the “good” category. Price forecasts for January–December 2025 using the best scheme indicate a price range of IDR 23,200 – 24,300 per kilogram, with peak prices in March, July, and November, and the lowest prices in April, August, and December. Although the model successfully captures historical price patterns, real-world fluctuations driven by seasonal factors, supply disruptions, and distribution costs may cause prediction deviations. This study recommends integrating exogenous variables and real-time data to improve forecasting accuracy and support local food price stabilization policies.
Copyrights © 2025