Analysis And Forecasting of Foodstuffs Prices In Bandung Using Gated Recurrent Unit

— Bandung is a city in West Java province, Indonesia. Bandung becomes one of the most densely populated cities in Indonesia. Therefore, predicting and analyzing the prices of foodstuffs based on historical data is necessary to provide useful information for society and government. This paper developed models implementing a gated recurrent unit or GRU which is a specific version of recurrent neural networks (RNN) for forecasting the price of rice, chicken meat, chicken egg, shallot, and garlic in a Bandung traditional market. The GRU models are trained using a dataset from the Information Center for National Strategic Food Price. The data are recorded from January 2018 – February 2023. The experimental results show that GRU was successfully implemented for forecasting the price of rice, chicken meat, chicken egg, shallot, and garlic. The best models produce Mean Absolute Error (MAE) as 4.3, 133.1, 118.3, 341.8, and 338.1 for rice, chicken meat, chicken egg, shallot, and garlic, respectively.


I. INTRODUCTION
Indonesia is an archipelago country in Asia region, and it has tropical climate.Indonesia has two seasons: wet (October-March) and dry (April -September) seasons [1].The seasons affect farming period which is possibly related to the foodstuffs price.The other variables that possibly affect the foodstuffs price are religious holidays [2] [3] and fuel prices [4] [5].The government Republic of Indonesia records information about regional daily foodstuffs prices via Information Center for National Strategic Food Price [6].Essential foodstuffs for Indonesian society are chicken egg, rice, beef, chicken meat, shallot, garlic, cayenne pepper, red chili, sugar, and cooking oil.The selected essential foodstuffs are the main ingredients in Indonesian cuisine.
A study reveals that the increasing price of rice, vegetables, and fish impacts poverty in Indonesia [7].Foodstuffs price prediction is beneficial to control the price for stability economic and food security.Some research has been done for forecasting foodstuffs prices employing machine learning approaches.A study uses Backpropagation to predict the rice prices in 33 provinces in Indonesia to produce accuracy of 88% [8].The rice price prediction using Least Square obtained an error rate of 5% [9].Autoregressive Integrated Moving Average (ARIMA) has been implemented for foodstuffs prices prediction [10] [11] [12].Some studies implementing Extreme Learning Machine (ELM) have been done to forecast the prices of the foodstuffs [13] [14] [15].ANFIS (Adaptive Neuro-Fuzzy Inference System) has been applied to forecast the food price and it produced an MSE score of 0.9176 [16].
Bandung is a city in West Java, Indonesia that lies on 107º36'E and 6º55'S [17].Bandung becomes one of the densest cities in Indonesia.The number of populations in 2020 is around 2,510,103.Bandung offers beautiful tourist destinations and culinary tourism.The cuisines in Bandung are typically Sundanese food [18].Foodstuff is an essential part of culinary tourism.Analyzing the foodstuffs' price in Bandung traditional market is beneficial to find interesting patterns from historical data and is worthwhile for economic study.
The research goal is to develop a model for forecasting foodstuffs (rice, chicken meat, beef, red chili, shallot, garlic) prices in Bandung and analyzing the trend of data.Gated Recurrent Unit (GRU) is proposed to be used as a model for forecasting the foodstuffs price.The advance of this paper is an application for forecasting and analyzing the foodstuffs prices in Bandung.

II. LITERATURE REVIEW A. Gated Recurrent Unit
Recurrent neural networks (RNN) using a gating procedure is called Gated recurrent unit (GRU) [19] [20].Fig. 1 shows the GRU's architecture [21].GRU contains a reset gate and an update gate to manage the hidden state at each time for each -th hidden unit.Suppose matrices , , , , and , are model parameters.Let be sigmoid function and be multiplication.The mathematical models of GRU are described using equations (1-4).(1) (2) (3) (4) GRU has been successful in forecasting time-series data.A model based on GRU has been used in forecasting Beijing air quality using datasets from 2010 to 2014 [22].A study in forecasting meteorological data and air pollution in Jakarta uses multivariate time series data and applied the GRU model [23].This study used meteorological data (humidity, temperature, wind speed, rainfall, sunshine duration) and air pollution data (PM10, SO2, CO, O3, NO2).Four GRU models are trained to predict PM2.5 according to spring, summer, autumn, and winter seasons [24].A study implementing Bidirectional GRU has been done for forecasting PM2.5 [25].GRU-based models worked well to predict oil prices [26] [27].GRU model produced a high accuracy for forecasting rice, broiler meat, and chicken egg prices [28].GRU has been implemented to predict the stock price [29] [30].

