A method and system for predicting the emission flux of non-point source pollutants and identifying coastal risks
Through the CCM causal analysis model and the Trans-GRU coupling model, combined with density clustering and trend testing, the problems of estimating emission fluxes of surface source pollution and identifying high-emission risk areas are solved, and high-precision and high-frequency prediction and identification effects are achieved.
Patent Information
- Application Number
- CN202510386516.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-03-31
AI Technical Summary
The prior art is difficult to achieve high-precision and continuous estimation of emission fluxes for surface source pollution and accurate identification of high emission risk areas, especially when processing long-term data and complex spatiotemporal interactions.
The CCM causal analysis model was used to extract key surface-like driving elements, and the Trans-GRU coupling model was used, combining the Transformer Encode branch and the GRU gating unit branch to predict the surface source pollutant flux. Identify high-risk areas along the coast through density clustering and trend tests.
It has achieved high-frequency and high-precision estimation of emission flux of surface source pollutants and accurate identification of high-risk areas along the coast, improving the ability of water safety risk assessment and water pollution prevention and control.
Smart Images

Figure CN119886845B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of big data estimation and risk early warning of water environmental pollution, and particularly relates to a method and system for predicting the discharge flux of non-point source pollutants and identifying the risks along the coast. Background Technique
[0002] The statements in this part only provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] Non-point source pollution has become an important source affecting the health of the water ecological environment. Compared with point source pollution, it has characteristics such as randomness, diffusivity, and hysteresis, and is affected by various driving factors such as climate change and land use, making the identification and control of non-point source pollution risks more complex. Therefore, it is of great significance for water safety risk assessment and water pollution prevention and control to capture the spatio-temporal dynamic characteristics of non-point source pollution in real time, estimate the discharge flux of pollutants, and identify the risks in the coastal discharge areas.
[0004] In the past, the methods for estimating the discharge flux of non-point source pollution and identifying risks mainly relied on site monitoring and model simulation methods: Site monitoring can provide accurate water quality point source pollution data, but it can only reflect the local and discontinuous water quality conditions, and the pollution risk identification and analysis based on single local area data lack the ability of global dynamic monitoring; Model simulation often uses empirical formulas and watershed models, but often expands the pollution sources and is difficult to adapt to the global dynamic changes of complex pollution sources, and the diversity and uncertainty of pollution sources make traditional models unable to effectively capture the main driving factors. The above problems result in the inability of traditional methods to meet the requirements of high-precision and continuous estimation of non-point source pollution discharge flux and accurate identification of high-emission risk areas.
[0005] With the booming development of big data technology and deep learning, new technical support has been obtained for the research of non-point source pollution. Deep learning has good spatio-temporal data fusion processing ability and the ability to capture non-linear relationships. By using multi-source spatio-temporal auxiliary data, it can effectively expand the site monitoring data to spatio-temporally continuous non-point source pollution monitoring. At the same time, the dynamic analysis ability of the time series data of deep learning is good at dealing with the dynamic changes of emergencies or abnormal pollution sources, which is crucial for risk identification. However, traditional deep learning methods are easily limited by the problems of gradient disappearance or explosion when dealing with long time series data, have insufficient ability to capture long-time series dynamic changes, and lack a unified framework to process complex spatio-temporal interaction relationships, resulting in large differences in estimation accuracy under different scenarios. Summary of the Invention
[0006] To overcome the deficiencies of the above-mentioned existing technologies, the present invention provides a method and system for predicting the emission flux of non-point source pollutants and identifying coastal risks, which can achieve the estimation of pollutant emission flux with high frequency and high precision, as well as the accurate identification of the distribution locations and time periods of high-risk areas along the coast.
[0007] To achieve the above object, one or more embodiments of the present invention provide the following technical solutions:
[0008] The first aspect of the present invention provides a method for predicting the emission flux of non-point source pollutants and identifying coastal risks;
[0009] A method for predicting the emission flux of non-point source pollutants and identifying coastal risks includes:
[0010] Obtain the water quality pollution data and spatio-temporal auxiliary feature data of the research area, preprocess the data, and construct a water quality pollution database and a spatio-temporal auxiliary feature database;
[0011] Extract candidate areal driving factors based on the spatio-temporal auxiliary feature database, analyze the causal relationship between the candidate areal driving factors and water quality pollution using the CCM causal analysis model, and screen out the key areal driving factors with high contribution degrees;
[0012] Extract the time information features, explicit spatial features, and implicit spatial features of the key areal driving factors, and use supervised learning to transform and integrate the explicit spatial features and implicit spatial features to generate feature vectors;
[0013] Input the feature vectors into the trained Trans-GRU coupling model to output the predicted values of the non-point source pollutant flux; wherein, the trained Trans-GRU coupling model uses the Transformer Encode branch and the GRU gated unit branch to calculate the feature vectors layer by layer, and outputs the Transformer branch features and the GRU branch features; by weighted coupling the Transformer branch features and the GRU branch features, the predicted value of the non-point source pollution flux is output through the prediction layer;
[0014] Perform density clustering and trend test on the predicted values to obtain the emission intensity and emission trend of the pollutants, and divide the risk levels according to the emission intensity and emission trend of the pollutants to achieve coastal risk identification and early warning.
[0015] As a further technical solution, the preprocessing process includes:
[0016] Remove the outliers in the water quality pollution data and spatio-temporal auxiliary feature data, and use interpolation or neighboring values to fill the missing values in the data;
[0017] Align the water quality pollution data and spatio-temporal auxiliary feature data in spatio-temporal scales to unify the time granularity and spatial resolution;
[0018] Perform standardization processing on the water quality pollution data and spatio-temporal auxiliary feature data to ensure the consistency of the dimensions of different data.
[0019] As a further technical solution, the process of using the CCM causal analysis model to analyze the causal relationship between candidate planar driving factors and water quality pollution and screening out key planar driving factors with high contribution degrees is as follows:
[0020] Extract the time series variables of the water quality pollution flux in the water quality pollution database and the time series variables of the candidate planar driving factors in the spatio-temporal auxiliary feature database respectively, and perform normalization processing;
[0021] According to the time delay embedding principle, reconstruct the attractor manifolds of the water quality pollution flux and candidate planar driving factors respectively to generate the time series manifold of the water quality pollution flux and the time series manifold of the candidate planar driving factors;
[0022] According to the time series manifold of the water quality pollution flux, find the nearest neighbor points and calculate the Euclidean distance, and use weights to measure the similarity between state vectors;
[0023] Based on the time series manifold of the candidate planar driving factors and the said weights, calculate the predicted values of the candidate planar driving factors, and judge the causal contribution of the candidate planar driving factors to the pollutant flux by calculating the convergence cross mapping ability value;
[0024] Through two-way causal test, screen out the key planar driving factors with high contribution degrees affecting the pollutant flux.
[0025] As a further technical solution, the explicit spatial features include point location longitude and latitude features and water body type features; the implicit spatial features include water quality pollution flux features, key driving factor features, and time information features.
[0026] As a further technical solution, the process of using the trained Trans-GRU coupling model to perform layer-by-layer calculation on the feature vectors through the Transformer Encode branch and output the Transformer branch features is as follows:
[0027] Use linear transformation to map the feature vectors from the original dimension to a new spatial dimension to represent the input features in a higher-dimensional space;
[0028] Add positional encoding to the feature vectors at each time step in the time series so that the attention mechanism can utilize the positional information equivalent to the time order;
[0029] Calculate the query matrix, key matrix, and value matrix of the feature vectors at each time step through the encoder;
[0030] Calculate the attention weights between the current time step and other time steps;
[0031] Map the query, key, and value matrices to different subspaces respectively through the multi-head attention mechanism to obtain the feature representation based on the long-time series relationship information; perform residual connection and layer normalization on the obtained feature based on the long-time series relationship information;
[0032] Capture the spatio-temporal dependence of non-point source pollution of water quality through the feed-forward network, and output the Transformer branch features.
[0033] As a further technical solution, the process of using the GRU gated unit branch of the trained Trans-GRU coupling model to calculate the feature vector layer by layer and output the GRU branch features is as follows:
[0034] Divide the feature vector into feature vectors of different time steps;
[0035] Use the update gate to control the weight distribution between the input feature at the current moment and the hidden state at the previous moment; use the reset gate to control the influence of the hidden state at the previous moment in the calculation of the candidate hidden state at the current moment;
[0036] Based on the divided feature vector and the reset gate, output and update the candidate hidden state, and obtain the GRU branch features by calculating the weighted combination of the hidden state at the previous moment and the candidate hidden state at the current moment.
[0037] As a further technical solution, the process of performing spatial clustering and trend test on the predicted value to obtain the emission intensity and emission trend of pollutants is as follows:
[0038] Combine the pollutant emission flux value of each data point in the predicted value with the spatial coordinate information as the input of clustering, and perform density clustering according to the neighborhood distance and the minimum number of points parameter to identify the high-density areas of pollutant emissions;
[0039] Present the pollution degree of each region according to the quantization index to form a density map of pollution sources, and realize the preliminary identification of high-emission pollution areas along the coast;
[0040] Extract the pollutant emission flux values of different time steps in each pollution area as the input of trend test;
[0041] For each region, calculate the slope between all time point pairs and take the median, and judge the pollution emission trend according to the slope median.
[0042] The second aspect of the present invention provides a non-point source pollutant emission flux prediction and coastal risk identification system.
[0043] A system for predicting the emission flux of non-point source pollutants and identifying coastal risks, comprising:
[0044] A database construction module, configured to: obtain water quality pollution data and spatio-temporal auxiliary feature data of the research area, preprocess the data, and construct a water quality pollution database and a spatio-temporal auxiliary feature database;
[0045] A causal analysis module, configured to: extract candidate areal driving factors based on the spatio-temporal auxiliary feature database, analyze the causal relationship between the candidate areal driving factors and water quality pollution using the CCM causal analysis model, and screen out key areal driving factors with high contribution degrees;
[0046] A supervised learning module, configured to: extract the time information features, explicit spatial features, and implicit spatial features of the key areal driving factors, use supervised learning to transform and integrate the explicit spatial features and implicit spatial features, and generate feature vectors;
[0047] A non-point source pollutant flux prediction module, configured to: input the feature vectors into a trained Trans-GRU coupling model, and output the predicted values of the non-point source pollutant fluxes; wherein, the trained Trans-GRU coupling model respectively uses the Transformer Encode branch and the GRU gated unit branch to perform layer-by-layer calculations on the feature vectors, and outputs the Transformer branch features and the GRU branch features; by performing weighted coupling on the Transformer branch features and the GRU branch features, the predicted values of the non-point source pollution fluxes are output through the prediction layer;
[0048] A coastal risk identification module, configured to: perform density clustering and trend test on the predicted values, obtain the emission intensity and emission trend of the pollutants, divide the risk levels according to the emission intensity and emission trend of the pollutants, and realize coastal risk identification and early warning.
[0049] The third aspect of the present invention provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the steps in a method for predicting the emission flux of non-point source pollutants and identifying coastal risks as described in the first aspect of the present invention are implemented.
[0050] The fourth aspect of the present invention provides an electronic device, comprising a memory, a processor, and a program stored on the memory and executable on the processor, and when the processor executes the program, the steps in a method for predicting the emission flux of non-point source pollutants and identifying coastal risks as described in the first aspect of the present invention are implemented.
[0051] The above one or more technical solutions have the following beneficial effects:
[0052] (1) By introducing the CCM causal analysis model, the present invention utilizes the convergence of causal cross-mapping, analyzes the asymmetric driving of elements such as meteorology and land use on pollution through bidirectional causality tests (unidirectional driving of rainfall, mutual feedback between land use and pollution), quantifies their cross-time and cross-space contributions (agricultural activities dominate the long-term trend, rainfall triggers short-term fluctuations), and extracts key driving elements related to pollution flux.
[0053] (2) The present invention takes the time-series data of water quality pollution and the areal driving element data with significant causal relationships as inputs, and the water quality non-point source pollution flux as the output, and constructs a Trans-GRU model to effectively solve the problems of gradient disappearance and gradient explosion existing in traditional time-series deep learning models.
[0054] (3) By using density clustering (Density-Based Spatial Clustering of Applications with Noise, DBSCAN) and Theil-Sen Median Slope Estimator (Theil-Sen) to test the predicted values of the non-point source pollutant fluxes output by the Trans-GRU model, the positions and time periods of high-emission areas along the coast are accurately identified, which is of great significance for water safety risk assessment and water pollution prevention and control.
[0055] The advantages of the additional aspects of the present invention will be partly given in the following description, partly will become obvious from the following description, or will be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The accompanying drawings forming a part of this specification are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not constitute an improper limitation to the present invention.
[0057] Figure 1 It is a flowchart of the method for the first embodiment.
[0058] Figure 2 It is a system structure diagram for the second embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0059] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0060] It should be noted that the terms used herein are only for describing the specific embodiments and are not intended to limit the exemplary embodiments according to the present invention.
[0061] Without conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0062] Based on high-precision, daily-scale water quality monitoring data, combined with characteristic data such as hydrological conditions, meteorological conditions, land use types, and human activities, the present invention uses causal analysis CCM to determine the contribution degree of each characteristic, and constructs a pollutant emission flux estimation model and its application based on a deep learning algorithm that combines Transformer and GRU. Based on density clustering and Theil-Sen median slope estimation method testing, accurate identification of the location and time period of high-emission areas along the coast is achieved.
[0063] Embodiment 1
[0064] This embodiment discloses a method for predicting non-point source pollutant emission flux and identifying coastal risks;
[0065] As Figure 1 shown, a method for predicting non-point source pollutant emission flux and identifying coastal risks includes:
[0066] Step S1, obtaining water quality pollution data and spatio-temporal auxiliary characteristic data of the research area, and preprocessing the data to construct a water quality pollution database and a spatio-temporal auxiliary characteristic database;
[0067] Collect water quality pollution concentration and flux data of rivers, lakes, reservoirs, drinking water sources, etc. in the research area. Among them, the pollutant flux is the total amount of pollutants passing through a certain cross-section of a river, lake, reservoir or drinking water source per unit time, reflecting the pollutant transport intensity, and its calculation formula is as follows:
[0068] ;
[0069] In the formula, is the daily area-normalized flux of pollutants; is the daily pollutant concentration of this cross-section; is the daily river flow; is the area of the region, and the pollutants can be ammonia nitrogen, total phosphorus, potassium permanganate index, etc.
[0070] At the same time, collect spatio-temporal auxiliary characteristic data such as hydrology (flow rate, flow velocity, water level, etc.), meteorology (precipitation, temperature, sunshine hours, etc.), and land use in the research area, and use human activity data as a time stamp, set as a latent variable, and also input it as a time series into the coupling model.
[0071] Preprocess the obtained water quality pollution data and spatio-temporal auxiliary characteristic data to construct a water quality pollution database and a spatio-temporal auxiliary characteristic database. Among them, the preprocessing process includes:
[0072] Remove outliers from the data to ensure data quality. Fill in the missing values in the data using interpolation or neighboring values.
[0073] Align the water quality pollution data and the spatio-temporal auxiliary feature data in terms of spatio-temporal scale, and unify the time granularity of each data to the daily scale, with the spatial resolution matching the river basin.
[0074] Standardize the water quality pollution data and the spatio-temporal auxiliary feature data to ensure that the dimensions of different data are consistent. For example, Min-Max normalization can be used to ensure that the dimensions of different variables are consistent, and its formula is as follows:
[0075] ;
[0076] In the formula, is the time series data to be standardized, that is, ; is the result after normalization processing; is the minimum value in the time series data; is the maximum value in the time series data.
[0077] Step S2: Extract candidate areal driving factors from the spatio-temporal auxiliary feature database, and use the CCM causal analysis model to analyze the causal relationship between the candidate areal driving factors and water quality pollution, and screen out the key areal driving factors with high contribution degrees;
[0078] Analyze the causal relationship between the candidate areal driving factors and water quality pollution through the CCM causal analysis model, and then identify the key driving factors and their contribution degrees. Among them, the target variable (result) is the water quality pollution data X obtained from the monitoring stations, that is, the emission fluxes or concentrations of pollutants such as ammonia nitrogen and total phosphorus. The candidate areal driving factors (causes) are the extracted areal features such as meteorology (rainfall, temperature, etc.), land use, and agricultural activities, which constitute the candidate areal driving factors Y.
[0079] Step S21: Extract the time series variables of the water quality pollution fluxes in the water quality pollution database and the time series variables of the candidate areal driving factors in the spatio-temporal auxiliary feature database respectively, and perform normalization processing;
[0080] Take the time series variables of the water quality pollution fluxes as , and the time series variables of the candidate areal driving factors as , determine the time window and perform normalization according to the following rules:
[0081] ;
[0082] ;
[0083] In the formula, are the maximum and minimum values of the water quality pollution flux X in this time window; are the maximum and minimum values of the candidate planar driving factor Y in this time window.
[0084] Step S22: According to the delay embedding principle, reconstruct the attractor manifolds of the water quality pollution flux and the candidate planar driving factor respectively, generate the time series manifold of the water quality pollution flux and the time series manifold of the candidate planar driving factor. The generation process is as follows:
[0085] ;
[0086] ;
[0087] In the formula, is the time series manifold of the water quality pollution flux X; is the time series manifold of the candidate planar driving factor Y. , is a certain moment in the time series variable, C is the length of the time window. E is the number of data points at different moments used when reconstructing the manifold. is the time interval between two adjacent moments in the time series data of X and Y. That is, the manifold at each moment and are composed of the current observed value , and the subsequent delayed observed values.
[0088] Step S23: According to the time series manifold of the water quality pollution flux, find the nearest neighbor points and calculate the Euclidean distance, and use weights to measure the similarity between state vectors; specifically:
[0089] According to the time series manifold of the water quality pollution flux at a certain moment, find E + 1 nearest neighbor points from near to far, that is, the time points in the same time window close to this moment , and then calculate the Euclidean distance from the nearest neighbor point to this moment , that is, sum the squares of the differences of all corresponding dimensions of the two vectors and take the square root to get the Euclidean distance. Use weights to measure the similarity between two state vectors. The weight calculation is as follows:
[0090] ;
[0091] In the formula, is the and Euclidean distance between, that is, it represents the contribution ratio of this nearest neighbor point to the predicted value of the target moment . The greater the weight, the higher the similarity.
[0092] Step S24: Based on the temporal manifold of the candidate areal driving factors and the weights, calculate the predicted values of the candidate areal driving factors, and judge the causal contribution of the candidate areal driving factors to the pollutant flux by calculating the convergent cross-mapping ability value.
[0093] Based on the temporal manifold of the candidate areal driving factor data , find the corresponding E + 1 nearest neighbor points from near to far , and use these neighboring points and the above weights to calculate the predicted value of the candidate areal driving factor Y corresponding to time :
[0094] ;
[0095] In the formula, is the predicted value of the candidate areal driving factor Y.
[0096] By calculating the convergent cross-mapping ability value (CMS), judge the causal effect of the candidate areal driving factor Y on the pollutant flux X, that is:
[0097] ;
[0098] In the formula, is the covariance between the true value and the predicted value, and are their variances respectively. Extend the time window and observe whether it tends to increase steadily with the increase of the data volume. If its value increases significantly and converges to a relatively high level, it indicates that the candidate areal driving factor Y has an obvious causal effect on the water quality pollutant flux X.
[0099] Step S25: Through two-way causal test, screen out the key areal driving factors with high contribution degrees that affect the pollutant flux.
[0100] Furthermore, if it is necessary to judge the causal direction between the pollutant flux X and the candidate factor Y (X → Y or Y → X), predict the pollutant flux X on the manifold of the candidate areal driving factor Y respectively, and predict the candidate areal driving factor Y on the manifold of the pollutant flux X, and calculate their respective CMS values. If the CMS value of "Y → X" is higher and converges well, it indicates that the candidate areal driving factor Y unidirectionally drives the pollutant flux X; if both are high, there may be a "mutual feedback" relationship.
[0101] Under multiple candidate planar driving factor scenarios, repeat the above process for each candidate factor, and measure its causal contribution to the pollutant flux X using the size of the CMS; screen out the key planar driving factors with higher contribution degrees as the main inputs for non-point source pollution flux estimation and coastal risk identification.
[0102] Step S3: Extract the time information features, explicit spatial features, and implicit spatial features of the key planar driving factors, and use supervised learning to transform and integrate the explicit spatial features and implicit spatial features to generate feature vectors.
[0103] Step S31: Time information features , Use sine and cosine functions to process periodic features and capture seasonal and periodic changes. The encoding is as follows:
[0104] ;
[0105] ;
[0106] In the formula, is the time information in the time series data, which is converted into a periodic numerical representation, and the two-dimensional vector can also reflect the transitional changes during seasonal alternation, capturing the dynamic process of climate change and hydrological change affecting non-point source pollution of water quality.
[0107] The explicit spatial features directly represent the spatial distribution through clear spatial features. For example, the point location longitude and latitude features (spatial location of point source pollution), water body type features. The encoding is as follows:
[0108] Point location longitude and latitude features , Use positive and cosine position encoding to convert the longitude and latitude information of water quality point source pollution data into high-dimensional feature representations. Encoding:
[0109] ;
[0110] In the formula, , are the standardized longitude and latitude; is the dimension index in the encoding vector, d is the total dimension of the encoding (such as 64 or 128), that is, has a value range of [0, d - 1].
[0111] Water body type features , According to the water body type, use unique encoding to convert different water body types into four-dimensional vectors. The encoding is as follows:
[0112] [1, 0, 0, 0] (River), [0, 1, 0, 0] (Lake), [0, 0, 1, 0] (Reservoir), [0, 0, 0, 1] (Drinking Water Source).
[0113] Implicit spatial features indirectly represent spatial laws through features such as depth-correlated planar driving factors. For example, water quality pollution flux, key driving factors, and time information. The self-attention mechanism is used to learn the relationships between different time steps and positions, and then the spatial diffusion law of pollutants is captured.
[0114] Step S32: A time series is essentially a continuous data stream that changes over time and needs to be reorganized into a form containing inputs and outputs. By supervised learning, explicit spatial features (such as longitude and latitude) and implicit spatial features (such as meteorological data) are integrated to construct a multi-dimensional supervision signal.
[0115] By taking the point longitude and latitude features , water body type features , water quality pollution flux features , key driving factor features and time information features in the time series features (such as water quality, hydrology, meteorology) data are aligned in chronological order, and non-time series features (such as land use) are regarded as static features and repeatedly added to each time step. Based on the standardized , input and output vectors are constructed using a time sliding window respectively:
[0116] Input vector , M ∈ [B, T, F], where B is the batch size, that is, the number of time series samples input into the model at one time; T is the time series length, that is, the number of past time steps used for each input sample (i.e., the time step size); F is the feature dimension of each time step, that is, the number of features used for each sample, including water quality pollution flux and driving factors.
[0117] Output vector , if it is a single-point prediction and the target is the data at a future time point, then , is the predicted feature dimension (quantity); if it is a multi-step prediction and the target is a sequence for a future period of time, then , is the predicted time step size.
[0118] Step S4: Input the feature vector into the trained Trans-GRU coupling model to output the predicted value of the non-point source pollutant flux. Among them, the trained Trans-GRU coupling model respectively uses the Transformer Encode branch and the GRU gated unit branch to calculate the feature vector layer by layer, and outputs the Transformer branch feature and the GRU branch feature. By weighting and coupling the Transformer branch feature and the GRU branch feature, the non-point source pollution flux prediction value is output through the prediction layer.
[0119] Among them, in the construction process of the Trans-GRU coupling model, first, a feature vector M containing information such as water quality, hydrology, and meteorology is used as the input, and the water quality non-point source pollution flux data is used as the output to construct an initialized pollutant emission estimation model. The mean square error is used as the loss function, and the loss function is optimized through backpropagation and gradient descent to update the model parameters. Among them, the loss function is used to measure the error between the estimated value and the measured value. By optimizing the model parameters, the model estimated value is made as close as possible to the measured value. Therefore, the mean square error (MSE) is used as the loss function:
[0120] ;
[0121] In the formula, is the estimated value of the water quality pollution flux of the i-th sample, is the measured value of the water quality pollution flux of the i-th sample. The key to the optimization process is to calculate the gradient of the loss function for each layer through backpropagation and update the model parameters using gradient descent.
[0122] Secondly, traverse all hyperparameters through the grid search algorithm and select the optimal hyperparameter combination. The hyperparameters that need to be calibrated for the coupling model include: the number of stacked layers, the number of GRU gated units, the number of attention heads, the number of hidden units, and the learning rate. Traverse all hyperparameters based on the grid search algorithm, set reasonable ranges or discrete values, such as the learning rate (1e-3, 1e-4, 1e-5), the number of layers (2, 3, 4), the number of hidden units (64, 128, 256), etc.; for each set of hyperparameters, calculate the average performance index (such as the average MSE or NSE) of each cross-validation; select the hyperparameter combination that performs the best in the cross-validation.
[0123] Thirdly, backpropagation and gradient update are also performed on the constructed Trans-GRU coupling model. Among them, backpropagation calculates the gradient of the loss function with respect to the weight parameters of each layer through the chain rule, that is, the gradient is passed from the prediction layer to each layer, and the model parameters are gradually updated. Therefore, calculate the mean square error gradient:
[0124] ;
[0125] Wherein, is the gradient of the loss function L with respect to the parameter θ; is the derivative of the estimated value of the output water quality non-point source pollution flux with respect to the parameter θ. Transformer Encode branch: Calculate the gradients of the self-attention mechanism and the feed-forward network, and update the corresponding weights. GRU branch: Calculate the gradients of the update gate, reset gate, and candidate hidden state, and update the corresponding weights.
[0126] When updating the model weights, use gradient descent to update the parameters:
[0127] ;
[0128] Wherein, represents the model parameters after the λ-th iterative update, is the learning rate, which controls the step size of each update, usually using . During the iteration, the model parameters are updated along the negative gradient direction of the loss function, gradually approaching the minimum point, so as to minimize the loss function.
[0129] Finally, prevent overfitting by setting the training termination condition to ensure that the model does not lose its generalization ability due to overtraining during the training process. The specific steps are:
[0130] (1) Set the NSE efficiency coefficient (Nash-Sutcliffe Efficiency, NSE) as the monitoring index, which is used to measure the difference between the model prediction value and the measured value. The value of NSE ranges from -∞ to 1, and the closer the value is to 1, the better the prediction performance of the model. The calculation formula is:
[0131] ;
[0132] Wherein, B is the number of samples, is the measured value of the water quality pollution flux of the -th sample, is the corresponding estimated value of the water quality non-point source pollution flux, is the average value of the measured values. NSE > 0.8 indicates that the model has good fitting performance.
[0133] (2) After each epoch, check the NSE index on the validation set. If the performance on the validation set has not improved significantly for several consecutive rounds (e.g., 10 rounds), stop the training, and record the model parameters with the highest NSE as the final weight parameters.
[0134] Furthermore, the K-Fold Cross-Validation method is also used to comprehensively evaluate the prediction performance and generalization ability of the constructed Trans-GRU coupling model. The specific steps are as follows: The dataset is divided into K subsets. Then, in each round, one of the subsets is selected as the validation set, and the remaining K - 1 subsets are used as the training set. The model is trained on the training set and evaluated on the validation set. This process is repeated K times, with a different subset used as the validation set each time. Finally, the average of the K evaluation results is used as the performance evaluation of the model. Assuming the mean squared error (MSE) is used as the evaluation metric, the results of multiple validations are respectively 、 、… , that is, the average MSE is:
[0135] ;
[0136] This method can reduce the accidental impact caused by data partitioning and ensure the reliability of the evaluation results. In addition, appropriate evaluation metrics (such as the R² coefficient of determination, MAE mean absolute error, RMSE root mean square error, MAPE mean absolute percentage error, etc.) can be used to evaluate the performance of the model in the task of estimating non-point source pollution fluxes. The specific metrics are as follows:
[0137] ;
[0138] ;
[0139] ;
[0140] ;
[0141] In the formula, B represents the number of samples, 、 represent the measured value and estimated value of the pollution flux respectively, is the average value of the measured pollution flux. It is applicable to linear regression models and measures the fitting ability of the model. The closer it is to 1, the better the effect. MAE is not sensitive to outliers and is suitable for tasks that require robustness. These metrics comprehensively consider the variance explanatory power ( ), the residual amplitude (MAE and RMSE), and the proportional accuracy (MAPE), thus comprehensively evaluating the performance of the model.
[0142] Step S41, the trained Trans-GRU coupling model uses the Transformer Encode branch to calculate the feature vectors layer by layer and outputs the Transformer branch features.
[0143] Input the feature vector M, and map M from the original dimension F to a new spatial dimension through a linear transformation , and represent the input features in a higher-dimensional space. The encoding is as follows:
[0144]
[0145] where is a trainable weight matrix with dimension F× .
[0146] Add positional encoding to the feature vectors at each time step (i.e., daily, monthly) in the time series, so that the attention mechanism can utilize positional information equivalent to the time order. The encoding is as follows:
[0147] ;
[0148] ;
[0149] ;
[0150] where is the positional encoding at time t, i is the dimension index, i.e., the relative order of the spatial dimensions in the vector, is the dimension of.
[0151] For features such as water quality pollution flux and rainfall at each time step, the weight matrices obtained through training ( , , ) are used to calculate the query (Q), key (K), and value (V) matrices for all time steps:
[0152] , , ;
[0153] where Q represents the query of the current time step to other time steps; K represents the influence of other time steps on the current time step; V represents the actual feature information corresponding to this time step, i.e., each row vector of the V matrix contains the actual feature information after linear transformation for the corresponding time step, i.e., the representation after mapping the measured value or state of this time step.
[0154] Calculate the similarity between Q and K through the self-attention mechanism, and determine the influence weight of each time step with the dot product, i.e., the output of each time step is the weighted sum from other time steps, thereby capturing the global dependencies in the input sequence:
[0155] ;
[0156] In the formula, represents the similarity between different time steps; is the dimension of the key, which is used for scaling to prevent gradient explosion; is used to convert the similarity into a probability distribution to ensure that the attention weights sum to 1.
[0157] The query, key, and value matrices are respectively mapped to H subspaces (attention heads) through the multi-head attention layer of the encoder for parallel computing, understanding the dynamic changes of pollutant emissions from multiple angles. That is, one attention head can focus on the relationship between meteorological characteristics and the water quality non-point source pollution flux, and another head can focus on the relationship between land use types and the water quality non-point source pollution flux. Each head independently captures these relationships and finally fuses them together:
[0158] ;
[0159] ;
[0160] In the formula, represents the relationship between different features and the water quality non-point source pollution flux, is the output linear weight matrix, and H is the number of attention heads. Each head calculates an independent attention weight respectively, combines the results of all heads, and preliminarily obtains the feature representation based on the long-time series relationship information through linear transformation .
[0161] The output of the multi-head attention layer is connected with the input in a residual connection to alleviate the problem of gradient disappearance during training, and is normalized through layer normalization to improve the stability of model training:
[0162] ;
[0163] In the formula, represents the input vector after position encoding, represents the output of the multi-head attention layer. Normalization helps to ensure the stability of the mean and variance of the output and promotes the convergence of the model.
[0164] The feed-forward network FFN is used to help the model learn complex spatio-temporal dependencies, especially how different time and space factors affect the water quality non-point source pollution. It usually consists of two fully connected layers and an activation function:
[0165] ;
[0166] ;
[0167] In the formula, , , , are the weight matrices and bias terms of the first and second fully connected layers, and max( ) is the activation function that performs a non-linear mapping (retaining positive values) on the output value after the first fully connected layer ( ). Then, through residual connection and layer normalization, the stability of the training process is ensured.
[0168] Therefore, the output features of the Transformer Encode branch are the Transformer branch features output after the input vector M iterates through L encoder layers. .
[0169] Step S42. The process of the trained Trans-GRU coupling model using the GRU gated unit branch to calculate the feature vector layer by layer and output the GRU branch features is as follows:
[0170] The input feature M is divided into feature vectors at different time steps , where t = 1, 2,..., T represents the time step. Each contains the water quality pollution flux feature and driving factor feature at the current moment.
[0171] The input feature at the current moment t is controlled by the update gate and the hidden state at the previous moment t - 1 to allocate weights between them. That is, based on the water quality pollution flux feature and driving factor feature at the current moment, as well as the water quality pollution flux feature and driving factor feature at the past moment, it is decided whether to retain the information at the t - 1 moment. The structure is as follows:
[0172] ;
[0173] In the formula, is the output of the update gate, and the output value ranges between [0, 1]. 0 indicates completely forgetting the data information at the past moment, and 1 indicates completely retaining the data information at the past moment; is the Sigmoid activation function that determines the degree of information update, is the weight matrix of the input feature , is the weight matrix of the hidden state at the t - 1 moment, is the bias term of the update gate.
[0174] The influence of the hidden state at the t - 1 moment on the calculation of the candidate hidden state at the current moment t is controlled by the reset gate. That is, it is judged whether some areal driving factors at the t - 1 moment are still meaningful for predicting the water quality pollution flux at the t moment. The structure is as follows:
[0175] ;
[0176] In the formula, is the output of the reset gate, and the output value ranges between [0, 1]. 0 indicates completely forgetting the feature influence at time t - 1, and 1 indicates completely retaining the feature influence at time t - 1.
[0177] Based on the current input features and the reset gate output update the candidate hidden state, which reflects the potential change in the water quality pollution flux at the current time t, and combine the areal driving factors to adjust the estimated value of the water quality non-point source pollution flux:
[0178] ;
[0179] In the formula is the candidate hidden state at the current time t, is the element-wise multiplication, is the hyperbolic tangent function, ensuring that the output is within the range of [-1, 1].
[0180] Through the hidden state at time t - 1 and the candidate hidden state at the current time t a weighted combination is obtained to get the final hidden state:
[0181] ;
[0182] In the formula, is the final hidden state, which will be used as the input for the next time step, and it synthesizes the changes in the current water quality pollution flux, historical pollution data, and the influence of areal driving factors.
[0183] Therefore, the output features of the GRU branch are the at different time steps, which are the GRU branch features output after G iterations of the gated units .
[0184] Step S43, by weighted coupling the Transformer branch features and the GRU branch features, output the predicted value of the non-point source pollution flux through the prediction layer.
[0185] Fuse the Transformer branch features with the GRU branch features to generate a unified feature representation by weighted concatenation:
[0186] ;
[0187] In the formula, is a hyperparameter used to dynamically adjust the weights of the two types of features. The fused features contain both global context information and local temporal dynamic information.
[0188] The model prediction layer uses the fused features output by the splicing layer to perform the final prediction task. The predicted values are calculated through a fully connected layer, and the number of output nodes of this fully connected layer is set to k, and each node corresponds to an estimated value for a future time step:
[0189] ;
[0190] In the formula, is an activation function that is a non-linear activation function taking into account non-negativity, smoothness and differentiability. In this way, the estimated value of the water quality non-point source pollution flux in the corresponding area can be initially obtained .
[0191] Step S5: Perform density clustering and trend test on the predicted values to obtain the emission intensity and emission trend of pollutants, and divide the risk levels according to the emission intensity and emission trend of the pollutants to achieve coastal risk identification and early warning.
[0192] Based on the estimated data of the water quality non-point source pollution flux of pollutant emissions output by the Trans-GRU coupling model carry out spatial clustering work, that is, identify high-emission areas based on spatial density, where each data point corresponds to the non-point source pollution emission flux value at the k-th future time step.
[0193] Combine the pollutant emission flux value of each data point with the spatial coordinate information (such as longitude and latitude) as the input of clustering. According to the neighborhood distance (Eps) and minimum number of points (Min-Pts) parameters, perform density clustering, and the clustering result will identify the high-density areas of pollutant emissions. At the same time, according to the quantization index, the pollution degree of each area is presented to form a density map of pollution sources, which can be used as a preliminary identification of high-emission pollution areas along the coast.
[0194] Carry out trend test work on the estimated data of the water quality non-point source pollution flux in the high-emission areas identified by DBSCAN clustering, that is, identify high-risk areas based on the time change trend.
[0195] Extract the pollutant emission flux values of k time steps in each area as the input of the trend test. For each area, calculate the slope of all possible point pairs, that is, the slope between any two time points, and then take the median of these slopes to obtain β :
[0196] ;
[0197] In the formula, i and j are any two time points, satisfying Judge the pollution emission trend according to the slope β: β>0 indicates an upward trend in pollution emissions, β<0 indicates a downward trend, and β ≈ 0 indicates no significant change. A threshold can also be set to more precisely quantify the pollution emission changes in each region and provide a trend basis for risk assessment.
[0198] Based on the intensity of pollution emissions (DBSCAN clustering results) and the change trend (Theil-Sen trend test results), conduct risk identification and early warning. Divide the regions into the following risk levels: Red early warning, indicating high risk: regions with high emissions and a strong upward trend in pollution emissions; Orange early warning, indicating medium-high risk: regions with high emissions but fluctuating trends; Yellow attention, indicating potential risk: regions with low emissions but a potential upward trend in pollution emissions.
[0199] Based on real-time or predicted pollutant emission flux data, trigger a threshold alarm for high-risk regions, so as to accurately identify high-emission risk regions along the coast.
[0200] Embodiment 2
[0201] This embodiment discloses a non-point source pollutant emission flux prediction and coastal risk identification system;
[0202] As Figure 2 shown, a non-point source pollutant emission flux prediction and coastal risk identification system includes:
[0203] A database construction module, configured to: obtain water pollution data and spatio-temporal auxiliary feature data of the research area, preprocess the data, and construct a water pollution database and a spatio-temporal auxiliary feature database;
[0204] A causal analysis module, configured to: extract candidate areal driving factors based on the spatio-temporal auxiliary feature database, analyze the causal relationship between the candidate areal driving factors and water pollution using the CCM causal analysis model, and screen out key areal driving factors with high contribution degrees;
[0205] A supervised learning module, configured to: extract the time information features, explicit spatial features, and implicit spatial features of the key areal driving factors, and use supervised learning to transform and integrate the explicit spatial features and implicit spatial features to generate feature vectors;
[0206] The non-point source pollutant flux prediction module is configured to: input the feature vector into the trained Trans-GRU coupling model and output the predicted value of the non-point source pollutant flux; wherein, the trained Trans-GRU coupling model respectively uses the Transformer Encode branch and the GRU gated unit branch to perform layer-by-layer calculations on the feature vector, and outputs the Transformer branch feature and the GRU branch feature; by performing weighted coupling on the Transformer branch feature and the GRU branch feature, the predicted value of the non-point source pollution flux is output through the prediction layer.
[0207] The coastal risk identification module is configured to: perform density clustering and trend test on the predicted value to obtain the emission intensity and emission trend of the pollutant, and divide the risk level according to the emission intensity and emission trend of the pollutant, so as to realize coastal risk identification and early warning.
[0208] Embodiment III
[0209] The purpose of this embodiment is to provide a computer-readable storage medium.
[0210] A computer-readable storage medium stores a computer program thereon, and when the program is executed by a processor, it implements the steps in a non-point source pollutant emission flux prediction and coastal risk identification method as described in Embodiment I.
[0211] Embodiment IV
[0212] The purpose of this embodiment is to provide an electronic device.
[0213] An electronic device includes a memory, a processor, and a program stored on the memory and executable on the processor. When the processor executes the program, it implements the steps in a non-point source pollutant emission flux prediction and coastal risk identification method as described in Embodiment I.
[0214] The steps involved in the devices in the above Embodiments II, III, and IV correspond to those in Method Embodiment I. For specific implementation manners, reference may be made to the relevant description part of Embodiment I. The term "computer-readable storage medium" should be understood to include a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode, or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.
[0215] Those skilled in the art should understand that the various modules or steps of the present invention described above can be implemented by a general-purpose computer device. Optionally, they can be implemented by program codes executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.
[0216] Although the specific implementation manners of the present invention have been described above in conjunction with the accompanying drawings, it is not a limitation to the protection scope of the present invention. Those skilled in the art should understand that based on the technical solutions of the present invention, various modifications or deformations that can be made by those skilled in the art without creative efforts are still within the protection scope of the present invention.
Claims
1. A method for predicting the emission flux of non-point source pollutants and identifying coastal risks, characterized in that: include: Acquire water quality pollution data and spatiotemporal auxiliary feature data of the study area, preprocess the data, and build a water quality pollution database and a spatiotemporal auxiliary feature database; Based on the spatiotemporal auxiliary feature database, candidate areal driving factors are extracted, and the causal relationship between candidate areal driving factors and water pollution is analyzed using the CCM causal analysis model to screen out key areal driving factors with high contribution. The specific process is as follows: The time series variables of water pollution flux in the water pollution database and the time series variables of candidate area driving elements in the spatiotemporal auxiliary feature database are extracted respectively, and normalized; According to the delayed embedding principle, the attractor manifolds of water pollution flux and candidate surface driving elements are reconstructed respectively, and the time series manifolds of water pollution flux and candidate surface driving elements are generated; According to the time series manifold of water pollution flux, find the nearest neighbor points and calculate the Euclidean distance, and use weights to measure the similarity between state vectors; Based on the temporal manifold of the candidate areal driving elements, the predicted values of the candidate areal driving elements are calculated, and the causal contribution of the candidate areal driving elements to the pollutant flux is determined by calculating the convergence cross-mapping capability value; Through two-way causal test, the key surface driving factors with high contribution to pollutant flux are screened out; Extract the time information features of key surface driving elements as well as explicit spatial features and implicit spatial features, integrate the explicit spatial features and implicit spatial features using supervised learning transformation, and generate feature vectors; The feature vector is input into the trained Trans-GRU coupling model, and the predicted value of the non-point source pollutant flux is output; wherein the trained Trans-GRU coupling model respectively uses the Transformer Encode branch and the GRU gating unit branch to calculate the feature vector layer by layer, and outputs the Transformer branch features and the GRU branch features; the Transformer branch features and the GRU branch features are weightedly coupled, and the predicted value of the non-point source pollution flux is output through the prediction layer; Density clustering and trend testing are performed on the predicted values to obtain the emission intensity and emission trend of pollutants, and risk levels are divided according to the emission intensity and emission trend of pollutants to achieve coastal risk identification and early warning.
2. A method for predicting non-point source pollutant emission flux and identifying coastal risks according to claim 1, characterized in that: The pretreatment process includes: Remove outliers from water pollution data and spatiotemporal auxiliary feature data, and use interpolation or neighboring values to fill in missing values in the data; Align water pollution data and spatiotemporal auxiliary feature data in time and space to unify time granularity and spatial resolution; Water pollution data and spatiotemporal auxiliary characteristic data are standardized to ensure the consistency of dimensions of different data.
3. The method for predicting non-point source pollutant emission flux and identifying coastal risks according to claim 1, characterized in that: The explicit spatial features include point longitude and latitude features and water body type features; the implicit spatial features include water pollution flux features, key driving factor features, and time information features.
4. The method for predicting non-point source pollutant emission flux and identifying coastal risks according to claim 1, characterized in that: The trained Trans-GRU coupling model uses the Transformer Encode branch to calculate the feature vector layer by layer, and the process of outputting the Transformer branch features is as follows: A linear transformation is used to map the feature vector from the original dimension to a new spatial dimension, representing the input features in a higher-dimensional space; Add position encoding to the feature vector of each time step in the time series so that the attention mechanism can use position information equivalent to time order; The encoder computes the query matrix, key matrix, and value matrix of the feature vector at each time step; Calculate the attention weights between the current time step and other time steps; The query, key, and value matrices are mapped to different subspaces through a multi-head attention mechanism to obtain feature representation based on long-term temporal relationship information; The feature representation based on long-term temporal relationship information is subjected to residual connection and layer normalization. The temporal and spatial dependencies of water quality non-point source pollution are captured through a feedforward network, and Transformer branch features are output.
5. The method for predicting non-point source pollutant emission flux and identifying coastal risks according to claim 1, characterized in that: The trained Trans-GRU coupling model uses the GRU gated unit branch to calculate the feature vector layer by layer, and the process of outputting the GRU branch features is: Dividing the feature vector into feature vectors at different time steps; The update gate is used to control the weight distribution between the input features at the current moment and the hidden state at the previous moment; the reset gate is used to control the influence of the hidden state at the previous moment on the calculation of the candidate hidden state at the current moment; The candidate hidden state is updated based on the divided feature vector and the reset gate output, and the GRU branch feature is obtained by calculating the weighted combination of the hidden state at the previous moment and the candidate hidden state at the current moment.
6. The method for predicting non-point source pollutant emission flux and identifying coastal risks according to claim 1, characterized in that: The process of performing spatial clustering and trend testing on the predicted values to obtain the emission intensity and emission trend of pollutants is as follows: The pollutant emission flux value of each data point in the predicted value is combined with the spatial coordinate information as the input of clustering. According to the neighborhood distance and minimum point number parameters, density clustering is performed to identify high-density areas of pollutant emission. The pollution level of each area is presented based on quantitative indicators, forming a density map of pollution sources and achieving preliminary identification of high-emission pollution areas along the coast; Extract the pollutant emission flux values of each pollution area at different time steps as the input of trend test; For each region, the slopes between all pairs of time points are calculated and the median is taken. The trend of pollution emissions is determined based on the median slope.
7. A system for predicting the emission flux of non-point source pollutants and identifying coastal risks, characterized by: include: The database construction module is configured to: obtain water quality pollution data and spatiotemporal auxiliary feature data of the study area, and pre-process the data to construct a water quality pollution database and a spatiotemporal auxiliary feature database; The causal analysis module is configured to: extract candidate surface driving factors based on the spatiotemporal auxiliary feature database, analyze the causal relationship between the candidate surface driving factors and water pollution using the CCM causal analysis model, and screen out key surface driving factors with high contribution. The specific process is as follows: The time series variables of water pollution flux in the water pollution database and the time series variables of candidate area driving elements in the spatiotemporal auxiliary feature database are extracted respectively, and normalized; According to the delayed embedding principle, the attractor manifolds of water pollution flux and candidate surface driving elements are reconstructed respectively, and the time series manifolds of water pollution flux and candidate surface driving elements are generated; According to the time series manifold of water pollution flux, find the nearest neighbor points and calculate the Euclidean distance, and use weights to measure the similarity between state vectors; Based on the temporal manifold of the candidate areal driving elements, the predicted values of the candidate areal driving elements are calculated, and the causal contribution of the candidate areal driving elements to the pollutant flux is determined by calculating the convergence cross-mapping capability value; Through two-way causal test, the key surface driving factors with high contribution to pollutant flux are screened out; The supervised learning module is configured to: extract time information features, explicit spatial features and implicit spatial features of key surface driving elements, integrate the explicit spatial features and implicit spatial features using supervised learning transformation, and generate feature vectors; The non-point source pollutant flux prediction module is configured to: input the feature vector into a trained Trans-GRU coupling model, and output a predicted value of the non-point source pollutant flux; wherein the trained Trans-GRU coupling model uses the Transformer Encode branch and the GRU gating unit branch to calculate the feature vector layer by layer, and outputs the Transformer branch feature and the GRU branch feature; and outputs the non-point source pollution flux prediction value through the prediction layer by weighted coupling of the Transformer branch feature and the GRU branch feature; The coastal risk identification module is configured to: perform density clustering and trend testing on the predicted values to obtain the emission intensity and emission trend of pollutants, divide the risk level according to the emission intensity and emission trend of the pollutants, and realize coastal risk identification and early warning.
8. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps in a method for predicting non-point source pollutant emission flux and identifying coastal risks as described in any one of claims 1-6 are implemented.
9. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the method for predicting non-point source pollutant emission flux and identifying coastal risks as described in any one of claims 1-6 are implemented.
Citation Information
Patent Citations
Mobile pollution source emission concentration prediction method based on space-time deep learning
CN109492830A
Water quality prediction method based on graph neural network and spatial-temporal feature fusion
CN119598402A