Linear equation set of diffusion equation diagram neural network model, F-GNN method and system

By introducing a linear equation system method of diffusion equation graph neural network model into the water quality prediction model, combining the spatiotemporal graph and the temporal feature expansion module, the diffusion equation constraints are embedded, and the existing model's shortcomings in spatiotemporal joint modeling and small sample prediction are solved, and more efficient and reliable water quality prediction is achieved.

CN119918403AActive Publication Date: 2025-05-02SHANGHAI JIAOTONG UNIV +2

Patent Information

Application Number
CN202411981945.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-02
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

The existing water quality prediction models have shortcomings in joint spatial and temporal modeling and data-driven prediction, especially in small samples, which are prone to overfitting problems and lack physical constraints, which affect the prediction accuracy and reliability.

Method used

A linear equation system method for diffusion equation graph neural network model for water quality prediction is proposed. By collecting historical data, the space-time graph is constructed, the diffusion equation calculation formula is calculated using the finite difference method, the super-fixed linear equation system is constructed and the parameters are estimated by the least squares method. Combining the graph neural network and the time feature expansion module, diffusion equation constraints are embedded to improve prediction capabilities.

Benefits of technology

It effectively solves the shortcomings of existing models in space-time joint modeling and small sample prediction, improves prediction accuracy and reliability, is suitable for a variety of environmental monitoring scenarios, and enhances the physical interpretability and generalization capabilities of the model by introducing physical constraints.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918403A_ABST
    Figure CN119918403A_ABST
Patent Text Reader

Abstract

The invention provides a linear equation set of a diffusion equation diagram neural network model for water quality prediction, an F-GNN method and a system, and the F-GNN method comprises the steps: S1, collecting the monitoring historical data of each station, and constructing a space-time diagram; s2, on the basis of the space-time diagram, calculating a diffusion equation calculation formula by adopting a finite difference method, constructing an overdetermined linear equation set according to the diffusion equation calculation formula, and estimating parameters of the diffusion equation of each river reach by applying a least square method; and S3, if the parameters of the diffusion equation of each river reach are positive numbers, performing F-GNN prediction to obtain feature prediction of each station. According to the method, the defect that a water quality prediction model lacks space-time joint modeling is overcome, the problem that a traditional data driving model is prone to overfitting under the small sample condition is solved, diffusion equation constraints are introduced, the defect is effectively overcome, meanwhile, physical constraints are introduced, prediction precision and reliability are improved, and the method is suitable for large-scale popularization and application. The method is suitable for various environment monitoring scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart water conservancy, and in particular to a linear equation group, F-GNN method and system of a diffusion equation graph neural network model for water quality prediction. Background Art

[0002] In the field of water resources management and environmental protection, water quality prediction plays a pivotal role. Accurate water quality prediction can provide a scientific basis for water supply decision-making and effectively avoid the potential threat of sudden pollution incidents to human health. At the same time, by understanding the trend of water quality changes and mastering the law of pollution diffusion, it can also provide key data support for watershed management, ecological restoration and other work (such as pollution source control and purification project optimization).

[0003] However, water quality prediction is an extremely challenging multidisciplinary task. First of all, the complexity of multidimensional heterogeneous data is a problem. Water quality data involves a variety of indicators, such as pH, dissolved oxygen, heavy metal content, etc. These data come from a wide range of sources and in various formats, making them difficult to integrate and analyze. Secondly, it is difficult to accurately model spatiotemporal dependencies. Changes in water quality not only evolve dynamically over time, but are also closely related to geographical location. How to accurately capture this complex spatiotemporal correlation in the model is a challenge. Furthermore, data scarcity and noise interference also pose huge obstacles to water quality prediction. Limited monitoring data can hardly fully reflect the true situation of water quality, and the presence of noise further reduces the quality and reliability of the data.

[0004] At present, water quality prediction methods are mainly divided into mechanism methods (that is, physical modeling) and non-mechanism methods (including machine learning and deep learning). The mechanism method is based on the law of water quality diffusion, chemical reaction processes and physical conservation laws, and describes the migration, transformation and diffusion behavior of pollutants in water bodies by constructing mathematical models such as partial differential equations. This method has strong scientific explanatory power and generalization ability, but it is highly dependent on parameters, the calculation process is complex, and it is subject to many limitations in practical applications. The non-mechanism method is a data-driven modeling method that mines the relationship between water quality indicators through learning from historical monitoring data, and then realizes prediction. This method performs well in automation, real-time and flexibility, but is obviously restricted by data quality and scale, and has deficiencies in physical explanatory power and generalization ability.

[0005] Through searching patent documents, it was found that the invention patent with publication number CN117744494A discloses a river water quality intelligent simulation method based on a non-embedded modal decomposition algorithm, including: collecting basic data of the target river; building a model based on the basic data based on the NS equation, mass conservation equation, momentum equation and pollutant transport and diffusion equation, and simulating and calculating to obtain the two-dimensional concentration field data of the river plane; post-processing the model and exporting a txt format file; using a programming language to process the two-dimensional concentration field data of the river plane into concentration field time series snapshot data; using a programming language to establish a SPOD modal decomposition model, decompose the concentration field time series snapshot data, and perform weighted oblique projection on the original data to construct a SPOD latent space to obtain a historical expansion coefficient matrix; predicting the future expansion coefficient matrix based on the historical expansion coefficient matrix, and predicting the concentration field at future moments. This patent is based on traditional equations and modal decomposition methods, and lacks in integrating multi-dimensional information to build a model.

