Method for spatio-temporal prediction of water quality indexes of multiple monitoring sections based on graph attention wave network

By using a method based on SG filtering and graph attention wave network, the problem that traditional neural networks are unable to capture long-term information and ignore spatial dependence in water quality prediction is solved, and high-precision prediction of water quality indicators at multiple cross sections is achieved.

CN115689013BActive Publication Date: 2026-06-26BEIJING UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING UNIV OF TECH
Filing Date
2022-10-31
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Traditional neural networks struggle to capture key information with long spans in water quality indicators and ignore spatial dependence in the aquatic environment, resulting in insufficient accuracy in water quality prediction.

Method used

A method based on SG filtering and Graph Attention Wave Network (GATWNet) is adopted. By constructing a directed graph, the upstream and downstream relationships between water quality monitoring stations are obtained. By combining the graph attention mechanism and extended causal convolution, the temporal and spatial dependencies are captured, and multi-step prediction of water quality indicators at multiple cross sections is performed.

Benefits of technology

It improves the accuracy and efficiency of water quality indicator prediction, better captures long-term and spatial dependencies, and enhances prediction precision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115689013B_ABST
    Figure CN115689013B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of multi-monitoring section water quality index space-time prediction method, in particular to a kind of multi-monitoring section water quality index prediction method based on SG (Savitzky Golay) filtering and graph attention wave net (Graph Attention WaveNet, GATWNet).First, the water quality index historical data of multiple monitoring sites obtained is sorted according to time sequence, and the water quality historical data is smoothed pretreatment using SG filtering, and on this basis, the upstream and downstream relationship of water quality monitoring site is constructed into a directed graph.Second, the water quality data is normalized, and the water quality time series data is divided into multiple sub-sequences as feature sequences according to the preset sliding window size, i.e. into supervised data, and input into GATWNet model based on graph attention network (Graph Attention Network, GAT) and wave net (WaveNet) at the same time, and then predict the water quality index value of future multi-section, multi-time step, finally obtain the water quality index prediction result with higher accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for spatiotemporal prediction of water quality indicators at multiple monitoring sections, and in particular to a method for spatiotemporal prediction of water quality indicators at multiple monitoring sections based on graph attention wave networks. Background Technology

[0002] In recent years, due to the development of IoT technology and the continuous decline in the cost of water quality monitoring hardware, water quality monitoring sensors have been deployed on a large scale in rivers and lakes across various regions. These sensors generate massive amounts of high-frequency, multi-source data. Therefore, by analyzing and studying this high-frequency data, valuable information can be extracted, enabling functions such as water quality prediction and early warning, thereby further scientifically and effectively managing the water environment and improving the quality of the aquatic ecological environment. With the increasing socio-economic connections between regions, the evolution of the water environment exhibits complex changes involving cross-regional and multi-site interactions. This means that future data from water quality monitoring stations depends not only on their own historical values ​​but also on the historical values ​​of neighboring monitoring stations. Therefore, when facing the intricate relationships between watersheds and upstream and downstream sensors, water quality prediction modeling must consider both time and spatial dependencies to further improve the accuracy of prediction results.

[0003] With the continuous development of artificial intelligence and machine learning, deep learning has increasingly become the mainstream algorithm for time series forecasting and is widely used in aquatic environments. Most water quality index data belong to long-correlated time series, meaning that there are relatively long intervals or delays in the series, as well as important events that have a significant impact on subsequent values. Traditional neural networks struggle to capture such long-span key information, leading to insufficient prediction accuracy. With the advent of Recurrent Neural Networks (RNNs), neurons in the hidden layers of neural networks can pass information to each other, thereby improving the accuracy of neural network models in time series forecasting tasks. However, ordinary RNNs suffer from the gradient vanishing problem when dealing with long-term dependencies. The introduction of LSTM (Long Short Term Memory) effectively alleviated this problem. However, LSTM has the disadvantages of not being able to be parallelized and having excessively long training time. Furthermore, the above methods rely solely on their own historical values ​​for time series forecasting, ignoring the spatial dependencies in the aquatic environment, resulting in generally low prediction accuracy. Therefore, a suitable method is needed to solve the above technical problems. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on Savitzky-Golay (SG) filtering and Graph Attention WaveNet (GATWNet). This includes: a water quality time series preprocessing scheme based on SG filtering; and multi-section, multi-step prediction of water quality indicators based on the GATWNet model. The objective of this invention is achieved through the following technical solutions.

