Linear equations of diffusion equation graph neural network model, F-GNN method and system
By constructing a diffusion equation graph neural network model, combining finite difference and least squares method, the problem of multi-dimensional data integration and space-time correlation in water quality prediction is solved, the prediction accuracy and reliability are improved, and it is suitable for a variety of environmental monitoring scenarios.
Patent Information
- Application Number
- CN202411981945.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing water quality prediction methods have difficulties in the integration of multi-dimensional heterogeneous data and spatial-temporal correlation modeling. The mechanism method is complex to calculate but not the mechanism method is insufficient in data quality and physical interpretability. Traditional data-driven models are prone to overfitting in small samples.
A diffusion equation graph neural network model is constructed, diffusion equations are calculated through the finite difference method, hyper-fixed linear equation system is constructed, and parameters are estimated using the least squares method. Combined with the graph neural network and the time feature expansion module, diffusion equation constraints are introduced for prediction.
It improves the accuracy and reliability of water quality prediction, is suitable for a variety of environmental monitoring scenarios, solves the problem of overfitting traditional models, and enhances the processing ability of spatiotemporal and spatial feature.
Smart Images

Figure CN119918403B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart water conservancy, and in particular to a system of linear equations, an F-GNN method and a system for a diffusion equation graphical neural network model for water quality prediction. Background Art
[0002] Water quality prediction plays a crucial role in water resource management and environmental protection. Accurate water quality predictions provide a scientific basis for water supply decisions and effectively mitigate potential threats to human health from sudden pollution incidents. Furthermore, understanding water quality trends and pollution spread patterns can provide critical data support for river basin management and ecological restoration efforts (such as pollution source control and purification project optimization).
[0003] However, water quality prediction is an extremely challenging multidisciplinary task. First, the complexity of multidimensional heterogeneous data is a challenge. Water quality data involves a variety of indicators, such as pH, dissolved oxygen, and heavy metal content. These data come from a wide range of sources and in various formats, making integration and analysis difficult. Second, accurately modeling spatiotemporal dependencies is fraught with difficulties. Changes in water quality not only evolve dynamically over time but are also closely related to geographic location. Accurately capturing this complex spatiotemporal correlation in the model is a challenge. Furthermore, data scarcity and noise interference also pose significant obstacles to water quality prediction. Limited monitoring data makes it difficult to fully reflect the true state of water quality, and the presence of noise further reduces the quality and reliability of the data.
[0004] Currently, water quality prediction methods are primarily categorized into mechanistic approaches (i.e., physical modeling) and non-mechanistic approaches (including machine learning and deep learning). Mechanistic approaches, based on water diffusion laws, chemical reaction processes, and physical conservation laws, describe the migration, transformation, and diffusion of pollutants in water bodies by constructing mathematical models such as partial differential equations. This approach offers strong scientific interpretability and generalization capabilities, but is highly dependent on parameters and has complex computational processes, limiting its practical application. Non-mechanistic approaches, on the other hand, are data-driven modeling approaches that leverage historical monitoring data to uncover relationships between water quality indicators and achieve predictions. While these approaches excel in automation, real-time performance, and flexibility, they are significantly constrained by data quality and scale, and lack physical interpretability and generalization capabilities.
[0005] A search of patent literature revealed an invention patent with publication number CN117744494A, which discloses an intelligent river water quality simulation method based on a non-embedded modal decomposition algorithm. The method includes: collecting basic data on the target river; building a model based on the NS equation, mass conservation equation, momentum equation, and pollutant transport and diffusion equation, and calculating two-dimensional concentration field data along the river plane; post-processing the model and exporting it as a txt file; processing the two-dimensional concentration field data into concentration field time series snapshots using a programming language; establishing a SPOD modal decomposition model using a programming language, decomposing the concentration field time series snapshots, and constructing a SPOD latent space using weighted oblique projection on the original data to obtain a historical expansion coefficient matrix; and predicting the future expansion coefficient matrix based on the historical expansion coefficient matrix to predict the concentration field at future moments. This patent, based on traditional equations and modal decomposition methods, lacks the ability to integrate multidimensional information to construct a model.
[0006] In summary, in response to the above-mentioned problems of the existing technology, studying a linear equation system, 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 system, F-GNN method and system of a diffusion equation graphical neural network model for water quality prediction.
[0008] According to the present invention, a linear equation system method for 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, the finite difference method is used to calculate the diffusion equation, an overdetermined linear equation system is constructed based on the diffusion equation, and the least squares method is used to estimate the parameters of the overdetermined linear equation system for subsequent prediction;
[0011] Step S3: Substitute the estimated parameters into the diffusion equation to obtain the predicted value.
[0012] Preferably, step S1 includes: collecting each section of the past s days Historical data monitored Based on historical data, the spatial relationship between upstream and downstream sections is clarified. Based on the spatial relationship, an adjacency matrix is introduced to represent the topological relationship between sections. , thus constructing a space-time graph, which is used Indicates that For edge sets.
[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. For each site at each moment, the first-order and second-order derivatives of the diffusion equation are calculated using the finite difference method on the graph structure, thereby constructing the diffusion equation formula.
[0015] In step S2.2, for each site, multiple diffusion equations are calculated based on different moments to form an overdetermined linear equation group. That is, each site obtains a set of overdetermined linear equations. Subsequently, the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters obtained will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed through 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]
[0019]
[0020] in , , For each site The concentration of the moment, and are the distances between sites, respectively;
[0021] 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;
[0022] 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 follows:
[0023]
[0024]
[0025] 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 between in-degree node j and the current node, Indicates the distance between the out-degree node i and the current node, Represents the distance between in-degree node j and the current node.
[0026] Preferably, in step S2.2, based on the diffusion equation, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as:
[0027] (5)
[0028] in, 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 , is the parameter vector, is the result vector at T moments; the overdetermined linear equations are calculated by the least squares method, and the parameter values obtained are the parameters of the diffusion equation for each river section, that is, .
[0029] The present invention also provides an F-GNN method for a diffusion equation graphical neural network model for water quality prediction, comprising the following steps:
[0030] 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;
[0031] Step S2: Based on the space-time graph, a finite difference method is used to calculate the diffusion equation, an overdetermined linear equation system is constructed based on the diffusion equation, and then the least squares method is used to estimate the parameters of the overdetermined linear equation system, i.e., the parameters of the diffusion equation for each river section;
[0032] In 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.
[0033] Preferably, F-GNN prediction includes the following sub-steps:
[0034] Step S3.1, embed the calculation method of the diffusion equation into the GNN model to construct a new GNN model;
[0035] 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.
[0036] Preferably, step S3.1 includes the following sub-steps:
[0037] 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;
[0038] The calculation method of GNN neurons is to add the node's own features and the features of adjacent nodes, and use the result of the addition as the input of the next layer. The formula is as follows:
[0039]
[0040] in, Represents the first in GNN Nodes in the layer Features, is a node The neighbor set of is a node With neighboring nodes a measure of the relationship between (e.g., edge distance), is a trainable parameter matrix, is the activation function;
[0041] 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:
[0042]
[0043] 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):
[0044]
[0045] In step S3.1.2, 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 improve the prediction ability of the model in the time dimension.
[0046] For the total Time step data, water quality concentration The data features are expanded into multiple historical time steps through the time window, and for each site , The time will pass The water quality concentration of each time step is used as a feature, namely:
[0047]
[0048] Therefore, the optimization goal is determined and expressed as the following optimization problem:
[0049]
[0050] in, These are all the trainable parameters of the model, including the weights in the graph neural network and the parameters of the diffusion equations for each river section. , is the constraint weight coefficient, which is used to balance the influence of different error terms.
[0051] Step S3.1.3, in calculating the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.
[0052] Preferably, step S3.2 includes the following sub-steps:
[0053] Step S3.2.1: The input data enters the time series feature expansion module, which expands the water quality concentration of the node at one time step to the past N time steps as input features, obtaining data with an expanded feature window;
[0054] Step S3.2.2, passing the data with the expanded feature window through the diffusion equation graph neural network module to obtain data processed by the diffusion equation graph neural network module;
[0055] Step S3.2.3, the data processed by the diffusion equation graph neural network module and the source data Direct aggregation to obtain aggregated data;
[0056] In step S3.2.4, the aggregated data is passed through the fully connected layer predictor to obtain the feature predictions for each site.
[0057] The present invention also provides an F-GNN system for a diffusion equation graphical neural network model for water quality prediction, comprising:
[0058] 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;
[0059] Module M2, based on the space-time graph, 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 for each river section;
[0060] In module M3, 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.
[0061] Compared with the prior art, the present invention has the following beneficial effects:
[0062] 1. The present invention solves the deficiency of the 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, the introduction of physical constraints improves prediction accuracy and reliability, making it suitable for a variety of environmental monitoring scenarios.
[0063] 2. The model of the present invention combines graph neural networks (for capturing spatial dependencies), time feature expansion 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
[0064] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments with reference to the following drawings:
[0065] Figure 1 The water network data structure in the embodiment of the present invention;
[0066] Figure 2 is the diffusion equation under the graph structure in the embodiment of the present invention;
[0067] Figure 3 The residual distribution histogram obtained by fitting a linear equation system for the water quality indicator pH in an embodiment of the present invention;
[0068] Figure 4 The topological diagram of the diffusion equation parameters of each river section for water quality pH is obtained by fitting a linear equation system in an embodiment of the present invention;
[0069] Figure 5 This is a diagram of the F-GNN model architecture in an embodiment of the present invention;
[0070] Figure 6 The MAE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention;
[0071] Figure 7 The RMSE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention;
[0072] Figure 8 1 is a comparison of the dissolved oxygen characteristic test and the predicted value in the monitoring station 18 in an embodiment of the present invention. DETAILED DESCRIPTION
[0073] The present invention will be described in detail below with reference to specific embodiments. The following examples 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 skilled in the art, several changes and improvements can be made without departing from the scope of the present invention. These all fall within the scope of protection of the present invention.
[0074] 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:
[0075] Each section in the past period of time The monitored historical data is recorded as ,in , is the time step, is the number of sections, is the observed characteristic length.
[0076] By using formula (1), the water quality data of the next F days can be predicted using the historical data of s days:
[0077]
[0078] Among them, p represents the model predictor, whose output is the predicted value with the maximum probability, Represents s days of historical data.
[0079] In the basic one-dimensional advection-diffusion equation (material transport equation) of the environmental domain model, for any water quality characteristic, its diffusion equation is determined as:
[0080]
[0081] in, is the characteristic concentration of water quality, in units of ; is the calculation unit step size, ; is the time, the unit is ; is the flow rate, in units of ; is the longitudinal diffusion coefficient of the river, in units of ; is the input and output mass concentration of pollution, in units of ; The volume of the calculation unit is .
[0082] Modeling based on this diffusion equation requires the process of river segmentation, coefficient determination and coefficient verification for each segment. Parameters such as θ and k require extensive data measurement, including cross-sectional area, flow velocity, depth, temperature, wind speed, and water oxygen consumption coefficient for each river section. This process requires acquiring all relevant data, making the modeling process complex. Furthermore, coefficient measurements must be repeated for different water areas, and significant temporal variations require re-measurement of model coefficients, which undoubtedly consumes considerable time and effort. Currently, in practice, only characteristic data from each water quality monitoring station is collected, along with corresponding water network diagrams.
[0083] Example 1:
[0084] This embodiment proposes a linear equations method for a diffusion equation graphical neural network model for water quality prediction. The method is based on the time series model prediction problem definition (Formula 1) and the basic one-dimensional advection-diffusion equation (Formula 2).
[0085] The main purpose of this linear equations method is to explore how to improve the accuracy of predictions when data is missing. Specifically, this method aims to achieve the following goals:
[0086] 1. Verify whether adjacent monitoring stations in the dataset satisfy the basic diffusion equation form;
[0087] 2. As a simple prediction model, it can be used as a comparative reference for other subsequent methods.
[0088] The linear equations method comprises the following steps:
[0089] 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 spatiotemporal graph.
[0090] Figure 1 This is the water network data structure in an embodiment of the present invention.
[0091] Specifically, each section of the past s days is collected Historical data monitored Based on historical data, the spatial relationship between upstream and downstream sections is clarified. Based on the spatial relationship, an adjacency matrix is introduced to represent the topological relationship between sections. , thus constructing Figure 1 The space-time diagram shown is Indicates that For edge sets.
[0092] In step S2, based on the space-time graph, the finite difference method is used to calculate the diffusion equation formula, an overdetermined linear equation system is constructed according to the diffusion equation formula, and then the least squares method is used to estimate the parameters of the overdetermined linear equation system for subsequent prediction.
[0093] Specifically, step S2 includes the following sub-steps:
[0094] In step S2.1, all sites are constructed into a topological graph based on the space-time graph. For each site at each moment, the first-order and second-order derivatives of the diffusion equation are calculated using the finite difference method on the graph structure, thereby constructing the diffusion equation calculation formula.
[0095] More specifically, on a specific structure of a one-dimensional plane, such as The structure of the site The diffusion equation is calculated as follows:
[0096]
[0097]
[0098]
[0099] in , , For each site The concentration of the moment, and are the distances between sites, respectively;
[0100] 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;
[0101] Figure 2 is the diffusion equation under the graph structure in the embodiment of the present invention.
[0102] 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:
[0103]
[0104]
[0105] 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 between in-degree node j and the current node, Indicates the distance between the out-degree node i and the current node, Represents the distance between in-degree node j and the current node.
[0106] In step S2.2, for each site, multiple diffusion equations are calculated based on different moments to form an overdetermined linear equation group. That is, each site obtains a set of overdetermined linear equations. Subsequently, the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters obtained will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed through the diffusion equation calculation formula.
[0107] Specifically, based on the diffusion equation, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as:
[0108] (5)
[0109] in, 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 , is the parameter vector, is the result vector at T moments.
[0110] In an overdetermined linear system, the parameter vector 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 The overdetermined linear equations are calculated by the least squares method, and the parameter values obtained are the parameters of the diffusion equation for each river section. .
[0111] Step S3: Substitute the estimated parameters into the diffusion equation to obtain the predicted value.
[0112] Specifically, the parameters of each station (diffusion coefficient and flow velocity of the river section) are calculated according to step S2, and 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.
[0113] 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 3 For 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 topological diagram of the diffusion equation parameters of each river section for water quality pH is obtained by fitting a linear equation group. It can be seen from the figure that the parameters of the diffusion equation of each river section are all positive numbers, and the parameters of adjacent river sections are The values of are not much different, which is consistent with the trend of stable changes in hydrodynamic parameters in actual environments. The specific experimental prediction results are compared with other methods in the subsequent comparative experiments.
[0114] Example 2:
[0115] The present invention also proposes an F-GNN method for the diffusion equation graphical 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 water network scenario currently under study. Based on this, the diffusion equation constraints are integrated into the GNN model. Therefore, the verification results of the linear equation system method are a prerequisite for the F-GNN method.
[0116] 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 method 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, the GNN model is used to calculate the time series information. When learning the GNN model, the partial differential form of the diffusion equation is introduced as a constraint. This approach is called physics-guided learning or prior embedding modeling. Modifying the transfer mode of the GNN model by embedding simplified equations obtained through numerical analysis into the GNN model can optimize the transfer mode. This approach can guide the learning direction of the GNN model and achieve good results even when trained with limited data.
[0117] Specifically, the F-GNN method includes the following steps:
[0118] 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 spatiotemporal graph.
[0119] In step S2, based on the space-time graph, the diffusion equation formula is calculated using the finite difference method, an overdetermined linear equation system is constructed based on the diffusion equation formula, and then the least squares method is used to estimate the parameters of the overdetermined linear equation system, that is, the parameters of the diffusion equation for each river section.
[0120] In step S3, if the parameters of the diffusion equation of each river section are all positive, that is, when the hydrodynamic parameters change steadily, F-GNN prediction is performed to obtain the characteristic prediction of each station.
[0121] Specifically, F-GNN prediction includes the following sub-steps:
[0122] In step S3.1, the calculation method of the diffusion equation is embedded into the GNN model to construct a new GNN model.
[0123] Specifically, based on the diffusion equation, the transmission method of each layer of neurons in the GNN model is modified. When performing the error backpropagation calculation, the diffusion equation is added as a regularization term in the calculation process (see Formula 10). This method differs significantly from the technical approach used by PINN. PINN directly integrates partial differential equations into the error term to achieve overall physical constraints. However, this method achieves a deep alignment with physical laws by incorporating the diffusion equation into the neuron transmission method and the backpropagation error calculation process.
[0124] More specifically, step S3.1 includes the following sub-steps:
[0125] In step S3.1.1, the transmission mode of neurons in each layer of GNN is adjusted according to the diffusion equation to obtain the modified transmission mode.
[0126] In this embodiment, the calculation method of GNN neurons is to add the node's own features and the features of adjacent nodes, and use the result of the addition as the input of the next layer. The formula is as follows:
[0127]
[0128] in, Represents the first in GNN Nodes in the layer Features, is a node The neighbor set of is a node With neighboring nodes a measure of the relationship between (e.g., edge distance), is a trainable parameter matrix, is the activation function;
[0129] 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:
[0130]
[0131] 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):
[0132]
[0133] Step S3.1.2, the method of embedding the diffusion equation into the GNN model in step S3.1.1 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 improve the model's prediction ability in the time dimension.
[0134] For the total Time step data, water quality concentration The data features are expanded into multiple historical time steps through the time window, and for each site , The time will pass The water quality concentration of each time step is used as a feature, namely:
[0135]
[0136] Therefore, the optimization goal is determined and expressed as the following optimization problem:
[0137]
[0138] in, These are all the trainable parameters of the model, including the weights in the graph neural network and the parameters of the diffusion equations for each river section. , is the constraint weight coefficient, which is used to balance the influence of different error terms.
[0139] Step S3.1.3, in calculating the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.
[0140] Specifically, the first-order and second-order derivatives of the concentration with respect to distance in the diffusion equation are embedded into the error calculation as regularization constraints, and the corresponding expression is as shown in Formula (10).
[0141] Figure 5 This is a diagram of the F-GNN model architecture in an embodiment of the present invention.
[0142] The overall architecture of the new GNN model is as follows Figure 5 shown.
[0143] 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.
[0144] The F-GNN method of this embodiment mainly includes: i) modifying the calculation method of neuron transmission within the 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).
[0145] In this embodiment, the input is the historical monitoring data of each site and the adjacency matrix , the output is the feature prediction of each site in the next F days .
[0146] Specifically, step S3.2 includes the following sub-steps:
[0147] In step S3.2.1, the input data enters the temporal feature extension module. The temporal feature extension module expands the water quality concentration of the node at one time step to the past N time steps as input features, obtaining data with an extended feature window.
[0148] Step S3.2.2: The data with the expanded feature window is passed through the diffusion equation graph neural network module (F-GNN)
[0149] Specifically, the node update rules of each layer of the neural network are as follows: In the layer, for a neuron node Features , calculated by adding the right side of the Fusion equation to itself Get the next layer of neurons , get the data processed by the diffusion equation graph neural network module;
[0150] Step S3.2.3, the data processed by the diffusion equation graph neural network module and the source data (Mainly precipitation data) Direct aggregation (Concat) to obtain aggregated data;
[0151] In step S3.2.4, the aggregated data is passed through the fully connected layer (FC) predictor to obtain the feature predictions of each site.
[0152] The following content is to verify the effectiveness of the prediction method of the present invention through experiments:
[0153] The experimental data includes daily monitoring data of 24 sections. 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 can be constructed. , and source data Precipitation data.
[0154] In order to improve the experimental effects of each model, before the experiment, the existing water quality monitoring dataset was first preprocessed and the daily monitoring data was expanded through the linear interpolation method.
[0155] 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.
[0156]
[0157] Table 1. Comparative analysis of average prediction errors of water quality characteristic pH
[0158] Table 1 shows the average error results of each model for the water quality characteristic pH, and shows the error results MAE and RSME for the prediction horizon of 1 day, 7 days and 30 days. The definitions of MAE and RSME are shown in formulas (8) and (9). and represent the prediction variance and mean square error of each water quality characteristic, respectively.
[0159] The experimental results are analyzed as follows: Due to the large number of parameters in spatiotemporal models like STGCN, training performance is poor on small datasets. Methods like STID and Dlinear, which use linear preprocessing of spatiotemporal features, achieve better results than spatiotemporal graph networks. Dlinear achieves good error rates for one-day forecasts, but fails to consider information from more distant sites in long-term forecasts. Linear equation methods achieve moderate results, comparable to the machine learning method ARIMA.
[0160] In long-term forecasting, the F-GNN method overcomes the overfitting problem of STGCN by introducing diffusion equation fusion constraints and a temporal feature expansion module. Compared to single-variable forecasting methods such as ARIMA and BP, it considers the characteristic relationships between spatially adjacent sites. Unlike Dlinear and STID methods, which use linear layers to learn spatiotemporal features, F-GNN utilizes a spatiotemporal fusion approach. Experiments with F-GNN achieved minimal prediction error on the Hangzhou-Jiaxing-Huzhou Plain dataset.
[0161] (11)
[0162] (12)
[0163] Figure 6The MAE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention; Figure 7 The RMSE comparison of each model for each indicator when Horizon=1 in the embodiment of the present invention; Figure 8 1 is a comparison of the dissolved oxygen characteristic test and the predicted value in the monitoring station 18 in an embodiment of the present invention.
[0164] 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 equation system 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 the RSME is reduced by an average of 24.84%.
[0165] 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 overfitting disadvantage. The effect of the linear equation method is similar to that of the simple single variable prediction methods ARIMA and BP. Overall, the method F-GNN (red broken line) of the present invention achieves the best effect.
[0166] Example 3:
[0167] 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.
[0168] The F-GNN system includes:
[0169] 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;
[0170] Module M2, based on the space-time graph, 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 for each river section;
[0171] In module M3, 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.
[0172] The key points and protection points of the present invention are as follows:
[0173] 1. Improve prediction accuracy:
[0174] By embedding spatial features into the diffusion equation and fusing temporal features through time series expansion, the fusion of spatiotemporal features can more accurately predict water quality changes. Compared to other top-performing algorithms, F-GNN achieved an average reduction in mean error (MAE) of 27.23% and in relative small mean error (RSME) of 24.84% in water quality prediction.
[0175] 2. Enhance generalization ability:
[0176] Physical constraints are embedded in the calculation transmission method between each layer of GNN to avoid overfitting of GNN in small sample cases, so as to adapt to different scenarios.
[0177] 3. Achieving physical interpretability:
[0178] 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.
[0179] Those skilled in the art will appreciate that, in addition to implementing the system and its various devices, modules, and units provided by the present invention in purely computer-readable program code, it is entirely possible to implement the same functions of the system and its various devices, modules, and units provided by the present invention 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 a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; the devices, modules, and units for implementing various functions can also be considered as both software modules implementing the method and structures within the hardware component.
[0180] The above describes specific embodiments of the present invention. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art may make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. The embodiments of this application and the features in the embodiments may be combined with each other in any manner unless there is a conflict.
Claims
1. A linear equations method for a diffusion equation graphical neural network model for water quality prediction, characterized by: 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 based on the diffusion equation, and then using the least squares method to estimate the parameters of the overdetermined linear equation system for subsequent prediction; In step S2, the diffusion equation of the site on the specific structure of the one-dimensional plane is calculated as follows: in , , For each site The concentration of the moment, and are the distances between sites, respectively; 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 follows: 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 between in-degree node j and the current node, Indicates the distance between the out-degree node i and the current node, Represents the distance between in-degree node j and the current node; 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 of the past s days Historical data monitored Based on the historical data, the spatial relationship between the upstream and downstream sections is clarified. Based on the spatial relationship, an adjacency matrix is introduced to represent the topological relationship between sections. , thereby constructing a space-time graph, which is used Indicates that For edge sets.
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 spatiotemporal graph, construct a topological graph of all sites. For each site at each moment, calculate the first-order and second-order derivatives of the diffusion equation using the finite difference method on the graph structure, thereby constructing a calculation formula for the diffusion equation. In step S2.2, for each site, multiple diffusion equations are calculated based on different moments to form an overdetermined linear equation group. That is, each site obtains a set of overdetermined linear equations. Subsequently, the parameters of the overdetermined linear equation group are estimated using the least squares method. The estimated parameters obtained will be used for subsequent predictions. At the same time, the concentration changes at each moment are clearly expressed by the diffusion equation 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.2, based on the diffusion equation, for T time moments, each feature of each site is formed into a set of overdetermined linear equations, expressed as: (5) in, 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 , is the parameter vector, is the result vector at T moments; 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, .
5. An F-GNN method for a diffusion equation graphical neural network model for water quality prediction, based on the linear equation system method for a diffusion equation graphical neural network model for water quality prediction according to any one of claims 1 to 4, 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 based on the diffusion equation, and then using the least squares method to estimate the parameters of the overdetermined linear equation system, i.e., the parameters of the diffusion equation for each river section; Step S3: If the parameters of the diffusion equations of the respective river sections are all positive, F-GNN prediction is performed to obtain feature predictions of the respective stations.
6. The F-GNN method of the diffusion equation graph neural network model for water quality prediction according to claim 5, 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: Input 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.
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 step S3.1 includes the following sub-steps: 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; The calculation method of GNN neurons is to add the node's own features and the features of adjacent nodes, and use the result of the addition as the input of the next layer. The formula is as follows: in, Represents the first in GNN Nodes in the layer Features, is a node The neighbor set of is a node With neighboring nodes The relationship between the is a trainable parameter matrix, is the 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 spatiotemporal relationships and improving the prediction ability of the model in the time dimension; For the total Time step data, water quality concentration The data features are expanded into multiple historical time steps through the time window, and for each site , The time will pass The water quality concentration of each time step is used as a feature, namely: Therefore, the optimization goal is determined and expressed as the following optimization problem: in, These are all the trainable parameters of the model, including the weights in the graph neural network and the parameters of the diffusion equations for each river section. , is the constraint item weight coefficient, which is used to balance the influence of different error items; Step S3.1.3, in calculating the model error When performing back propagation, two regularization constraints of the diffusion equation are introduced.
8. The F-GNN method of the diffusion equation graphical neural network model for water quality prediction according to claim 6, 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, which expands the water quality concentration of the node at one time step to the past N time steps as input features, obtaining data with an expanded feature window; Step S3.2.2, passing the data with the expanded 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, the data processed by the diffusion equation graph neural network module and the source data Direct aggregation to obtain aggregated data; In step S3.2.4, the aggregated data is passed through the fully connected layer predictor to obtain the feature predictions for each site.
9. An F-GNN system for a diffusion equation graph neural network model for water quality prediction, characterized by: 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 graph, 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 for each river section; In the module M2, on a specific structure in a one-dimensional plane, the diffusion equation of the site is calculated as follows: in , , For each site The concentration of the moment, and are the distances between sites, respectively; 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 follows: 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 between in-degree node j and the current node, Indicates the distance between the out-degree node i and the current node, Represents the distance between in-degree node j and the current node; Module M3, if the parameters of the diffusion equation of each river section are all positive, then 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
Graph neural network optimization method based on partial differential equation diffusion attenuation and related device
CN117521729A