[0006] In summary, in response to the above-mentioned problems of the prior art, studying a set of linear equations, F-GNN method and system of the diffusion equation graph neural network model for water quality prediction has become a key task that needs to be solved urgently. Summary of the invention

[0007] In view of the defects in the prior art, the purpose of the present invention is to provide a linear equation group, F-GNN method and system of a diffusion equation graph neural network model for water quality prediction.

[0008] According to the present invention, a linear equation system method of a diffusion equation graphical neural network model for water quality prediction includes the following steps:

[0009] Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, construct an adjacency matrix between sites, and then construct a spatiotemporal graph;

[0010] Step S2, based on the space-time graph, a finite difference method is used to calculate a diffusion equation, an overdetermined linear equation system is constructed according to the diffusion equation, and then the least square method is used to estimate the parameters of the overdetermined linear equation system for subsequent prediction;

[0011] Step S3, substituting the estimated parameters into the diffusion equation to obtain the predicted values.

[0012] Preferably, step S1 includes: collecting each section P of the past s days i Historical data monitored X t-s:t Based on historical data, the spatial relationship between upstream and downstream sections is clarified. Based on the spatial relationship, the adjacency matrix A is introduced to represent the topological relationship between sections. t-s:t , thus constructing a space-time graph, which is represented by G t-s:t =(Xt-s:t ,E,A t-s:t ) is represented by E, where E is the edge set.

[0013] Preferably, step S2 includes the following sub-steps:

[0014] Step S2.1, based on the space-time graph, all sites are constructed into a topological graph, and for each site at each time, the first-order derivative and the second-order derivative in the diffusion equation are calculated according to the finite difference method on the graph structure, so as to construct the calculation formula of the diffusion equation;

[0015] Step S2.2, for each site, multiple diffusion equations are calculated based on different times to form an overdetermined linear equation group, that is, each site obtains a set of overdetermined linear equations, and then the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed by the diffusion equation calculation formula.

[0016] Preferably, in step S2.1, on a specific structure in a one-dimensional plane, the diffusion equation of the site is calculated as follows:

[0017]

[0018] Where X1, X2, and X3 are the concentrations of each site at time t, and d1 and d2 are the distances between the sites;

[0019] By definition, the first-order derivative of a site's characteristic concentration is related to the site's in-degree site, and the second-order derivative involves both the in-degree site and the out-degree site;

[0020] The calculation method is extended from the one-dimensional plane to the graph structure. Under the graph structure, the diffusion equation of any site is calculated as:

[0021]

[0022] Among them, u i,j represents the average longitudinal diffusion coefficient of the river between the in-degree node j and the out-degree node i, k j represents the average flow rate from in-degree node j to the current node, d i Indicates the distance between the out-degree node i and the current node, d j Represents the distance between in-degree node j and the current node.

[0023] Preferably, in step S2.2, based on the diffusion equation calculation formula, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as:

[0024] A·x=b (5)

[0025] Among them, A is a matrix containing the calculation results of the first-order and second-order derivatives of concentration at all times, with a size of T×3, x is the parameter vector, and b is the result vector of T times; the overdetermined linear equations are calculated by the least squares method, and the parameter values ​​obtained are the parameters of the diffusion equation of each river section, that is, x=(A T A) -1 A T b.

[0026] The present invention also provides an F-GNN method for a diffusion equation graph neural network model for water quality prediction, comprising the following steps:

[0027] Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, construct an adjacency matrix between sites, and then construct a spatiotemporal graph;

[0028] Step S2, based on the space-time graph, a finite difference method is used to calculate a diffusion equation, an overdetermined linear equation system is constructed according to the diffusion equation, and then the least square method is used to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation of each river section;

[0029] Step S3: If the parameters of the diffusion equation of each river section are all positive, F-GNN prediction is performed to obtain the characteristic prediction of each station.

[0030] Preferably, F-GNN prediction includes the following sub-steps:

[0031] Step S3.1, embed the calculation method of the diffusion equation into the GNN model to construct a new GNN model;

[0032] In step S3.2, the historical data of each site and the constructed adjacency matrix are input into the new GNN model to obtain the prediction results of the characteristics of each site.

[0033] Preferably, step S3.1 includes the following sub-steps:

[0034] Step S3.1.1, adjusting the transmission mode of each layer of neurons in the GNN according to the diffusion equation to obtain a modified transmission mode;

[0035] The calculation method of GNN neurons is to add the node's own features and the adjacent node features, and use the result of the addition as the input of the next layer. The formula is as follows:

[0036]

[0037] in, represents the features of node v in the lth layer of GNN, is the neighbor set of node v, d vu is the relationship measure between node v and its neighbor node u (e.g., edge distance), W(l) is a trainable parameter matrix, σ is an activation function;

