Forecasting Model of Staple Food Prices Using Support Vector Regression with Optimized Parameters

ABSTRACT


INTRODUCTION
As one of the three basic needs, food is a need that must be met by everyone. Most people in Asian countries use rice as their staple food, one of which is Indonesia. The number of Indonesian people who consume rice is more than 95%. This number will increase along with the increase in the population of Indonesia [1]. The very high dependence of the Indonesian people on rice has caused the rice to become a benchmark for the Government in determining food-related policies [2]. This condition causes the rice price to affect the other staple prices [3]. Thus, the fluctuation of rice prices will also affect the price fluctuations of other food commodities such as animal products (meat and milk) and agricultural products (shallots, garlic, and chilies).
Climate change can affect rice production because it is related to the change of planting season. Therefore, floods and droughts that occur at certain times can lead to instability in rice prices [4]. Apart from the climate, several factors cause rice price instability in Indonesia, including Rupiah's exchange rates, distribution, international and domestic markets, and so on [3]. The high fluctuation in staple food prices can cause anxiety for the Indonesian people and threaten the stability of the government because the stable and affordable prices of staples will enable farmers and consumers to improve their welfare [5]. Sudden spikes in food prices can also increase malnutrition among low-income people [6]. The prediction of the staple food prices can be considered as a recommended purchase price for consumers before going to the market to help consumers estimate the expenditure that must be spent on buying staple foods.
In the research conducted by Asnhari [7], prediction of the price of staples was carried out by using multiple linear regression, and Fourier prediction of the price of staple foods was carried out by using multiple linear regression and Fourier regression approach combined with the Autoregressive Integrated Moving Average (ARIMA). The determination of the prices of these staples also considers several factors such as oil prices and rainfall. Prediction results show that the use of Fourier regression and ARIMA provides an accuracy of more than 80% for all staple foods, while the use of multiple linear regression and ARIMA, only four of the six staple foods provide an accuracy above 80%. The ARIMA model is considered a suitable method for shortterm time series forecasting and can minimize the number of parameters used during the forecasting process [8]. However, ARIMA has a disadvantage in determining the optimal model [9]. As one of the classic methods, ARIMA is considered incapable of dealing with real-world problems because it cannot handle missing or corrupted data, only focusing on complete data [10].
In another research [11], Long Short Term Memory (LSTM), as a Recurrent Neural Network (RNN) architecture, was used to predict the Consumer Price Index (CPI). CPI is a parameter used to provide information about the purchase price of a product or service at the consumer level. As input for modeling, there is a list of prices for 34 kinds of staple foods in East Java. After being processed using LSTM, the resulting prediction output is monthly CPI data. However, the disadvantage of modeling using machine learning, especially deep learning, is that the computation costs required are very high, this is related to the time, and memory used [12]. In addition, deep learning usually has many hyperparameters and is difficult to train [13].
Research on price of staples forecasting has been applied using various approaches. However, data on prices of staples are sequential and historical, so there is a need for modeling to predict prices of staples using regression based on time-series data. Time series analysis is an important tool for predicting the future based on the observed history. One approach that can be used to form a time-series forecasting model is a machine learning technique, namely Support Vector Regression (SVR). This method is a development of Support Vector Machine (SVM) that is focused on solving regression problems, which can generalize unseen data [14]. It provides better results in terms of predictive analytics on time-series data than ARIMA [15]. SVR is also proven to be better than Backpropagation for forecasting oil palm production [16]. However, similar to SVM, SVR cannot determine the appropriate parameters to produce optimal results, whereas the selection of appropriate parameters will be able to improve the accuracy of the results produced [17].
The contribution of this research is to increase the accuracy of forecasting results by SVR using the Improved Crow Search Algorithm (ICSA) through dynamic parameter adjustments. ICSA is an improvised metaheuristic algorithm, which works in the same way as the crow's principle of searching for food. The improvisation mechanism that is carried out lies in the solution updating mechanism to improve the results in conventional CSA. ICSA has proven to provide the best results compared to several other metaheuristic algorithms for large datasets [18]. Therefore, the use of ICSA is expected to increase the accuracy results produced by the SVR in predicting the price of staple foods. In addition, the use of long time-series data to form a regression model is also expected to increase the accuracy of forecasting results through a good learning process.

