Method and device for calculating spatial non-stationary soil humidity
By using geographic attention network and weighted regression formula in soil moisture calculation, the problems of low accuracy and poor versatility of soil moisture calculation in the prior art are solved, and higher calculation accuracy and applicability are achieved.
Patent Information
- Application Number
- CN202411883723.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-12-19
AI Technical Summary
The existing soil moisture calculation method ignores the spatial heterogeneity of soil moisture, resulting in low calculation accuracy and poor versatility.
A geographic map attention network is used to construct a site space heterogeneous weight prediction model, and soil moisture is calculated through weighted regression formulas, and different number of spatial points are processed using inductive learning.
It improves the accuracy and versatility of soil moisture calculation, can capture complex nonlinear relationships between multiple points in parallel, and is suitable for different number of spatial points.
Smart Images

Figure CN119827740A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of soil moisture calculation, and in particular to a method and device for calculating spatial non-stationary soil moisture. Background Art
[0002] Since soil moisture information can be used in the forecasting and monitoring of droughts, floods, and forest fires, it is of great significance to accurately calculate soil moisture information. However, soil moisture is affected by factors such as climate conditions, soil depth, regional geography, and seasonal changes, showing significant spatial heterogeneity, which means that there are obvious differences in the spatial distribution of soil moisture, which is a factor that cannot be ignored in soil moisture calculation.
[0003] At present, the existing soil moisture calculation methods mainly focus on the study of the driving factors of soil moisture in various places, but ignore the spatial heterogeneity of soil moisture, that is, they pay less attention to the spatial non-stationarity. Therefore, the existing soil moisture calculation methods have poor versatility and low calculation accuracy.
[0004] Based on this, there is an urgent need for a method and device for calculating spatial non-stationary soil moisture to solve the above problems. Summary of the invention
[0005] The present invention provides a method and device for calculating spatial non-stationary soil moisture, which can improve the calculation accuracy of soil moisture and has strong versatility. The technical solution is as follows:
[0006] In a first aspect, a method for calculating spatial non-stationary soil moisture is provided, the method comprising:
[0007] Based on the geographic map attention network, a site spatial heterogeneous weight prediction model is constructed; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and the main parameters related to soil moisture, and the main parameters include dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter;
[0008] constructing a weighted regression formula for calculating soil moisture at a site based on a spatially heterogeneous weight matrix output by the prediction model;
[0009] Based on a pre-constructed data set and the regression formula, the prediction model is trained to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites;
[0010] Inputting the spatial-attribute information of the target site into the trained prediction model to obtain a spatial heterogeneous weight matrix of the target site;
[0011] The calculated spatial heterogeneity weight matrix of the target site is substituted into the regression formula to calculate the soil moisture of the target site.
[0012] In a second aspect, a device for calculating spatial non-stationary soil moisture is provided, the device comprising:
[0013] The first construction unit is used to construct a site spatial heterogeneous weight prediction model based on a geographic map attention network; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and main parameters related to soil moisture, and the main parameters include dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter;
[0014] A second construction unit is used to construct a weighted regression formula, wherein the regression formula is used to calculate the soil moisture of the site based on the spatial heterogeneity weight matrix output by the prediction model;
[0015] A training unit, used to train the prediction model based on a pre-constructed data set and the regression formula to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites;
[0016] An input unit, used to input the spatial-attribute information of the target site into the trained prediction model to obtain the spatial heterogeneity weight matrix of the target site;
[0017] The calculation unit is used to bring the calculated spatial heterogeneity weight matrix of the target site into the regression formula to calculate the soil moisture of the target site.
[0018] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0019] In a fourth aspect, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for calculating spatial non-stationary soil moisture are implemented.
[0020] In a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for calculating spatially non-stationary soil moisture.
[0021] The embodiment of the present invention provides a method for calculating spatial non-stationary soil moisture. A spatial heterogeneous weight prediction model is constructed through a geographic map attention network, and a weighted regression formula is adopted. It can not only capture the complex nonlinear relationship between multiple points in parallel, but also use an inductive learning method to flexibly process different numbers of spatial points, overcoming the limitation that the model proposed by previous researchers requires a fixed number of spatial points when calculating soil moisture, so that the model has a certain degree of versatility and improves the accuracy of soil moisture calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 It is a flow chart of a method for calculating spatial non-stationary soil moisture provided by one embodiment of the present invention;
[0024] Figure 2 It is a structural diagram of a device for calculating spatial non-stationary soil moisture provided by one embodiment of the present invention;
[0025] Figure 3 is a hardware architecture diagram of a computer device provided by an embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of a solution process of a model provided by an embodiment of the present invention;
[0027] Figures 5 to 10 They are the MAE scatter plots of the OLR model, the GWR-AFG model, the GWR-AAB model, the GNNWR-S model, the GNNWR-SA model and the GGATWR model of this application;
[0028] Figures 11 to 16 They are the regression performance comparison diagrams between the true value and the predicted value of the OLR model, the GWR-AFG model, the GWR-AAB model, the GNNWR-S model, the GNNWR-SA model and the GGATWR model of the present application;
[0029] Fig.17 and Fig.18They are the MSE and R of the GGATWR model in this application on the training set and the validation set. 2 Comparison chart of evaluation indicators. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] The specific implementation of the above concept is described below.
[0032] Please refer to Figure 1 , an embodiment of the present invention provides a method for calculating spatial non-stationary soil moisture, the method comprising:
[0033] Step 100, based on the geographic map attention network, a site spatial heterogeneous weight prediction model is constructed; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and the main parameters related to soil moisture, the main parameters include dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter;
[0034] Step 102, constructing a weighted regression formula, the regression formula is used to calculate the soil moisture of the site based on the spatial heterogeneity weight matrix output by the prediction model;
[0035] Step 104, training the prediction model based on the pre-constructed data set and regression formula to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites;
[0036] Step 106, inputting the spatial-attribute information of the target site into the trained prediction model to obtain a spatial heterogeneous weight matrix of the target site;
[0037] Step 108: Substitute the calculated spatial heterogeneity weight matrix of the target site into the regression formula to calculate the soil moisture of the target site.
[0038] In this embodiment, a spatially heterogeneous weight prediction model is constructed through a geographic map attention network, and a weighted regression formula is adopted. It can not only capture the complex nonlinear relationship between multiple points in parallel, but also use an inductive learning method to flexibly process different numbers of spatial points, overcoming the limitation that the model proposed by previous researchers in soil moisture calculation requires a fixed number of spatial points, thereby making the model universal to a certain extent and improving the accuracy of soil moisture calculation.
[0039] Described below Figure 1 How the various steps are performed.
[0040] First, for step 100, a site spatial heterogeneity weight prediction model is constructed based on the geographic graph attention network.
[0041] In this step, we first give a spatial graph consisting of N sites in the study, and the node set is {P1, P2, …, P N The prediction model consists of a multi-layer graph attention network. The purpose of the prediction model is to encode the spatial-attribute characteristics of each site into a high-dimensional embedding representation, and use the high-dimensional embedding as the output of the prediction model, which is used to represent the spatial heterogeneity weights of each site.
[0042] For all sites in the graph, when multiple graph attention layers are stacked, the formula for each layer l can be obtained as follows:
[0043]
[0044] α ij =sofxmax j (e ij ) (2)
[0045]
[0046] In the formula, e ij is the attention coefficient of site i and site j calculated based on the attention mechanism; is the weight matrix for performing linear transformation; and are the feature vectors of sites i and j respectively; is a single-layer feedforward neural network; || represents vector concatenation; LeakyReLU is a nonlinear activation function; α ij To use the softmax function for e ij Normalized attention coefficient; i = 1, 2...N; j = 1, 2...M, N is the total number of sites; M is the total number of neighboring sites of site i; k is the number of heads, k = 1, 2...K, K is the total number of heads; is the linear transformation weight matrix of the kth “head”; is the normalized attention coefficient of the k-th “head”, which is used to measure the contribution of the j-th site in the k-th “head” to the site i in the adjacent network; represents the spatial features of site i output by the lth attention layer, l = 1, 2...L, L is the total number of graph attention layers, and for the Lth layer, its output is the spatial heterogeneous weight matrix of the spatial features of site i, GAT stands for Graph Attention Network.
[0047] In some embodiments, the spatial adjacency matrix between each site is determined based on the spatial distance between each site, and the calculation formula is as follows:
[0048]
[0049] In the formula, A ij is the adjacency matrix between site i and site j; d ij is the spatial distance between site i and site j; δ is the threshold for controlling the sparsity of the adjacency matrix A.
[0050] In this step, the threshold δ is set based on experience, such as 0.2, and is not specifically limited in this application. ij When it is less than or equal to the threshold δ, it means that the relationship between the two points is weak, and it is considered that there is no connectivity between the two sites. After defining the node features and the connectivity relationship of adjacent nodes, the feature propagation process of the spatial heterogeneous weight prediction model can be written as follows:
[0051] W GAT =V GAT =GAT(A,P;θ) (5)
[0052] In the formula, represents the spatial heterogeneity weights of q influencing factors in all N sites, P∈R N×d represents the spatial-attribute features of all sites, d is the dimension of the spatial-attribute features, A is the spatial adjacency matrix of the graph, and θ is the parameter set of the graph attention network in the prediction model. The conversion of spatial-attribute features to high-dimensional hidden feature vectors can be achieved through formula (3) N×d →R N×q ), that is, the output is a spatially heterogeneous weight, which converts the input d-dimensional vector into a q-dimensional vector.
[0053] It should be noted that the spatial heterogeneous weight of each station is a matrix, the dimension of the matrix is equal to the number of main parameters after dimensionality reduction, and each weight in the spatial heterogeneous weight matrix corresponds to a main parameter. For example, the main parameters are: dew point temperature, relative humidity, precipitation and drying ratio, and the four parameters correspond to a weight respectively, so the four weights constitute the spatial heterogeneous weight matrix.
[0054] For step 102, the weighted regression formula is:
[0055]
[0056] In the formula, is the soil moisture at the ith site; is the regression coefficient of the ith site The corresponding spatial heterogeneity weight, (s i ,a i ) represents the spatial-attribute characteristics of the i-th site, where s i is the spatial position feature vector of the ith site; a i is the spatially related attribute feature vector of the ith site; x ih is the hth main parameter of the i-th site; h = 1, 2...q, q is the total number of main parameters; is the regression coefficient of the hth main parameter; is the spatial heterogeneity weight constant of the ith site; is the regression coefficient constant; ε i is the error coefficient of the ith station.
[0057] Based on the prediction model, this step first takes the spatial-attribute features of each site as input, encodes them into embedded representations through the graph attention layer, and outputs them. The spatial heterogeneous weights w of each output layer are i For each independent variable x i The spatial heterogeneity weights are then multiplied by the pre-calculated OLS regression coefficients to obtain the local non-stationary coefficients. The final output soil moisture is the result of multiplying the local non-stationary coefficients by the corresponding independent variables.
[0058] With respect to step 104, the prediction model is trained based on the pre-constructed data set and regression formula to obtain a trained prediction model, including:
[0059] S1, extracting the real soil moisture and spatial-attribute information of each station in the data set, and normalizing the extracted information to obtain normalized data; dividing the normalized data into a training set, a validation set, and a test set according to a preset ratio;
[0060] S2, generating a spatial adjacency matrix between sites based on the spatial distances between sites;
[0061] S3, set the hyperparameters of the prediction model, including the maximum number of iterations, initial learning rate, and hidden layer parameters; use the preset loss function and monitor the determination coefficient R of the model 2 , root mean square error RMSE, mean absolute error MAE and mean absolute percentage error MAPE, and execute S4;
[0062] S4, taking the spatial-attribute information of each site in the training set and the spatial adjacency matrix between each site as input, using the Adadelta optimizer, training the training set through the gradient descent method and the back propagation algorithm, and executing S5;
[0063] S5, after each epoch, based on the spatial heterogeneous weight matrix output by the prediction model, the predicted soil moisture of each station is calculated using the regression formula, and based on the predicted soil moisture of each station and the actual soil moisture, the loss function is used to calculate the loss index of the training set and the validation set, and it is judged whether the loss function of the training set decreases or whether the judgment index of the validation set is overfitting; if the loss function does not decrease or the judgment index is overfitting, the next round of training is carried out;
[0064] S6, repeat step S5 until the set maximum number of iterations is reached, and determine whether the training index is better than the index of the previous round of training. If so, record the optimal parameters of the current model and execute S7;
[0065] S7, use the trained model to calculate and verify the generalization ability of the model on the test set, end the model training process, and obtain the trained prediction model.
[0066] In this step, the model inputs are of three types: spatial-attribute characteristics of site i (s i ,a i ), q independent variables related to soil moisture considered at site i (x i1 ,x i2 ,…,x iq ) and soil moisture SM at site i i ,All data were processed using standard normalization methods to ensure the stability of the data.
[0067] In some embodiments, the loss function for:
[0068]
[0069] Where i represents the i-th site, i = 1, 2...N; SM i is the actual soil moisture of the ith site; is the predicted soil moisture at the ith site.
[0070] In this step, the mean square error (MSE) is used as the loss function to back-propagate and update the model parameters until At the same time, in each training round, the experiment used a validation set to determine whether the model was overfitting. It is worth noting that since the prediction model of this application adopts an inductive learning method, the number and location of sites in the data set are variable, so the spatial heterogeneous weights of any unseen sites can be obtained, making the model have a certain degree of versatility.
[0071] For steps 106 and 108, the soil moisture prediction process is as follows: Figure 4 As shown in FIG. 1 , the spatial-attribute information of the target site is input into the prediction model to obtain the spatial heterogeneous weight matrix of the target site; the spatial heterogeneous weight matrix is brought into the regression formula to calculate the soil moisture of the target site.
[0072] In order to verify the effectiveness of the method of the present application, the inventor used a data set to test the model of the present application (denoted as the GGATWR model) and multiple existing methods.
[0073] First, in terms of model comparison methods, the experiment first used the classic geographically weighted regression (GWR) model. According to the kernel function type and bandwidth selection method, the fixed bandwidth Gaussian kernel function (Fixed Gaussian) and the adaptive bandwidth bi-square kernel function (Adaptive Bi-square) were selected. At the same time, the bandwidth optimization criteria used AICc, which were respectively denoted as the GWR-AFG model and the GWR-AAB model. In addition, the experiment also selected the geographic neural network weighted regression (GNNWR) model that introduced the neural network algorithm into the GWR model, in which the spatial proximity relationship was expressed using spatial distance (Spatial Distance). In order to compare with the spatial-attribute features used in this application as model input, the spatial-attribute distance (Spatial-Attribute Distance) was introduced to express the expression of the spatial proximity relationship, denoted as the GNNWR-S model and the GNNWR-SA model. Finally, the experiment used the OLR model as the benchmark model.
[0074] In summary, the model of this application is compared with the OLR model, GWR-AFG model, GWR-AAB model, GNNWR-S model and GNNWR-SA model respectively.
[0075] Second, in terms of experimental environment configuration, all models were implemented on Python 3.9 and Pytorch 1.12.0 and trained on an Nvidia GeForce RTX 4090 GPU with 24GB of video memory.
[0076] Third, in order to better evaluate the soil moisture estimation effects of the above-mentioned models and analyze the spatial distribution of their estimation errors, this application selected a data set consisting of 559 simulated ground-based sites to compare the various models, and randomly divided the spatial map data set into a training set (392), a validation set (120) and a test set (47) in a ratio of 0.7:0.2:0.1.
[0077] Under the above settings, the inventors used each model to predict soil moisture, and the spatial distribution of the obtained MAE error values is as follows: Figures 5 to 10 As shown in the figure, it can be seen that the OLR model has the highest error value, indicating that it has significant deficiencies in dealing with spatial heterogeneity, resulting in weak estimation ability of soil moisture. In contrast, the GWR models (GWR-AFG and GWR-AAB) significantly reduced the error value by introducing the idea of geographical weighting, especially the GWR-AAB model, which showed stronger spatial fitting ability and could better capture the spatial variation of soil moisture. The GNNWR models (GNNWR-S and GNNWR-SA) that further introduced neural networks have achieved greater improvements in error values, showing their advantages in dealing with complex nonlinear relationships. In particular, the GNNWR-SA model further improved the prediction accuracy of the model by combining spatial and attribute characteristics.
[0078] In addition, in almost all station performances, the proposed model (GGATWR model) is superior to other models, with the lowest error value, indicating that the proposed model has significant advantages in capturing spatial non-stationarity and complex nonlinear characteristics. Through the introduction of graph neural networks, the proposed model can more finely characterize the spatial distribution of soil moisture and provide more accurate estimation results.
[0079] In order to more specifically reflect the regression performance of the model of the present application (GGATWR model), the inventors compared the regression performance of the model of the present application with that of the other five models. The results are as follows: Figures 11 to 16 shown.
[0080] It can be seen from the figure that the fitting effect of soil moisture gradually improves with the complexity of the model, and the other five models show obvious advantages over the simple OLR model. Specifically, the R 2 It is only 0.20, indicating that its ability to explain the data is weak. In contrast, GWR-AFG and GWR-AAB have 2 , RMSE and MAPE, etc., all showed good fitting ability, especially GWR-AAB had good R 2The R value of the GGATWR model is 0.55, which shows that it has certain advantages in capturing local changes of data after introducing spatial geographic location information. Furthermore, GNNWR-S, GNNWR-SA and GGATWR show stronger fitting ability, among which the R value of the GGATWR model is 0.55. 2 The value is as high as 0.79, and the RMSE is reduced to 0.0072, indicating their excellent fitting and prediction capabilities with the help of neural networks. From the overall performance, the fitting effect of all models on low values is generally better than that on high values, but the fitting effect of the GGATWR model on the high value part is relatively good.
[0081] Overall, the geographically weighted regression model with the help of neural networks performs better in capturing the spatial heterogeneity in the data and can more accurately reflect the spatial variation trend of the true value.
[0082] In order to further reflect the performance of each model on the three data sets, the comparison of each evaluation index of OLR, GWR-AFG, GWR-AAB, GNNWR-S, GNNWR-SA and GGATWR models on the soil moisture data set is shown in Table 2.
[0083] Table 2 Results of OLR, GWR-AFG, GWR-AAB, GNNWR-S, GNNWR-SA and GGATWR models on the dataset
[0084]
[0085] It can be seen from Table 2 that the GGATWR model proposed in this application outperforms the other five models in all indicators, verifying its significant advantages in fitting ability and generalization ability. Specifically, the overall performance of the OLR model is weak, R 2 The RMSE and MAPE are only 0.20, which indicates that the prediction bias is small, but the explanatory power is limited. The training set, validation set, and test set have similar performances, which may be due to underfitting. However, GWR-AFG and GWR-AAB show obvious improvements, R 2 The performance of these two models on various data sets is relatively stable, showing good generalization ability. GNNWR-S and GNNWR-SA further improve the performance, R 2 The RMSE and MAPE are significantly reduced. Finally, the GGATWR model in this application shows the best performance. 2 As high as 0.79, RMSE and MAPE also reached the lowest.
[0086] It can be seen that the model of this application has obvious advantages and can significantly improve the prediction accuracy of soil moisture.
[0087] In addition, the model of this application adopts a multi-layer and multi-head graph attention network, and its hyperparameter settings are shown in Table 1.
[0088] Table 1 Structure and hyperparameters of the model in this application
[0089]
[0090] As can be seen from the table, the input dimension of the model of this application is 6, namely longitude, latitude, precipitation, relative humidity, dew point temperature and dryness ratio; the output dimension is 4, namely the spatial heterogeneous weights of precipitation, relative humidity, dew point temperature and dryness ratio. In order to improve the computing power of the model of this application, the model adopts a double-layer stacking and two-head double-layer attention network structure, and the initial learning rate is set to 0.05, the maximum number of iterations is 400, and the loss ratio of the Dropout layer is 0.2.
[0091] The inventors conducted a comparative study on the key indicators MSE and R under this parameter. 2 The changes in the training set and the validation set with the epoch iterations are compared, and the comparison results are shown in Fig.17 and Fig.18 .
[0092] As can be seen from the figure, the MSE value of the training set is generally on a downward trend, while the MSE value of the validation set is basically flat after the epoch iteration number reaches 300. 2 From the changes in the training set, we can see that its changes are generally on the rise. On the validation set, when epoch 300 is reached, the changes thereafter tend to remain flat. Therefore, MSE and R 2 There was no overfitting due to increased indicators on the validation set. After debugging to obtain the optimal parameters, setting the epoch to 400 can basically fully train the model.
[0093] It can be seen that the model of this application has a good prediction effect using the above parameters. Of course, users can also use other parameters, and this application does not make specific limitations.
[0094] like Figure 2 , Figure 3 As shown, an embodiment of the present invention provides a device for calculating spatial non-stationary soil moisture. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 2 As shown, it is a hardware architecture diagram of a computing device where a computing device for calculating spatial non-stationary soil moisture provided by an embodiment of the present invention is located, except Figure 2In addition to the processor, memory, network interface, and non-volatile memory shown in the figure, the computing device in which the device is located in the embodiment may also generally include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 3 As shown, as a device in a logical sense, the CPU of the computing device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it.
[0095] Please refer to Figure 3 , an embodiment of the present invention provides a device for calculating spatial non-stationary soil moisture, the device comprising:
[0096] The first construction unit 300 is used to construct a site spatial heterogeneous weight prediction model based on a geographic map attention network; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and the main parameters related to soil moisture, the main parameters including dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter;
[0097] A second construction unit 302 is used to construct a weighted regression formula, where the regression formula is used to calculate the soil moisture of the site based on the spatial heterogeneity weight matrix output by the prediction model;
[0098] The training unit 304 is used to train the prediction model based on the pre-constructed data set and regression formula to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites;
[0099] An input unit 306 is used to input the spatial-attribute information of the target site into the trained prediction model to obtain a spatial heterogeneity weight matrix of the target site;
[0100] The calculation unit 308 is used to bring the calculated spatial heterogeneity weight matrix of the target site into the regression formula to calculate the soil moisture of the target site.
[0101] In some embodiments, the prediction model consists of multiple graph attention layers stacked in sequence, and each graph attention layer uses the following calculation formula:
[0102]
[0103] α ij =sofxmax j (e ij )
[0104]
[0105] In the formula, e ij is the attention coefficient of site i and site j calculated based on the attention mechanism; is the weight matrix for performing linear transformation; and are the feature vectors of sites i and j respectively; is a single-layer feedforward neural network; || represents vector concatenation; LeakyReLU is a nonlinear activation function; α ij To use the softmax function for e ij Normalized attention coefficient; i = 1, 2...N; j = 1, 2...M, N is the total number of sites; M is the total number of neighboring sites of site i; k is the number of heads, k = 1, 2...K, K is the total number of heads; is the linear transformation weight matrix of the kth “head”; is the normalized attention coefficient of the k-th “head”, which is used to measure the contribution of the j-th site in the k-th “head” to the site i in the adjacent network; represents the spatial features of site i output by the lth attention layer, l = 1, 2...L, L is the total number of graph attention layers, and for the Lth layer, its output is the spatial heterogeneous weight matrix of the spatial features of site i, GAT stands for Graph Attention Network.
[0106] In some embodiments, the spatial adjacency matrix between each site is determined based on the spatial distance between each site, and the calculation formula is as follows:
[0107]
[0108] In the formula, A ij is the adjacency matrix between site i and site j; d ij is the spatial distance between site i and site j; δ is the threshold for controlling the sparsity of the adjacency matrix A; i=1,2……N; j=1,2……N.
[0109] In some embodiments, the weighted regression formula is:
[0110]
[0111] In the formula, is the soil moisture at the ith site; is the regression coefficient of the ith site The corresponding spatial heterogeneity weight, (s i ,a i ) represents the spatial-attribute characteristics of the i-th site, where s i is the spatial position feature vector of the ith site; a iis the spatially related attribute feature vector of the ith site; x ih is the hth main parameter of the i-th site; h = 1, 2...q, q is the total number of main parameters; is the regression coefficient of the hth main parameter; is the spatial heterogeneity weight constant of the ith site; is the regression coefficient constant; ε i is the error coefficient of the ith station.
[0112] In some implementations, the training unit 304 is configured to perform the following operations:
[0113] S1, extracting the real soil moisture and spatial-attribute information of each station in the data set, and normalizing the extracted information to obtain normalized data; dividing the normalized data into a training set, a validation set, and a test set according to a preset ratio;
[0114] S2, generating a spatial adjacency matrix between sites based on the spatial distances between sites;
[0115] S3, setting the hyperparameters of the prediction model, including the maximum number of iterations, the initial learning rate, and the hidden layer parameters; using the preset loss function, and supervising the model's coefficient of determination, root mean square error, mean absolute error, and mean absolute percentage error, and executing S4;
[0116] S4, taking the spatial-attribute information of each site in the training set and the spatial adjacency matrix between each site as input, using the Adadelta optimizer, training the training set through the gradient descent method and the back propagation algorithm, and executing S5;
[0117] S5, after each epoch, based on the spatial heterogeneous weight matrix output by the prediction model, the predicted soil moisture of each station is calculated using the regression formula, and based on the predicted soil moisture of each station and the actual soil moisture, the loss function is used to calculate the loss index of the training set and the validation set, and it is judged whether the loss function of the training set decreases or whether the judgment index of the validation set is overfitting; if the loss function does not decrease or the judgment index is overfitting, the learning rate is adjusted or the model parameters are reconstructed, and the next round of training is carried out;
[0118] S6, repeat step S5 until the set maximum number of iterations is reached, and determine whether the training index is better than the index of the previous round of training. If so, record the optimal parameters of the current model and execute S7;
[0119] S7, use the trained model to calculate and verify the generalization ability of the model on the test set, end the model training process, and obtain the trained prediction model.
[0120] In some embodiments, the loss function for:
[0121]
[0122] Where i represents the i-th site, i = 1, 2...N; SM i is the actual soil moisture of the ith site; is the predicted soil moisture at the ith site.
[0123] It should be noted that the device for calculating spatial non-stationary soil moisture provided in the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for calculating spatial non-stationary soil moisture provided in the above embodiment and the embodiment of the method for calculating spatial non-stationary soil moisture belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0124] The embodiment of the present application also provides a computer device, please refer to Figure 3 The computer device includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the calculation method of spatial non-stationary soil moisture provided by the above-mentioned method embodiments.
[0125] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method for calculating spatial non-stationary soil moisture provided by the above-mentioned method embodiments.
[0126] An embodiment of the present application also provides a computer program product, which includes a computer program. A processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method for calculating spatial non-stationary soil moisture described in any of the above embodiments.
[0127] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0128] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0129] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0130] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for calculating spatial non-stationary soil moisture, characterized in that: The method comprises: Based on the geographic map attention network, a site spatial heterogeneous weight prediction model is constructed; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and the main parameters related to soil moisture, and the main parameters include dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter; constructing a weighted regression formula for calculating soil moisture at a site based on a spatially heterogeneous weight matrix output by the prediction model; Based on a pre-constructed data set and the regression formula, the prediction model is trained to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites; Inputting the spatial-attribute information of the target site into the trained prediction model to obtain a spatial heterogeneous weight matrix of the target site; The calculated spatial heterogeneity weight matrix of the target site is substituted into the regression formula to calculate the soil moisture of the target site.
2. The method according to claim 1, characterized in that: The prediction model consists of multiple graph attention layers stacked in sequence, and each graph attention layer uses the following calculation formula: In the formula, e ij is the attention coefficient of site i and site j calculated based on the attention mechanism; is the weight matrix for performing linear transformation; and are the feature vectors of sites i and j respectively; is a single-layer feedforward neural network; || represents vector concatenation; LeakyReLU is a nonlinear activation function; α ij To use the softmax function for e ij Normalized attention coefficient; i = 1, 2...N; j = 1, 2...M, N is the total number of sites; M is the total number of neighboring sites of site i; k is the number of heads, k = 1, 2...K, K is the total number of heads; is the linear transformation weight matrix of the kth "head"; is the normalized attention coefficient of the k-th "head", which is used to measure the contribution of the j-th site in the k-th "head" to the site i in the adjacent network; represents the spatial features of site i output by the lth attention layer, l = 1, 2...L, L is the total number of graph attention layers, and for the Lth layer, its output is the spatial heterogeneous weight matrix of the spatial features of site i, GAT stands for Graph Attention Network.
3. The method according to claim 1, characterized in that: The spatial adjacency matrix between each site is determined based on the spatial distance between each site, and the calculation formula is as follows: In the formula, A ij is the adjacency matrix between site i and site j; d ij is the spatial distance between site i and site j; δ is the threshold for controlling the sparsity of the adjacency matrix A; i=1,2……N; j=1,2……N.
4. The method according to claim 2, characterized in that: The weighted regression formula is: In the formula, is the soil moisture at the ith site; is the regression coefficient of the ith site The corresponding spatial heterogeneity weight, (s i ,a i ) represents the spatial-attribute characteristics of the i-th site, where s i is the spatial position feature vector of the i-th site; a i is the spatially related attribute feature vector of the ith site; x ih is the hth main parameter of the i-th site; h = 1, 2...q, q is the total number of main parameters; is the regression coefficient of the hth main parameter; is the spatial heterogeneity weight constant of the ith site; is the regression coefficient constant; ε i is the error coefficient of the ith station.
5. The method according to claim 1, characterized in that The step of training the prediction model based on the pre-constructed data set and the regression formula to obtain a trained prediction model includes: S1, extracting the real soil moisture and spatial-attribute information of each site in the data set, and normalizing the extracted information to obtain normalized data; dividing the normalized data into a training set, a validation set, and a test set according to a preset ratio; S2, generating a spatial adjacency matrix between sites based on the spatial distances between sites; S3, setting the hyperparameters of the prediction model, including the maximum number of iterations, the initial learning rate, and the hidden layer parameters; using a preset loss function, and supervising the determination coefficient, root mean square error, mean absolute error, and mean absolute percentage error of the model, and executing S4; S4, taking the spatial-attribute information of each site in the training set and the spatial adjacency matrix between each site as input, using the Adadelta optimizer, training the training set through the gradient descent method and the back propagation algorithm, and executing S5; S5, after each epoch, based on the spatial heterogeneous weight matrix output by the prediction model, the predicted soil moisture of each station is calculated using the regression formula, and based on the predicted soil moisture of each station and the actual soil moisture, the loss index of the training set and the validation set is calculated using the loss function, and it is determined whether the loss function of the training set decreases or whether the determination index of the validation set is overfitted; if the loss function does not decrease or the determination index is overfitted, the learning rate is adjusted or the model parameters are reconstructed, and the next round of training is performed; S6, repeat step S5 until the set maximum number of iterations is reached, and determine whether the training index is better than the index of the previous round of training. If so, record the optimal parameters of the current model and execute S7; S7, use the trained model to calculate and verify the generalization ability of the model on the test set, end the model training process, and obtain the trained prediction model.
6. The method according to claim 5, characterized in that The loss function for: Where i represents the i-th site, i = 1, 2...N; SM i is the actual soil moisture of the ith site; is the predicted soil moisture at the ith site.
7. A device for calculating spatial non-stationary soil moisture, characterized in that: The device comprises: The first construction unit is used to construct a site spatial heterogeneous weight prediction model based on a geographic map attention network; the prediction model takes the spatial-attribute information of the site and the spatial adjacency matrix between the sites as input, and takes the spatial heterogeneous weight matrix of each site as output; the spatial-attribute information includes the latitude and longitude coordinates of the site and the main parameters related to soil moisture, and the main parameters include dew point temperature, relative humidity, precipitation and drying ratio; each weight in the spatial heterogeneous weight matrix corresponds to a main parameter; A second construction unit is used to construct a weighted regression formula, wherein the regression formula is used to calculate the soil moisture of the site based on the spatial heterogeneity weight matrix output by the prediction model; A training unit, used to train the prediction model based on a pre-constructed data set and the regression formula to obtain a trained prediction model; the data set includes real soil moisture and spatial-attribute information of multiple known sites; An input unit, used to input the spatial-attribute information of the target site into the trained prediction model to obtain a spatial heterogeneity weight matrix of the target site; The calculation unit is used to bring the calculated spatial heterogeneity weight matrix of the target site into the regression formula to calculate the soil moisture of the target site.
8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of any one of the methods described in claims 1-6.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Atmospheric environmental pollutant prediction model based on dynamic space-time attention mechanism
CN113326981A
Soil humidity prediction method based on extreme learning machine
CN115730511A
Time series data prediction method associated with time-space relationship
CN117668743A
Soil humidity prediction method based on deep learning
CN118134100A
Soil humidity prediction method of attention coding and decoding LSTM (Long Short Term Memory) model based on physical process
CN118940160A