Forecasting the Selling Price of the Agricultural Products in Ukraine Using Deep Learning Algorithms

The paper aims to figure out the effectiveness of machine learning algorithms in the price forecasting of agricultural products based on the example of barley prices. In addition, the article provides a comparative analysis of traditional forecasting methods and deep learning algorithms, and also considers the expediency of their use in enterprises and in public administration. The authors use time series forecasting methods and models, in particular, traditional prediction methods (Linear Regression and Fb Prophet) and different strategies of deep learning algorithms (recursive multi-step and Direct-recursive hybrid convolutional neural networks) were used. As a result, the study shows that traditional methods and neural networks show sufficiently greater results than naive forecasts; however, at the same time, traditional models are more effective than deep learning models, and they require less time and fewer resources to implement. It has been established that neural networks, in contrast to traditional forecasting methods, take into account other patterns, so it makes sense to consider the possibility of using neural networks together with traditional forecasting methods using ensemble methods. The article considers the conditions under which it is advisable to use methods in enterprises, as well as in public regulation. Hence, results of the study can be used in the following ways: a) in research activities in the agricultural sector; b) practically in the planning process in enterprises of the agricultural sector; c) companies related to the above industry, such as logistics companies or financial enterprises; 4) in public planning, budgeting and control.


Introduction
Ukraine's agricultural sector is one of the most important sectors of their economy, with its products generating a significant share of export revenues in the structure of foreign trade, which is also the basis of Ukraine's food security. Due to this, the agricultural complex is an attractive sector for investment. Based on the information of Top lead it has gained more than UAH 280 billion of capital investment over the last five years [1]. On the one hand, obtaining significant investments in the agricultural sector creates additional opportunities for its development, but on the other hand this increases the need for control and support public authorities as well as the need for the adequate short-term and long-term planning by enterprises. In both cases proper price forecasting is one of the key points that could lead to faster development of agricultural industry of Ukraine [2; 3; 4].
In case of agricultural enterprises, it is important to pay 92 Forecasting the Selling Price of the Agricultural Products in Ukraine Using Deep Learning Algorithms attention to their short-term planning and forecasting, because this has a large impact on the operational and financial activities of enterprises and allows them to respond quickly to changes in the economic environment. When creating a short-term strategy for any company, it is important to determine the projected number of products to be sold and the cost of sale. Ukrainian agricultural enterprises are no exception [5; 6]. However, there are almost no problems in forecasting the number of goods sold, so determining the future selling price in the agricultural sector of Ukraine is a difficult task, unlike many other industries. The main reason is the export orientation of the agricultural sector. In case of public authorities, the usage of forecasting models is important by several reasons: 1) It helps to regulate the amount of food stocks depending on the projected price of product; 2) It allows to prepare for and respond to financial risks and uncertainty; 3) It improves the quality control of the companies, especially in the context of tax.
Unfortunately, Ukraine doesn't have open-source information portal with forecasted commodity prices and thus all players in the market should rely on the information of statistical agencies or their internal forecasts [7]. This results in the following problems: 1) The quality of forecasts made by statistical agencies is low. Even if the forecasts of such big agencies as World Bank or EIU were used the quality of forecasts is low, since they do not take into account characteristics of the economy of the Ukrainian agricultural sector; 2) Ukraine has a lot of small and medium-sized enterprises (SMEs) that don't have enough resources to create their own forecasting systems and thus the decisions made by their management are frequently subjective and could lead to financial loss.
The SMEs that have their own forecasting models rely mainly on simple time-series methods in their short-term forecasting of sales price, the most common of which are the methods of expert forecasts, linear regression, and autoregressive integrated moving average (ARIMA) models. However, modern hardware and software allows the use of the newest forecasting methods, which may be able to give better results [8; 9]. One example of these new prediction tools is deep learning models, which are based on neural networks. Neural networks are complex models that require significant computing power and the availability of highly skilled labor. Therefore, before using neural networks on a permanent basis at the enterprise it is necessary to be convinced that their results will differ considerably from those which can be gathered using traditional methods of forecasting.
Forecasting the selling price of agricultural products in Ukraine has some specific features in comparison to forecasting other sectors of the economy and agricultural sectors of other countries, so it is important to consider their impact on the accuracy of forecasting models. The agro-industrial complex of Ukraine has two significant features, the first of which is specific to the sector, and the second of which concerns all Ukrainian industries, namely: 1) The agricultural sector of Ukraine is focused heavily on exporting, accounting for almost 40% of total exports [10]. Thus, sales prices largely depend on the situation on the world market for agricultural products. This dependence creates an additional error in forecasting; 2) Ukraine experienced a socio-political crisis in 2014, which affected both the economic development of the state as a whole and the economic stability of individual sectors of the economy. Therefore, it should be taken into account when forecasting, as the agricultural sector has undergone significant changes due to these forces [11; 12].
Additionally, the agricultural sector of Ukraine has a small number of large enterprises that are able to follow the global trend towards deep learning algorithms in their operational and financial activities, without incurring significant resource costs. At the same time, most SMEs are unable to spend significant resources on research, so there is a need to investigate whether there is a significant difference in the effectiveness of deep learning methods, including neural networks, and whether it is sufficient to use traditional forecasting methods to obtain satisfactory results.

