## 3 Network Optimization of the Coal Mine Safety Risk Assessment
### Modeling
#### 3.1.2 The PSO-BP Neural Network  
In the BP neural network, the network learns by adjusting the weights and biases of its neurons in response to the training data [65]. The objective is to minimize a cost function that measures the error between the network's predicted and actual outputs. However, a common problem with BP neural networks is that they can get stuck at local minima. Local minima are points in the weighting space where the cost function has a lower value than in surrounding areas but may not be the global minimum, which is the best set of weights for the network [66]. If the network is stuck at a local minimum, it may not be able to improve its performance further, even if there is a better set of weights that could lead to a lower error. The PSO-BP neural network algorithm is robust to noisy and incomplete data [67]. This is because the PSO algorithm can effectively deal with noisy data by exploring the entire search space and finding the optimal set of weights that minimizes the error even in the presence of noise [68]. To develop the neural network PSO-BP, the PSO algorithm was used to find the optimal initial weights and thresholds for the BP neural network. The particles in the swarm represent different sets of weights, and their positions are updated based on their own and the global best positions. The fitness of each particle was evaluated based on the error between the predicted and actual outputs of the neural network with the corresponding weights. Using the optimal structure of \(46\times 14\times 1\), the coal mine safety risk evaluation model based on the PSO-BP neural network structure is shown in Figure 3.  
The initialization of weights and thresholds was randomly selected. A total of 1673 weights were used to determine the length of particles in the initial population. The fitness function of the particles was evaluated at each iteration by training the BP neural network with its weights and calculating its performance on the training datasets. The velocity of each particle is updated by iterating its _pbest_ and _gbest_. After the PSO algorithm updated the weights and thresholds of each particle, the BP algorithm was used to train the network with the updated weights and thresholds. The BP algorithm uses the error between the predicted output and the actual output to adjust the weights and thresholds of the neural network. The PSO-BP algorithm terminates when a termination criterion is met, such as reaching a maximum number of iterations or a certain accuracy level. In this study, _MSE_ was used to evaluate the fitness function of the BP neural network  
Figure 2: GA-BP neural network algorithm process. on the training dataset for the i-th particle. The smaller the fitness value of a particle, the better the particle. The flowchart of the learning algorithm is shown in Figure 4.  
Figure 4: PSO-BP neural algorithm process. Figure 3: Coal safety risk assessment based on the PSO-BP neural network’s optimal structure. The Optimized Parameters of the Network Model  
In order to verify the optimization methodology and the accuracy of the observed values, the process was performed based on the results provided in the developed MATLAB (R2019a) code. The initialization of the PSO algorithm involves setting various parameters that govern the behavior of the swarm. These parameters include the number of particles in the population, the number of iterations, the inertia weight, and the parameters that control the update of the velocity and position vectors. As shown in Table 1, the initialization parameters were described as follows. The number of particles in the PSO population is an important hyperparameter that can affect the performance and convergence speed of the algorithm. Generally, a larger population size can increase the diversity of the search and reduce the chance of getting stuck in local optima, but it also requires more computational resources and may lead to slower convergence [69].