METHOD
SVR has six parameters that play a significant role in the learning process, consisting of lambda (), epsilon (), sigma (), learning rate (), soft margin constant (C), and the number of iterations. Fig. 1 shows the application of ICSA to optimize SVR parameters to increase the accuracy value, with improvised mechanisms adapted from previous research [18].

Dataset
This study uses historical data on the price of staple foods from https://siskaperbapo.com/harga/tabel, which is managed by the Industry and Trade Office of East Java Province. The data used is a time-series by collecting data on the price of staple food every day from January 1, 2015, to December 31, 2018, at Dinoyo Market, Malang City. There are 11 types of staple foods used for forecasting consisting of Bengawan rice, sugar, cooking oil, beef, broiler chicken, eggs, powdered milk, iodized salt, bird's eye chilies, shallots, and garlic. The graph of the daily price of each staple for four years is shown in Fig. 2  Each staple food has 1461 rows of data containing price information for four years. To form a regression model for each staple food, the dataset is divided into training data, test data, and validation data with a composition of 60%, 20%, and 20%.

Data Preprocessing
In the data preprocessing stage, there were three steps that were taken, consisting of determining the attributes of the historical data, normalizing the data, and dividing the dataset into two parts (training data and testing data). The first step is determining the number of attributes to describe the condition of the price of staple food, or the number of n-days before today, which is considered to affect the price of staple food today. This n value is used to build a regression model. In this study, the value of n used is 7, meaning that the price of staple food for the previous seven days is considered to affect the price of staple food today.
The second step is transforming the dataset by changing the value range between 0 and 1. The transformation process is carried out using min-max normalization, as shown in (1). This normalization can accelerate the learning process involving data in the same scale value [17].
In (1), xi is the original value of the i-th data, xi' is the new transformed value of the i-th data, min is the minimum value of all data, and max is the maximum value of all data.
The third step is dividing the dataset into training data and testing data based on the number of k-fold cross-validation. The training data is used to test the SVR parameters from the optimization results to obtain the best regression model, while the testing data is used to evaluate the accuracy of the regression model in predicting the price of staple foods. In this study, the k value used is 10, which means that the dataset will be randomly divided into ten subsections of the same size. One sub-section of which will be used as testing data, while the other nine subsections will be used as training data.

Support Vector Regeression
SVR is an algorithm that works to build a model for regression problems with a continuous value output. The procedure in building a regression model is carried out by finding the value of the function f(x) based on training data [19]. SVR will look for a regression function f(x) that can produce output close to the actual target for all training data, with an error tolerance of . The regression function f(x) is shown in (2), where w is the weight vector, φ(x) is the transformation of the variable, and b is a constant, while T is the symbol of transformation [20]. In this study, regression modeling was carried out using the Radial Basis Function (RBF) kernel, which is stated in (3). This is because RBF can be used for various types of data and is considered capable of analyzing high-dimensional data [21].
In (3), 2 x' x  is the distance between the two training data calculated using Euclidean Distance and  is the parameter in the RBF kernel that arranges the data distribution. The value of  greatly affects the performance of SVR. When the  value approaches 0, then SVR tends to experience overfitting because all training data are used as support vectors. In this case, SVR can produce very good forecasting accuracy for all training data, but performance is poor when applied to testing data. On the other hand, if the value of  tends to be infinite, then underfitting will occur because all training data will be considered as one instance. By default, the value for  is 1 [22].

