Space-time joint modeling system and method for watershed water quality prediction

By building a joint modeling system of space-time and time-series and spatial coding, a dynamic graph learner is used to process the basin topology, the problem of space-time coupling impact in water quality prediction in basin is solved, and more accurate water quality prediction and visualization of pollutant diffusion paths are achieved.

CN120373544AActive Publication Date: 2025-07-25SUN YAT SEN UNIV +1

Patent Information

Application Number
CN202510455814.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-11
Publication Date
2025-07-25
Estimated Expiration
2045-04-11

AI Technical Summary

Technical Problem

When processing spatiotemporal data, the existing basin water quality prediction model ignores the spatiotemporal coupling effect of basin topology on pollutant diffusion, resulting in insufficient spatial correlation modeling and difficult to balance the complexity and computational efficiency of the prediction model.

Method used

A joint modeling system for water quality prediction in the basin is designed. Through the data acquisition module, feature extraction module, feature fusion module and model training module, combined with timing encoding and spatial encoding, dynamic graph learners are used to carry out dynamic graph learning, and a gated network for dynamic fusion of spatiotemporal features is constructed, taking into account the impact of the basin topology on the spatiotemporal coupling of pollutant diffusion.

Benefits of technology

It realizes more accurate water quality prediction in the basin, can dynamically adjust attention weights, pay attention to the propagation of information at key hub points, suppress noise or redundant information, and improves the accuracy and reliability of the prediction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373544A_ABST
    Figure CN120373544A_ABST
Patent Text Reader

Abstract

The invention discloses a spatial-temporal joint modeling system and method for watershed water quality prediction. The system comprises a data acquisition module, a feature extraction module, a feature fusion module, a model training module and a prediction output module. In the watershed water quality prediction process, the combined influence of time and space is considered, a space-time position coding combined embedded layer is designed, an attention mechanism guided by hydrological characteristics is combined, a door control network dynamically fused with space-time characteristics is constructed, and the space-time coupling influence of a watershed topological structure on pollutant diffusion is considered; the attention weight is dynamically adjusted by quantifying the topological importance of the monitoring points in the network, a feature channel which is most effective for a current prediction task is highlighted, and noise or redundant information is suppressed; in the model training process, a simplified gating mechanism is adopted, the gradient dispersion problem is reduced, the nonlinearity of a layer is kept, convergence is accelerated, a dynamic graph learning device is used, physical rules are respected, data changes are self-adapted, and more accurate water quality modeling is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of watershed water quality prediction, and more specifically, to a spatio-temporal joint modeling system and method for watershed water quality prediction. Background Art

[0002] Traditional watershed water quality prediction methods mainly rely on statistical models and physical process models. They have certain advantages in dealing with univariate time series data but are difficult to directly capture spatial correlations. Physical process models are constructed based on the physical and chemical principles of hydrology and water quality. Although they can relatively accurately simulate the water quality change process, they usually require a large number of parameter inputs and may face challenges in computational efficiency and accuracy under complex watershed conditions.

[0003] In the prior art, spatio-temporal joint modeling methods have gradually been applied to the field of watershed water quality prediction. For example, a hydrological model based on deep learning has been developed, which realizes the spatio-temporal dynamic simulation of hydrological elements such as rainfall and runoff in the watershed by combining CNN and LSTM, and then is used for water quality prediction. In addition, some studies have also tried to integrate multi-source information such as meteorological data and land use data into the spatio-temporal joint model to further improve the prediction accuracy.

[0004] Although spatio-temporal joint modeling shows great potential in watershed water quality prediction, some problems still exist. Existing water quality prediction models mostly process time series or spatial features in isolation, ignoring the spatio-temporal coupling effect of the watershed topology (upstream-downstream relationship, tributary confluence) on pollutant diffusion, resulting in insufficient spatial correlation modeling. How to reasonably process spatio-temporal data, balance the complexity and computational efficiency of the prediction model, and better optimize the model to improve the reliability and practicality of the prediction results is the current challenge. Summary of the Invention

[0005] The purpose of the present invention is to provide a spatio-temporal joint modeling system and method for watershed water quality prediction to solve the above problems existing in the prior art.

[0006] Specifically, this application is as follows:

[0007] Provide a spatio-temporal joint modeling system for watershed water quality prediction, including: a data acquisition module, a feature extraction module, a feature fusion module, a model training module, and a prediction output module;

[0008] The data acquisition module: acquires the watershed water quality data of each monitoring point during the watershed water quality prediction process. The watershed water quality data includes time series data and spatial topology data, and aligns the spatio-temporal data of each monitoring point and constructs an adjacency matrix;

