Agricultural Commodity Price Forecasting using PSO-RBF Neural Network for Farmers Exchange Rate Improvement in Indonesia

Agricultural commodity price forecasting becomes important for farmers since the knowledge of agriculture commodity price fluctuation can help the farmers to identify the right selling time. Recently, the absence of such the forecasting system makes the farmers decide to sell their commodities to middlemen which in turn, reduces their exchange rate as the length of distribution flow is complicated. The length of distribution flow is started from farmers, middlemen, wholesalers, retailers, and consumers. To address this problem, a forecasting system based on radial basis function neural network (RBFNN) is proposed. To optimize the network’s learning process, particle swarm optimization (PSO)-based learning technique is applied. The RBFNN is chosen because of its ability to generally track irregular signal changing, good speed in learning process, and robustness. Meanwhile, the implementation of PSO aims to improve weight values towards global optimum in RBFNN model.


INTRODUCTION
Agriculture can be defined as activities related to cultivation and management of plants and livestock to make ends meet humans [1]. Nowadays, agricultural sector faces main challenges: how to increase the amount of agricultural produce for support growth [2]and how to improve welfare of farmers in situations and conditions the reduced availability of natural resources.
Some of the problems are the reduced quality and quantity of water, decreasing soil fertility, climate change [3], and diminishing agricultural land fertile [4] which leads to urbanization of the population which ends in conflict in society. The problems faced by farmers are related to the process of managing agricultural products. Based on the farmer's perspective, the agricultural cycle is usually divided into three the main stages are [5], [6]: • Pre-cultivation, starting with seed selection, land selection, scheduling, access to credit from government funding sources, and others. • Crop cultivation and harvesting (planting and harvest), consisting of land preparation, seed sowing, management, water management and fertility, pest management, etc. • Post-harvest (post-harvest), including marketing, transportation, packaging, and processing of agricultural products. average (ARIMA). In this work, the inputs were time-series price data. The data was separated into linear and nonlinear data. For forecasting purposes, the neural network, i.e., time-delay neural network (TDNN) was used to identify the pattern of errors. It was claimed that the hybrid ARIMA-TDNN system can predict the price accurately.
The issue of uncertainties is caused by random factors in agricultural commodity market [17]. Here, a mind evolutionary algorithm (MEA) was combined with support vector machine (SVM). Additionally, the pattern of price was modeled by using fuzzy logic techniques. The fuzzy information granulation was used for time series data pre-processing. The fluctuation of time-series data were granulated into three levels, i.e., low, average, and high. As the result, the range of fluctuation can be identified. Therefore, the variance of the forecasted price can be predicted.
BP neural network has a problem with overfitting and computational complexity [16]. In this research, the model will be generated using a non-linear artificial intelligence technique namely radial basis function neural network (RBFNN). The association of agricultural prices with non-linear factors such as political and social factors causes agricultural prices prediction cannot be done using a linear approach because it can generate inaccurate calculations.
In generating prediction model, Radial BFNN has better performance [18], [19] since RBFNN is nonlinear and the output of the network is linear when it concerns adjustable weights by means the learning will speed up. The RBFNN has good speed in learning the data, effectively improves the accuracy, easy to get adapted, and robust. This algorithm defines gaussian function as its parallel function. Unfortunately, since the values in the input space is non-zero, the RBFNN has local approximation.
In this research, the prediction model is proposed to generate price forecasting. The proposed method used is that of RBFNN. In addition, Particle Swarm Optimization (PSO) is also proposed to improve weight values towards global optimum.

RESEARCH METHODS
The experiments used chili prices dataset from 1st January 2017 to 31st May 2019. The dataset was obtained from https://hargapangan.id/. The dataset is divided into 2 groups, namely training data and testing data with ratio of 80% and 20%, respectively. In this research, the prediction model is proposed to generate agriculture price forecasting. The proposed method used is that of radial basis function-based neural network with particle swarm optimization (PSO)-based adaptation.