Improved Crow Search Algorithm
Crow Search Algorithm (CSA) is a population-based metaheuristic algorithm to solve optimization problems by mimicking the behavior of crows in finding and hiding their food [23]. Improvisation in CSA is done by making modifications to the process of updating the solution so that the results of finding solutions can be better. In addition, updating of awareness probability is also carried out by adopting the concept of Dynamic Awareness Probability [24]. The modification or improvisation process of the algorithm is needed to provide a better solution in the form of a higher fitness value [25]. In this ICSA, the solution updating mechanism is carried out by directing the search agent to follow other search agents randomly so that the search agent can explore new areas. The optimization procedure using ICSA is as follows [18]: Step 1: Initialize parameters of ICSA There are six parameters used in the optimization process using ICSA, consisting of flock size (N), the number of iterations (itermax), flight length (fl), awareness probability (AP), and threshold value to update awareness probability (thres).
Step 2: Initialize the position and memory of N search agents. N search agents will be placed in a certain position in the search area at random. Each position of the search agent states the solution to the problem, in this case, the values for the six SVR parameters. Meanwhile, the memory of all search agents is initialized to zero because currently, search agents have not yet started the search process.
Step 3: Define AP for all search agents. The AP value determines how each search agent behaves in looking for food. AP has an important role in controlling exploration and exploitation during the search process.
Step 4: Calculate the fitness function. Each search agent position is applied as values for the six SVR parameters. Then, after forecasting using SVR using these values, accuracy can be obtained using one of the evaluation indexes.
Step 5: Generate new positions for all search agents. Each search agent updates its current position by selecting one of the two existing conditions based on the random value it gets. If the random value generated for a search agent is more than 0.5, the search agent can randomly select one of the other search agents to follow. Conversely, if the value is less than or equal to 0.5, the search agent must follow the best search agent. This mechanism is an improvisation offered at ICSA.
Step 6: Update memory for all search agents. Since search agents have updated their position, they can also update their memory by selecting one of the two conditions. If the current position's fitness value is better than the previous position's fitness value, then they must update the memory to store the current position. Conversely, if the previous position's fitness value is better than the current position's fitness value, the memory does not need to be updated. Step 7: Update the AP value. The AP value update is carried out based on the results of checking the best fitness values from all search agents in each iteration. If the value of the best fitness value does not change for thres times in a row, then the AP value needs to be updated using (4).

Evaluation Indexes
To determine the performance of the regression model that has been built, accuracy calculations are carried out so that can be seen the similarity of the forecasting results and the actual data. In this study, the evaluation indexes used were Mean Absolute Percentage Error (MAPE) and Normalized Root Mean Square Error (NRMSE). The two evaluation indexes will calculate the error rate from the forecasting results, as shown in (5) and (6)  In (5) and (6), d y is the actual price of staple food on the d-th day, d ŷ is the forecast of the price of staple food on the d-th day, y is the average actual price of staple food for each type of staple food for four years, and n is the number of data for a type of staple food.

RESULTS AND DISCUSSION
Forecasting the price of staple food is carried out using SVR with optimized parameters using ICSA in this study. To find out how accurate the forecasting results are provided by the proposed method, forecasting the price of staple food using SVR without optimization is used as a comparison using the same dataset [28]. The parameters used in the study are shown in Table 1, which consists of SVR static parameters for forecasting using SVR without optimization, and ICSA static parameters to dynamically optimize SVR parameters in the forecasting process, while the range of SVR parameter values used in the optimization process using ICSA is presented in Table 2. Table 3 shows the comparison of the forecast results of the two methods by displaying the error values in the form of MAPE and NRMSE.  Table 3, it is known that forecasting the price of staple food using the SVR with optimized parameters using ICSA can produce smaller MAPE values in almost all staple foods compared to forecasting using SVR without an optimization process. The difference in MAPE values between the two approaches is also quite large for each staple food. This shows the ability of ICSA to improve the accuracy of forecasting results by finding the optimal SVR parameters so that the forecasting results are closer to the actual target. Meanwhile, based on the NRMSE value, five staple foods give a smaller error value compared to SVR without an optimization process, namely Bengawan rice, cooking oil, beef, powdered milk, and garlic. However, the difference in NRMSE values between these two methods does not differ too much.  In general, it appears that the average MAPE value from the forecasting results using this proposed method gives a smaller error value, which is 17.081, which means the forecasting result is acceptable. Meanwhile, the NRMSE value generated from the proposed method was slightly greater than the NRMSE value provided by the SVR without optimization process, which is 1.594, which means that the forecasting accuracy is excellent [29][30].

CONCLUSION
The test results show that the SVR parameter has a very important role in determining the results of forecasting the price of staple foods. With the optimal parameters resulting from the optimization process using ICSA, SVR can forecast the price of staple foods with a small error value. The difference in MAPE value between the proposed method and the use of SVR without optimization is also quite different, while the difference in the resulting NRMSE value between the two approaches is not too significant. The results of forecasting the price of staple foods using SVR with optimized parameters using ICSA produce very good forecasting accuracy with an NRMSE value of 1.594 and are included in the good forecasting category with a MAPE value of 17.081. In future studies, attributes that can affect the instability of staple food prices can be included in the calculation process to form a regression model. In addition, the number of datasets can be increased so that a recommendation system can be built to forecast the price of staple foods over the next period based on a specific location chosen by the user.