A monitoring and scarce point water quality prediction and early warning method based on a liquid graph neural network
By constructing a liquid graph neural network, the problem of insufficient data continuity in sparse location water quality prediction is solved, achieving higher prediction accuracy and generalization ability, and is suitable for water quality early warning in sparse monitoring networks.
Patent Information
- Application Number
- CN202510518993.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-04-24
AI Technical Summary
Existing machine learning algorithms suffer from data continuity issues in water quality prediction in sparse areas of monitoring networks, resulting in poor prediction accuracy and making it difficult to meet the demand for precise water quality early warning in sparse areas.
A method for monitoring scarce water quality early warning based on liquid graph neural network is constructed. By constructing an initial adjacency matrix, degree matrix and feature matrix, and combining dynamic connection weights and real-time hydrological data, hidden state and dynamic adjacency matrix are generated. Liquid differential equation is used to simulate the real-time update of node state, and a mask matrix is introduced for constraint to optimize the neural network model.
It improves the accuracy and generalization ability of water quality prediction in scarce locations, ensures that the prediction results are consistent with the actual migration patterns of pollutants, and has better robustness and physical interpretability.
Smart Images

Figure CN120355032B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of water environment big data, in particular to a monitoring-scarce-point water quality prediction and early warning method based on a liquid graph neural network. BACKGROUND
[0002] Basin water pollution prevention and control is an important guarantee for ensuring regional water environment health. With the continuous enhancement of human activities, cross-regional pollution diffusion and sudden pollution events occur frequently. However, in the sparse monitoring network area, there are monitoring blind spots and data continuity problems, and traditional methods are difficult to capture the deterioration of water quality in the basin in a timely manner. Therefore, it is urgent to build a water quality prediction model suitable for sparse data points, and to break through the technical bottleneck of hydrological topology and dynamic environment coupling.
[0003] With the deep penetration of artificial intelligence into the field of water environment, data-driven modeling provides a new reliable tool for basin water quality warning. Compared with traditional mechanism models that rely on prior mechanisms and complex parameters, machine learning models can mine the correlation features in the data, and the modeling is flexible and more adaptable. In recent years, it has been widely used in basin water quality prediction, mutation warning and other scenarios. However, existing machine learning algorithms have application limitations in the environment with sparse monitoring network. Under the condition of discontinuous or insufficient monitoring data, related algorithms rely on historical data under static topological constraints for information reasoning, which is easy to cause errors to accumulate between nodes, restrict the robustness and generalization performance of the model, and is difficult to meet the accurate water quality early warning demand under monitoring scarcity. SUMMARY
[0004] The problem to be solved by the present application is that water quality prediction is mostly dependent on high-quality time series data of dense monitoring points, and the representation ability of spatial heterogeneity characteristics such as hydrological topological structure and upstream and downstream correlation response is insufficient, and the spatio-temporal coupling is insufficient in the data-scarce scenario, and the prediction accuracy is poor.
[0005] To solve the above problems, the present application provides a monitoring-scarce-point water quality prediction and early warning method based on a liquid graph neural network, and the liquid graph neural network model is constructed based on the following methods:
[0006] According to the river data, historical hydrological data and hydrological connectivity data of the nodes, the initial connection weight between each pair of adjacent nodes is determined, and the initial adjacency matrix, degree matrix and feature matrix of each node are constructed, wherein each node includes a target site and a surrounding monitoring site, and each pair of adjacent nodes is two nodes having a downstream relationship;
[0007] According to the initial connection weight between each pair of adjacent nodes, real-time hydrological data of each node, determine the dynamic connection weight between each pair of adjacent nodes, according to the feature matrix of each node, the initial adjacency matrix and the dynamic connection weight between each pair of adjacent nodes, generate the comprehensive input of each node to the pre-set liquid differential equation, to output the hidden state of each node;
[0008] According to the hidden state of each node at the last time and the degree matrix, construct a topological channel update network, construct a hydrological channel update network according to the real-time hydrological data, update the initial adjacency matrix according to the topological channel update network and the hydrological channel update network, and introduce a mask matrix through a joint attention mechanism to obtain a dynamic adjacency matrix of each node, wherein the mask matrix is used to mask the inverse flow relationship and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix;
[0009] Input the hidden state of each node at the last time and the dynamic adjacency matrix into an initial neural network model, output the water quality parameter prediction value of each node, and optimize and verify the initial neural network model to obtain a liquid graph neural network model.
[0010] The application provides a monitoring and rare point water quality prediction and early warning method based on a liquid graph neural network.
[0011] The application further provides a liquid graph neural network model construction system, comprising:
[0012] The construction module is used for determining the initial connection weight between each pair of adjacent nodes according to the river data, historical hydrological data and hydrological connection data of the nodes, constructing the initial adjacency matrix, degree matrix and feature matrix of each node, wherein the nodes include target sites and surrounding monitoring sites, and each pair of adjacent nodes are two nodes having a downstream relationship.
[0013] a feature coding module, configured to determine the dynamic connection weight between each pair of adjacent nodes according to the initial connection weight between the nodes and real-time hydrological data of each node, and generate comprehensive input of each node to a preset liquid differential equation according to the feature matrix of each node, the initial adjacency matrix and the dynamic connection weight between each pair of adjacent nodes, to output the hidden state of each node;
[0014] a perception updating module, configured to construct a topological channel updating network according to the hidden state of each node at a previous time and the degree matrix, construct a hydrological channel updating network according to the real-time hydrological data, update the initial adjacency matrix according to the topological channel updating network and the hydrological channel updating network, and introduce a mask matrix through a joint attention mechanism to obtain a dynamic adjacency matrix of each node, wherein the mask matrix is used to mask counterflow relationships and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix;
[0015] an optimization module, configured to input the hidden state of each node at the previous time and the dynamic adjacency matrix into an initial neural network model, output a water quality parameter prediction value of each node, and perform parameter optimization and verification on the initial neural network model to obtain a liquid graph neural network model.
[0016] The construction system of the liquid graph neural network model provided by the application has the beneficial effects of the construction of the liquid graph neural network model, which will not be described here. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 A river basin spatial topological graph is shown in the embodiment of the application;
[0018] Figure 2 A flowchart of the construction method of the liquid graph neural network model in the embodiment of the application is shown;
[0019] Figure 3 A schematic diagram of the liquid neuron-driven spatiotemporal feature dynamic coding mechanism in the embodiment of the application is shown;
[0020] Figure 4 A schematic diagram of the liquid causal perception mechanism in the embodiment of the application is shown;
[0021] Figure 5 An NSE graph of the total nitrogen concentration prediction model based on the liquid graph neural network in the embodiment of the application is shown;
[0022] Figure 6 A comparison graph of the prediction NSE effects of different models in the embodiment of the application is shown.
[0023] Figure 7 A comparison chart of predicted and measured total nitrogen in water quality parameters in the embodiment of the application is shown;
[0024] Figure 8 A structural schematic diagram of a construction system of a liquid graph neural network model in the embodiment of the application is shown;
[0025] Figure 9 A flow schematic diagram of a water quality prediction and early warning method in the embodiment of the application is shown;
[0026] Figure 10 A node influence basked diagram in the embodiment of the application is shown. DETAILED DESCRIPTION
[0027] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0028] It should be noted that the relationship terms such as "first" and "second" and the like in the present application 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 the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0029] In the description of the present specification, the description referring to the terms "embodiment", "one embodiment" and "one implementation" and the like means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or implementation are included in at least one embodiment or implementation of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or implementation. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or implementations in a suitable manner.
[0030] Reference Figure 1 and Figure 2 As shown in the drawings, the embodiment of the present application proposes a monitoring and scarce point water quality prediction and early warning method based on a liquid graph neural network, and the liquid graph neural network model is constructed based on the following methods:
[0031] S100: Multi-source heterogeneous spatio-temporal data fusion and basin spatial topology graph construction, according to the river data, historical hydrological data and hydrological connectivity data of the nodes, the initial connection weight between each pair of adjacent nodes is determined, the initial adjacency matrix, degree matrix and feature matrix of each node are constructed, wherein each node includes a target station and a surrounding monitoring station, and each pair of adjacent nodes is two nodes with a downstream relationship.
[0032] Specifically, the target station is a station with less or missing water quality data. According to the spatial position of the monitoring point, the upstream and downstream flow direction and the river topology relationship, etc., a basin spatial heterogeneous graph is constructed with the surrounding monitoring stations as known nodes, the data sparse point as the target station (to be inverted node) and the hydrological correlation as the edge as shown in Figure 1 Figure 1 1-10 are surrounding monitoring stations, A, B and C are target stations, the spatial relationship of the stations is obtained, such as the geographical position of the nodes, the distance between them and the water flow direction, etc. These information helps to understand the spatial correlation between the stations. In addition, basin characteristic data is also collected, including but not limited to the topography of the basin, land use type, vegetation coverage, etc. These characteristics have important influence on water quality. By integrating these data, comprehensive basic information is provided for subsequent model construction and analysis, that is, the feature matrix of the nodes is constructed. The initial connection weight is used to represent the relationship between the water flow velocity and the distance attenuation coefficient, which directly reflects the weight of information transmission between nodes. Higher initial connection weight means that node j has greater contribution to node i. The initial adjacency matrix represents the adjacent relationship between nodes in the basin spatial heterogeneous graph. Figure 1 The diagonal elements of the degree matrix are the sum of the connection numbers of the corresponding nodes in the adjacency matrix. The above data provides structure and feature information for the liquid neural network, which can be used to construct a liquid graph neural network model.
[0033] S200: Dynamic encoding of spatio-temporal features, according to the initial connection weight between each pair of adjacent nodes, the real-time hydrological data of each node, the dynamic connection weight between each pair of adjacent nodes is determined, according to the feature matrix, the initial adjacency matrix of each node and the dynamic connection weight between each pair of adjacent nodes, the comprehensive input of each node to the preset liquid differential equation is generated, to output the hidden state of each node.
[0034] Specifically, the real-time hydrological data generally includes rainfall and flow rate between nodes and other data, which will affect the connection weight, therefore, the initial connection weight can be updated in combination with the real-time hydrological data to obtain the dynamic connection weight between nodes, in combination with the dynamic connection weight, the feature matrix and the initial adjacency matrix, through the continuous time evolution mechanism of the liquid neuron, the spatial heterogeneity constraint is dynamically fused (that is, the connection weight between nodes is dynamically adjusted in combination with the hydrological parameter, the water quality influence signal of the upstream and downstream nodes is aggregated, the fusion of the spatial heterogeneity constraint is generated, the adjacency matrix is a static matrix which is the basis of spatial heterogeneity, when the model calculates the hidden state of the node, the water quality influence signal from the adjacent nodes, especially the upstream nodes, is aggregated according to the adjacency matrix and the dynamic connection weight, so that the spatial distribution heterogeneity in the basin is embodied at the network structure level, the spatial heterogeneity refers to the difference of the influence of the nodes at different spatial positions on the pollutant transmission embodied in the hidden state generation process by dynamically adjusting the connection weight, combining the static topological structure adjacency matrix and the degree matrix) and the time series feature, that is, the real-time updating process of the node state is simulated by using the liquid differential equation, the connection weight between nodes is dynamically adjusted in combination with the hydrological parameter, the water quality influence signal of the upstream and downstream nodes is aggregated, the spatial heterogeneity constraint and the time dynamic response are fused, and a dynamically updated spatio-temporal feature matrix, that is, the hidden state of each node, is generated, so that the feature caused by data missing is fully expressed.
[0035] S300: Spatio-temporal propagation perception under causal constraint, constructing a topological channel update network according to the hidden state of each node at the last time and the degree matrix, constructing a hydrological channel update network according to the real-time hydrological data, updating the initial adjacency matrix according to the topological channel update network and the hydrological channel update network, and introducing a mask matrix through a joint attention mechanism to obtain a dynamic adjacency matrix of each node, wherein the mask matrix is used to mask the reverse flow relationship and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix.
[0036] Specifically, the dynamic update of the connection weight between nodes driven by the real-time hydrological data (which is essentially the update of the degree matrix), the attention mask which only depends on the historical time and the upstream node is introduced, the physical causal constraint of the pollutant migration is ensured, the future information interference is avoided, and after the fusion of the two, the non-steady state transmission process of the pollutant with the change of the hydrological condition can be simulated, and thus the updated dynamic adjacency matrix is obtained.
[0037] S400: dynamic prediction of multi-objective optimization, input the hidden state of each node at the last time and the dynamic adjacency matrix into an initial neural network model, output the water quality parameter prediction value of each node, and optimize and verify the initial neural network model to obtain a liquid graph neural network model, which is used for water quality prediction and early warning.
[0038] Specifically, the generated hidden state and the updated dynamic adjacency matrix are input as input to perform multi-objective dynamic prediction. The hidden state provides the node itself and its historical feature information, and the dynamic adjacency matrix is used to adjust the weight of information transmission between nodes, so that the feature aggregation is more consistent with the current hydrological environment. The combination of the two ensures that the model optimized and verified considers both the local state of each node and the global spatio-temporal dependence relationship during prediction, thereby effectively improving the prediction accuracy, and the early warning based on multi-objective dynamic prediction is more accurate.
[0039] In practical application, the initial connection weight between each pair of adjacent nodes is determined according to river data, historical hydrological data and hydrological connectivity data of the nodes, the initial adjacency matrix, the degree matrix and the feature matrix of each node are constructed, and structure and feature information are provided for the liquid neural network; through dynamic adjustment of the connection weight, the static topological structure (adjacency matrix, degree matrix) is combined, the real-time updating process of the node state is simulated through a differential equation under the liquid neural network, a dynamically updated space-time feature matrix, that is, the hidden state of each node, is generated, and sufficient expression of the feature caused by data loss is realized; the physical causality constraint of pollutant migration is ensured through the double-channel network, future information interference is avoided, the updated degree matrix is fused, and the updated dynamic adjacency matrix is obtained, so that the non-steady-state transmission process of the pollutant with the change of the hydrological condition can be simulated, finally, the generated hidden state and the updated dynamic adjacency matrix are taken as inputs to perform multi-objective dynamic prediction, since the hidden state provides the historical feature information of the node itself, the spatial distribution heterogeneity in the basin is reflected at the network structure level, and the dynamic adjacency matrix is used to adjust the weight of information transmission between nodes, so that the aggregated feature (hidden state) is more consistent with the current hydrological environment, and the combination of the two guarantees that the constructed liquid graph neural network model considers both the local state of each node and the global space-time dependence relationship during prediction. In summary, through the introduction of the continuous time differential equation and the liquid neuron under the liquid graph neural network, the dynamic evolution and adaptive weight update of the node state are realized, the network structure can be flexibly adjusted relying on real-time hydrological parameters, the problem of insufficient space-time coupling under the condition of data scarcity in the related art is overcome, at the same time, the attention mechanism with physical constraints is embedded in the liquid graph neural network, the lag effect and path dependence of the pollutant are more accurately captured, so that the physical interpretability of the model is improved, and it is ensured that the prediction result is more consistent with the actual migration rule of the pollutant in the data-scarce point. Based on the above characteristics, the model constructed in the embodiment of the application has higher prediction precision and generalization ability at the data-sparse point during monitoring and early warning of the data-scarce water quality prediction, provides a new technical path for basin pollution prediction, and has a significant application prospect.
[0040] As an optional embodiment of the application, the initial connection weight between each pair of adjacent nodes is determined according to river data, historical hydrological data and hydrological connectivity data of the nodes, and the initial adjacency matrix, the degree matrix and the feature matrix of each node are constructed.
[0041] The initial connection weight between each pair of adjacent nodes is determined according to the river distance, river flow rate and river bed permeability coefficient between each pair of adjacent nodes.
[0042] Specifically, the initial connection weight adopts an improved attenuation coefficient formula, ;
[0043] wherein: denotes the initial connection weight; denotes the river distance between node i and j, i is any node, j is any node except i, and it is cyclic, for example, i = 1, j is 2-10, when i = 2, j is 1 and 3-10; denotes the river flow rate, denotes the river bed permeability coefficient.
[0044] According to the river distance between each pair of adjacent nodes, the node average distance of each node, and the distance attenuation coefficient, the initial adjacency matrix of each node is constructed, and the degree matrix of each node is constructed according to the initial adjacency matrix of each node;
[0045] Specifically, the initial adjacency matrix is as follows:
[0046]
[0047] wherein, denotes the initial adjacency matrix, denotes the river distance between node i and j, denotes the average distance between each pair of adjacent nodes of the river basin, and a denotes the distance attenuation index, which is 1.5-2.0, reflecting the diffusion intensity of pollutants with distance. For determination, for example, under the premise of connection relationship, for example, 1km, 5km and 10km respectively, then = (1+5+10) / 3 = 5.33.
[0048] According to the historical hydrological data of each node, the hydrological connection data, the feature matrix of each node is constructed; wherein, the historical hydrological data includes historical meteorological time series data, historical water quality data and vegetation coverage index, the river distance, the river flow rate, the river bed permeability coefficient, the node average distance and the distance attenuation coefficient, the hydrological connection data includes node spatial topology relationship, and the historical water quality data of the target station is generated by the generative adversarial network.
[0049] Specifically, the feature matrix X contains the attributes of each node, such as water quality parameters, meteorological factors, etc. The attributes of each node have 22 dimensions, in which static attributes, dynamic time series, spatial topology, etc. are integrated into multi-dimensional features. The following table 1 gives the detailed contents.
[0050] Table 1:
[0051]
[0052] Based on the adjacency matrix, construct the degree matrix, which is a diagonal matrix, where the diagonal elements are the sum of the connection numbers of the corresponding nodes in the adjacency matrix.
[0053] An example adjacency matrix is shown in Table 2 below.
[0054] Table 2:
[0055] .
[0056] For example, the degree matrix obtained from Table 2 is shown in Table 3 below.
[0057] Table 3:
[0058] .
[0059] In practical application, this embodiment collects historical water quality data, vegetation cover index, and meteorological time-series data from monitoring points within the watershed. The data undergoes preprocessing, including: identifying and deleting erroneous values in each data type; setting reasonable upper and lower thresholds and capping data exceeding these thresholds; filling in missing values using a random forest regression model; performing normalization to eliminate dimensional differences; ensuring consistent time steps for data from each station by downscaling hourly data to daily data and generating a spatiotemporally aligned model input dataset; collecting vegetation cover index and meteorological time-series data from sparse data points (target stations), performing the aforementioned data preprocessing, and using an adversarial network to generate historical water quality auxiliary pseudo-node data, forming a spatiotemporal dataset covering the entire region. This yields a feature matrix, while the generation of the adjacency matrix and degree matrix takes into account dynamic connection weights (including water flow velocity and distance attenuation coefficient).
[0060] like Figure 3 As shown, in an optional embodiment of the present invention, the method is based on the initial connection weight between each pair of adjacent nodes and the real-time hydrological data of each node. Number According to the data, determining the dynamic connection weight between each pair of adjacent nodes includes:
[0061] Based on the real-time hydrological data and learning parameters of each node, a dynamic correction factor is determined between each pair of adjacent nodes. The dynamic correction factor is used to characterize the driving relationship between the linear combination of velocity gradient and rainfall change on the initial connection weight.
[0062] Specifically, the dynamically adjusted correction factor is expressed as follows:
[0063] .
[0064] In the formula:
[0065] : node and node between the nodes at a time moment;
[0066] : hyperbolic tangent function
[0067] : cross-sectional flow velocity, including
[0068] : rainfall intensity
[0069] , : learnable parameter
[0070] : river length from node i to j
[0071] determining the dynamic connection weight between each pair of adjacent nodes according to the initial connection weight and the dynamic correction factor.
[0072] Specifically, the formula is as follows: .
[0073] represents the initial connection weight, represents the dynamic connection weight, which is a quantitative representation of the information transmission strength between nodes in the model, and the connection strength is the weight of the information transmission between nodes. Higher means that the contribution of node j to node i is greater, and the value of the model is higher.
[0074] In actual application, the dynamic adjustment factor drives the change of the dynamic connection weight through the formula of the real-time hydrological response equation , and realizes the mechanism-data hybrid driving of the hydrodynamics principle and machine learning through the linear combination of the flow velocity gradient and the rainfall change. > 0 , indicating that there is accelerated flow, i.e. enhanced pollutant transmission (there is a case of less than 0), and the correction factor increases positively; by to capture the driving force of the rainfall event on the surface runoff, a positive value indicates that the rainfall will enhance the input intensity of the non-point source pollution, thereby ensuring the dynamic update of the dynamic connection weight between each pair of adjacent nodes.
[0075] As an optional embodiment of the present application, the generating of the comprehensive input of each node to the preset liquid differential equation according to the feature matrix of each node, the initial adjacency matrix and the dynamic connection weight between each pair of adjacent nodes to output the hidden state of each node comprises:
[0076] determining an eigenvector of the feature matrix of each of the nodes, and generating a comprehensive input of each of the nodes to a preset liquid differential equation according to the eigenvector and the dynamic connection weight, so as to output the hidden state of each of the nodes;
[0077] wherein the preset liquid differential equation is:
[0078]
[0079]
[0080] representing a node at time , for mapping the node feature to a hidden space; representing a nonlinear activation function, that is, a ReLU function; representing a learnable bias term representing a learnable parameter matrix, which is automatically learned through model training without manual setting, and is used for mapping the feature vector of the node to the hidden space; representing a node at time , the feature vector of the node, representing a dynamic connection weight, representing a feature splicing operation, representing a learnable bias term, representing a time delay, representing the comprehensive input, j representing the node adjacent to the node, representing a set of the nodes adjacent to the node .
[0081] Specifically, the above uses an improved liquid time constant network to design a liquid neuron, uses a liquid differential equation to simulate the real-time updating process of the node state, dynamically adjusts the connection weight between nodes in combination with hydrological parameters, aggregates the water quality influence signals of upstream and downstream nodes, generates a data sparse point space feature matrix (that is, a hidden state matrix of the node, a set of hidden states of all nodes at the current time (or a time sequence)) that integrates spatial heterogeneity constraints (achieved by dynamically adjusting the dynamic connection weight, and the adjacency matrix is a static matrix that is the basis of spatial heterogeneity. When the model calculates the hidden state of the node, it aggregates the water quality influence signals from adjacent nodes (especially upstream nodes) according to the adjacency matrix and the dynamic connection weight, thereby embodying the spatial distribution heterogeneity in the basin at the network structure level) and time dynamic response, and solves the problem of insufficient feature expression caused by data missing.
[0082] In actual application, through the continuous time evolution mechanism of liquid neurons (reflected in the preset liquid differential equation), the spatial topological dependence relationship and the time sequence characteristics can be dynamically fused, the real-time updating process of the node state is simulated by using the liquid differential equation, the original node attribute, the adjacency matrix and the degree matrix and other data are dynamically encoded through the liquid time constant network to generate the hidden state reflecting the space-time characteristics of the nodes, and finally a dynamically updated space-time feature matrix, i.e. the hidden state of each node, is output.
[0083] As an optional embodiment of the application, the topological channel updating network is constructed according to the hidden state of each node at the last moment and the degree matrix, the hydrological channel updating network is constructed according to the real-time hydrological data, the initial adjacency matrix is updated according to the topological channel updating network and the hydrological channel updating network, and the mask matrix is introduced through the joint attention mechanism to obtain a dynamic adjacency matrix, including:
[0084] Based on the hidden state of each node at the last moment, the attention score is determined, the spatial mask matrix and the time mask matrix are constructed, and the spatial mask matrix and the time mask matrix are fused and processed to act on the attention score to obtain joint attention.
[0085] Specifically, the hidden state at the last moment is selected, and the attention score reflects the importance of different elements in the input sequence. In the attention mechanism, the query matrix, the key matrix and the value matrix are all obtained by linear transformation of the hidden state. Then, the dot product of the query and the key is scaled and processed by Softmax to obtain the attention score, and the new hidden state is obtained in combination with the mask matrix.
[0086] The hidden state of each node at the last moment is captured by the graph convolution network, and the topological channel updating network is constructed in combination with the degree matrix. The space-time convolution of the real-time flow field matrix and the turbulence feature matrix is captured by the graph convolution network to construct the hydrological channel updating network, wherein the real-time flow field matrix and the turbulence feature matrix are determined according to the real-time hydrological data.
[0087] Specifically, based on the dynamic updating of the connection weight between nodes driven by real-time hydrological data, the non-steady state transmission process of pollutants with hydrological conditions is simulated, the local flow mutation caused by rainstorm, gate control and other events is captured through the space-time convolution of the flow field and the turbulence feature to construct the hydrological channel network; the propagation mode of the node state is analyzed by using the graph convolution to identify the potential pollution path and construct the topological channel network.
[0088] The topological channel update network and the hydrological channel update network are merged and activated, and the joint attention is fused based on the initial adjacency matrix to obtain a dynamic adjacency matrix of each node.
[0089] Specifically, a dual-channel update network including a hydrological channel network and a topological channel network is constructed, and a joint attention is combined to generate a dynamic adjacency matrix reflecting a real-time system state based on an initial adjacency matrix, so as to provide a more accurate graph structure representation for a prediction and control task in a complex environment, that is, based on dynamic update of a connection weight between nodes driven by real-time hydrological data, a non-steady state transmission process of a pollutant with a change in hydrological conditions is simulated.
[0090] The mask matrix includes a spatial mask matrix and a temporal mask matrix, the spatial mask matrix is used for masking a counterflow relationship in the initial adjacency matrix, and the temporal mask matrix is used for masking future time data in the initial adjacency matrix.
[0091] Specifically, the causal attention mask is designed as follows:
[0092] By using an upper triangular mask matrix , unidirectionality of water flow is forced, counterflow pollution propagation is avoided, and a spatial constraint mask is constructed:
[0093] ;
[0094] In the formula:
[0095] : The spatial mask matrix only allows information flow from upstream to downstream.
[0096] As shown in Figure 4 , a strict causal convolution kernel is used to ensure causality and avoid future data interference, and a temporal constraint mask is defined:
[0097] ;
[0098] In the formula:
[0099] : The temporal mask matrix only uses previous data to update subsequent data.
[0100] The mask mechanism ensures that the model decision complies with the law of water flow dynamics, and can constrain the search space, so that the model training time is shortened.
[0101] As an optional embodiment of the application, the dynamic adjacency matrix is expressed by a formula as follows:
[0102] ;
[0103] In the formula, denotes the dynamic adjacency matrix, denotes the initial adjacency matrix, denotes the activation function, which is used to map the input variable between [0, 1], for normalizing and adjusting the feature weight, which helps to stabilize the training and keep the updated weight within a reasonable range;
[0104] denotes the hydrological channel update network, and ;
[0105] denotes the topological channel update network, and ;
[0106] denotes the graph convolution network, denotes the real-time flow field matrix, which represents the cross-section flow rate of each node at time t, denotes the turbulence feature matrix (which can be represented by three-dimensional eddy viscosity coefficient, reflecting the intensity of river turbulence mixing), denotes the hidden state at the previous time; denotes the degree matrix, which contains the real-time in-degree / out-degree of the node;
[0107] ; wherein, respectively
[0108] denotes the query matrix, the key matrix and the value matrix, and the three are obtained by linear transformation of the hidden state at the previous time, denotes the vector dimension of the key matrix, denotes the spatial mask matrix, denotes the time mask matrix, denotes the normalized exponential function, which is used to convert each element in the input vector into a probability distribution.
[0109] Specifically, Q denotes the query matrix, and the hidden state of the node is input as the query vector; K denotes the key matrix, which represents the historical state of each node or the features of the adjacent nodes it depends on; denotes the value matrix, which contains the node features (hidden state) that can be passed to the target station; denotes the dimension of the key vector, which is used to scale the dot product result; denotes the normalized exponential function, which converts the attention score into a probability distribution, Q (query matrix), which indicates which information the current node i needs to pay attention to, is the query vector obtained after the hidden state of node i is projected; K (key matrix), which indicates which information other nodes j can provide, is the key vector obtained after the hidden state of node j is projected After projection change, the query vector V (value matrix) is obtained, which represents the specific feature information actually transmitted to the target station and comes from the hidden state of node j After After projection change, the query vector Q (query matrix) is obtained. K (key matrix), V (value matrix) are indirectly derived from the hidden state generated in step three, only through different linear changes to realize feature projection, 、 and are the weight matrices of Q, K and V respectively, and the above All belong to the tuning parameters provided by default.
[0110] In summary, by adding the above space mask matrix and time mask matrix to process and act on the attention score, while meeting the requirements of time causality and space unidirectionality (that is, applying causal attention mask to shield reverse flow information and future time information), it is ensured that the model meets the hydrological unidirectionality and time causality, and the priority of information transmission between nodes can be determined according to the space-time characteristics, improve the model training efficiency and the prediction accuracy.
[0111] As an optional embodiment of the present application, the input of the hidden state of each node at the last time and the dynamic adjacency matrix into the initial neural network model, the output of the water quality parameter prediction value of each node, and the parameter optimization and verification of the initial neural network model to obtain the liquid graph neural network model include:
[0112] Based on the water quality parameter prediction value of each node, a loss function is constructed, and based on the loss function and K-fold cross-validation mechanism, the optimal hyperparameters of the initial neural network model are determined to obtain the liquid graph neural network model.
[0113] Specifically, through loss function optimization and training phase space generalization verification: based on the K-fold cross-validation framework (K=10), the regional "leave-one-out" test is performed - in each iteration, 1 known surrounding monitoring station (stations 1-10) is shielded, and the remaining K-1 stations are used to train the model based on the topological relationship and historical data. When the accuracy of cross-validation meets the preset accuracy, the pollutant concentration time series of the shielded point is predicted, and the Nash-Sutcliffe efficiency coefficient (Nash-Sutcliffe Efficiency, NSE) is calculated. This process traverses all surrounding monitoring points, and finally the NSE of each node is obtained, as shown in the circle part of Figure 5 .
[0114] Subsequent prediction verification of target sites (i.e. rare sites): after obtaining the optimal model parameters, input the initial adjacency matrix, degree matrix and feature matrix for A, B and C three data rare sites (only ≤5% time steps of measured data for each site) not participating in training, output the water quality parameter prediction value of each day in the future 7 days, and then compare the prediction value with the sparse historical measured data to obtain the NSE of A, B and C three data rare sites, see Figure 5 the part of the triangle.
[0115] Figure 6 The prediction NSE effect comparison chart of different models shows that, by comparing the random forest, long short-term memory network, graph neural network and liquid neural network in the application, it can be found from Figure 6 that the prediction efficiency of the technical solution in the liquid neural network in the application is the highest.
[0116] Figure 7 The prediction water quality parameter total nitrogen and measured effect comparison is given, and from Figure 7 it can be seen that the prediction and effect comparison of the technical solution in the application based on the liquid neural network, most of the prediction values follow the measured values, which shows the accuracy of the prediction of the application.
[0117] As an optional embodiment of the application, the loss function is:
[0118] ; wherein, the total loss function represents an index for measuring prediction error and regularization effect, N represents the number of nodes adjacent to the node set at the current time, represents the water quality parameter prediction value, represents the water quality parameter measured value, represents the optimal hyperparameter, L represents the graph Laplacian matrix, which is used to quantify the structure information between nodes in the graph, and constrain the spatial smoothness of adjacent node prediction values, represents the matrix composed of the water quality parameter prediction values of each node, represents the sum of all elements on the diagonal of the matrix, represents the graph Laplacian regularization term.
[0119] In combination with the foregoing K-fold cross-validation framework, each time one fold is taken as the validation set and the other K-1 folds are taken as the training set, K times of loss evaluation are obtained through repeated training and validation, and finally the hyperparameters and model parameters that make the average value of L minimum are selected to determine the optimal model. For example, the node numbers are 1 to 10, the first time, nodes 1-9 are taken as the training set and node 10 is taken as the validation set; the second time, nodes 2-10 are taken as the training set and node 1 is taken as the validation set, and so on. After repeating the validation for 10 times, each node will be taken as the validation set once, and 10 validation values and NSEs are obtained. The average of the 10 results is taken as the overall performance indicator of the current model and hyperparameter configuration. By comparing the average validation loss under different hyperparameters, the hyperparameter configuration that makes the value of the validation loss minimum is selected to determine the optimal model.
[0120] Specifically, the multi-objective loss function can be used to optimize the prediction accuracy of the model and the spatial gradient consistency of the constrained hydrological topology. The mean square error can quantify the deviation between the predicted value and the measured value of the model, ensuring the fitting ability of the model to historical water quality data (such as pH, dissolved oxygen, etc.). The graph Laplacian matrix is constructed based on the static topology adjacency matrix of the basin, and the spatial gradient consistency of the predicted value matrix is constrained to force the prediction results of adjacent nodes (i.e., monitoring sites with direct hydrological connectivity) to meet the continuity rule of pollutant diffusion. Cross-validation of hyperparameters is used to balance the weight of data fitting and physical constraints, and to enhance the generalization ability of the model in complex hydrological scenarios. This loss function significantly improves the prediction reliability of data-scarce sites by combining data-driven and mechanism modeling, and provides a theoretical guarantee for the generation of spatiotemporal confidence interval warning signals.
[0121] As shown in Figure 9 , the method for monitoring water quality prediction and early warning of data-scarce sites based on a liquid graph neural network further comprises: inputting the initial adjacency matrix, degree matrix and feature matrix of the target site into the liquid graph neural network model constructed by the method for monitoring water quality prediction and early warning of data-scarce sites based on a liquid graph neural network, and outputting the water quality parameter prediction value of the target site; specifically, the initial adjacency matrix, degree matrix and feature matrix of the target site are inputted into the constructed liquid graph neural network model, the target site is a data-scarce site, and its water quality data is scarce. Auxiliary pseudo-node data of historical water quality can be generated through a generative adversarial network, and then the corresponding feature matrix can be generated. Through the trained liquid graph neural network model, the water quality parameter prediction value can be determined.
[0122] The liquid graph neural network model, the initial adjacency matrix of each node, the degree matrix, the feature matrix, and the water quality parameter prediction value of the target station are analyzed to determine the contribution of the surrounding monitoring stations and real-time hydrological data to the water quality parameter prediction value of the target station, and an early warning is performed based on the water quality parameter prediction value of the target station; based on a graph structure explanation tool, the pollution key nodes and driving elements are quantitatively explained; specifically, after the liquid graph neural network model constructed by the liquid neural network is input with the codes of the related model and the water quality parameter prediction value, the explanation is performed by the analysis tool, for example, the graph structure explanation tool GNNExplainer, the contribution of each node and edge to the prediction is calculated, the key upstream nodes of the pollution are reversely located, the target stations to be explained are set as A, B and C three data-scarce stations, the importance scores of the edges and nodes are obtained respectively, and it is analyzed which monitoring stations (1-10) have the highest contribution to the water quality prediction of the data-scarce point, and the important edge and node contribution degrees are given, as shown in Figure 10 By combining the land use type (city, forest, industry, etc.), upstream input flux, river length, total nitrogen amount and other environmental variables, it can be further explained why some features have high contribution to the prediction values of A, B and C.
[0123] Figure 10 The explanation of the surrounding monitoring stations to the target stations is shown in FIG. 8, the left side is the 1-10 surrounding monitoring stations, the right side is the A, B and C target stations, the thicker the line is, the greater the contribution of the monitoring station to the water quality prediction of the target station is, and the thinner the line is, the smaller the contribution is. It can be seen that when the hydrological distance is closer and the position is directly or indirectly upstream, the line is usually thicker, indicating that the nearby and upstream stations in the basin have higher prediction contribution to the data-scarce point. Therefore, when the water quality parameter prediction value of the target station exceeds the early warning value, the monitoring stations with a contribution value exceeding the preset value (corresponding to the preset line thickness) are warned to improve the water quality of the corresponding target station downstream. The early warning value is set according to which water quality category (I to V) the target station belongs to in the “Surface Water Environmental Quality Standard”, and different water quality indicators are set. For example, if the target station is a class III water body (mainly applicable to centralized drinking water surface water source protection area, fish and shrimp overwintering site, migratory channel, aquaculture area and swimming area), the permanganate index of the target station is less than or equal to 6 mg / L, and the early warning value of the permanganate index of the target station is set to 6 mg / L.
[0124] As shown in Figure 8 The application also provides a liquid graph neural network model construction system 200, which comprises:
[0125] The construction module 210 is configured to determine an initial connection weight between each pair of adjacent nodes according to river data, historical hydrological data and hydrological connectivity data of the nodes, construct an initial adjacency matrix, a degree matrix and a feature matrix of each node, wherein each node includes a target station and the peripheral monitoring station, and each pair of adjacent nodes are two nodes having a downstream relationship.
[0126] The feature encoding module 220 is configured to determine the dynamic connection weight between each pair of adjacent nodes according to the initial connection weight between each pair of adjacent nodes and real-time hydrological data of each node, generate a comprehensive input of each node to a preset liquid differential equation according to the feature matrix, the initial adjacency matrix of each node and the dynamic connection weight between each pair of adjacent nodes, and output the hidden state of each node.
[0127] The perception updating module 230 is configured to construct a topological channel updating network according to the hidden state of each node at a previous time and the degree matrix, construct a hydrological channel updating network according to the real-time hydrological data, update the initial adjacency matrix according to the topological channel updating network and the hydrological channel updating network, and obtain a dynamic adjacency matrix of each node by introducing a mask matrix through a joint attention mechanism, wherein the mask matrix is used to mask the inverse flow relationship and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix.
[0128] The optimization module 240 is configured to input the hidden state of each node at the previous time and the dynamic adjacency matrix into an initial neural network model, output a water quality parameter prediction value of each node, and perform parameter optimization and verification on the initial neural network model to obtain a liquid graph neural network model.
[0129] Specifically, the specific embodiments of the present embodiment can refer to the foregoing construction method of the corresponding liquid graph neural network model, which will not be described here.
[0130] The above is only a specific embodiment of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A liquid graph neural network-based monitoring of water quality of scarce point prediction and early warning method, characterized in that, The liquid graph neural network model is constructed based on the following method: According to the river data, historical hydrological data and hydrological connectivity data of nodes, determine the initial connection weight between each pair of adjacent nodes, construct the initial adjacency matrix, degree matrix and feature matrix of each node, wherein each node includes a target site and a surrounding monitoring site, and each pair of adjacent nodes are two nodes with a downstream relationship; According to the initial connection weight between each pair of adjacent nodes, the real-time hydrological data of each node, determine the dynamic connection weight between each pair of adjacent nodes, according to the feature matrix, the initial adjacency matrix of each node and the dynamic connection weight between each pair of adjacent nodes, generate the comprehensive input of each node in the preset liquid differential equation, to output the hidden state of each node; According to the hidden state of each node at the last time and the degree matrix, construct a topological channel update network, construct a hydrological channel update network according to the real-time hydrological data, update the initial adjacency matrix according to the topological channel update network and the hydrological channel update network, and introduce a mask matrix through a joint attention mechanism to obtain the dynamic adjacency matrix of each node, wherein the mask matrix is used to mask the inverse flow relationship and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix. The hidden state of each node at the last time and the dynamic adjacency matrix are input into an initial neural network model, and the water quality parameter prediction value of each node is output, and the initial neural network model is parameter optimized and verified to obtain a liquid graph neural network model.
2. The method of claim 1, wherein the method is based on a liquid graph neural network. The initial connection weight between each pair of adjacent nodes is determined according to the river data, historical hydrological data and hydrological connectivity data of nodes, and the initial adjacency matrix, degree matrix and feature matrix of each node are constructed, wherein each node includes a target site and a surrounding monitoring site, and each pair of adjacent nodes are two nodes with a downstream relationship. According to the river distance, river flow rate and river bed permeability coefficient between each pair of adjacent nodes, the initial connection weight between each pair of adjacent nodes is determined. According to the river distance, node average distance and distance attenuation coefficient between each pair of adjacent nodes, the initial adjacency matrix of each node is constructed, and the degree matrix of each node is constructed according to the initial adjacency matrix of each node. According to the historical hydrological data and hydrological connectivity data of each node, the feature matrix of each node is constructed. The historical hydrological data includes historical meteorological time series data, historical water quality data and vegetation coverage index, the river data includes river distance, river flow rate, river bed permeability coefficient, node average distance and distance attenuation coefficient, the hydrological connectivity data includes node spatial topological relationship, and the historical water quality data of the target site is generated by a generative adversarial network.
3. The method of claim 1, wherein the method is based on a liquid graph neural network. The determining the dynamic connection weight between each pair of adjacent nodes according to the initial connection weight between the nodes, and real-time hydrological data of each node comprises: According to the real-time hydrological data of each node and the learning parameter, a dynamic correction factor between each pair of adjacent nodes is determined, and the dynamic correction factor is used to represent a driving relationship of a linear combination of a flow gradient and rainfall variation on the initial connection weight; According to the initial connection weight and the dynamic correction factor, the dynamic connection weight between each pair of adjacent nodes is determined.
4. The method of claim 3, wherein the method is characterized by, The generating the comprehensive input of each node to the preset liquid differential equation according to the feature matrix of each node, the initial adjacency matrix, and the dynamic connection weight between each pair of adjacent nodes, and outputting the hidden state of each node comprises: The feature vector of the feature matrix of each node is determined, and the comprehensive input of each node to the preset liquid differential equation is generated according to the feature vector and the dynamic connection weight, so as to output the hidden state of each node. The preset liquid differential equation is: ; denote a node at time , a hidden state, denote a nonlinear activation function, denote a learnable bias term denote a learnable parameter matrix, denote a node at time , the feature vector, denote a dynamic connection weight, denote a feature concatenation operation, denote a time delay, denote the integrated input, j denotes the node adjacent to node denote a set of the nodes adjacent to node 5. The method according to claim 3 or 4, wherein, The constructing a topology channel update network according to the hidden state of each node at the last moment and the degree matrix, constructing a hydrological channel update network according to the real-time hydrological data, updating the initial adjacency matrix according to the topology channel update network and the hydrological channel update network, and introducing a mask matrix through a joint attention mechanism to obtain a dynamic adjacency matrix comprises: Based on the hidden state of each node at the last moment, an attention score is determined, a spatial mask matrix and a time mask matrix are constructed, and the spatial mask matrix and the time mask matrix are fused and processed to act on the attention score to obtain joint attention; The hidden state of each node at the last moment is captured through a graph convolution network, and the topology channel update network is constructed in combination with the degree matrix. The spatial convolution of the real-time flow field matrix and the turbulence feature matrix is captured through the graph convolution network, and the hydrological channel update network is constructed, wherein the real-time flow field matrix and the turbulence feature matrix are determined according to the real-time hydrological data; The topology channel update network and the hydrological channel update network are merged and activated, and the joint attention is fused based on the initial adjacency matrix to obtain the dynamic adjacency matrix of each node. The mask matrix comprises the spatial mask matrix and the time mask matrix, the spatial mask matrix is used to mask the counterflow relationship in the initial adjacency matrix, and the time mask matrix is used to mask the future time data in the initial adjacency matrix.
6. The method of claim 5, wherein the method is based on a liquid graph neural network. The dynamic adjacency matrix is represented by a formula as follows: ; wherein, denotes the dynamic adjacency matrix, denotes the initial adjacency matrix, denotes an activation function; representing the hydrological channel update network, and ; representing the topology tunnel update network, and ; denotes the graph convolution network, denotes the real-time flow velocity field matrix, denotes the turbulence feature matrix, denotes the hidden state of the previous time, denotes the degree matrix; ; denote the query matrix, the key matrix and the value matrix, respectively, and are derived from the hidden state at the previous time step by linear transformations, denotes the vector dimension of the key matrix, denotes the spatial mask matrix, denotes the temporal mask matrix, denotes the normalized exponential function.
7. The method of claim 5, wherein the method is characterized by, The inputting the hidden state of each node at the last moment and the dynamic adjacency matrix into an initial neural network model, outputting the water quality parameter prediction value of each node, and optimizing and verifying the initial neural network model to obtain a liquid graph neural network model comprises: Based on the water quality parameter prediction value of each node, a loss function is constructed, and based on the loss function and a K-fold cross-validation mechanism, optimal hyperparameters of the initial neural network model are determined to obtain the liquid graph neural network model.
8. The method of claim 7, wherein the method is based on a liquid graph neural network. The loss function is: ; wherein, represents a total loss function, N represents a node a set of nodes adjacent to the current time point, represents a predicted value of the water quality parameter, represents a measured value of the water quality parameter, represents an optimal hyperparameter, L represents a graph Laplacian matrix, represents a matrix composed of predicted values of the water quality parameter of each node, represents a sum of all elements on the diagonal of the matrix, represents a graph Laplacian regularization term.
9. The liquid-graph neural network-based monitoring and rare point water quality prediction and early warning method according to any one of claims 1-4, characterized in that, Also includes: The initial adjacency matrix, degree matrix and feature matrix of the target site are input into the liquid graph neural network model, and the water quality parameter prediction value of the target site is output. The liquid graph neural network model, the initial adjacency matrix, the degree matrix, the feature matrix of each node and the water quality parameter prediction value of the target site are analyzed to determine the contribution of the surrounding monitoring stations and real-time hydrological data to the water quality parameter prediction value of the target site, and a warning is given based on the water quality parameter prediction value of the target site. 10.A system for constructing a liquid graph neural network model, comprising: The application of the liquid graph neural network-based monitoring and prediction method for water quality prediction and warning of scarce sites according to any one of claims 1-9, comprising: The construction module is used to determine the initial connection weight between each pair of adjacent nodes according to the river data, historical hydrological data and hydrological connection data of the nodes, and to construct the initial adjacency matrix, degree matrix and feature matrix of each node, wherein each node includes a target site and a surrounding monitoring station, and each pair of adjacent nodes is two nodes having a downstream relationship. The feature encoding module is used to determine the dynamic connection weight between each pair of adjacent nodes according to the initial connection weight between each pair of adjacent nodes and the real-time hydrological data of each node, and to generate a comprehensive input of each node to a preset liquid differential equation according to the feature matrix, the initial adjacency matrix of each node and the dynamic connection weight between each pair of adjacent nodes, so as to output the hidden state of each node. The perception updating module is used to construct a topological channel updating network according to the hidden state of each node at the previous time and the degree matrix, to construct a hydrological channel updating network according to the real-time hydrological data, and to update the initial adjacency matrix according to the topological channel updating network and the hydrological channel updating network, and to introduce a mask matrix through a joint attention mechanism to obtain a dynamic adjacency matrix of each node, wherein the mask matrix is used to mask the inverse flow relationship and future time data in the initial adjacency matrix, and the degree matrix is updated based on the update of the initial adjacency matrix. The optimization module is used to input the hidden state of each node at the previous time and the dynamic adjacency matrix into an initial neural network model, output the water quality parameter prediction value of each node, and optimize and verify the initial neural network model to obtain a liquid graph neural network model.
Citation Information
Patent Citations
Basin multi-site water quality space-time prediction method based on space-time diagram convolutional network
CN118940886A
Water quality prediction method based on graph neural network and spatial-temporal feature fusion
CN119598402A