[0005] A spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on graph attention wavenets, comprising the following steps:

[0006] 1) Obtain the distances between multiple water quality monitoring sections and their upstream and downstream relationships in the river network, and construct a directed graph;

[0007] 2) Obtain time-series data of water quality indicators monitored at multiple water quality monitoring sections over a period of time;

[0008] 3) Perform SG filtering on the data for smoothing and noise reduction;

[0009] 4) Based on 3), normalize the processed data, then divide it into multiple subsequences according to the preset sliding window width, transform the sequence into supervised data, and divide it into training set and test set.

[0010] 5) Based on 4), the directed graph and feature sequence are input into the graph attention wave net model, and the multi-step predicted values ​​of water quality indicators of multiple sections are output.

[0011] 6) Based on 5), the predicted values ​​are inversely normalized to obtain the predicted values ​​of future water quality indicators. Attached Figure Description

[0012] Figure 1 A schematic diagram of a spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on graph attention wave networks;

[0013] Figure 2 SG filter flowchart;

[0014] Figure 3 Attention module diagram;

[0015] Figure 4 Extended example diagram of causal convolution;

[0016] Figure 5 GATWNet architecture diagram. Detailed Implementation

[0017] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. The following description covers numerous specific details in order to provide a comprehensive understanding of the invention. However, it will be apparent to those skilled in the art that the invention can be practiced without requiring some of these specific details. The following description of embodiments is merely intended to provide a clearer understanding of the invention by illustrating examples of the invention. The invention is by no means limited to any specific configurations and algorithms presented below, but covers any modifications, substitutions, and improvements to related elements, components, and algorithms without departing from the spirit of the invention.

[0018] The following will refer to the appendix. Figure 1 The specific steps of a spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on SG filtering and GATWNet according to an embodiment of the present invention are as follows:

[0019] The first step is to obtain the distances between multiple water quality monitoring stations and their upstream and downstream relationships within the river network.

[0020] Select a target area and identify all water quality monitoring stations within that area. Measure the distances between the monitoring stations and their upstream / downstream positions in the river channel using an online mapping tool. Then, construct a weighted directed graph with the monitoring stations as vertices and the distances and river flow directions as directed edges.

[0021] The second step is to obtain time-series data composed of water quality indicators monitored by multiple water quality monitoring stations over a period of time.

[0022] Since automatic water quality monitoring stations typically monitor every 4 hours, during the data preprocessing stage, water quality parameter data are screened and uniformly adjusted to 4-hour intervals. For missing data, interpolation is used to fill in the gaps.

[0023] The third step is to preprocess the time series data of water quality indicators using SG filtering.

[0024] Since the data may contain noise points, it often leads to overfitting of nonlinear models. By using the SG method to smooth and filter the original data and reduce the interference of noise, the overfitting of nonlinear models can be effectively suppressed. Figure 2 This is a flowchart illustrating the implementation method of SG filtering. The principle of SG filtering is as follows:

[0025] The core idea of ​​SG filtering is to perform weighted filtering on the data within a window. The weights are obtained by least-squares fitting of a given high-order polynomial. Filtering is performed on n (n = 2m + 1) observations before and after the current time step, and a k-1 order polynomial is used for fitting. For the observation at the current time step, the following formula is used for fitting:

[0026] y = a0 + a1x + a1x 2 +...+a k-1 x k-1

[0027] Where x represents the data to be fitted, y represents the fitted output data, and a0, a1, ..., a k-1 Let A be the parameters to be solved. For n points within the window, n equations are formed, constituting a system of k linear equations. The fitting parameters A are solved using the least squares method, and can be represented as a matrix:

[0028] Y n =X n×k ·A k×1 +B n×1

[0029] Least square solution of A for:

[0030]

[0031] Y's model filter value for:

[0032]

[0033] The fourth step is to normalize the data and then divide the feature sequence data using a sliding window.

[0034] The filtered data needs to undergo the following sliding window processing before it can be used as input to the model.

[0035] 1) Normalize the data processed in the previous step. The specific formula is as follows:

[0036]

[0037] Where, x * Let x represent the target value after normalization, and x represent the data that needs to be normalized. min x represents the minimum value in the data. max This represents the maximum value in the data.

