## 3 Predicting Missing Soil Heavy-Metal Values Based on SA-FOA-BP
### SA-FOA-BP Model  
The Back Propagation (BP) neural network is a widely used neural network with input layer (i), hidden layer (h), and output layer (o), as well as the desired output (d) [21]. The key feature of the BP neural network is its ability to utilize external input samples for stimulation. In the BP neural network, each layer calculates the error between the result and the expected output, and propagates the error backward to the previous layer. It then adjusts the weights of the previous layer to reduce the difference between the network's output and the desired output until it stabilizes. Figure 1 presents structure of the BP neural network. The basic structure of a BP neural network consists of the following components [22]. Input Layer i: It contains the input vector \(x=(x_{1},x_{2}\cdots,x_{n})\) and the weight values \(\omega_{i\text{i}_{l}}\) connecting the input layer to the hidden layer. The input layer serves as the entry point of the model and is a collection of vectors formed by the input data. The first column represents the bias value \(\text{b}_{i}\), and the second column to the last column represents the feature vectors (excluding the classification label). The output layer is the exit point of the model. It is the result of the dot product of the model's input layer and weights, followed by the application of the activation function. Hidden Layer h: It includes the input vector \(yi=(yi_{1},yi_{2},\cdots,yi_{n})\), output vector \(y_{0}=(yo_{1},yo_{2}\cdots,yo_{n})\), bias value \(\mathrm{b_{o}}\), threshold for the connection between the hidden layer and the output layer, and the logistic activation function. In a BP neural network, there is no specific requirement for the number of hidden layers, but generally, it does not exceed 2 layers. The scalar result of the dot product between the output of the layer immediately preceding the hidden layer and the weights serves as the input for this layer. This scalar, combined with the calculation of the logistic function, forms the output of this layer. The expected output \(d_{o}=(d_{1},d_{2},\cdots,d_{n})\) is the classification label vector. In a BP neural network, each layer calculates the error with respect to the expected output, propagates this error backward to the previous layer, and adjusts the weights of the previous layer accordingly. In general, the number of neurons in the hidden layer of a BP neural network is typically calculated according to the following formula based on experience:  
\[\mathrm{n_{hid}}\leq\sqrt{\mathrm{n_{out}+n_{in}}}+\mathrm{a} \tag{6}\]  
In Equation (6), \(\mathrm{n_{in}}\) and \(\mathrm{n_{out}}\) represent the number of neurons in the input and output layers, and the value of a ranges from [0, 10]. Traditional BP neural networks have limitations such as slow convergence, sensitivity to weight initialization, and easy trapping in local optima. Inspired by Boltzmann machines [23], the SA and FOA were combined with BP neural networks. The SA-FOA replaces the traditional gradient descent method used to update the weights and thresholds in BP neural networks. The FOA can find the global optimum in complex, multimodal, and non-differentiable vector spaces, and it can search for the initial weights of BP neural networks, overcoming the slow convergence of BP neural networks. The introduction of the SA reduces the possibility of the algorithm becoming trapped in a local optimum, further improving the accuracy of the BP neural network model. The SA-FOA was used to search for the thresholds of nodes and weights of links in the BP neural network algorithm, which were assigned to the BP neural network; the BP neural network was trained to obtain the optimal parameters. Thus, the SA-FOA-BP neural network model can be divided into two parts: the first part is the SA-FOA optimization process, and the second part is the BP neural network training process. The calculation steps of the model are presented as follows:  
Figure 1: Structure of the BP neural network. 1.