[0038] Under the modified transmission method, the transmission method between each layer of the network is no longer a simple weighted summation of neighboring nodes, but the result of the next layer of GNN is obtained based on the calculation method of the diffusion equation. The formula is as follows:

[0039]

[0040] Among them, the aggregate calculation results of each layer It is calculated based on the diffusion equation in the graph structure, and the result is calculated by the right side of formula (4):

[0041]

[0042] In step S3.1.2, historical data of multiple time steps are expanded into water quality characteristics and time series information is introduced to achieve the fusion of spatiotemporal relationships and enhance the prediction capability of the model in the time dimension.

[0043] For a total of T time steps of data, the water quality concentration X t The time window is expanded into data features of multiple historical time steps. For each site P, the water quality concentration of the past N time steps is used as a feature at time t, that is:

[0044]

[0045] Therefore, the optimization goal is determined and expressed as the following optimization problem:

[0046]

[0047] Among them, θ is all the trainable parameters of the model, including the weights in the graph neural network and the parameters u, k, S of the diffusion equation on each river section. λ1 and λ2 are the constraint weight coefficients used to balance the influence of different error terms.

[0048] Step S3.1.3, calculate the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.

[0049] Preferably, step S3.2 includes the following sub-steps:

[0050] Step S3.2.1, the input data enters the time series feature expansion module, and the time series feature expansion module expands the water quality concentration of the node in one time step to the past N time steps as the input feature, and obtains data with an expanded feature window;

[0051] Step S3.2.2, passing the data with the extended feature window through the diffusion equation graph neural network module to obtain data processed by the diffusion equation graph neural network module;

[0052] Step S3.2.3, directly aggregating the data processed by the diffusion equation graph neural network module and the source data S to obtain aggregated data;

[0053] In step S3.2.4, the aggregated data is passed through the fully connected layer predictor to finally obtain the feature predictions for each site.

[0054] The present invention also provides an F-GNN system of a diffusion equation graph neural network model for water quality prediction, comprising:

[0055] Module M1 collects historical data monitored at each site, clarifies the spatial distribution of each site, constructs an adjacency matrix between sites, and then constructs a spatiotemporal graph;

[0056] Module M2, based on the space-time diagram, uses the finite difference method to calculate the diffusion equation, constructs an overdetermined linear equation system based on the diffusion equation, and then uses the least squares method to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation of each river section;

[0057] In module M3, if the parameters of the diffusion equation of each river section are positive, F-GNN prediction is performed to obtain the characteristic prediction of each station.

[0058] Compared with the prior art, the present invention has the following beneficial effects:

[0059] 1. The present invention solves the deficiency of lack of spatiotemporal joint modeling in existing water quality prediction models. Traditional data-driven models are prone to overfitting problems in small sample conditions. The present invention effectively compensates for this deficiency by introducing diffusion equation constraints. At the same time, physical constraints are introduced to improve prediction accuracy and reliability, and is suitable for a variety of environmental monitoring scenarios.

[0060] 2. The model of the present invention combines graph neural networks (for capturing spatial dependencies), time feature extension modules (for capturing temporal relationships), and diffusion equation embedding (as physical constraints) to construct a water quality prediction framework that can efficiently process spatiotemporal characteristics. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0062] Figure 1 The water network data structure in the embodiment of the present invention;

[0063] Figure 2is a diffusion equation under the graph structure in an embodiment of the present invention;

[0064] Figure 3 A residual distribution histogram obtained by fitting a linear equation group for the water quality indicator pH in an embodiment of the present invention;

[0065] Figure 4 The topological diagram of diffusion equation parameters of each river section for water quality pH obtained by fitting a linear equation group in an embodiment of the present invention;

[0066] Figure 5 It is a diagram of the F-GNN model architecture in an embodiment of the present invention;

[0067] Figure 6 This is the error MAE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention;

[0068] Figure 7 This is the RMSE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention;

[0069] Figure 8 The figure is a comparison between the dissolved oxygen characteristic test and the predicted value in the monitoring station 18 in the embodiment of the present invention. DETAILED DESCRIPTION

[0070] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0071] In the current field of water quality prediction, the water quality prediction problem in the water network scenario belongs to the time series prediction task, which is specifically defined as follows:

[0072] Each section P in the past period of time i The monitored historical data is recorded as X t-s:t ,in t is the time step, n is the number of sections, and C is the observation characteristic length.

[0073] By using formula (1), the water quality data of the next F days can be predicted using the historical data of s days:

[0074]

[0075] Among them, p represents the model predictor, whose output is the predicted value with the maximum probability, X t-s:t Represents s days of historical data.

[0076] In the basic one-dimensional advection-diffusion equation (material migration equation) of the environmental domain model, for any water quality characteristic, its diffusion equation is determined as:

[0077]

[0078] Among them, X is the characteristic concentration of water quality, the unit is d is the calculation unit step size, in m; t is the time, in s; k is the flow rate, in u x is the longitudinal diffusion coefficient of the river, in units of S is the input and output mass concentration of pollution, in units of V is the volume of the calculation unit, in m 3 .