Literature Review
H. Hakimpoor analyzed the possibility of using deep learning algorithms at enterprises [13]. The authors showed that artificial neural network (ANN) could be used in the fields of finance, manufacturing and production as well as the field of strategic management and business policy. As a result of review of numerous publications, the article lists the problems that could be solved by ANN. Creating business strategy is a part of strategic management and was discussed by [14]. The authors provided the example of how the use of internal, external data and ANN could help to increase the effectiveness of management by creating generalized strategy development [15; 16]. Their model is used to determine the direction in which changes in the manipulated variables will improve performance. Despite the possibility of using Neural Networks in company's management there is still not a lot of publications about the effect of using time series models at the financial and operational forecasting as a part of the developing company's short-and long-term strategies. Thus, some attention should be given to the basic of time series forecasting and ways how it can improve the development of the financial and operational strategies [17].
The theoretical basics of the time series forecasting is discussed in numerous publications. "Time Series Analysis: Forecasting and Control" is one of the fundamental works that describes the basic principle of building forecasting models and the problems to be solved [18]. Despite modern software development and the emergence of new methods of mathematical modelling, the problem of long-term forecasting of time series still remains challenging due to increasing uncertainty with increasing forecasting periods [19]. The use of long short-term memory (LSTM) neural networks with recurrent-skip component, temporal attention layer and autoregressive component could be a solution to a problem [20]. Another way to reduce uncertainty is to use hyperparameter tunning, proper cross-validation techniques, and different forecasting strategies [21; 22; 23]. Another problem is the presence of extreme events that can change the trend. This problem is still not fully resolved, but some solutions such as creating separate event detector or using text-mining methods were proposed [24; 25].
Currently, there are two types of methods and models used in forecasting, namely traditional methods and algorithms for deep learning [26]. It should be noted that in recent years the algorithms of deep learning have been considered in the scientific literature as an alternative to traditional methods of forecasting time series [27]. Each of the traditional methods and deep learning algorithms has its own advantages and disadvantages [28; 29]. The presence of significant disadvantages and advantages in each approach leads to the conclusion that there is no specific rule for the use of methods, because in some cases, traditional methods give better results, and in some cases the best results come from deep learning algorithms [30; 31]. Different authors tried to aggregate the result of various researches and conclude which methods are better, but the results are contradictive because of input data, goals, industries and statistical methods that were used in their analysis [32; 33] Thus, it is once again confirmed that in each case both options should be considered, because according to the "No Free Lunch Theorem" there is no algorithm that is proven to be the best in all scenarios [34].
One of the most important parameters that affects the quality of time series forecasting models and any other model is the amount of data available for model training. The effectiveness of traditional methods and methods of deep learning is highly depended on the number of values in the sample and it was proved that deep learning methods on average lose to traditional methods if a small sample of data is used, but as the sample size increases, the effectiveness of deep learning methods increases and they can give better results than traditional methods [35].
The possibility of time series forecasting for products on the commodity market is considered is by N. Kohzadi [36]. The author shows that the use of neural networks to determine the future value of the product is suitable and can give better results than traditional forecasting methods, like autoregressive integrated moving average (ARIMA model). The main methods of data preparation are considered by N. K Ahmed [37], and it is noted that the main and highest quality combinations of data transformation are logarithmic transformation, and the separation of seasonal and trend components.
As a result of reviewing well-known scientific publications on the problem of forecasting time series, we concluded that there is now competition between traditional methods and methods of deep learning. Also, scientific literature has not yet defined the rules as to when to use a particular method. Traditional forecasting methods are well known and widespread, while deep learning methods have become popular in the last 20 years and therefore the best models for forecasting appear and change every year. In general, scientific papers are of the opinion that traditional forecasting methods are still better than deep learning methods, but the use of the latter in some cases, such as non-linearity of input data, the presence of a large sample, etc., gives better results. Thus, when forecasting any time series, it is necessary to use both the first and second models and choose whichever works best.

