# Regional Geomagnetic Field Modeling Based on Associated Legendre Polynomials
## 3 Data and Modeling Results
### Regional Geomagnetic Anomaly Field Model Construction
As shown in Figure 2b, when the truncation level is less than 10, the model is in an underfitting state, leading to a certain number of outliers. As the truncation level increased gradually from 10, the accuracy of the model training improved, with the RMSE reaching its minimum value of 0.41 nT at the 85 th degree. This accuracy was maintained up to approximately the 104 th degree, after which the RMSE started to increase gradually and slightly. The relationship between the number of outliers and the truncation level follows an approximately exponential trend, expressed as \(y=0.482885^{0.061157x}\). As the truncation level increases from 0 to 87, the number of outliers increases from 0 to 100. With a further increase in the truncation level from 88 to 97, the number of outliers increases from 100 to 200. Subsequently, as the truncation level increases from 98 to 300, the number of outliers continues to increase, before decreasing slightly to 100 from 200 when the truncation level spans from 88 to 97. As the truncation level increased from 98 to 105, the detected outliers also increased. At a truncation level of 85, 93 outliers were identified, which comprised 5.74% of the total number of data points. When the truncation level increased to 104, the number of detected outliers increased to 270, approximately three times the original number. Figure 3 illustrates the distribution of outliers at truncation levels of 85 and 104. The outliers were primarily concentrated at the four corners of the region's boundary. At the 104 th truncation level, the number of outliers increased significantly and extended further into the interior of the region. To more accurately and rationally determine the optimal truncation level, this study proposes a comprehensive evaluation index formula that combines the RMSE and the number of outliers \(A\), and fully considers their impact on the overall assessment. The formula is as follows:  
\[S=w_{1}\cdot RMSE+w_{2}\cdot f(A) \tag{9}\]  
In Equation (9), \(w_{1}\) and \(w_{2}\) represent the weight parameters and satisfy \(w_{1}+w_{2}=1\); meanwhile, \(f(A)\) denotes a nonlinear function of the number of outliers \(A\), which is used to adjust the impact of outliers on the comprehensive evaluation index. Specifically, as the number of outliers increases, the negative impact on the comprehensive evaluation index also increases. The explicit form of \(f(A)\) is given by:  
\[f(A)=\left\{ \begin{array}{ll}\frac{1}{100}A&\text{ if }A\leq A_{0}\\ \frac{1}{100}A^{k}&\text{ if }A>A_{0}\end{array} \right. \tag{10}\]  
Figure 1: Overview of the experimental area: (**a**) Scope of the experimental area. (**b**) Distribution of geomagnetic anomalies in the experimental area. The data have a horizontal resolution of 2 arcminutes. In Equation (10), \(A_{0}\) represents a threshold value and \(k\) represents a constant greater than 1, which is used to amplify the impact of outliers that exceed the threshold. During the model training phase, the RMSE was selected as the primary evaluation index. The value of the weight \(w_{1}\) was set to 0.7 and the value of \(w_{2}\) was set to 0.3. \(A_{0}\) is taken as the threshold value of 0.7% of the number of checkpoints (i.e., it is 113). This threshold value was based on a statistical analysis of the dataset and the requirements for identifying outliers. Furthermore, k was set to 1.2 to enhance the sensitivity of the model to outliers. As shown in Figure 2b, analyzing the trend of the comprehensive evaluation index in relation to the truncation level revealed that the index remained highly stable between the 81 st and 89 th truncation levels, consistently falling within the range of 0.56 to 0.59. The integrated evaluation index value reached a minimum of 0.5622 at the 83 rd degree. This result indicates that the 83 rd degree is the optimal truncation level for the model, achieving a good balance between model complexity and prediction performance.