Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. Comparison of Premium Rice Price Prediction in East Java with ARIMA and LSTM (Case Study: National Food Agency Dat. Devi D. Purwanto1,2. Rasional Sitepu2, and Eric S. Honggara3 1Informatics Department. Faculty of Technic. Universitas Katolik Widya Mandala Surabaya. Surabaya. Indonesia 2Engineering Profession. Faculty of Technic. University Katolik Widya Mandala Surabaya. Surabaya. Indonesia 3Information System Department. Faculty of Sains and Technology. Institut Sains dan Teknologi Terpadu Surabaya. Surabaya. Indonesia Corresponding author: Devi Dwi Purwanto . -mail: devi. dp@ukwms. ABSTRACT Rice price prediction plays a crucial role in maintaining economic stability and food security, especially in East Java, one of Indonesia's major rice production centers. This study aims to forecast premium rice prices in East Java using the ARIMA (AutoRegressive Integrated Moving Averag. The data utilized in this research comprises premium rice prices obtained from the National Food Agency over the period from March 15, 2021, to October 17, 2024. The analysis process begins with data exploration to identify trends and seasonal patterns in the rice price data. Subsequently, the data is analyzed using ARIMA and LSTM methods, both recognized for their effectiveness in time-series forecasting. The ARIMA. ,1,. model was selected due to its capability to capture price dynamics through its autoregressive, integrated, and moving average components, making it well-suited for linear data with minimal seasonal variation. LSTM was employed as a comparative model because it is a subset of Machine Learning that integrates computational models and neural network algorithms, offering potential improvements in prediction accuracy. The LSTM model used for prediction consists of four layers, each with 50 neurons, dropout rates of 20% and 30%, and a single output layer representing the predicted price. The results indicate the ARIMA model provides highly accurate price estimates with a Mean Absolute Percentage Error (MAPE) of 0. 485%, whereas the LSTM model achieves a MAPE of 1. These findings serve as a reference for policymakers and food industry stakeholders in formulating strategic measures to stabilize rice prices in East Java. KEYWORDS ARIMA. Food Security. LSTM. SDG INTRODUCTION Each region must manage food security, particularly rice, which is a staple food in Indonesia. Food security refers to a condition where food is adequately available for the nation and individuals, as reflected by sufficient quantity and quality of food. With established food security, citizens can meet their needs and contribute to steady national development . According to Ohyver, rice prices in Indonesia follow a seasonal harvest pattern, where prices decrease during the harvest season and increase during off-seasons. The instability in rice prices forces the government to implement pricing policies to ensure people's needs are met and inflation remains under control . In this article, the author aims to develop a model for predicting the price of premium rice in East Java. The time series data was sourced from the Directorate of Supply and Price Stability of the Food Availability and Stability VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. Deputy 1. Several studies have been conducted to predict rice prices using the Smoothing Winters method, which achieved a Mean Absolute Percent Error (MAPE) of 4. , the K-Nearest Neighbor (KNN) method, which obtained an RMSE of 0. , and the linear regression method, which resulted in a Mean Absolute Error (MAE) of In machine learning, there are two approaches: supervised and unsupervised learning. In machine learning, there are two approaches: supervised and unsupervised Supervised learning focuses on studying the relationship between inputs and outputs by using historical training data, while unsupervised learning aims to discover new patterns and relationships within raw and unlabeled Direktorat Stabilitas Pasokan dan Harga Pangan Kedeputian Bidang Ketersediaan dan Stabilitas Pangan, https://panelharga. id/harga-eceran, accessed on March 15, 2021, to October 17, 2024. Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. One way to estimate rice prices is by analyzing historical rice price data over a specific period and modeling it to predict future rice prices using a supervised learning Supervised learning is further categorized into two types of predictions: predictions for labeled data . and predictions for unlabeled data . uch as One common challenge encountered in data analysis is the presence of missing values. To address this issue, data preprocessing is conducted as an initial step. Various approaches can be employed to handle missing values, including deleting records with missing data, imputing replacement values using constants, mean, median, or employing other imputation models . In this study, the handling of missing values will utilize binning boundaries. Detailed explanations of the research methodology are provided in the following sections. II. METHODOLOGY The research methodology is divided into several phases. The first phase involves collecting theories related to ARIMA. LSTM, and the calculation of errors in prediction The subsequent phase focuses on developing the system architecture, conducting research based on the established architecture, and performing evaluations. ARIMA ARIMA was selected because this model completely disregards independent variables in making predictions, relying solely on past and present data to generate accurate forecasts . ARIMA treats historical data as a time series, which is typically non-stationary. Non-stationary data must be transformed into stationary data through differencing, which calculates the changes or differences in values. address this. ARIMA utilizes the parameters p, d, and q, where p represents the degree of Autoregressive (AR), d denotes the degree of differencing, and q indicates the degree of Moving Average (MA). The ARIMA model can be expressed mathematically as . ycUycUycyc = yuNyuN yucyuc1 ycUycUycycOe1 U yucyucycyycy ycUycUycycOeycyycy Oe yuEyuE1 yceyceycycOe1 Oe U Oe yuEyuEycyc yceyce Where: ycUycUycyc : Stationary time series yuNyuN : Constant ycUycUycycOe1 , . , ycUycUycycOeycyycy : Past values that are related yuEyuE1 . A , yuEyuEycyc : Coefficients/parameters of the AR model yceyceycyc : Residual at time t . The ARIMA model is a category of linear approaches that utilizes past values to predict future outcomes. Each of the three techniquesAiAutoregressive (AR). Integrated (I), and Moving Average (MA)Aiplays a role in the overall The breakdown of these three techniques is as VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. AUTOREGRESSIVE (AR) A linear combination of historical values of the variable is used to forecast the variable of interest in the autoregressive model, where the value of the variable is tested against In other words, to predict future values, we can incorporate the lagged values of the target variable. Equation . is an example of a p-th order autoregressive ycoycoycyc = 0 1ycoycoycycOe1 2ycoycoycycOe2 3ycoycoycycOe3 U ycyycyycyycyycycOeycyycy . In equation . , the current value m is directly related to the previous value p. The regression coefficients are determined after training and are represented by . , . conventional method to find the optimal value of p is by examining the plots of the Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF). The ACF measures the correlation between the current value and its past values, considering both direct effects and translation effects, which refer to the impact a value has over time. For example, the price of premium rice in the market influences prices from two days ago, which in turn affects the price from the previous day and today. However, the ACF measures the value today, which could be influenced by the price of premium rice from two days ago. On the other hand, the PACF measures only the direct correlation between past and present values, excluding translation For example, the PACF does not account for the influence of the price of premium rice from two days ago on today's price. Therefore, the value of p in AR is determined using ACF and PACF plots, which demonstrate the dependence on past values. INTEGRATED (I) Integrated refers to the differencing process applied to make the data stationary. To determine whether the data is stationary, the Dickey-Fuller test can be used, followed by experimentation with different differencing factors. With a differencing factor of d=1, a lag is introduced in the series mt-mt-. A clear distinction can be observed between the After performing the differencing, it is evident that this version is significantly more stable than the initial one, with both the mean and variance remaining stable over several MOVING AVERAGE (MA) Systematically, by using previous values in models such as regression, the moving average model uses previous forecast errors to make predictions about future values. Using . , we can represent the moving average model. ycoycoycyc = 0 1yceyceycycOe1 2yceyceycycOe2 3yceyceycycOe3 U ycycyceyceycycOeycyc The MA. model illustrates this. The error or residual, denoted as e in . , represents the random deviation Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. between the target variable and the model. As an unobservable parameter, the value of e cannot be known in advance and must be computed after the model has been Therefore, iterative methods such as Maximum Likelihood Estimation (MLE) can be used as an alternative to Ordinary Least Squares (OLS) to solve the MA problem. LSTM Deep Learning is a subset of Machine Learning that integrates computational models and neural network Recently. Deep Learning has garnered significant attention from both academia and industry due to its ability to provide more advanced intelligence in handling complex problems. One of the Deep Learning methods. Long Short-Term Memory (LSTM), is chosen because it is a popular model well-suited for making accurate predictions, as it stores information and learns patterns from the provided data . LSTM is a derivative of Recurrent Neural Networks (RNN), and RNN models have been shown to be effective in predicting time series data. The LSTM architecture consists of an input layer, processing layer, and an output layer . LSTM is widely used for processing text, video, and time series data . this context, time series refers to sequential data. LSTM includes three gates . nput gate, output gate, and forget gat. and one cell. The cell is used to retain values over time intervals, while the forget gate determines what information from the previous state should be discarded, known as the dropout layer . The dropout layer is essential for mitigating overfitting. The input gate determines which new information will be stored in the cell, and the output gate controls which information from the cell will be output. The visualization of the LSTM Module Iteration is shown in Figure 1. percentage of absolute errors in an experiment or trial. The formula for MAPE is . ycAycAycAycAycAycAycAycA = Ocycuycuycnycn=1 ycaycaycaycaycaycaycaycaycaycaycaycaycnycn Oeycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycnycn ycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycyycnycn ycuycu100% . The lower the MAPE value, the better the predictive performance of the model. According to Hutasuhut, the range of MAPE values is categorized as shown in Table 1 . TABLE I MAPE VALUE RANGES MAPE <10% 10-20% 20-50% >50% Interpretation Very Accurate Model Prediction Good Model Prediction Acceptable Model Prediction Poor Model Prediction . SYSTEM ARCHITECTURE This section explains the system architecture used in this study. The raw data obtained from the Directorate of Supply Stability and Food Prices will undergo preprocessing due to the presence of missing values in the After preprocessing, the next step is to build prediction models using ARIMA and LSTM. The models created will then be provided with testing data to predict the The predicted prices will be evaluated using MAPE to determine the error rate. A detailed overview of these steps is illustrated in Figure 2. Preprocessing Raw Data Model Prediction (ARIMA. LSTM) Prediction Results Testing Data Evaluation Figure 2. Figure 1. LSTM Module Iteration 2 MAPE MAPE (Mean Absolute Percentage Erro. is a calculation technique used to determine the average Rifqi Mulyawan. Long Short-Term Memory, https://rifqimulyawan. com/kamus/long-short-term-memory/. VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. General Research Architecture Handling missing values can be approached in several ways, including ignoring the missing data, manually filling the gaps, using a global constant to fill the missing values, applying specific calculations to fill the gaps, using calculations based on the same class, or using mathematical methods such as linear regression. Bayesian, or decision In this study, binning boundaries will be used to handle missing values. This approach also aims to smooth the data to prevent the occurrence of outliers. An example Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. TABLE II EXCERPT OF RAW DATA FROM DOWNLOAD RESULTS Commodity (R. 15/03/2021 16/03/2021 17/03/2021 18/03/2021 19/03/2021 20/03/2021 21/03/2021 Premium Rice Medium Rice Dry Soybeans (Impor. Red Onion Garlic Bulb Curly Red Chili Red Cayenne Pepper of how binning boundaries work is shown in Figure 3. The data underwent binning boundaries to handle the missing values and smooth the data. The data that is ready to be used as input for model development is shown in Table 3. A total of 1000 data points were used for training, while 313 data points were used for testing. ARIMA Data Identification Stationary Data Figure 3. Data Transformation Example of Binning Boundaries 3 Model Identification Parameter Estimation ACF. PACF, i. RESULTS This section will discuss the data acquisition, preprocessing, model development, prediction using the model, and evaluation. Model Evaluation . DATA A total of 1313 data points were collected, with the initial data obtained from the website and downloaded in XLS format as shown in Table 2. There are 22 types of commodities recorded by the Directorate of Supply Stability and Food Prices, but this study will focus specifically on premium rice commodities. TABLE i DATA SEGMENT AFTER PREPROCESSING Date 15-Mar-2021 16-Mar-2021 17-Mar-2021 18-Mar-2021 19-Mar-2021 20-Mar-2021 21-Mar-2021 22-Mar-2021 23-Mar-2021 24-Mar-2021 25-Mar-2021 Day PremiumRicePrice Yu Su. Data & Data Preprocessing, https://ysu1989. io/courses/sp20/cse5243/Preprocessing-0117. VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. Prediction Figure 4. ARIMA Model Development Process The process of developing the ARIMA model is outlined in Figure 4. Initially, the data is checked for stationarity. time series is considered stationary if its properties do not depend on time. If the data is found to be non-stationary, a transformation is applied to make the data linear. Transformations such as logarithms can help stabilize the variance of the time series. Differencing helps stabilize the mean by removing trends and seasonality, thus transforming the series into a stationary form. Once the data is stationary, model identification is performed, which includes analyzing the Autocorrelation Function (ACF), regression, and Partial Autocorrelation Function (PACF). addition to inspecting the time plot, the ACF plot is also used to identify non-stationary time series. For stationary series, the ACF rapidly drops to zero, whereas for nonstationary data, the ACF decreases more gradually. In this study, the data was found to be non-stationary and required transformation by applying first-order differencing. Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. Furthermore, for non-stationary data, the values tend to be large and positive. After completing the experimentation process, the most appropriate model will be selected and The chosen model will then be used to make predictions, which will be validated by calculating the Mean Absolute Percentage Error (MAPE). The experiments conducted with the ARIMA model included ARIMA. ,0,. and ARIMA. ,1,. The prediction results from these two models are shown in Table 4. The ARIMA. ,0,. model achieved a Mean Absolute Percentage Error (MAPE) of 0. 547%, while the ARIMA. ,1,. model resulted in a MAPE of 0. Therefore, the ARIMA. ,1,. model was selected for comparison with the LSTM model. TABLE IV EXCERPT OF PREDICTION RESULTS FOR ARIMA. ,0,. AND ARIMA. ,1,. Date Day 04-Feb-2024 05-Feb-2024 06-Feb-2024 07-Feb-2024 08-Feb-2024 09-Feb-2024 10-Feb-2024 11-Feb-2024 12-Feb-2024 13-Feb-2024 14-Feb-2024 15-Feb-2024 16-Feb-2024 Premium RicePrice Predicted_Price _Model_101 Predicted_Price _Model_111 . LSTM In the LSTM model, preprocessing is performed first by scaling the price data to a range of 0 to 1 using the min-max scaling, where the min-max formula is: ycyc A = ycyc Oe yaAyaA . cuycuycuycuycuycu max Oe ycuycuycuycuycuycu min ) ycuycuycuycuycuycu ycoycoycoycoycoyco yaya Oe yaAyaA Where: A: Upper bound/minimum value B: Lower bound/maximum value In this case, since the data will be scaled between 0 and 1, new_min = 0 and new_max = 1. For example, for the training data, the first 1000 data points are taken with a maximum value of 14500 and a minimum value of 11500, so v' for the value 12800 would be: 12800 Oe 11500 O . Oe . 0 14500 Oe 11500 = 0. The next step involves splitting the data into training and testing sets. For the training data, a 3-dimensional reshaping will be performed, which will subsequently serve as input to the Recurrent Neural Network (RNN). The activation function used is the hyperbolic tangent . , a VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. commonly employed function in Long Short-Term Memory (LSTM) networks, as it effectively handles both positive and negative values while helping to mitigate the vanishing gradient problem in time-series data. The LSTM model consists of four stacked layers, each containing 50 neurons, with the inclusion of dropout. Dropout is applied to prevent certain neurons from being used as input for the subsequent layers, promoting model generalization and reducing For the experiments, dropout rates of 20% and 30% are applied to the neurons in each layer. As a result, 15 random neurons . or 30% dropou. or 10 random neurons . or 20% dropou. are excluded during backpropagation. The output layer consists of a single neuron since the model predicts only the rice price. The architecture of the LSTM model used is depicted in Figure 5. Figure 5. LSTM Model Architecture Used The optimizer used in this experiment is ADAM (Adaptive Moment Estimatio. ADAM is a stochastic optimization method, and its recursive nature makes it wellsuited for solving problems involving linear data with noise and extreme values. ADAM combines two stochastic gradient descent approaches: adaptive gradients and root mean square propagation. A learning rate of 0. 001 was used, which is a commonly used starting point for ADAM and often provides stable convergence for many tasks. Additionally, the dataset used was selected randomly for stochastic estimation, making the computation more efficient and requiring less memory. The loss function employed is MSE (Mean Squared Erro. , which calculates the average of the squared differences between the actual and predicted values. The training data is divided into batches, with each batch containing 32 samples for weight update iterations. Experiments were conducted using 50 epochs, 100 epochs, and 150 epochs. EVALUATION The testing data used for the prediction experiment consists of 313 data points. Using the ARIMA. ,1,. model, a plot comparing the real prices and predicted prices is shown in Figure 6. Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. results are shown on Figure 7. plot of predicted and actual prices of premium rice in East Java Actual Price Predicted Price Predicted Price Actual Price Dropout = 0,3 Epoch = 50 Figure 6. Plot of Actual ARIMA. ,1,. Prices Predicted Prices Using Predicted Price Actual Price The MAPE obtained from the testing data experiment with the ARIMA. ,1,. model was 0. Meanwhile, for the LSTM model with 4 layers and a dropout of 0. experiments were conducted using 50 epochs, 100 epochs, and 150 epochs. The prediction results for each epoch with a dropout of 0. 2 are shown in Table 5. Dropout = 0,3 Epoch = 100 TABLE V LSTM PREDICTION RESULTS Date Day 04-Feb-2024 05-Feb-2024 06-Feb-2024 07-Feb-2024 08-Feb-2024 09-Feb-2024 10-Feb-2024 11-Feb-2024 12-Feb-2024 13-Feb-2024 14-Feb-2024 15-Feb-2024 16-Feb-2024 17-Feb-2024 18-Feb-2024 Premium RicePrice Predicted Price Actual Price Dropout = 0,2 Epoch = 50 Predicted Price Actual Price In the experiments with the LSTM model, several trials were conducted using two different dropout rates, 0. 2 and 3, as well as varying numbers of epochs, as shown in Table 6. Dropout = 0,2 Epoch = 100 Dropout. MAPE (%) 1,95 3,119 2,806 2,389 5,426 3,074 From the trials in Table 6, the plotting results of real prices compared to predicted prices indicate that the model with the lowest MAPE is the one using a dropout rate of 0. and 50 epochs, achieving a MAPE of 1. The plotting VOLUME 06. No 02, 2024 DOI: 10. 52985/insyst. loss function TABLE VI DROPOUT AND EPOCH TESTING ON THE LSTM MODEL 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Figure 7. Plot of Actual Prices and Predicted Prices Using LSTM with Loss Function Devi D. Purwanto, et. : Comparison of Premium Rice PriceA (October 2. IV. CONCLUSION REFERENCES