[0079] Modeling based on the diffusion equation requires the process of river segmentation, coefficient determination and coefficient verification for each segment. x , k and other parameters require a lot of data measurement, including the cross-sectional area, flow velocity, depth, temperature, wind speed and water oxygen consumption coefficient of each river section. This process requires the acquisition of all kinds of relevant data, the modeling process is complicated, and the coefficient measurement needs to be repeated for different waters. When the time changes are large, the model coefficient also needs to be re-measured, which undoubtedly consumes a lot of time and energy. At present, in actual operation, generally only the characteristic data of each water quality monitoring station is collected, and the corresponding water network structure diagram is obtained.

[0080] Embodiment 1:

[0081] This embodiment proposes a linear equation system method for a diffusion equation graph neural network model for water quality prediction, which is based on the time series model prediction problem definition (Formula 1) and the basic one-dimensional advection-diffusion equation (Formula 2).

[0082] The main purpose of this linear equations method is to explore how to improve the accuracy of prediction when data is missing. Specifically, this method aims to achieve the following goals:

[0083] 1. Verify whether the adjacent monitoring sites in the data set satisfy the basic diffusion equation form;

[0084] 2. As a simple prediction model, it can be used as a comparative reference for other subsequent methods.

[0085] The linear equations method comprises the following steps:

[0086] Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, build an adjacency matrix between sites, and then build a space-time graph.

[0087] Figure 1 This is the water network data structure in the embodiment of the present invention.

[0088] Specifically, collect each section P of the past s days i Historical data monitored X t-s:t Based on historical data, the spatial relationship between upstream and downstream sections is clarified. Based on the spatial relationship, the adjacency matrix A is introduced to represent the topological relationship between sections. t-s:t , thus constructing Figure 1 The space-time diagram shown in G t-s:t =(X t-s:t ,E,A t-s:t ) is represented by E, where E is the edge set.

[0089] Step S2, based on the space-time graph, the finite difference method is used to calculate the diffusion equation, an overdetermined linear equation system is constructed according to the diffusion equation, and then the least squares method is used to estimate the parameters of the overdetermined linear equation system for subsequent prediction.

[0090] Specifically, step S2 includes the following sub-steps:

[0091] Step S2.1, based on the space-time graph, all sites are constructed into a topological graph. For each site at each moment, the first-order derivative and the second-order derivative in the diffusion equation are calculated according to the finite difference method on the graph structure, thereby constructing the calculation formula of the diffusion equation.

[0092] More specifically, on a specific structure in a one-dimensional plane, such as the structure of P1→P2→P3, the diffusion equation of site P2 is calculated as follows:

[0093]

[0094] Where X1, X2, and X3 are the concentrations of each site at time t, and d1 and d2 are the distances between the sites;

[0095] By definition, the first-order derivative of a site's characteristic concentration is related to the site's in-degree site, and the second-order derivative involves both the in-degree site and the out-degree site;

[0096] Figure 2 is the diffusion equation under the graph structure in the embodiment of the present invention.

[0097] By extending the computational method from the one-dimensional plane to the graph structure, each edge can be regarded as satisfying a diffusion equation. In the graph structure, for example Figure 2 For the directed graph structure shown in Figure 1, the diffusion equation for any site is calculated as:

[0098]

[0099] Among them, u i,j represents the average longitudinal diffusion coefficient of the river between the in-degree node j and the out-degree node i, k j represents the average flow rate from in-degree node j to the current node, d i Indicates the distance between the out-degree node i and the current node, d j Represents the distance between in-degree node j and the current node.

[0100] Step S2.2, for each site, multiple diffusion equations are calculated based on different times to form an overdetermined linear equation group, that is, each site obtains a set of overdetermined linear equations, and then the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed by the diffusion equation calculation formula.

[0101] Specifically, based on the diffusion equation calculation formula, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as:

[0102] A·x=b (5)

[0103] Among them, A is a matrix containing the calculation results of the first-order and second-order derivatives of concentration at all times, with a size of T×3, x is the parameter vector, and b is the result vector of T times.

[0104] In the overdetermined linear equations, the parameter vector x contains the parameters that need to be solved in the diffusion equation for each river section (such as flow velocity k, river longitudinal diffusion coefficient u x The overdetermined linear equations are calculated by the least square method, and the parameter values ​​obtained are the parameters of the diffusion equation for each river section. T A) -1 A T b.

[0105] Step S3, substituting the estimated parameters into the diffusion equation to obtain the predicted values.

[0106] Specifically, the parameters of each station (diffusion coefficient and flow velocity of the river section) are calculated according to step S2, and then the parameters and the data of the station and adjacent stations for the past day can be substituted into the diffusion equation to obtain the predicted value for the next day.

