# An Aeromagnetic Compensation Algorithm Based on Radial Basis Function Artificial Neural Network
## 2 Compensation Models and Methods
### RBF Artificial Neural Network  
Compared with BP artificial neural network, RBF artificial neural network is an effective feed forward neural network, which has significant advantages such as strong global approximation ability, no local minimum problems and fast learning speed [30]. It usually consists of an input layer, hidden layer, and output layer, in which it can be adjusted according to the actual need for the number of neurons in the hidden layer. In this paper, the number of RBF-ANN neurons in the hidden layer was the same as the number of input samples, and its network structure diagram is shown in Figure 3.  
BP-ANN can have one or multiple hidden layers, while BRF-ANN have only one hidden layer. The first layer of the BRF-ANN is the input layer, which only plays the role of transmitting information and does not do any transformation processing on the input data. The second layer is a hidden layer, the number of nodes of the hidden layer is not fixed, it can be adjusted according to actual need, and based on the task goal is constantly changing, the activation function of the hidden layer is a non-negative linear function symmetrical along the center point and constantly decaying rapidly to both sides, with local response characteristics. The third layer is the output layer, which will linearly transform the input data and then the output. The activation function of the hidden layer of the BP-ANN calculates the inner product of the input data and connection weights, while the independent variable of the activation function in the hidden layer of the BRF-ANN is the Euclidean distance between the input data and the center vector, and the activation function is the radial basis function. The farther the input data is from the center of the radial basis function, the less active it is. It can be seen that the output of the BRF-ANN is not related to all parameters, but only to a small number of parameters, and this article calls this characteristic of the BRF-ANN a local response characteristic. Therefore, BRF-ANNs are local approximation networks, while BP-ANNs are global approximation networks. The hidden and output layers of a BP-ANN can be linear or nonlinear, while the hidden layer of an BRF-ANN is nonlinear, and the output layer is linear. The basic idea of BRF-ANN is that the radial basis function is used to construct a hidden layer space for the data in hidden nodes in the hidden layer, and the hidden layer converts the input data to a certain extent, and converts the low-dimensional mode input data into the high-dimensional space, so that the linear indivisible problem in the low-dimensional space becomes linearly separable in the high-dimensional space. In the learning process of BRF-ANN, the most critical problem is how to determine the expansion coefficient of the hidden layer activation function. The common method is to select directly from a given set of training samples according to a certain method, or to determine by clustering. In this paper, the center point was randomly selected from the input sample using the direct selection method. The activation function of the BRF-ANN is generally the Gaussian function:  
\[f(x)=e^{-\frac{x^{2}}{2\pi^{2}}}, \tag{25}\]  
Figure 3: Structure diagram of RBF-ANN. In the above equation, \(r\) is the Euclidean distance of the input data to the center point, \(\sigma\) represents the rate at which the function falls to 0, also known as the expansion factor. As can be seen from Figure 4, the smaller the expansion factor, the narrower the image. The training process of the BRF-ANN is as follows:  
1. Determine the parameters. Initialize the connection weights between the hidden layer and the output layer: \[w_{kj}=k_{\text{min}}+j\frac{k_{\text{max}}-k_{\text{min}}}{q+1},\] (26) where \(k_{min}\) is the minimum value of the output of the \(k\)-th neuron, \(k_{max}\) is the maximum value of the output of the \(k\)-th neuron, and \(q\) is the number of output layer units.