[0009] The feature extraction module: Set a temporal encoding module to encode time series data, extract temporal features, and obtain the first data feature. Set a spatial encoding module to perform spatial modeling on spatial topology data, extract spatial features, and obtain the second data feature;

[0010] The feature fusion module: Set a feature fusion gating mechanism to fuse the first feature data and the second feature data, generate a unified spatio-temporal representation, dynamically balance spatio-temporal features, and perform adaptive feature fusion;

[0011] The model training module: Design a training strategy through a multi-task loss function and perform staged training. Set a pre-trained temporal module to freeze the dynamic graph attention network layer, train the Informer model separately, unfreeze all parameters, perform joint fine-tuning through the learning rate, and introduce a dynamic graph learner for dynamic graph learning;

[0012] The prediction output module: Output the basin water quality prediction results and effectiveness indicators, perform visual display of the pollutant diffusion path, and issue early warnings for sudden pollution events.

[0013] The temporal encoding module uses the Informer model to encode time series data, preprocesses the time series data using a dynamic sliding window algorithm, uses a moving average method based on a dynamic window selection strategy, adjusts the window size in real time in combination with the water quality data change rate, and uses the z-score method to standardize the data. Design a multi-scale fusion mechanism to splice the original temporal data and the multi-scale moving average features along the channel dimension to obtain the first temporal data;

[0014] Segment the first temporal data and input it into a neural network layer to extract the local features of each sub-data sequence to obtain the second temporal data. Perform a short-time Fourier transform on the second temporal data to extract frequency domain characteristics to obtain the third temporal data;

[0015] Use the second temporal data and the third temporal data as the input to the encoder in the Informer model, use the probabilistic sparse self-attention mechanism to process the sequence to extract features, use the multi-head self-attention mechanism to further process the sequence to capture features in different subspaces, and send the processed sequence to the decoder to obtain the first data feature.

[0016] The spatial encoding module uses a dynamic graph attention network to perform spatial modeling on spatial topology data. The first data feature is used as the node feature of the input data to construct the hidden state of each monitoring point at different time steps, define the spatial relationship between stations through topological connections, and set edge features as needed;

[0017] Generate a two-layer dynamic graph attention network. The first layer uses multi-head attention to capture multiple spatial patterns. The second layer aggregates multi-head information and reduces the dimension, retaining key topological features. Layer normalization is used to stabilize the training, and Dropout is adopted to prevent overfitting of data, thereby obtaining the second data feature.

[0018] The feature fusion gating mechanism is implemented by using the second feature data and the gating mechanism for parallel processing of the first feature data. When processing the first feature data, information is strictly saved according to the temporal position, and the processing speed is accelerated through the parallel processing structure, which is expressed as:

[0019]

[0020] where, X MIE and X IE represent the input and output matrices of the feature fusion gating mechanism, represent learnable parameters, ⊙ represents element-wise multiplication, and σ represents the ReLU activation function.

[0021] The feature fusion gating mechanism also includes setting a spatio-temporal position encoding joint embedding layer, using a Gaussian kernel to map spatial coordinates and periodic time encoding, combining with an attention mechanism guided by hydrological features, and constructing a gating network for dynamic fusion of spatio-temporal features. The node attention layer in the set gating network for dynamic fusion of spatio-temporal features includes a degree centrality-guided attention mechanism and a squeeze-and-excitation module.

[0022] The pre-trained temporal module freezes non-temporal data, calculates the mean absolute error between the predicted value and the true value of each monitoring point on the validation set, uses the mean absolute error loss as the objective function, independently learns the temporal evolution law of water quality parameters, inputs non-temporal data, unfreezes all parameters, and calculates the mixed loss.

[0023] The mixed loss includes the main prediction loss, spatial consistency loss, and temporal smoothness loss.

[0024] The introduction of the dynamic graph learner for dynamic graph learning includes: calculating the association strength scores of all combinations of monitoring points through the feature data of each monitoring point, splicing the features of two monitoring points, predicting the connection weights through a neural network, generating an adjacency matrix for dynamic graph construction, strengthening the water flow direction by punishing reverse connections through a loss function, and performing sparsity control through Top-k screening, so that each monitoring point only retains the k strongest connected neighbors. When the feature of the pollution source site mutates, a new strong connection is generated, and the downstream sites of the basin automatically enhance the association weights, forming a temporary pollution diffusion path.

[0025] The predicted results include the predicted values of key water quality indicators at each monitoring point in the future time period, accurate to the hourly level. The effectiveness indicators include the spatial consistency error ratio, the dynamically generated pollutant propagation path when visualizing the pollution diffusion path, marking key nodes, dividing into 1-5 level early warnings according to the exceeding standard degree and influence range, and attaching a reason description.