[0107] It should be noted that the linear equations method of this embodiment may have the problem of insufficient fitting ability. However, this method can still reflect the trend between adjacent sites that basically conforms to the equation, that is, the change in concentration is inversely proportional to the first-order derivative of concentration and space, and is also inversely proportional to the second-order derivative of concentration and space, such as Figure 3For the water quality indicator pH, the residual distribution histogram obtained by fitting the linear equation group shows that our water quality data roughly presents an independent normal distribution, such as Figure 4 The linear equations are used to fit the topological diagram of the diffusion equation parameters of each river section for water quality pH. It can be seen from the figure that the parameters of the diffusion equation of each river section are all positive numbers, and the values ​​of the parameters u, k, and S of adjacent river sections are not much different, which is consistent with the trend of stable changes in the actual environmental hydrodynamic parameters. The comparison of the specific experimental prediction results with other methods will be further presented in the subsequent comparative experiment section.

[0108] Embodiment 2:

[0109] The present invention also proposes an F-GNN method for a diffusion equation graph neural network model for water quality prediction. Only when the linear equation system method successfully verifies that each river section satisfies the diffusion equation form can it be shown that the diffusion equation has certain rationality and applicability in the current water network scenario. Based on this, the diffusion equation constraints are integrated into the GNN model. Therefore, the verification results of the linear equation system method are the prerequisites of the F-GNN method.

[0110] The F-GNN method of this embodiment is a diffusion equation graph neural network model based on spatiotemporal fusion, which combines the physical constraints of the mechanism model with the data-driven capabilities of the non-mechanism model. This fusion method not only ensures the scientific nature of the model, but also improves its practicality and prediction accuracy. The specific fusion methods include: First, modifying the transmission mode of each layer of neurons in the GNN model according to the diffusion equation. Second, introducing time series information. Third, in calculating the model error When the partial differential form of the diffusion equation is introduced as a constraint. This idea is called physical guided learning or prior embedding modeling. Modify the transfer mode of the GNN model and optimize the transfer mode of the GNN model by embedding the simplified equations obtained by numerical analysis into the GNN model. This method can guide the learning direction of the GNN model and enable the model to achieve better results even when trained with limited data.

[0111] Specifically, the F-GNN method includes the following steps:

[0112] Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, build an adjacency matrix between sites, and then build a space-time graph.

[0113] Step S2, based on the space-time diagram, the finite difference method is used to calculate the diffusion equation, an overdetermined linear equation group is constructed according to the diffusion equation, and then the least squares method is used to estimate the parameters of the overdetermined linear equation group, that is, the parameters of the diffusion equation of each river section.

[0114] Step S3: If the parameters of the diffusion equation of each river section are all positive numbers, that is, when the hydrodynamic parameters change steadily, F-GNN prediction is performed to obtain the characteristic prediction of each station.

[0115] Specifically, F-GNN prediction includes the following sub-steps:

[0116] Step S3.1, embed the calculation method of the diffusion equation into the GNN model to build a new GNN model.

[0117] Specifically, based on the diffusion equation, the transmission mode of each layer of neurons in the GNN model is modified, and when performing the error back propagation calculation, the diffusion equation is added as a regular term in the calculation process (refer to formula 10). This method is significantly different from the technical route adopted by PINN. PINN directly integrates partial differential equations into the error term to achieve the imposition of overall physical constraints, while this method achieves a deep fit with physical laws by integrating the diffusion equation into the neuron transmission mode and the error calculation link of back propagation.

[0118] More specifically, step S3.1 includes the following sub-steps:

[0119] Step S3.1.1, adjust the transmission mode of each layer of neurons in the GNN according to the diffusion equation to obtain the modified transmission mode.

[0120] In this embodiment, the calculation method of the GNN neuron is to add the node's own features and the adjacent node features, and use the added result as the input of the next layer. The formula is as follows:

[0121]

[0122] in, represents the features of node v in the lth layer of GNN, is the neighbor set of node v, d vu is the relationship measure between node v and its neighbor node u (e.g., edge distance), W (l) is a trainable parameter matrix, σ is an activation function;

[0123] Under the modified transmission method, the transmission method between each layer of the network is no longer a simple weighted summation of neighboring nodes, but the result of the next layer of GNN is obtained based on the calculation method of the diffusion equation. The formula is as follows:

[0124]

[0125] Among them, the aggregate calculation results of each layer It is calculated based on the diffusion equation in the graph structure, and the result is calculated by the right side of formula (4):

[0126]

[0127] Step S3.1.2, Step S3.1.1 The method of embedding the diffusion equation into the GNN model only considers the spatial relationship. Since water quality data is time series data, the historical data of multiple time steps are expanded into water quality characteristics, and time series information is introduced to achieve the fusion of spatiotemporal relationships and enhance the model's prediction ability in the time dimension.

[0128] For a total of T time steps of data, the water quality concentration X t The time window is expanded into data features of multiple historical time steps. For each site P, the water quality concentration of the past N time steps is used as a feature at time t, that is:

[0129]

[0130] Therefore, the optimization goal is determined and expressed as the following optimization problem:

[0131]

[0132] Among them, θ is all the trainable parameters of the model, including the weights in the graph neural network and the parameters u, k, S of the diffusion equation on each river section. λ1 and λ2 are the constraint weight coefficients used to balance the influence of different error terms.