Radial Basis Function-based Artificial Neural Network (RBFNN)
Radial Basis Function-based Artificial Neural Network (RBFNN) is a class of neural network using radial basis function (RBF) in all of its hidden neurons. Typically, the RBFNN is widely used for various purposes, such as system identification, pattern recognition, adaptive control systems, and so forth [20], [21] Some advantages of RBFNNs are that such the network can compensate input noise properly, have a good ability to learn and make generalization of given data [20]. Comparing to another network like multilayer perceptron (MLP), the RBFNNs perform better in nonlinear signals by approximating errors in some locals. Meanwhile, MLP performs global approximation which may be less accurate to identify errors. As shown in Figure 1, an RBFNN consists of three layers, i.e., input, hidden, and output layer. Each k-th layer in the hidden layer is constructed by M neurons. For an RBFNN with M inputs and K outputs, let us define Y = [y1 y2 … yM] T as the output vector of the ANN; X as a vector of N-th inputs, i.e., X = [x1 x2 … xN] T ; W as matrix of hidden neuron weights in correspondence to the outputs Y formulated as where wi,j is the weight of the j-th hidden neuron and the i-th output; = [ 1 2 … ], where (. ) is defined as the product of sub-neurons , ( , , , , ), or formally, Some well-known functions to apply as activation function are Gaussian functions, sigmoid functions, inverse multiquadric function, and so forth. In this paper, we apply Gaussian function as follows.
Where c k,i is the center of the i-th hidden neuron related to the i-th input, σ k,i is the standard deviation of the j-th hidden neuron in association to the i-th input. Finally, the output of the RBFNN is formulated as Note that the proposed RBFNN, we set otherwise.

Particle Swarm Optimization (PSO)
Particle Swarm Optimization (PSO) is a meta-heuristic algorithm for optimization inspired by the interaction among a set of particles. This algorithm was coined in Clerc and Kennedy in 2002 [21] and has been applied in various research fields, such as robotics [21], operational research [22], control system [23] and so forth. The algorithm mimics the behavior of atomic-size particles which interacts among themselves in the presence of some "forces" among them. The phenomenon is used to solve optimization problems. The PSO system consists of a number of particles representing system's parameters which move closer to a particle whose objective function gives the smallest or largest value among others. An individual particle p in the swarm can be regarded as a set of decision variables. All of the particles have to move to a point with minimum/maximum fitness value. Let us define a particle of PSO as Where M and K are the number of output nodes and the number of hidden nodes, respectively. The objective is to find the minimum/maximum fitness value of an objective function f. Note that in this paper we use two objective functions f. The first function is the root-mean square error (RMSE) defined as where i ŷ is defined as the forecast of the i-th output. In addition, we use the mean-absolute percentage error (MAPE) defined as In order to find the minimum fitness value, a series of iteration is used to determine the new positions of the vehicle. As particles in physics, each particle will move to a new position by adding the current position where ω is the inertial weight; c1 and c2 are constant learning rates; r1 and r2 are random numbers that are generated for each iteration; p lbest is the local best particle, defined as the coordinate W of each particle with the lowest RMSE and MAPE that have been ever achieved measured from the first iteration until the current one; p gbest is the global best particle, which is defined as the coordinate W related to the lowest RMSE and MAPE that have been ever achieved by all particles. The new position of P, i.e., Pn+1 is formulated as

PSO-RBFNN based Prediction Model
The agricultural comodity prices dataset is divided into training data and testing data with ratio of 80% and 20%, respectively. The training data is used to build an appropriate PSO-RBFNN agricultural prediction model and the testing data is used to evaluate the model's performance. The required model to obtain is that with the weights in W that yields minimum RMSE and MAPE. In order to find the optimal weight matrix W we propose to use an RBFNN with weight tuning using the PSO algorithm. The prediction model used such method is called "PSO-RBFNN based prediction model". Figure 2 shows the flowchart of agricultural commodity prices prediction model development. In this phase, RBFNN is implemented to build the agricultural commodity prices prediction model. Meanwhile, PSO is also employed to gain a better prediction model by optimizing the connection weight between hidden and output layer. The development steps of the model are described as follows.
In order to build agricultural commodity prices prediction model, we need to establish RBFNN architecture by determining the number of neurons in input layer, hidden layer and output layer. The number of neurons in input layer is obtained by using ACF and PACF analysis. Meanwhile, the number of neurons in hidden layer is obtained by trial and error.

• Initialize RBFNN parameters
In this step, RBFNN parameter (center point c, standard deviation σ, and weight w) was initialized. K-Means method was implemented to find the center points c of the hidden layers which are also used to calculate the value of standard deviation σ. The connection weights between the hidden layer and the output layer were initialized with random numbers. Moreover, we employed Gaussian as activation function in hidden layer formulated in (3). • Initialize the particles In order to search the optimized value of weights, we also need to initialize PSO parameters, such as the number of particles N, the maximum number of iteration k, learning rate (c1 and c2) and inertia weight (ω). Afterward, each particle P is initialized with random position and velocity v in D dimensional search space. The minimum and maximum values of particle position are also specified to limit the search space. • Calculate the fitness value for each particle In every iteration, each particle will keep track of its whereabouts in search space to determine the best position achieved by particle p lbest and the best position achieved by the swarm p gbest . In order to find the best solution of the problem, fitness value of i-th particle, p lbest and p gbest are calculated using predefined fitness function. We use two fitness functions, i.e., RMSE and MAPE which are defined in (6) and (7), respectively. • Evaluate the fitness value of each particle The fitness value of each particle is compared with the local best position p lbest . If the fitness value of i-th particle is better than the local best position p lbest , then the value of p lbest is updated with the position of the i-th particle. The fitness value of i-th particle is also compared with population global best position p gbest . Similar to the previous process, when the fitness value of i-th particle is better than the global best position p gbest , then the value of p gbest is updated with the position of the i-th particle.