B. Evaluation Methods
Suppose , , and denote the output of forecasting, the ground truth, and the number of items.Mean absolute error (MAE) and mean square error (MSE) can be computed using equation (5)(6) [23] [31].MAE, and MSE are popular model to evaluate the forecasting outcome. ( III. METODOLOGI PENELITIAN Figure 2 shows the research workflow.
Step one is collecting the data.Step two is data pre-processing.This step is dedicated to managing the missing values and preparing the format data to fit and suitable the model.The missing values data are filled up using the interpolation approach [32].The third step is model training and evaluation.This paper uses GRU as a model for forecasting.In the fourth step, the trained models are used to forecast the foodstuff price and then evaluate their performance.MAE and MSE are methods to evaluate the prediction outcome.The last step is analysis.

IV. RESULTS AND DISCUSSION
The data are recorded from January 2018 -February 2023 [6].The data are daily time-series from Bandung traditional market containing the price of rice, chicken meat, chicken egg, shallot, and garlic in Indonesian Rupiah (IDR).Rupiah is a formal currency used in Indonesia.Figure 3 1 shows the best experimental results in forecasting rice, chicken meat, chicken egg, shallot, and garlic.RMSProp optimizer is suitable for models to predict the price of rice and shallot.Meanwhile, the best models for predicting the price of chicken meat, chicken egg, and garlic apply Adam optimizer.Garlic and shallot have fluctuated trends and wider ranges of minimum and maximum prices.Therefore, the MAE and MSE scores are much higher than that of other foodstuffs prices.
Figure 4 shows the performance of several scenarios experiment using GRU models.Mostly, experiments that use  the Adam optimizer produce smaller errors.However, the lowest error when predicting the price of rice and shallot are obtained using RMSProp.The best values of hyperparameters vary for each foodstuff price.The prediction of rice price produces a smaller error than other foodstuffs.Prediction of shallot and garlic prices obtain higher error than other price foodstuffs.Figure 5 shows the examples of comparison the actual price and the prediction for each foodstuff.The models produce the predicted values for the price of rice, chicken meat, chicken egg, and shallot very close to the real values.The model for predicting the shallot price has a similar pattern but there was little gap between the predicted values and ground truth.It confirms that the GRU model works well to forecast the univariate time-series foodstuff price.The best models are then used as forecasting models to build the application.The application interface is displayed in Figure 6.The application is designed for Indonesian speakers.The application provides features for predicting the foodstuffs price and trend analysis.Figure 7 shows the average annual price of chicken meat, rice, chicken egg, shallot, and garlic.The average price of rice, chicken egg, and shallot has an increasing trend from 2018 -2023.The most expensive chicken meat occurred in 2022.The cheapest price of chicken meat was recorded in 2020.From 2021 -2023, the average price of chicken eggs always rises.
The average price of garlic prices increased dramatically in 2019 and drop significantly in 2021.In 2018 -2020 and 2021 -2023, the shallot price increased.Figure 8 describes average monthly foodstuff prices.The highest average price of rice happened in January and the lowest one was in July.From February -June and September -December, chicken meat price has an increasing trend but decreases from July to August.The price of a chicken egg has a similar trend to chicken meat prices.From January to June, the price of shallot is rising, and it decreases in July -September.The price of garlic is increasing to be more expensive in January -April and it goes cheaper in June -November.
The correlation analysis is conducted to find the relationships among foodstuffs prices.It observes the correlation coefficient over .Table 2 displays the Pearson correlation coefficient between foodstuffs prices.Rice has a positive correlation to chicken egg and shallot as 0.38 and 0.33, respectively.It indicates that when the price of rice increases, the price of chicken egg and shallot are also rising.On the other hand, the price of rice has a negative correlation to the price of garlic at -0.34.Chicken meat and chicken egg have a positive correlation, so the more expensive chicken meat, the price of a chicken egg is followed.Chicken egg and shallot have a positive correlation of 0.42 which indicates they are increasing and decreasing together.The correlation coefficient alone cannot be used to find the causal effect relationship.In other words, correlation does not imply  causation.It needs further study using causal learning inference to find the causal effect of the foodstuff prices.The output of this research is expected to enrich the knowledge of the application of deep learning in society.
V. KESIMPULAN In conclusion, GRU works well to predict the price of chicken meat, rice, chicken egg, shallot, and garlic.The different models produce the vary performance for different foodstuff prices.The optimal model for each foodstuff is different from each other.The analysis of the trend from 2018 -2023 reveals that the price of rice, chicken egg, and garlic tends to be more expensive.From April -May, the price of shallot reaches its maximum peak.Garlic reaches the maximum price in April -May and the lowest one is in August.The correlation analysis finds that the price of chicken egg, rice, chicken egg, shallot, and chicken meat correlated positively.It indicates that those prices change with the same trend.Future work is analyzing the causality among foodstuffs prices to reveal the cause-effect relationships.
displays the price of rice, chicken meat, chicken egg, shallot, and garlic in Bandung from January 2018 -February 2023.Rice has a stable price that is around IDR 11,200 -IDR 13,350.In 2019 -2021, the price of garlic fluctuated extremely.The price of garlic fluctuates from IDR 19,500 to IDR 87,500.The most expensive garlic happened in May 2019 and the cheapest price was in July -August 2020.The fluctuation price of shallot happened in 2020 and 2022.The price of shallot is around IDR 22,500 -IDR 71,250.The price of shallot was at the top in July 2022.The price of chicken egg and chicken meat tends to be stable.The range of chicken meat prices is IDR 27,000 -IDR 46,250.Meanwhile, the chicken egg price is around

Figure 4 .
Figure 4.The evaluation of forecasting using GRU.

Figure 5 .
Figure 5.The comparison of actual data and prediction.TABLE 2 PEARSON CORRELATION COEFFICIENT

Figure 6 .
Figure 6.Average annual foodstuffs price in Bandung traditional market.

Figure 8 .
Figure 8.Average monthly foodstuffs prices in Bandung traditional market.

TABLE 1 THE
BEST EXPERIMENTAL RESULTS