[0133] Step S3.1.3, calculate the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.

[0134] Specifically, the first-order derivative and the second-order derivative of the concentration with respect to the distance in the diffusion equation are embedded into the error calculation as regularization constraints, and the corresponding expression is as shown in formula (10).

[0135] Figure 5 This is a diagram of the F-GNN model architecture in an embodiment of the present invention.

[0136] The overall architecture of the new GNN model is as follows Figure 5 shown.

[0137] In step S3.2, the historical data of each site and the constructed adjacency matrix are input into the new GNN model to obtain the prediction results of the characteristics of each site.

[0138] The F-GNN method of this embodiment mainly includes: i) modifying the calculation method of neuron transmission inside GNN. The conventional node update method is to perform weighted summation of neighboring nodes, while this method makes specific adjustments based on formula (8); ii) in the error processing link, this method incorporates various parts of the diffusion equation, and the specific form is shown in formula (10).

[0139] In this embodiment, the input is the historical monitoring data of each site and the adjacency matrix (X t-s ,…,X t ; A ij ), the output is the prediction of the characteristics of each site in the next F days

[0140] Specifically, step S3.2 includes the following sub-steps:

[0141] Step S3.2.1, the input data enters the temporal feature extension module (Temporal Extension), and the temporal feature extension module expands the water quality concentration of the node in one time step to the past N time steps as input features to obtain data with an extended feature window;

[0142] Step S3.2.2, the data with the extended feature window is passed through the diffusion equation graph neural network module (F-GNN). Specifically, the node update rule of each layer of the neural network is as follows: in the FGNN module, in the lth layer of the GNN, for the feature of a certain neuron node v The calculation method of the right side of the Fusion equation is added to itself. Get the next layer of neurons Get the data processed by the diffusion equation graph neural network module;

[0143] Step S3.2.3, directly aggregate (Concat) the data processed by the diffusion equation graph neural network module and the source data S (mainly precipitation data) to obtain aggregated data;

[0144] In step S3.2.4, the aggregated data is passed through the fully connected layer (FC) predictor to finally obtain the feature predictions for each site.

[0145] The following contents are used to verify the validity of the prediction method of the present invention through experiments:

[0146] The experimental data includes daily monitoring data of 24 sections, and the monitoring characteristics include 9 indicators such as pH and ammonia nitrogen. According to the direction of water flow and the distance between each station, the water network adjacency matrix A can be constructed. ij , and the source data S is precipitation data.

[0147] In order to improve the experimental effects of each model, before the experiment, the existing water quality monitoring data set was first preprocessed, and the daily monitoring data was expanded through the linear interpolation method.

[0148] The comparative experiments include the existing univariate time series analysis methods ARIMA, BP, linear prediction methods STID, Dlinear and spatiotemporal prediction method ST-GCN in the field of water quality prediction. In addition, the two methods proposed in this invention, the linear equations method and the F-GNN method, will also be compared.

[0149]

[0150] Table 1. Comparative analysis of average prediction errors of water quality characteristic pH

[0151] Table 1 shows the average error results of each model for water quality characteristic pH, and shows the error results MAE and RSME for the prediction days horizon of 1 day, 7 days and 30 days. The definitions of MAE and RSME are shown in formulas (8) and (9), MAE j and RMSE j represent the prediction variance and mean square error of each water quality characteristic, respectively.

[0152] The experimental results are analyzed as follows: Due to the large number of parameters of spatiotemporal models such as STGCN, the training effect is the worst on small data sets. Methods such as STID and Dlinear that use linear preprocessing of spatiotemporal features have achieved better results than spatiotemporal graph networks. Among them, Dlinear has achieved a good error result in the prediction of 1 day, but in long-term prediction, Dlinear cannot consider the information of stations farther away from itself. The linear equation method has achieved average results, which is similar to the effect of the machine learning method ARIMA.

[0153] In the long-term prediction, the F-GNN method of the present invention compensates for the overfitting problem of STGCN by introducing the diffusion equation fusion constraint and the time feature expansion module; it considers the characteristic relationship of adjacent sites in space more than single variable prediction methods such as ARIMA and BP; and F-GNN adopts the method of space-time fusion compared with Dlinear and STID, which use linear layers to learn spatiotemporal features. The F-GNN experiment achieved the minimum prediction error on the Hangjiahu Plain data set.

[0154]

[0155] Figure 6 This is the error MAE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention; Figure 7 This is the RMSE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention; Figure 8 The figure is a comparison between the dissolved oxygen characteristic test and the predicted value in the monitoring station 18 in the embodiment of the present invention.

[0156] Furthermore, the error results of each model on all water quality characteristics when the prediction day Horizon = 1 are analyzed, such as Figure 6 and Figure 7 As shown in the figure, from the characteristic result diagrams of 9 water quality indicators, the spatiotemporal graph network STGCN has serious overfitting phenomenon, the linear equations method has insufficient fitting ability, and the effect is only better than STGCN. The MAE error of F-GNN on each feature has reached the minimum, and the prediction error of F-GNN is reduced by an average of 27.23% compared with the prediction error MAE of other best methods, and RSME is reduced by an average of 24.84%.