[0026] The present invention also provides a spatio-temporal joint modeling method for watershed water quality prediction, which is applied to any one of the above-mentioned spatio-temporal joint modeling systems for watershed water quality prediction, and specifically includes the following steps:

[0027] Step 1: Obtain the watershed water quality data of each monitoring point during the watershed water quality prediction process. The watershed water quality data includes time series data and spatial topology data, and perform the alignment of spatio-temporal data of each monitoring point and the construction of an adjacency matrix;

[0028] Step 2: Set a time series encoding module to encode the time series data, extract time series features, and obtain the first data feature. Set a spatial encoding module to perform spatial modeling on the spatial topology data, extract spatial features, and obtain the second data feature;

[0029] Step 3: Set a feature fusion gating mechanism to fuse the first feature data and the second feature data, generate a unified spatio-temporal representation, dynamically weigh spatio-temporal features, and perform adaptive feature fusion;

[0030] Step 4: Design a training strategy through a multi-task loss function and perform staged training. Set the pre-trained time series module to freeze the dynamic graph attention network layer, train the Informer model alone, unfreeze all parameters, perform joint fine-tuning through the learning rate, and introduce a dynamic graph learner for dynamic graph learning;

[0031] Step 5: Output the prediction results and effectiveness indicators for watershed water quality, perform visual display of the pollutant diffusion path, and issue early warnings for sudden pollution events.

[0032] Compared with the prior art, the embodiments of the present invention achieve the following beneficial effects:

[0033] 1. During the watershed water quality prediction process, considering the combined influence of time and space, design a spatio-temporal position encoding joint embedding layer, combine the attention mechanism guided by hydrological features, construct a gating network for dynamic fusion of spatio-temporal features, consider the spatio-temporal coupling influence of the watershed topology structure on pollutant diffusion, and reveal the spatio-temporal collaborative law of pollutant diffusion;

[0034] 2. The guided attention mechanism can quantify the topological importance of monitoring points in the network, dynamically adjust the attention weights, make the model pay more attention to the information dissemination of key hub points, compress and stimulate the feature channels that are most effective for the current prediction task, and suppress noise or redundant information;

[0035] During the training process of the water quality prediction model, a simplified gating mechanism is adopted to reduce the problem of gradient dispersion, maintain the non-linearity of the layer, accelerate convergence, use a dynamic graph learner to model the pollutant propagation path, emphasize the influence of the topological structure on the prediction accuracy, respect physical laws, and adapt to data changes to achieve more accurate water quality modeling. Brief Description of the Drawings

[0036] Figure 1 is a schematic structural diagram of a spatio-temporal joint modeling system for watershed water quality prediction provided by an embodiment of the present invention;

[0037] Figure 2 is a schematic flowchart of a spatio-temporal joint modeling method for watershed water quality prediction provided by an embodiment of the present invention. Detailed Embodiments

[0038] The present invention will be described in detail below with reference to the accompanying drawings.

[0039] Embodiment 1

[0040] As Figure 1 shown, the present invention provides a spatio-temporal joint modeling system for watershed water quality prediction, including: a data acquisition module, a feature extraction module, a feature fusion module, a model training module, and a prediction output module;

[0041] The data acquisition module: acquires the watershed water quality data of each monitoring point during the watershed water quality prediction process, where the watershed water quality data includes time series data and spatial topological data, and performs the alignment of spatio-temporal data of each monitoring point and the construction of an adjacency matrix;

[0042] The watershed water quality data is sourced from obtaining a watershed vector map from the water resources department's GIS system, extracting the river network topology from OpenStreetMap, analyzing the water flow direction using a DEM digital elevation model, and real-time collection by sensor deployment; the time series data includes hourly water quality data of each monitoring station, specifically including pH value, dissolved oxygen DO, chemical oxygen demand COD, etc.; the spatial topological data includes: river network topological structure, sluice and dam location information, and watershed topological features;

[0043] The alignment of the spatio-temporal data includes: performing alignment in the time dimension and the space dimension. The alignment in the time dimension includes, for different sampling frequencies, using time interpolation to unify the time base; for the problem of time missing values, using a time series model to predict and fill in the missing values; the alignment in the space dimension includes using spatial interpolation methods for spatial alignment, and the spatial interpolation methods include: inverse distance weighting, Kriging, and radial basis function;