• Update the particle velocity and position
In each iteration, the particle will update its position and velocity based on local best position p lbest and global best position p gbest . • Evaluate the stopping criterion When the minimum fitness value is met or the maximum number of iteration is reached, then the search process is terminated. Otherwise, steps 4 to 7 will be repeated until the stopping criterion is met. When the search process terminated, the optimized agricultural commodity prices prediction model is obtained.

RESULTS AND DISCUSSION
In this section, we conduct experiments to evaluate the performance of agricultural commodity prices prediction model. Before training process, we need to determine the RBFNN architecture and parameter. In this study, we implemented an RBFNN architecture which consists of 3 neurons in input layer, 8 neurons in hidden layer and a neuron in output layer. According to this architecture, the training data is used to determine the center point of neurons in hidden layer c and spread σ, while the value of connection weights are initialized randomly. The PSO parameters are also set to find the optimized model. To evaluate the best solution in PSO, Mean Square error (MSE) is employed as fitness function. When the minimum fitness value is met or the maximum number of iteration is reached, then the search process is terminated. Otherwise, steps 4 to 7 will be repeated until the stopping criterion is met. When the search process terminated, the optimized agricultural commodity prices prediction model is obtained. Table 1 shows the parameters of PSO. After training, the RBFNN parameters are finalized. The agricultural commodity prices prediction model is tested using RMSE and MAPE. RMSE and MAPE are employed because they are one of the most applied methods to measure forecasting model performance. Table 2 shows the evaluation result of chili prices prediction model on testing and training data. Prediction result on training data show that value of MAPE range from 2.55 to 6.08, while its range from 5.55 to 7.80 on testing data. As can be seen from the result, the agricultural commodity prices prediction model has a high accuracy. As a comparison, Figure 3 shows the actual and predicted agricultural commodity price on training and testing data.  (a) (b) Figure 3. Results of model testing using training data and testing data.
Chili price forecasting using ANN [24] resulted in 16.19 MAPE value. This result is much higher than the forecasting model using PSO-RBFNN. Another research shows that the chili price forecasting using SVM, ANFIS, and SVM optimized with ANFIS resulted in 86.24%, 65.97% and 92.11% of accuracy respectively [25]. These results indicate that price forecasting model using PSO-RBFNN has a better performance in predicting chili price.
In the prediction by using training data, the real price can be predicted with relatively small error under 1000 iterations of training. However, some inaccurate prediction occurs in some spots. It indicates that additional training iterations are needed. Meanwhile, the prediction by using testing data shows visible discrepancy. It can be inferred from the experiment that the prediction performs large errors. However, the fluctuation pattern is similar. The real and predicted prices are differentiated by finite offsets. Based on these experiments, it can be concluded that the implementation of RBFNN and PSO can predict the pattern of fluctuation of the general commodity price.

CONCLUSION
In this research, the combination of RBFNN and PSO is applied to generate agricultural commodity prices forecasting model. The chili price dataset is used to generate and evaluate the forecasting model. Based on the experimental results, the combination of RBFNN and PSO produced high accuracy rate in predicting agricultural commodity price. The highest result obtained from experiments is 94,454%. Furthermore, the determining factors of the agricultural commodity prices will be explored to improve the accuracy of forecasting system. Silfi Iriyani is now a student of Agriculture Doctoral Program at Universitas Syiah Kuala. She has experiences in agricultural field, environment, forestry, socio-economics. She recently experienced in strengthening community related to the development of community forest in Aceh through Hutan Desa at 11 villages. Started from planning to guiding community forest to raise community income from non-timber forest products, raising awareness for conservation issue, socio-economic activities which include enhancement of women participation and role, adaptation and mitigation climate change issue, institutional development, training, and capacity building.
Dinda Lestarini is an active lecturer in Computer Science Faculty, Universitas Sriwijaya. She received master degree in Informatics from School of Electrical and Informatics, Institut Teknologi Bandung (ITB). Her research interest including knowledge manangement, business process management, and information technology service management. She has already produced a number of research papers in reputable journal and conference. She has Scopus h-index of 3 and WoS h-index of 2. Currently, she serves as the head of database and big data laboratory in Computer Science Faculty, Universitas Sriwijaya.