Methodology
Two types of neural networks were used in the study to compare the efficiency of using neural networks in short-term forecasting of the selling price of products of the agricultural sector of Ukraine as a part of creating company's financial strategy. These methods were compared with traditional methods such as linear regression (that is widely used in Ukrainian enterprises) and the model, based on the Fb Prophet procedure. Additionally, a naive forecast was used in the analysis. As a forecast for the naive model, the last value in the test sample was used. As an indicator for comparing models with each other, the root mean square error (RMSE) was used, calculated by the following formula: where N is the number of predicted values; ŷ is the calculated value; y is the actual value.
The sales prices of barley over the 2009 to 2019 period in UAH were used in the study. The data source is the information portal of the agricultural sector of Ukraine "apk-inform" [38]. Figure 1   The visual analysis of the sales price in UAH shows that it increased throughout 2009 to 2018, with the visible spikes in the end of 2010 and middle of 2015. Then, steady growth can be observed. Seeing the whole picture is a necessary skill in enterprise management. While creating internal strategy, the companies shouldn't ignore the macroeconomics factors that could affect their performance. One of these factors is rapid increase UAH/USD FX Rate that started in 2014. As noted earlier, in 2014 there was a socio-political crisis in Ukraine that caused a significant devaluation of the hryvnia (almost 4 times) and together with the export orientation of the Ukrainian agro-industrial complex led to a significant increase in product prices. The calculated correlation coefficient between the hryvnia exchange rate and the selling price of barley is 0.92. It shows a significant interdependence between these indicators, thus confirming the hypothesis that the main factor in the growth of the price in UAH of barley was the change in exchange rates.
To reduce the deviations caused by the change in the exchange rate, the hryvnia price of barley was converted to the dollar equivalent using the official exchange rate data from the National Bank of Ukraine. Thus, the task of forecasting the selling price of products from the agricultural sector of Ukraine was reduced to the task of forecasting the USD selling price. The calculated historical USD selling price of barley is shown in Figure  2.
To train the models, 25 samples were created, based on the monthly data on the barley sales prices, each following the best world practices in the field of forecasting and deep learning [39]. Each sample was divided into training, cross-validation, and test sets (input windows). Each sample was created using the sliding method. It lay in shifting the preliminary sample one period ahead. An example of creating samples can be seen in Figure 3.  Depending on the model used, the length of the training set (input window) changed. However, the cross-validation set and test set were always selected for one year [40; 41]. The optimal length of the training set for linear regression and a model based on the Fb Prophet procedure was determined, based on the training data set and on the cross-validation set. Thus, the study used training data sets from 3 months to 6 years in increments of 3 months. The obtained results showed that the best models are the ones that trained based on data for 9 months. The results of the RMSE cross-validation data set for different lengths of the training data set are shown in Figure 4. The use of a longer training period is not appropriate because the RMSE value for the cross-validation data set increases.
The study also considered recursive neural networks, convolutional neural networks, and neural networks based on a multilayer perceptron. However, the results obtained from recursive and multilayer neural networks were significantly worse than the results obtained using convolutional neural networks. Therefore, convolutional neural networks were chosen as the main model of neural networks. The architecture of neural networks is depicted in Figure 5.  To obtain better predictions when using neural networks, certain operations were performed to prepare the input data. Box-Cox transformation was used as a logarithmic transformation in the study. The seasonal component was isolated by subtraction. To do this, the price of barley was deducted from the monthly sale price 12 months ago [42][43][44]. It is worth noting that in this case the first year falls out of the dataset, because it is used for deseasonalization. The allocation of the trend component occurred by subtracting the current price value from the previous price value.
Thus, three transformations were performed successively: 1) Box-Cox; 2) Allocation of seasonal components; 3) Allocation of the trend component.
The result of the transformations is shown in Figure 6.
Two strategies of using neural networks were used in the research to assess the effectiveness of neural networks, namely:  Multi-stage recursive strategy  Direct-recursive hybrid strategy.
A multi-stage recursive strategy involves using data that was provided in the last iteration to predict values in the current iteration. Therefore, the neural network is trained only once.
where X t -sales price in the period t; ŷ +1 -forecasted price in the period t+1. The direct-recursive hybrid strategy involves the use of data provided in the previous iteration to train a new model and predict values in the current iteration. In this case, at each iteration the model trains itself again.