[0044] The construction of the adjacency matrix includes: constructing a site graph structure according to the relevance between sites, regarding each monitoring point as a node in the graph, and representing the node set as V = {v1, v2... v n}, numbering the nodes, such as v1→1, v2→2, determining the connection relationship, using a directed line segment to represent the water flow direction, and constructing an adjacency matrix according to the upstream and downstream relationship between sites; at the same time, considering historical water quality data, constructing a feature matrix based on the historical water quality data of each site, selecting water quality parameters as input features, and then using a graph neural network to extract and discover the features and rules in the graph structure data, and capturing the spatial dependence relationship between the monitoring data of each site through the operation of the adjacency matrix and the feature matrix;

[0045] As a specific embodiment, let the topological structure of the water quality monitoring sites in a certain basin be G = (V, E), where V = {v1, v2... v n} represents the set of monitoring points, n represents the number of sites, E represents the set of edges, representing the upstream and downstream relationship between any two monitoring points. If the water flows from site v i to v j , then there is a directed edge between v i and v j . The monitoring point graph G can be represented as an adjacency matrix A ∈ R n*n , and R represents the weight of the adjacency matrix; according to the constructed site graph G and the input feature x composed of historical water quality data, a mapping function f(·) is learned to predict the water quality data of all monitoring points at t out time steps where N represents the length of the input time window, and t out is the length of the predicted time window;

[0046] The topological features of the basin are specifically the upstream and downstream relationship, tributary confluence, impact of water conservancy projects, and land use association; considering the spatio-temporal coupling impact on pollutant diffusion according to different basin topological relationships. Since pollutant diffusion downstream affects the upstream and downstream relationship of water areas, the flow velocity is used to represent the edge weight of the constructed directed graph; the tributary confluence produces a multi-source pollution superposition effect, and multi-node attention is used for aggregation; under the influence of water conservancy projects, the sluice and dam change the hydrological connectivity, and a dynamic adjacency matrix is used; under the land use association, a virtual connection edge is used for the non-point source pollution transmission path;

[0047] The feature extraction module: set a time series encoding module to encode the time series data, extract time series features, and obtain the first data feature. Set a spatial encoding module to perform spatial modeling on the spatial topological data, extract spatial features, and obtain the second data feature;

[0048] The timing encoding module uses the Informer model to encode time series data. It preprocesses the time series data using a dynamic sliding window algorithm, and based on the moving average method of the dynamic window selection strategy, combines the water quality data change rate to adjust the window size in real time. It also uses the z-score method to standardize the data, designs a multi-scale fusion mechanism, and splices the original time series data and multi-scale moving average features along the channel dimension to obtain the first time series data;

[0049] After segmenting the first time series data, it is input into a neural network layer to extract the local features of each sub-data sequence, obtaining the second time series data. The second time series data is subjected to a short-time Fourier transform to extract frequency domain characteristics, obtaining the third time series data;

[0050] The second time series data and the third time series data are used as the input to the encoder in the Informer model. The probability sparse self-attention mechanism is used to process the sequence to extract features, and the multi-head self-attention mechanism is further used to process the sequence to capture features in different subspaces. The processed sequence is sent to the decoder to obtain the first data feature;

[0051] Based on the moving average method of the dynamic window selection strategy, combined with the water quality parameter change rate, the window size (6h / 12h / 24h) is adjusted in real time, breaking through the limitations of the traditional fixed window;

[0052] As a specific embodiment, the hourly change rate is calculated for each water quality parameter Dynamically evaluate the data stationarity, r t : The real-time volatility at time t, x t : The water quality parameter value at time t, x t-1 : The water quality parameter value at time t-1;

[0053] Adaptive adjustment of the window, stable period (∣r t ∣<5%): Use a long window (24 hours) to strengthen periodic characteristics; applicable to the stable period (such as the slow change of DO in the dry season), smooth the diurnal cycle noise; fluctuating period (5%≤∣r t ∣≤15%): Switch to a medium window (12 hours) to balance trends and details, cope with the initial stage of rainfall or tidal effects, and retain semi-diurnal cycle characteristics; mutation period (∣r t ∣>15%): Enable a short window (6 hours) to quickly respond to sudden changes; for sudden pollution / such as factory leakage, minimize the lag effect;

[0054] Design a multi-scale feature fusion mechanism to splice the original time series data with short / medium / long-term moving average features, enhancing the model's ability to capture sudden pollution events and periodic patterns. Introduce short-time Fourier transform to process the time series. The original series is intercepted into several independent time domain segments according to a window function with a fixed step size, and Fourier transform is performed within each small segment to obtain the local frequency distribution within a period of time near time t. Then, the window function is slid on the time axis to obtain the time distribution of different frequencies, establishing a connection between the time series in the time domain and the frequency domain. After short-time Fourier transform, the time domain time series data is transformed into a time series containing both the time domain and the frequency domain;

