# Bayesian Network Demand-Forecasting Model Based on Modified Particle Swarm Optimization
## 2 Bayesian Network Model Construction
### Model Prediction Process
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{Dataset} & RMSE & MAPE & RMSE & MAPE & RMSE & MAPE \\ \hline \multirow{2}{*}{\(n\)} & \multirow{2}{*}{10} & \multicolumn{3}{c}{DS-1} & \multirow{2}{*}{30} \\  & & & & 20 & & 30 \\ \hline ARIMA & 13.0137 & 0.3533 & 10.1142 & 0.2580 & 9.4370 & 0.2608 \\ Standard PSO & 10.0647 & 0.2899 & 8.6060 & 0.2409 & 8.4051 & 0.2478 \\ MPSO & 9.3224 & 0.2647 & 7.9575 & 0.2301 & 8.1840 & 0.2363 \\ \hline \hline \multirow{2}{*}{\
\begin{tabular}{c} Dataset \\ \(n\) \\ \end{tabular} } & \multirow{2}{*}{10} & \multicolumn{3}{c}{DS-2} & \multirow{2}{*}{30} \\  & & & 20 & & 30 \\ \hline ARIMA & 18.8025 & 0.5415 & 32.5209 & 0.6418 & 30.3403 & 0.5449 \\ \hline Standard PSO & 9.2079 & 0.2614 & 29.4158 & 0.3723 & 32.0604 & 0.3942 \\ \hline MPSO & 8.6293 & 0.2413 & 28.5674 & 0.3558 & 31.3899 & 0.3846 \\ \hline \hline \multirow{2}{*}{
\begin{tabular}{c} Dataset \\ \(n\) \\ \end{tabular} } & \multirow{2}{*}{10} & \multicolumn{3}{c}{DS-3} & \multirow{2}{*}{30} \\  & & & 20 & & 30 \\ \hline ARIMA & 10.6941 & 0.4448 & 14.3582 & 0.4600 & 14.2508 & 0.3867 \\ Standard PSO & 7.7633 & 0.3977 & 13.6170 & 0.4428 & 13.9329 & 0.3853 \\ MPSO & 7.5219 & 0.4128 & 13.4165 & 0.4377 & 13.9712 & 0.3793 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Prediction result statistics. In terms of prediction methods, the Bayesian network prediction model shows better prediction results as a whole. When the prediction length of the DS-2 dataset is 30, the RMSE indicator is higher, but the MAPE indicator performs better. In terms of the solving algorithm, according to the results of the benchmark function in Table 5, the accuracy of the MPSO algorithm is better than that of the PSO algorithm. According to the prediction results in Table 8, the MPSO algorithm is better than the PSO algorithm in solving the Bayesian network prediction model. As seen in Tables 7 and 8, the multilayer Bayesian network prediction model has achieved good prediction results, which indicates that the model is more effective in the application of demand forecasting with large fluctuations. In addition, on the datasets DS-5 and DS-6, the data not only fluctuate greatly, but also show intervals. Hence, we add the results of the Croston method to predict the datasets DS-5 and DS-6 in Table 8. It can be seen from the results that the proposed method has a better prediction effect than the Croston method. In this paper, a more general Bayesian network demand-forecasting model is proposed. The model introduces a fluctuation factor on the basis of hidden layer variables, which can better adapt to the fluctuation of data. In Section 4, we selected the data with strong volatility and verified the validity of the model through experiments. Many studies have shown that the Bayesian method has better performance when the data fluctuation is strong. The Bayesian method needs to introduce a suitable prior distribution. The model assumes that the demand and parameters obey the normal distribution, which simplifies the calculation formula of the maximum posterior estimation. In this paper, the BN is combined with PSO, and the improved PSO algorithm is used to solve the maximum posteriori estimation function. The experimental results show that the improved MPSO algorithm is superior to the PSO algorithm in solving accuracy. ## 5 Conclusions

Nowadays, product substitutability is enhanced, and customized products are becoming a trend, which makes product demand show strong volatility. Considering the time series correlation and strong volatility of demand data, this study introduces hidden layer variables and volatility factors into the multilayer Bayesian network model. According to the relevant theoretical knowledge of Bayesian statistics, the parameters of the model are estimated by the maximum posterior estimation method. Due to the large number of model parameters and the complex objective function, this work improves the standard PSO algorithm.