[0157] Finally, in order to visualize the comparison between the true value of the test set and the predicted value of each model, Figure 8 Select the dissolved oxygen characteristics of monitoring station 18, from Figure 7 It can be seen that STGCN is not trained at all, which verifies its disadvantage of overfitting. The effect of the linear equation method is similar to that of the simple univariate prediction methods ARIMA and BP. Overall, the method F-GNN (red line) of the present invention achieves the best effect.

[0158] Embodiment 3:

[0159] The present invention also provides an F-GNN system for a diffusion equation graph neural network model for water quality prediction. The F-GNN system for a diffusion equation graph neural network model for water quality prediction can be implemented by executing the process steps of the F-GNN method for a diffusion equation graph neural network model for water quality prediction, that is, those skilled in the art can understand the F-GNN method for a diffusion equation graph neural network model for water quality prediction as a preferred implementation of the F-GNN system for a diffusion equation graph neural network model for water quality prediction.

[0160] The F-GNN system includes:

[0161] Module M1 collects historical data monitored at each site, clarifies the spatial distribution of each site, constructs an adjacency matrix between sites, and then constructs a spatiotemporal graph;

[0162] Module M2, based on the space-time diagram, uses the finite difference method to calculate the diffusion equation, constructs an overdetermined linear equation system based on the diffusion equation, and then uses the least squares method to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation of each river section;

[0163] In module M3, if the parameters of the diffusion equation of each river section are positive, F-GNN prediction is performed to obtain the characteristic prediction of each station.

[0164] The key points and protection points of the present invention are as follows:

[0165] 1. Improve prediction accuracy:

[0166] By embedding the diffusion equation to fuse spatial features, and fusing temporal features through time series expansion, the fusion of spatiotemporal features can more accurately predict water quality changes. Compared with other best performing algorithms, F-GNN has an average MAE reduction of 27.23% and an average RSME reduction of 24.84% in water quality feature prediction.

[0167] 2. Enhance generalization ability:

[0168] Physical law constraints are embedded in the calculation transmission method between each layer of GNN to avoid overfitting of GNN in the case of small samples, so as to adapt to different scene applications.

[0169] 3. Achieving physical interpretability:

[0170] The diffusion equation is embedded into the model to improve the interpretability of the model output results and ensure that they conform to the actual water quality diffusion law.

[0171] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0172] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A linear equations method for diffusion equation graph neural network model for water quality prediction, characterized in that: The steps include: Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, construct an adjacency matrix between sites, and then construct a spatiotemporal graph; Step S2, based on the space-time graph, using the finite difference method to calculate the diffusion equation, constructing an overdetermined linear equation system according to the diffusion equation, and then using the least squares method to estimate the parameters of the overdetermined linear equation system for subsequent prediction; Step S3: Substitute the estimated parameters into the diffusion equation to obtain the predicted value.

2. The linear equation system method of the diffusion equation graphical neural network model for water quality prediction according to claim 1 is characterized in that: The step S1 includes: collecting each section P of the past s days i Historical data monitored X t-s:t Based on the historical data, the spatial relationship between the upstream and downstream of each section is clarified. Based on the spatial relationship, an adjacency matrix A is introduced to represent the topological relationship between sections. t-s:t , thereby constructing a space-time graph, which is represented by G t-s:t =(X t-s:t ,E,A t-s:t ) is represented by E, where E is the edge set.

3. The linear equation system method of the diffusion equation graphical neural network model for water quality prediction according to claim 1 is characterized in that: The step S2 includes the following sub-steps: Step S2.1, based on the space-time graph, all sites are constructed into a topological graph, and for each site at each time, the first-order derivative and the second-order derivative in the diffusion equation are calculated according to the finite difference method on the graph structure, so as to construct a calculation formula of the diffusion equation; Step S2.2, for each site, multiple diffusion equations are calculated based on different times to form an overdetermined linear equation group, that is, each site obtains a set of overdetermined linear equations, and then the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed by the diffusion equation calculation formula.

4. The linear equation system method of the diffusion equation graphical neural network model for water quality prediction according to claim 3 is characterized in that: In step S2.1, the diffusion equation of the site on a specific structure in a one-dimensional plane is calculated as follows: Where X1, X2, and X3 are the concentrations of each site at time t, and d1 and d2 are the distances between the sites; By definition, the first-order derivative of a site's characteristic concentration is related to the site's in-degree site, and the second-order derivative involves both the in-degree site and the out-degree site; The calculation method is extended from the one-dimensional plane to the graph structure. Under the graph structure, the diffusion equation of any site is calculated as: Among them, u i,j represents the average longitudinal diffusion coefficient of the river between the in-degree node j and the out-degree node i, k j represents the average flow rate from in-degree node j to the current node, d i Indicates the distance between the out-degree node i and the current node, d j Represents the distance between in-degree node j and the current node.