[0055] Use the probabilistic sparse self-attention mechanism to process the sequence and extract features. This mechanism can greatly reduce the computational amount by screening features. Take the second time series data and the third time series data as the input of the encoder in the Informer model, expressed as: I = Informer((A, C), θ Informer ), where I is the model output, θ Informer is the model parameter; A and C are the second time series data and the third time series data;

[0056] The calculation of the probabilistic sparse self-attention mechanism can be expressed as:

[0057]

[0058] Among them, Q, K, and V are the query, key, and value matrices respectively; the Softmax function is used for normalization calculation, d k is the dimension of the key vector; ⊙ represents element-wise multiplication; M is a probabilistic mask matrix, and each of its elements Mij represents the probability of performing attention calculation between the i-th query vector and the j-th key vector. This probabilistic mask matrix is generated according to a certain strategy and is set to the mean value of the value matrix;

[0059] The spatial encoding module uses a dynamic graph attention network to perform spatial modeling on spatial topological data. The first data feature is used as the node feature of the input data to construct the hidden state of each monitoring point at different time steps, define the spatial relationship between stations through topological connection, and set edge features as needed;

[0060] Generate a two-layer dynamic graph attention network. The first layer uses multi-head attention to capture multiple spatial patterns, and the second layer aggregates multi-head information and reduces the dimension, retaining key topological features. Layer normalization is used to stabilize the training, and Dropout is used to prevent overfitting of the data to obtain the second data feature;

[0061] Specifically, construct the hidden state of each monitoring point at different time steps to store and transmit information between time steps, helping the model capture the temporal dependencies and context relationships in the input sequence. The hidden state of each monitoring point i at time t includes: historical hydrological memory, such as rainfall-runoff dynamics in the past 7 days; spatial topological relationships, such as the influence of upstream and downstream stations; instantaneous environmental characteristics, such as current soil moisture and temperature;

[0062] Use a two-layer dynamic graph attention network. The first layer adopts multi-head attention (e.g., 3 heads), and the second layer reduces the dimension for aggregation. Layer normalization is used to stabilize the training, and Dropout is used to prevent overfitting. Each station calculates its interaction weights with neighboring stations through 3 independent attention mechanisms. For example, head 1 may focus on hydrological connectivity (such as the influence of upstream stations on downstream stations); head 2 may capture geographical proximity (such as similar pollution sources of neighboring stations); head 3 may learn physical constraints (such as the diffusion speed of pollutants limited by flow velocity). The second layer (single head): Concatenate the multi-head features and compress them back to the original dimension to generate a comprehensive spatial representation. If the river distance is provided, it is incorporated into the calculation of attention weights to distinguish between "strong influence at close range" and "weak influence at long range" for feature fusion. And introduce non-linearity through the LeakyReLU activation function to retain negative value differences. For example, if the pollutant concentration at a certain station is abnormally lower than that of its neighbors, a non-linear transformation is achieved;

[0063] The feature fusion module: Set a feature fusion gating mechanism to fuse the first feature data and the second feature data to generate a unified spatio-temporal representation, dynamically weigh spatio-temporal features, and perform adaptive feature fusion;

[0064] The feature fusion gating mechanism is implemented using the second feature data and a gating mechanism that processes the first feature data in parallel. When processing the first feature data, information is strictly saved according to the temporal position, and the processing speed is accelerated through a parallel processing structure, expressed as:

[0065]

[0066] where, X MIE and X IE represent the input and output matrices of the feature fusion gating mechanism, represent learnable parameters, ⊙ represents element-wise multiplication, and σ represents the ReLU activation function;

[0067] The feature fusion gating mechanism also includes setting a spatio-temporal position encoding joint embedding layer, using a Gaussian kernel to map spatial coordinates and periodic time encoding, and combining a hydrological feature-guided attention mechanism to construct a gating network for dynamic spatio-temporal feature fusion. The node attention layer in the set gating network for dynamic spatio-temporal feature fusion includes a degree centrality-guided attention mechanism and a squeeze-and-excitation module;

[0068] The calculation formula of the node attention layer is:

[0069] X NF = F scale (X MIE , ATT DC F ex (F sq (X MIE ), W SET ))

[0070] where X NF is the output data of the node attention layer, W SET is the learnable parameter of the squeeze-and-excitation module, F scale , F ex , F sq are the scaling, excitation, and compression operations of the squeeze-and-excitation module, ATT DC ∈R N*N represents the degree centrality-guided attention calculated according to the node embedding;

[0071] The degree centrality-guided attention is expressed as:

[0072]

[0073] where softmax(·) represents the normalized exponential function, DC(·) is the degree centrality calculation function, matrices E1 and E2 are randomly initialized node embeddings, and are the trainable model parameters, d DC represents the adjustment parameter;

