XGBoost-based collaborative Kriging pollution evaluation method
By combining XGBoost and the collaborative Kriger method, relevant information of multiple auxiliary variables is extracted and integrated into comprehensive auxiliary variables, the problem of calculation complexity and accuracy in multivariate processing of traditional collaborative Kriger method is solved, and efficient and accurate pollution assessment and spatial distribution analysis are achieved.
Patent Information
- Application Number
- CN202510188090.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The traditional collaborative Kriger method significantly improves the computational complexity when processing multiple auxiliary variables, making it difficult to effectively process the highly nonlinear features of the data and the interaction of multivariables, resulting in problems of prediction accuracy and calculation cost.
Combining the XGBoost machine learning algorithm and the collaborative Kriger interpolation method, the information most relevant to the target polluting variable is extracted from multiple auxiliary variables through XGBoost, integrated into a comprehensive auxiliary variable, reducing the complexity of cross-covariance calculation, and using the collaborative Kriger method for spatial distribution interpolation prediction.
It effectively reduces the computational complexity of the collaborative Kriger method, improves the efficiency and accuracy of data modeling, improves the accuracy and efficiency of pollution assessment, and is suitable for spatial distribution analysis in complex geology fields.
Smart Images

Figure CN119671068A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of environmental data processing, and in particular to a pollution assessment method based on XGBoost and collaborative kriging, which is applicable to soil pollution monitoring and assessment and other environment-related fields. Background Art
[0002] With the deepening of geological research, the understanding and prediction of natural phenomena have become increasingly important. The spatial distribution of soil pollution is often affected by multiple environmental factors, such as soil composition, meteorological conditions, terrain characteristics, and human activities, and there are complex interactions between these factors. The traditional cokriging interpolation method is widely used in spatial data analysis, especially in the fields of geological resource evaluation and groundwater pollution monitoring. With its advantages in processing spatial correlation data, it has achieved good application results. However, when multiple auxiliary variables are involved, the computational complexity of the cokriging method is significantly increased, and the cross-covariance matrix between the main variable and each auxiliary variable needs to be calculated separately, which increases the difficulty of data modeling and calculation. At the same time, traditional methods often find it difficult to provide high-precision, low-computational-cost solutions when faced with highly nonlinear characteristics of data and multivariate interactions.
[0003] In this context, the present invention provides a data prediction technology that combines the XGBoost machine learning algorithm with the co-kriging interpolation method. XGBoost has powerful feature selection and regression modeling capabilities, and can extract the most relevant information about the target pollution variable (such as soil mercury content) from multiple auxiliary variables and integrate it into a comprehensive auxiliary variable, thereby effectively reducing the complexity of cross-covariance calculations between multiple variables. Through this method, the tedious process of independent calculation of multiple auxiliary variables in the co-kriging method is avoided, while retaining the influence of multi-source information on the main variable, improving the efficiency and accuracy of data modeling.
[0004] The present invention uses Python language to implement the method, forming an efficient pollution assessment software tool. It is particularly suitable for spatial distribution analysis in complex geological fields, including but not limited to geological exploration, environmental pollution assessment, meteorological pollution forecasting and other fields. Compared with the traditional co-kriging method, this technology uses XGBoost to reduce the dimension of multivariate features, significantly reducing the computational complexity of co-kriging interpolation, while improving the accuracy and efficiency of data prediction. It is particularly superior when processing data sets with significant nonlinear characteristics and multivariate coupling effects. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a pollution assessment method based on XGBoost and collaborative kriging.
[0006] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is: The pollution assessment method based on XGBoost collaborative kriging includes the following steps: S1. Collect soil samples from the target area, record the geographic coordinates of each sampling point, and test the content of pollutants and other elements in each soil sample. Clean and preprocess all data, and divide the data set into a training set and a test set. S2. Establish an XGBoost regression model, use the training set to learn the nonlinear relationship between auxiliary factors and target pollutant elements, use the test set to verify and optimize the model, integrate the influence of all auxiliary factors, and generate a comprehensive variable to characterize its overall impact on the target mercury element; S3, based on the XGBoost comprehensive prediction variables obtained through training in S2 as auxiliary variables, the co-kriging method is used to perform spatial distribution interpolation prediction of mercury pollution elements; S4. Solve the co-kriging equation to obtain the predicted value of the spatial distribution of soil mercury content, and generate a spatial distribution map of soil pollution of the predicted results.
[0007] Furthermore, the XGBoost regression model in S2 is expressed as:
[0008] in, is a comprehensive auxiliary variable for prediction, It is A base learner, is the total number of base learners.
[0009] Furthermore, the S3 specifically includes the following steps: S31, calculating the variogram of each of the main variable and the auxiliary variable, and calculating the cross-variogram between the main variable and the auxiliary variable to characterize the spatial correlation and co-dependence of the variables; S32, constructing a combined covariance matrix according to the main variable covariance matrix, the auxiliary variable covariance matrix and the cross covariance matrix between the two; S33. Combine the spatial information of the main variable and the auxiliary variable in the combined covariance matrix, construct the co-kriging equation, and obtain the weight coefficient by solving the equation.
[0010] Furthermore, the variation function of the main variable in S31 is expressed as:
[0011] in, For location The value of the main variable, For distance, is the mathematical expectation, is the variance function of the main variable; The variogram of the auxiliary variable is expressed as:
[0012] In the formula, is the variogram of the auxiliary variable, yes variogram of the auxiliary variables at location; The cross-variogram function is expressed as:
[0013] In the formula, is the cross-variogram function.
[0014] Furthermore, the combination matrix in S32 is expressed as:
[0015]
[0016]
[0017] in, is the main variable and The mutual covariance between is an auxiliary variable and The mutual covariance between is the main variable and auxiliary variables The mutual covariance between .
[0018] Furthermore, the co-kriging equation in S33 is expressed as:
[0019] in, is the main variable and The covariance between is an auxiliary variable and The covariance between is the main variable and auxiliary variables The covariance between The main variable at position x and the reference point The mutual covariance between The main and auxiliary variables at position x and reference point The mutual covariance between , are the weight coefficients of the main variable and the auxiliary variable respectively.
[0020] Furthermore, the specific calculation of the predicted value of the spatial distribution of soil mercury content in S4 is as follows:
[0021] in, For the location The predicted main variable value of The main variable is at point The observed value at is the auxiliary variable at point The observed value at , are the weight coefficients of the main variable and the auxiliary variable, are the number of observation points for the main variable and the auxiliary variable, respectively.
[0022] The present invention has the following beneficial effects: The present invention combines XGBoost with the co-kriging method to effectively introduce the synergistic influence of multiple auxiliary variables while maintaining the spatial autocorrelation of the main variable. Co-kriging can integrate multivariate information, but as the number of variables increases, the computational complexity and data dimension increase, which poses a challenge to modeling efficiency. After the introduction of XGBoost, the complexity of co-kriging calculations is reduced by integrating multiple auxiliary variables into a comprehensive variable, while retaining the spatial autocorrelation of the main variable and the synergistic correlation between multiple variables. While improving the prediction accuracy, this method reduces the computational cost, enhances the stability and adaptability of the model, and provides an efficient and accurate technical means for pollution assessment and geospatial data analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the flow of the pollution assessment method based on XGBoost and collaborative kriging of the present invention. DETAILED DESCRIPTION
[0024] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0025] The pollution assessment method based on XGBoost co-kriging, such as Figure 1 As shown, the following steps are included: S1. Data collection and preprocessing: Collect soil samples from the target area, record the geographic coordinates of each sampling point, and test the content of pollutants and other elements in each soil sample. Clean and preprocess all data, and divide the data set into a training set and a test set: First, soil samples are collected from a specific area, and the geographic coordinates of each sampling point and the corresponding content of pollutants (such as mercury) and other elements in the soil samples (such as pH, organic matter, various oxides, etc.) are recorded. Appropriate data cleaning and conversion strategies are used to prepare data suitable for input into model training. The data set is divided into training and test sets; 30% of the data is designated for testing and 70% for training.
[0026] S2. XGBoost regression model construction and training: Establish an XGBoost regression model, use the training set to learn the nonlinear relationship between other elements (cofactors) and the target pollutant element (for example, mercury), and use the test set to verify and optimize the model. Finally, integrate the influence of all cofactors to generate a comprehensive variable to characterize its overall impact on the target mercury element: First, create an XGBoost regression model and train the model. The model can be expressed as:
[0027] in, is the predicted value, It is A base learner, is the total number of base learners. XGBoost minimizes an objective function, which usually consists of a loss function and a regularization term. The loss function measures the difference between the predicted value and the true value. The commonly used loss function is the mean square error (MSE):
[0028] The objective function of XGBoost can be expressed as:
[0029] in, is a regularization term used to control model complexity and is usually defined as:
[0030] here, is the number of leaf nodes in the tree, is the weight of the leaf node, and is the regularization parameter. XGBoost iteratively adds base learners via the gradient boosting algorithm. For each round k, the model is updated by minimizing the objective function: The gradient formula is:
[0031] The Hessian matrix formula is:
[0032] XGBoost builds a new tree for the current residual (gradient), selecting features at each node by splitting using the gradient and the Hessian matrix. and split point , so that the objective function is minimized:
[0033] in, and They are the total gradient and Hessian matrix of the current node, respectively. and It's the left and right Gradients and Hessian matrices of nodes. After multiple rounds of iterations, the final prediction model consists of multiple trees:
[0034] At each prediction, input features This includes variables that may affect mercury content, such as soil pH. The output of each tree is obtained and summed up to form the final prediction result. Finally, the model performance is evaluated and the mean square error (MSE) is calculated using the mean square error formula, which measures the difference between the predicted value and the true value. The mean square error formula is:
[0035] The smaller the MSE value, the better the model performance. The R² score is calculated by the determination coefficient formula to measure the degree of fit of the model to the data. The determination coefficient formula is:
[0036] The closer the R² value is to 1, the better the model explains the variation in the data. Output MSE and R² scores to evaluate model performance.
[0037] S3, Co-kriging modeling: Based on the XGBoost comprehensive prediction variables obtained through S2 training as auxiliary variables, the co-kriging method is used to perform spatial distribution interpolation prediction of mercury pollution elements: The predicted data obtained by the XGBoost method is combined with the co-kriging method to create a co-kriging object, where the main variable is the main variable to be predicted (mercury content data), and the auxiliary variable is the comprehensive auxiliary variable predicted by XGBoost. In Python, pykrige does not currently directly support co-kriging, but this function can be achieved by manually implementing the co-kriging process or using other libraries (such as scikit-gstat, pykrige extensions or custom implementations). The specific steps are as follows: S31. Variogram calculation: Calculate the variogram of each of the primary and auxiliary variables, and calculate the cross-variogram between the primary and auxiliary variables to characterize the spatial correlation and co-dependence of the variables: Use the Variogram class of the skgstat library to calculate the variograms of the primary and auxiliary variables, and the cross-variograms between the primary and auxiliary variables. The variogram is used to describe the degree of change in spatial data and is usually defined as:
[0038] in, For location The value of the main variable, For distance, For expectations, is the variance function of the main variable.
[0039] The variogram of the auxiliary variable is expressed as:
[0040] in, is the variogram of the auxiliary variable, yes Variogram of the auxiliary variable at location.
[0041] The cross-variogram function is expressed as:
[0042] in, is the cross-variogram function.
[0043] S32. Covariance matrix construction: Construct a combined covariance matrix based on the main variable covariance matrix, the auxiliary variable covariance matrix, and the cross covariance matrix between the two:
[0044]
[0045]
[0046] in, is the main variable and The mutual covariance between is an auxiliary variable and The mutual covariance between is the main variable and auxiliary variables The mutual covariance between .
[0047] S33. Establishment of co-kriging equation: Combine the spatial information of the main variable and the auxiliary variable in the combined covariance matrix to construct the co-kriging equation, and obtain the weight coefficient by solving the equation:
[0048] in, is the main variable and The covariance between is an auxiliary variable and The covariance between is the main variable and auxiliary variables The covariance between The main variable is at position and reference point The mutual covariance between The main and auxiliary variables are in position and reference point The mutual covariance between , are the weight coefficients of the main variable and the auxiliary variable respectively.
[0049] S4. Solve the co-kriging equation to obtain the predicted spatial distribution value of soil mercury content and generate a spatial distribution map of soil pollution of the predicted results: In this embodiment, the spatial distribution prediction value of soil mercury content is obtained by solving the following equation:
[0050] In the formula, For the location The predicted main variable value of The main variable is at point The observed value at is the auxiliary variable at point The observed value at , are the weight coefficients of the main variable and the auxiliary variable, are the number of observation points for the main variable and the auxiliary variable, respectively.
[0051] After obtaining the predicted value of the main variable (mercury content), a more accurate spatial distribution map of mercury content is generated through matplotlib visualization. The generated spatial distribution map of mercury content is used to show the areas with high and low mercury concentrations. The heat map is used to intuitively show the difference in prediction effects of different methods.
[0052] The root mean square error (RMSE) and coefficient of determination (R²) are used to evaluate the prediction performance of the model. The results of using cokriging alone and combining XGBoost-cokriging are compared. It can be found that in this case study, XGBoost-cokriging performs better than cokriging alone in terms of reducing RMSE and improving R².
[0053] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0054] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0055] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.
[0056] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0057] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. The pollution assessment method based on XGBoost collaborative kriging is characterized by: The steps include: S1. Collect soil samples from the target area, record the geographic coordinates of each sampling point, and test the content of pollutants and other elements in each soil sample. Clean and preprocess all data, and divide the data set into a training set and a test set. S2. Establish an XGBoost regression model, use the training set to learn the nonlinear relationship between auxiliary factors and target pollutant elements, use the test set to verify and optimize the model, integrate the influence of all auxiliary factors, and generate a comprehensive variable to characterize its overall impact on the target mercury element; S3, based on the XGBoost comprehensive prediction variables obtained through training in S2 as auxiliary variables, the co-kriging method is used to perform spatial distribution interpolation prediction of mercury pollution elements; S4. Solve the co-kriging equation to obtain the predicted value of the spatial distribution of soil mercury content, and generate a spatial distribution map of soil pollution of the predicted results.
2. The pollution assessment method based on XGBoost collaborative kriging according to claim 1, characterized in that: The XGBoost regression model in S2 is expressed as: in, is a comprehensive auxiliary variable for prediction, It is A base learner, is the total number of base learners.
3. The pollution assessment method based on XGBoost collaborative kriging according to claim 1, characterized in that: The S3 specifically includes the following steps: S31, calculating the variogram of each of the main variable and the auxiliary variable, and calculating the cross-variogram between the main variable and the auxiliary variable to characterize the spatial correlation and co-dependence of the variables; S32, constructing a combined covariance matrix according to the main variable covariance matrix, the auxiliary variable covariance matrix and the cross covariance matrix between the two; S33. Combine the spatial information of the main variable and the auxiliary variable in the combined covariance matrix, construct the co-kriging equation, and obtain the weight coefficient by solving the equation.
4. The pollution assessment method based on XGBoost collaborative kriging according to claim 3 is characterized in that: The variation function of the main variable in S31 is expressed as: in, For location The value of the main variable, For distance, is the mathematical expectation, is the variance function of the main variable; The variogram of the auxiliary variable is expressed as: In the formula, is the variogram of the auxiliary variable, yes variogram of the auxiliary variable at location; The cross-variogram function is expressed as: In the formula, is the cross-variogram function.
5. The pollution assessment method based on XGBoost collaborative kriging according to claim 3, characterized in that: The combination matrix in S32 is expressed as: in, is the main variable and The mutual covariance between is an auxiliary variable and The mutual covariance between is the main variable and auxiliary variables The mutual covariance between .
6. The pollution assessment method based on XGBoost collaborative kriging according to claim 3, characterized in that: The co-kriging equation in S33 is expressed as: in, is the main variable and The covariance between is an auxiliary variable and The covariance between is the main variable and auxiliary variables The covariance between The main variable at position x and the reference point The mutual covariance between The main and auxiliary variables at position x and reference point The mutual covariance between , are the weight coefficients of the main variable and the auxiliary variable respectively.
7. The pollution assessment method based on XGBoost collaborative kriging according to claim 1, characterized in that: The specific calculation of the predicted value of the spatial distribution of soil mercury content in S4 is as follows: in, For the location The predicted main variable value of The main variable is at point The observed value at is the auxiliary variable at point The observed value at , are the weight coefficients of the main variable and the auxiliary variable, are the number of observation points for the main variable and the auxiliary variable, respectively.
Citation Information
Patent Citations
Soil manganese element content predicting method based on cokriging interpolation method
CN108088981A
Interpolation method of seismic local velocity data based on collaborative Kriging method
CN110941014A
Wavelet and XGBoost model integrated atmospheric fine particulate matter concentration estimation method
CN115544706A
Simultaneous multi-event universal kriging methods for spatio-temporal data analysis and mapping
US20140350856A1