# Bayesian Network Demand-Forecasting Model Based on Modified Particle Swarm Optimization
## 1 Introduction
### Review of Demand Forecasting
proposed a nonparametric Bayesian method (CPB), assuming that the demand follows a compound Poisson-geometric distribution [26]. However, there is no known conjugate prior that leads to a posterior distribution in a closed form. Considering the volatility of function time series, [PERSON] et al. proposed a local autoregressive nonparametric prediction model. The relevant parameters learn the inference through a strategy based on approximate Bayesian computation [29]. [PERSON] et al. proposed a nonparametric Bayesian forecasting method based on the empirical Bayesian paradigm, which is very flexible in dealing with a variety of demand patterns and used the demand data of 46,272 inventory units of an auto parts distributor to evaluate the relative performance of the method [30]. Aiming at the problem of port volume prediction, [PERSON] et al. proposed a prediction model based on Bayesian estimation. Mutual information analysis is added to the model, and the macroeconomic variables are regarded as random variables. The related uncertainty is quantified by the posterior distribution. However, this prediction method requires effective quantification of macroeconomic variables [31]. [PERSON] et al. pointed out that the Bayesian method regards the regression coefficient as a random variable and considers the uncertainty of the parameters with the data as the condition. In the model hypothesis of this paper, the regression coefficient \(\phi\) in the hidden layer variable \(\eta_{t}\) is assumed to obey the normal distribution, and the appropriate value is obtained through data training [32]. The Bayesian network is a probabilistic graphical model that combines the knowledge of probability theory and graph theory. It can reflect the potential dependencies between variables, deal with some uncertain causality, and effectively represent and calculate the joint probability distribution of a set of random variables. This structure has attracted much attention in statistics and artificial intelligence [33; 34]. The Bayesian network is widely used in the energy, biology, medical, and other fields, such as wind-energy forecasting, power demand forecasting, and water resources demand forecasting. In many studies, the Bayesian network model is used for supply-chain demand forecasting. The Bayesian network is based on Bayesian theory in practical application. It is worth pointing out that the Bayesian method shows the characteristics of experience and demand data in a quantifiable form by selecting an appropriate prior distribution. The variance in the prior distribution reflects the uncertainty of the demand data. As the demand evolves, the observed data are used to update the likelihood function to obtain the posterior distribution of the demand. The purpose of Bayesian posterior estimation is to find the appropriate parameter value. The prediction model in Section 2 mainly adopts the Bayesian method, which uses the Bayesian theorem to update the prior distribution (the probability specified before data collection) to the posterior distribution (the data after data analysis). In the parameter estimation process, we use the Bayesian maximum posterior estimation method to derive the functional form of the maximum posterior estimation. Bayesian methods have been successful in many fields and predictive environments and are particularly promising and appealing when there are considerable changes in the data. This paper considers the construction of a multilayer Bayesian network commodity demand-forecasting model under the given historical sales data of commodities. The model considers the time series correlation of historical data as well as the volatility of demand and has strong flexibility. The maximum posteriori estimation method is used to estimate the optimal parameters, and then the commodity demand in the future is predicted according to the optimal parameters.