[0074] Specifically, the Gaussian kernel function mapping is used to encode the watershed topological relationship by setting the attenuation coefficient for the longitude and latitude coordinates of the monitoring points, and the Sin / Cos periodic encoding is adopted to capture the multi-period time patterns of hours, days, and months; for the hydrological features, the scaling factor and offset of each attention head are generated through a multi-layer perceptron, and an affine transformation is performed on the original attention scores;

[0075] The model training module: designs a training strategy through a multi-task loss function, conducts phased training, sets the pre-trained time series module to freeze the dynamic graph attention network layer, trains the Informer model independently, unfreezes all parameters, performs joint fine-tuning through the learning rate, and introduces a dynamic graph learner for dynamic graph learning;

[0076] The pre-trained time series module freezes the non-time series data, calculates the mean absolute error between the predicted values and the true values of each monitoring point on the validation set, uses the mean absolute error loss as the objective function, independently learns the time evolution law of water quality parameters, inputs the non-time series data, unfreezes all parameters, and calculates the mixed loss;

[0077] The mixed loss includes the main prediction loss, spatial consistency loss, and temporal smoothness loss. The main prediction loss is expressed as:

[0078]

[0079] where L main represents the main prediction loss, N represents the total number of samples, y i represents the true water quality parameter value, represents the model prediction value;

[0080] The spatial consistency loss is expressed as:

[0081]

[0082] where L spa represents the spatial consistency loss, E represents all valid edges, A u,v represents the connection weight between nodes u and v in the adjacency matrix, represents the predicted feature vector of node u, represents the predicted feature vector of node v; ||·||2 represents the L2 norm;

[0083] The temporal smoothness loss is expressed as:

[0084]

[0085] where L tem represents the temporal smoothness loss, T represents the time step, represents the predicted value at the t-th time step, |·|1 represents the L1 norm;

[0086] The mixed loss is calculated by weighted combination of multiple sub-loss functions, expressed as:

[0087] L hyb = L main + α·L spa + β·L tem

[0088] Among them, α and β represent weights;

[0089] The introduction of the dynamic graph learner for dynamic graph learning includes: calculating the correlation strength scores of all combinations of monitoring points through the feature data of each monitoring point, splicing the features of two monitoring points, predicting the connection weights through a neural network, generating an adjacency matrix for constructing a dynamic graph, strengthening the water flow direction of the watershed by penalizing reverse connections through a loss function, and performing sparsity control through Top-k screening, so that each monitoring point only retains the k neighbors with the strongest connections. When the characteristics of the pollution source site change suddenly, new strong connections are generated, and the downstream sites of the watershed automatically enhance the association weights to form a temporary pollution diffusion path;

[0090] Specifically, the process of flow direction strengthening is as follows: Mark the true water flow direction between some monitoring points in advance, introduce a loss function penalty, and during the training process, impose a penalty on the connections that violate the known flow direction, while strengthening the connections in the correct direction. Input the known flow direction relationship and store the known upstream and downstream relationships in a list form. Calculate the flow direction loss. If the model predicts that the downstream site points to the upstream (such as site 2 → site 1), the loss value is increased to force the weight to approach 0; encourage the weight from upstream to downstream to approach 1 (strong connection), and combine the flow direction loss with the main loss in a weighted manner to ensure that the model takes into account both prediction accuracy and physical rationality during the optimization process;

[0091] The Top-k screening process is as follows: Calculate the connection weight ranking of each monitoring point, sort all the outgoing edges of each row of the adjacency matrix, which represents a monitoring point, and find the top k values with the largest weights, such as k = 3; take the k-th largest weight as the threshold, set the connections smaller than this threshold to 0, and then sparsify the adjacency matrix, only retaining the top-k connections of each site, and forcing the remaining weights to zero to ensure a simple network structure;

[0092] As a specific embodiment, the specific situation of the dynamic graph learner for dynamic graph learning includes: when a new monitoring site is set up, automatically learning the association between the new site and the existing network; when a tributary flows into the main stream during the rainy season, dynamically enhancing the newly added hydrological connections during the rainy season; when there is industrial illegal discharge behavior, automatically generating a temporary pollution channel; when a sensor fails, adaptively adjusting the surrounding connection weights;

[0093] The prediction output module: outputs the prediction results and effect indicators for the water quality of the watershed, conducts a visual display of the pollutant diffusion path, and issues early warnings for sudden pollution events;

[0094] The prediction results include the predicted values of key water quality indicators at each monitoring point in the future time period, accurate to the hourly level. For example, the water quality prediction for the next 72 hours. The effectiveness indicators include the proportion of spatial consistency error, the dynamically generated pollutant propagation path when visualizing the pollution diffusion path, marking key nodes such as pollution sources, sensitive water intakes, and propagation speed, dividing into level 1-5 early warnings according to the exceeding standard degree and influence range, and attaching a reason description.