[0038] 2) Set the sliding window width to the sum of the input time series length and the prediction time series length, and use the sliding window to capture the input and prediction values.

[0039] 3) Separate the input and predicted values ​​from the data captured by the sliding window and transform them into supervised data.

[0040] Step 5: GATWNet model prediction

[0041] This invention uses graph attention wavenets to analyze water environment-related indicators. After the data is processed in the previous step, the input sequence is set. A weighted directed graph G is used to capture spatial and temporal dependencies in the data via GATWNet. After extracting features, future water quality indicators are predicted for multiple monitoring stations. (See appendix) Figure 5 Give the complete structure of GATWNet.

[0042] Because it requires capturing the temporal trend of the input sequence, and traditional Convolutional Neural Networks (CNN) models cannot directly handle temporal prediction problems, GATWNet uses extended causal convolution as the temporal layer. Causal convolution is defined as the filter F = (f1, f2, ..., f...). k The sequence X = (x1, x2, ..., x) k ), in x t The causal convolution at the point is: Unlike RNNs, convolutional operations can be performed in parallel, meaning predictions for subsequent time steps don't need to wait for the previous time step to complete. Therefore, convolution-based models have an advantage over RNN-based models in terms of training and evaluation speed. By stacking multiple layers of causal convolutions, the model can capture trends from longer input time series. Since the receptive field of causal convolutions is linearly related to the number of stacked layers, a significant problem arises when considering very long input sequences: many layers or very large filters are needed to increase the receptive field. Increasing the number of layers leads to vanishing gradients, training complexity, and poor fitting performance. Extended causal convolutions use a hyperparameter `d` to skip part of the input, allowing the filter to operate on a region larger than the filter's length. Without increasing parameters or model complexity, the receptive field of the network can expand exponentially with the number of layers. It is defined as filter F = (f1, f2, ..., f...). k The sequence X = (x1, x2, ..., x) k ), in x t The expansion factor at point d is equal to the expanded convolution of d: Gating mechanisms play a crucial role in temporal convolution, effectively controlling the information flow between network layers. This model uses the sigmoid function as the gating function, defined as g = tanh(Θ1X + b)⊙σ(Θ2X + c). Here, * represents the convolution operation, ⊙ represents element-wise multiplication, and Θ1, Θ2, b, and c are learnable parameters in the model. σ represents the sigmoid function, determining the rate at which information is passed to the next layer.

[0043] Graph Attention Networks (GATs) aggregate neighbor nodes through a self-attention mechanism, achieving adaptive matching of weights for different neighbors, thereby improving model accuracy. GATs consist of several functionally identical graph attention layers, whose inputs are the feature values ​​of nodes. Where F is the dimension of the node features. In the graph attention layer, a weight matrix is ​​first used. Apply it to each node, and then input it to a parameter. A single-layer feedforward neural network is used, and then the LeakyReLU activation function is applied for non-linearization to calculate an attention coefficient e. i,j Let represent the importance of node j to node i. Theoretically, the weight from any node in the graph to the center node can be calculated. However, to simplify the calculation, GAT utilizes the graph structure and employs masked attention to only calculate the weights of node i's neighboring nodes. in It is node v i The neighbor nodes of the center node are then normalized using Softmax, calculated as follows:

[0044]

[0045]

[0046] node v i The input features are passed through a graph attention layer to obtain output features of dimension F'. To improve the generalization ability of the attention mechanism, GAT uses a multi-head attention layer, that is, M independent single-head attention layers, and then concatenates their results. The specific calculation method is as follows:

[0047]

[0048] Based on the concept of residual modules, temporal convolutional layers with gating mechanisms and graph attention layers are integrated to prevent network degradation. The integrated spatiotemporal layers are stacked multiple times, allowing the model to capture the spatial dependencies of different temporal layers. The outputs of each layer are then stacked via skip connections, and the stacked result is passed through a ReLU activation function and two fully connected layers to finally obtain the predicted result Y of the 3D tensor. Where N represents the number of nodes, F represents the feature dimension of the nodes, and τ represents the prediction step size. Additionally, to allow GATWNet to adapt to different input sequence lengths, the expansion factor for each layer and the number of layers to be stacked can be manually set.