5. The linear equation system method of the diffusion equation graphical neural network model for water quality prediction according to claim 3 is characterized in that: In step S2.2, based on the diffusion equation calculation formula, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as: A·x=b (5) Wherein, A is a matrix containing the calculation results of the first-order and second-order derivatives of the concentration at all times, with a size of T×3, x is the parameter vector, and b is the result vector of T times; the overdetermined linear equations are calculated by the least squares method, and the parameter values ​​obtained are the parameters of the diffusion equation of each river section, that is, x=(A T A) -1 A T b.

6. An F-GNN method for a diffusion equation graph neural network model for water quality prediction, based on a linear equation system method for a diffusion equation graph neural network model for water quality prediction as claimed in any one of claims 1 to 5, characterized in that: The steps include: Step S1, collect historical data monitored at each site, clarify the spatial distribution of each site, construct an adjacency matrix between sites, and then construct a spatiotemporal graph; Step S2, based on the space-time graph, using the finite difference method to calculate the diffusion equation, constructing an overdetermined linear equation system according to the diffusion equation, and then using the least squares method to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation of each river section; Step S3: If the parameters of the diffusion equations of the river sections are all positive numbers, F-GNN prediction is performed to obtain feature predictions of each site.

7. The F-GNN method of the diffusion equation graph neural network model for water quality prediction according to claim 6 is characterized in that: The F-GNN prediction includes the following sub-steps: Step S3.1, embedding the calculation method of the diffusion equation into the GNN model to construct a new GNN model; Step S3.2, inputting the historical data of each site and the constructed adjacency matrix into the new GNN model to obtain the prediction results of the characteristics of each site.

8. The F-GNN method of the diffusion equation graph neural network model for water quality prediction according to claim 7 is characterized in that: The step S3.1 includes the following sub-steps: Step S3.1.1, adjusting the transmission mode of each layer of neurons in the GNN according to the diffusion equation to obtain a modified transmission mode; The calculation method of GNN neurons is to add the node's own features and the adjacent node features, and use the result of the addition as the input of the next layer. The formula is as follows: in, represents the features of node v in the lth layer of GNN, is the neighbor set of node v, d vu is the relationship measure between node v and its neighbor node u, W (l) is a trainable parameter matrix, σ is an activation function; Under the modified transmission method, the transmission method between each layer of the network is no longer a simple weighted summation of neighboring nodes, but the result of the next layer of GNN is obtained based on the calculation method of the diffusion equation. The formula is as follows: Among them, the aggregate calculation results of each layer It is calculated based on the diffusion equation in the graph structure, and the result is calculated by the right side of formula (4): Step S3.1.2, expand the historical data of multiple time steps into water quality characteristics, introduce time series information, thereby realizing the integration of time and space relationships and improving the prediction ability of the model in the time dimension; For a total of T time steps of data, the water quality concentration X t The time window is expanded into data features of multiple historical time steps. For each site P, the water quality concentration of the past N time steps is used as a feature at time t, that is: Therefore, the optimization goal is determined and expressed as the following optimization problem: Among them, θ is all the trainable parameters of the model, including the weights in the graph neural network and the parameters u, k, S of the diffusion equation on each river section. λ1 and λ2 are the constraint weight coefficients, which are used to balance the influence of different error terms. Step S3.1.3, calculate the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.

9. The F-GNN method of the diffusion equation graph neural network model for water quality prediction according to claim 7, characterized in that: The step S3.2 includes the following sub-steps: Step S3.2.1, the input data enters the time series feature expansion module, and the time series feature expansion module expands the water quality concentration of the node in one time step to the past N time steps as the input feature, and obtains data with an expanded feature window; Step S3.2.2, passing the data with the extended feature window through the diffusion equation graph neural network module to obtain data processed by the diffusion equation graph neural network module; Step S3.2.3, directly aggregating the data processed by the diffusion equation graph neural network module and the source data S to obtain aggregated data; In step S3.2.4, the aggregated data is passed through the fully connected layer predictor to finally obtain the feature predictions for each site.

10. An F-GNN system of a diffusion equation graph neural network model for water quality prediction, characterized in that: include: Module M1 collects historical data monitored at each site, clarifies the spatial distribution of each site, constructs an adjacency matrix between sites, and then constructs a spatiotemporal graph; Module M2, based on the space-time diagram, uses the finite difference method to calculate the diffusion equation, constructs an overdetermined linear equation system according to the diffusion equation, and then uses the least squares method to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation of each river section; Module M3, if the parameters of the diffusion equation of each river section are positive, F-GNN prediction is performed to obtain the characteristic prediction of each site.

Citation Information

Patent Citations

  • Intelligent river water quality simulation method based on non-embedded mode decomposition algorithm

    CN117744494A

  • Time sequence point process prediction method and system based on graph neural network and Transform

    CN116227562A

  • Flow field mixing calculation method based on physical neural network

    CN116796648A

  • Graph neural network optimization method based on partial differential equation diffusion attenuation and related device

    CN117521729A

  • Graph neural diffusion

    US20220253671A1

Cited By

  • Method and device for predicting stability of water ecosystem based on graph neural network

    CN121257860A

  • A method and apparatus for predicting the stability of aquatic ecosystems based on graph neural networks

    CN121257860B