[0095] Embodiment 2

[0096] The present invention also provides a spatio-temporal joint modeling method for watershed water quality prediction, as Figure 2 shown, applied to a spatio-temporal joint modeling system for watershed water quality prediction as described above, specifically including the following steps:

[0097] Step 1: Obtain the watershed water quality data of each monitoring point during the watershed water quality prediction process. The watershed water quality data includes time series data and spatial topology data, and perform alignment of spatio-temporal data of each monitoring point and construction of an adjacency matrix;

[0098] Step 2: Set a time series encoding module to encode the time series data, extract time series features, obtain the first data feature, set a spatial encoding module to perform spatial modeling on the spatial topology data, extract spatial features, and obtain the second data feature;

[0099] Step 3: Set a feature fusion gating mechanism to fuse the first feature data and the second feature data, generate a unified spatio-temporal representation, dynamically weigh spatio-temporal features, and perform adaptive feature fusion;

[0100] Step 4: Design a training strategy through a multi-task loss function and perform staged training. Set the pre-trained time series module to freeze the dynamic graph attention network layer, train the Informer model alone, unfreeze all parameters, perform joint fine-tuning through the learning rate, and introduce a dynamic graph learner for dynamic graph learning;

[0101] Step 5: Output the prediction results and effectiveness indicators for watershed water quality, perform visual display of the pollutant diffusion path, and issue early warnings for sudden pollution events.

[0102] In the specification provided here, a large number of specific details are described. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and technologies are not shown in detail so as not to obscure the understanding of this specification.

[0103] Similarly, it should be understood that, for the purpose of streamlining the present disclosure and assisting in understanding one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all of the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present invention.

[0104] Furthermore, those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not others, combinations of features of different embodiments are meant to be within the scope of the present invention and form different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.

Claims

1. A spatio-temporal joint modeling system for watershed water quality prediction, characterized in that Including: A data acquisition module, a feature extraction module, a feature fusion module, a model training module, and a prediction output module; The data acquisition module: acquires the basin water quality data of each monitoring point during the basin water quality prediction process. The basin water quality data includes time series data and spatial topology data, and performs the alignment of the spatio-temporal data of each monitoring point and the construction of the adjacency matrix; The feature extraction module: sets a time series encoding module to encode the time series data, extracts time series features, and obtains the first data feature. Sets a spatial encoding module to perform spatial modeling on the spatial topology data, extracts spatial features, and obtains the second data feature; The feature fusion module: sets a feature fusion gating mechanism to fuse the first feature data and the second feature data, generates a unified spatio-temporal representation, dynamically weighs the spatio-temporal features, and performs adaptive feature fusion; The model training module: designs a training strategy through a multi-task loss function and conducts staged training. Sets a pre-training time series module to freeze the dynamic graph attention network layer, trains the Informer model separately, unfreezes all parameters, performs joint fine-tuning through the learning rate, and introduces a dynamic graph learner for dynamic graph learning; The prediction output module: outputs the basin water quality prediction results and effectiveness indicators, conducts a visual display of the pollutant diffusion path, and issues early warnings for sudden pollution events.

2. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, wherein, The time series encoding module uses the Informer model to encode the time series data, preprocesses the time series data using the dynamic sliding window algorithm, uses the moving average method based on the dynamic window selection strategy, adjusts the window size in real time in combination with the water quality data change rate, and uses the z-score method to standardize the data. Designs a multi-scale fusion mechanism, concatenates the original time series data and the multi-scale moving average features along the channel dimension to obtain the first time series data; Segments the first time series data and inputs it into the neural network layer to extract the local features of each sub-data sequence to obtain the second time series data, and performs a short-time Fourier transform on the second time series data to extract the frequency domain characteristics to obtain the third time series data; Uses the second time series data and the third time series data as the input of the encoder in the Informer model, processes the sequence using the probabilistic sparse self-attention mechanism to extract features, further processes the sequence using the multi-head self-attention mechanism to capture the features in different subspaces, and sends the processed sequence into the decoder to obtain the first data feature.

3. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, wherein The spatial encoding module uses the dynamic graph attention network to perform spatial modeling on the spatial topology data. The first data feature is used as the node feature of the input data, constructs the hidden state of each monitoring point at different time steps, defines the spatial relationship between sites through topological connections, and sets edge features as needed; Generates a two-layer dynamic graph attention network. The first layer uses multi-head attention to capture multiple spatial patterns. The second layer aggregates the multi-head information and reduces the dimension, retains the key topological features, stabilizes the training through layer normalization, and uses Dropout to prevent data overfitting to obtain the second data feature.