Results and Discussion
Understanding the current trend is one of the key factors for creating short-term strategy in the company, especially when the main operation activity of the company is commodity trading. After building each model, forecasting results were obtained for 25 test samples. In order to compare the models with each other, the average RMSE values of all samples were found for each model. Also, the authors calculated average RMSE for the data provided by the Worlds Bank and get the result of 36.71. The forecasting results of each model are shown in Table  1.
The analysis of the results showed that all the proposed models have a better RMSE value than the data provided by World Bank. At the same time, traditional and deep learning models have better result than naïve model. The best results were obtained using linear regression and models based on the FB Prophet. The multistage-recursive and direct-recursive hybrid model of neural networks received similar RMSE average values. It should be noted that the results obtained from neural networks are worse than the corresponding results of traditional modeling methods. The results of prediction using linear regression and package Fb Prophet are similar. Therefore, in further research, it is necessary to consider other traditional models, for example ARIMA, generalized autoregressive conditional heteroscedastic model (GARCH), seasonal auto regressive integrated moving average (SARIMAX), the Holt-Winter model, the model of exponential smoothing, and others.
It can also be seen that neural networks recognize patterns that are different from patterns obtained by traditional models. Thus, in the study, neural networks were able to predict samples from 8 to 19 better. As for traditional models, they demonstrated more accurate forecasts on such ranges as from 1 to 7 and from 20 to 25 samples. It should be emphasized that the study used the simplest configurations of neural networks. This is caused by a possible significant increase in the required computing power and an increase in the learning time of neural networks with the addition of additional layers. Neither traditional models nor neural networks used input data transformation techniques, such as time series reduction or stationary data scaling. Even with these models the companies are able to get 2x times better result compared to the date provided by statistic agencies and 25% better result compared to naïve model.

Conclusion
The study analyzed the effectiveness of the use of neural networks and traditional forecasting methods of determining the future sales price of agro-industrial products with the example of barley.
The analysis of changes in the USD price of barley over the period shows the presence of a generally positive trend. However, in comparison with the UAH price, the dynamics of the USD price for the last 10 years consists of three trends, namely: 1) positive trend from 2009 to 2013; 2) negative trend from 2013 to 2015; 3) a positive trend that began in late 2015 and continues today.
The obtained results demonstrate that the used neural networks can take into account factors that are different from those taken by traditional models. It is more possible for neural networks to adapt more quickly to global or local trends changes, and therefore make more effective predictions in such situations. Traditional forecasting methods are more effective for monotonous trendsbasically for those that have a steady increase or steady decline.
Even though the use of neural networks in forecasting the selling price of agricultural products in Ukraine gives better results than the naive model, the result is still worse than traditional forecasting methods. The neural networks used can take into account factors that are different from those taken into account by traditional models. Therefore, in further research, it is necessary to consider the effectiveness of the use of ensemble models, which will consist of both traditional models and deep learning models. In any case, the use of traditional or deep learning models is better than relying on the forecasts provided by the statistics agencies. Thus, it can help to reduce risk and uncertainty during creating financial and operational short-term strategy. Besides, further research should consider the possibility of forecasting the selling price of agricultural products not as a one-factor model, but as a multifactor one. That is, for such a model, it will be necessary to use additional input data, such as Ukraine's GDP, Ukraine's exports, yields, world news, and others.