[0049] The model generates predicted values ​​for the water quality test set, and the predicted values ​​are inversely normalized. They are then compared with the unfiltered true values ​​using MAE, RMSE, and MAPE. The number of attention heads in the graph attention network and the size of the hidden layer in the wavelet model are adjusted in the spatiotemporal prediction model of water quality. The adjusted spatiotemporal prediction model of water quality is then tested to obtain the parameter model with the best performance.

[0050] This water quality prediction model can be applied to predict water quality indicators such as dissolved oxygen (DO), pH, total phosphorus (TP), and total nitrogen (TN) in different water bodies, enabling accurate prediction of relevant water quality data and facilitating water quality early warning and water pollution control.

[0051] This invention relates to the spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on graph attention wave networks proposed above. It should be understood that the detailed description of the technical solutions of this invention using preferred embodiments is illustrative and not restrictive. Those skilled in the art can modify the technical solutions described in the embodiments or make equivalent substitutions for some technical features based on reading this specification; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of this invention.

Claims

1. A spatiotemporal prediction method for water quality indicators at multiple monitoring sections based on graph attention wavenets, characterized in that, The method includes the following steps: 1) Obtain the distances between multiple water quality monitoring sections and their upstream and downstream relationships in the river network, and construct a directed graph; 2) Obtain time-series data of water quality indicators monitored at multiple water quality monitoring sections over a period of time; 3) Perform SG (Savitzky-Golay) filtering on the data for smoothing and noise reduction; 4) Normalize the processed data and then divide it into multiple subsequences according to the preset sliding window width as feature sequence data; 5) Input the directed graph and feature sequence into the Graph Attention WaveNet model, output multi-step predicted values ​​of water quality indicators, and then perform inverse normalization on the predicted values ​​to obtain the predicted values ​​of future water quality indicators.

2. The method according to claim 1, characterized in that, The water quality spatiotemporal prediction model is trained based on historical water quality time series data and spatial relationship data of stations, including: The distance to the target station and its upstream and downstream location in the river network are obtained as spatial relationships; a directed graph is constructed according to the spatial relationships; water quality time series data of the target station are obtained as historical data; the historical data is smoothed and then normalized; the normalized historical data is divided into training set and test set according to a preset ratio, and the water quality spatiotemporal prediction model is trained according to the directed graph and the historical data of the training set to obtain the parameters of the water quality spatiotemporal prediction model.

3. The method according to claim 1, characterized in that, The prediction of water quality based on the spatiotemporal prediction model includes: The water quality time series data of the target station within a preset time period before the current time and the spatial relationship data between the target stations are obtained; the water quality time series data of the target station within the preset time period before the current time are normalized and a directed graph is constructed based on the spatial relationship data; the normalized time series data and the directed graph are input into the water quality spatiotemporal prediction model; the output data of the water quality spatiotemporal prediction model is denormalized to obtain the water quality spatiotemporal prediction data of the target station.

4. The method according to claims 2 and 3, characterized in that, The water quality prediction model based on SG filtering and GATWNet neural network includes: The time-series data is denoised using SG filtering; the denoised data is then used as input to the GATWNet neural network model to form the spatiotemporal prediction model for water quality.

5. The method according to claim 2, characterized in that, The step of testing and optimizing the water quality prediction model based on historical data from the test set includes: Based on the test results of the water quality spatiotemporal prediction model, the number of attention heads in the graph attention network and the size of the hidden layer of the wave network model in the water quality spatiotemporal prediction model are adjusted, and the adjusted water quality spatiotemporal prediction model is tested to optimize the parameters of the water quality spatiotemporal prediction model.

6. The method according to claim 3, characterized in that, The subsequences are divided according to the preset sliding window width and used as feature sequences. The length of each subsequence is the width of the sliding window, which is the sum of the lengths of the input and prediction time series. The data captured by the sliding window is separated into input and predicted values. The sum of the input and predicted time series lengths is set manually, thus transforming the sequence into supervised data.

7. The method according to claim 4, characterized in that, Before predicting water quality based on the spatiotemporal prediction model, the method further includes: The preset ratio is changed, and the normalized historical data is re-divided into training set and test set according to the changed preset ratio; the water quality spatiotemporal prediction model is trained based on the historical data of the re-divided training set, and the water quality spatiotemporal prediction model is fine-tuned.

8. The method according to claim 4, characterized in that Water quality prediction based on the GATWNet model includes: The lengths of the input and output sequences of a prediction model can be unequal, and the length of the input sequence can be adjusted to further optimize the model's prediction accuracy.