4. A spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, characterized in that, The feature fusion gating mechanism is implemented by using the second feature data and the gating mechanism for parallel processing of the first feature data. When processing the first feature data, information is strictly saved according to the temporal position, and the processing speed is accelerated through a parallel processing structure, which is expressed as: Among them, X MIE and X IE represent the input and output matrices of the feature fusion gating mechanism, represent learnable parameters, ⊙ represents element-wise multiplication, and σ represents the ReLU activation function.

5. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, wherein The feature fusion gating mechanism further includes setting a spatio-temporal position encoding joint embedding layer, using a Gaussian kernel to map spatial coordinates and periodic time encoding, combining with an attention mechanism guided by hydrological features to construct a gating network for dynamic fusion of spatio-temporal features. The node attention layer in the set gating network for dynamic fusion of spatio-temporal features includes an attention mechanism guided by degree centrality and a squeeze-and-excitation module.

6. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, characterized in that, The pre-trained temporal module freezes non-temporal data, calculates the mean absolute error between the predicted values and the true values of each monitoring point on the validation set, uses the mean absolute error loss as the objective function to independently learn the temporal evolution law of water quality parameters, inputs non-temporal data, unfreezes all parameters, and calculates the mixed loss.

7. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 6, wherein The mixed loss includes the main prediction loss, the spatial consistency loss, and the temporal smoothness loss.

8. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, characterized in that The introduction of a dynamic graph learner for dynamic graph learning includes: calculating the association strength scores of all combinations of monitoring points through the feature data of each monitoring point, splicing the features of two monitoring points, predicting the connection weights through a neural network to generate an adjacency matrix for constructing a dynamic graph, strengthening the water flow direction of the water area by penalizing reverse connections through a loss function, and performing sparsity control through Top-k screening, so that each monitoring point only retains the k neighbors with the strongest connections. When the characteristics of the pollution source site change suddenly, new strong connections are generated, and the downstream sites of the basin automatically enhance the association weights to form a temporary pollution diffusion path.

9. The spatio-temporal joint modeling system for watershed water quality prediction according to claim 1, wherein, The prediction results include the predicted values of the key water quality indicators for each monitoring point in the future period, accurate to the hourly level. The effect indicators include the spatial consistency error ratio. When visualizing the pollution diffusion path, the dynamically generated pollutant propagation path is marked with key nodes, and a warning level of 1 to 5 is divided according to the exceeding standard degree and the influence range, with a reason explanation attached.

10. A spatio-temporal joint modeling method for watershed water quality prediction, characterized in that, Applied to a spatio-temporal joint modeling system for watershed water quality prediction according to any one of claims 1 to 9, it specifically includes the following steps: Step 1: Obtain the watershed water quality data of each monitoring point during the watershed water quality prediction process. The watershed water quality data includes time series data and spatial topology data, and perform alignment of the spatio-temporal data of each monitoring point and construction of the adjacency matrix. Step 2: Set a temporal encoding module to encode the time series data, extract temporal features, and obtain the first data feature. Set a spatial encoding module to perform spatial modeling on the spatial topology data, extract spatial features, and obtain the second data feature. Step 3: Set a feature fusion gating mechanism to fuse the first feature data and the second feature data, generate a unified spatio-temporal representation, dynamically weigh the spatio-temporal features, and perform adaptive feature fusion. Step 4: Design the training strategy through a multi-task loss function, conduct staged training, set the pre-trained time series module to freeze the dynamic graph attention network layer, train the Informer model separately, unfreeze all parameters, perform joint fine-tuning through the learning rate, and introduce a dynamic graph learner for dynamic graph learning; Step 5: Output the prediction results and effect indicators for basin water quality, conduct a visual display of the pollutant diffusion path, and issue early warnings for sudden pollution incidents.

Citation Information

Patent Citations

  • Water bloom prediction method fusing multi-parameter spatio-temporal information

    CN119178863A

  • Water quality prediction method based on graph neural network and spatial-temporal feature fusion

    CN119598402A

  • Genome-wide prediction method based on deep learning by using genome-wide data and bioinformatics features

    US20250104813A1

Cited By

  • Automatic water quality monitoring method and system

    CN120748554A

  • An automatic water quality monitoring method and system

    CN120748554B

  • Automatic adjustment method for data-driven perfusion process based on machine learning

    CN121209282A

  • Water quality prediction network, water quality prediction model training method and device, and water quality prediction method and device

    CN121306338A

  • Water quality prediction system, water quality prediction model training, water quality prediction method and device

    CN121306338B