River water quality prediction method and system considering spatial information accumulation
By combining BiLSTM and graph attention mechanisms with BiGRU simulation to predict river water quality, the problem of quantifying the spatial accumulation effect of upstream pollutants is solved, achieving high accuracy and physical rationality in river water quality prediction, and is applicable to synchronous early warning at multiple monitoring stations across the entire basin.
Patent Information
- Application Number
- CN202511622801.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-11-07
AI Technical Summary
Existing methods for predicting river water quality are insufficient to accurately quantify the spatial accumulation effect of upstream pollutants, fail to deeply integrate hydrophysical mechanisms, and exhibit insufficient physical rationality and generalization ability in predictions at multiple monitoring stations.
The temporal features of the monitoring stations are extracted using the BiLSTM (Bisequential Feature Transmission Unit), and the upstream cumulative influence weight is calculated by combining the spatial information cumulative encoding unit with the graph attention mechanism. The pollutant transfer process is simulated using the BiGRU (Bihydrological Transfer Unit), and a comprehensive prediction model for the monitoring stations is generated.
It improves the accuracy and physical rationality of river water quality prediction, and can exhibit stronger robustness and generalization ability in complex watershed environments, enabling synchronous early warning from multiple monitoring stations across the entire watershed.
Smart Images

Figure CN121093799B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of river water quality prediction technology, and in particular to a method and system for river water quality prediction that takes into account the accumulation of spatial information. Background Technology
[0002] Accurate prediction of river water quality is a core component of water environment management, pollution prevention and control, and ecological security assessment. Accurately predicting the dynamic changes in the concentrations of key water quality parameters (such as nutrients, organic matter, and heavy metals) is crucial for ensuring drinking water safety and preventing water environment problems such as eutrophication and harmful algal blooms.
[0003] Currently, mainstream methods for predicting river water quality are mainly divided into two categories: mechanistic models based on physical mechanisms and mathematical statistical models based on data-driven approaches.
[0004] 1. Limitations of Mechanistic Models: Distributed hydrological and water quality models, such as SWAT and MIKE, simulate concentration changes by solving physical equations of pollutant migration and transformation. While they offer good physical interpretability, their application heavily relies on a large amount of high-precision input parameters (such as meteorological, soil, land use, and pollution source data). In areas with scarce data or highly complex underlying surfaces, they often face challenges such as difficulty in parameter calibration, high computational costs, and insufficient simulation accuracy for specific water quality parameters.
[0005] 2. Evolution and Limitations of Data-Driven Models: With the development of artificial intelligence technology, especially deep learning models such as Long Short-Term Memory (LSTM) networks, which can automatically capture the complex nonlinear temporal dependencies of water quality parameters, they have been widely used in this field. However, most existing LSTM-based water quality prediction studies either treat monitoring stations as independent entities for modeling or simply fuse data from multiple monitoring stations, generally neglecting the inherent network topology of river systems and the transport, transformation, and spatial accumulation effects of pollutants between upstream and downstream areas. This modeling approach cannot truly reflect the contribution of upstream water to downstream water quality, resulting in inherent defects in the model's physical rationality and generalization ability.
[0006] 3. Introduction and Legacy Issues of Graph Neural Networks (GNNs): In recent years, Graph Neural Networks (GNNs) have been introduced into river system modeling due to their inherent advantages in processing non-Euclidean spatial data. Related research has improved prediction accuracy to some extent by constructing river network maps with monitoring stations as nodes and flow direction as edges, and utilizing methods such as Graph Convolutional Networks (GCNs) or Graph Attention Networks (GATs). However, existing GNN models still have significant shortcomings in river water quality modeling:
[0007] The integration of physical mechanisms is superficial: most models fail to deeply integrate key physical prior knowledge affecting pollutant diffusion and transport, such as distance attenuation effect and water flow velocity, into the network structure, which limits the physical rationality and extrapolation ability of the models.
[0008] Inaccurate modeling of spatial cumulative effects: When simulating the cumulative impact of upstream pollutants on downstream areas, the dynamic interaction between the similarity of water quality characteristics and spatial distance is not comprehensively considered, making it difficult to accurately quantify the contribution weight of different upstream pollution sources.
[0009] Insufficient structural flexibility: Existing methods mostly support single-point prediction, making it difficult to achieve synchronous early warning of water quality parameters at multiple monitoring stations in a watershed, and the model structure is poorly adaptable to complex hydrological conditions.
[0010] Therefore, developing a general model that can deeply integrate river hydrophysical mechanisms, accurately quantify the spatial accumulation effect of pollutants in upstream and downstream areas, and is applicable to synchronous prediction at multiple monitoring stations across the entire basin has become a key technical problem that urgently needs to be solved in the current precise management and early warning of the water environment. Summary of the Invention
[0011] The purpose of this invention is to provide a method and system for predicting river water quality that takes into account the accumulation of spatial information, so as to solve the problems in the prior art that it is difficult to accurately quantify the spatial accumulation effect of upstream pollutants and fail to deeply integrate hydrophysical mechanisms.
[0012] To achieve the above objectives, the present invention provides a river water quality prediction method that takes into account the accumulation of spatial information, comprising the following steps:
[0013] Historical water quality data from multiple monitoring stations in the target river basin were obtained, with the monitoring stations arranged according to the river's flow direction.
[0014] Constructing a river water quality prediction model, including:
[0015] The temporal feature encoding unit is used to extract the temporal features of each monitoring station;
[0016] The spatial information cumulative coding unit is used to integrate the spatial location information of the monitoring station into the temporal features to form the feature vector of each monitoring station. It also uses a graph attention mechanism to dynamically calculate the cumulative influence weight of all upstream monitoring stations of the target monitoring station and aggregates them to generate the upstream cumulative influence feature.
[0017] The hydrological transport simulation unit is used to simulate the water quality information transport process from upstream to the target monitoring station based on a sequence modeling network, and output the river flow characteristics.
[0018] The monitoring station prediction unit is used to predict the future water quality parameter concentrations of the target monitoring station by integrating the feature vectors of the target monitoring station, the cumulative influence characteristics of the upstream, and the river flow characteristics.
[0019] Preferably, the temporal feature encoding unit processes the historical water quality data of each monitoring station through a bidirectional long short-term memory network (BiLSTM) to extract the temporal features of each monitoring station. The specific formula is as follows:
[0020] ;
[0021] in, Indicates monitoring stations The temporal characteristics, Indicates from the most upstream monitoring station to monitoring station All monitoring stations within the time window Observational data within, Indicates time, Indicates a historical time window, Indicates the number of feature dimensions. This indicates the index of the currently monitored site.
[0022] Preferably, the spatial information accumulation coding unit generates a location code for each monitoring station and fuses the location code with the corresponding temporal features to form a monitoring station feature that fuses spatial location information;
[0023] The position code is generated using a sine-cosine position code function:
[0024] ;
[0025] ;
[0026] in, , Indicates the first The monitoring station at the first peacekeeping Position encoding value in dimension, This indicates the location index of the monitoring station in the river. Indicates the index of the location feature dimension;
[0027] The formula for calculating the feature vector of a monitoring station is as follows:
[0028] ;
[0029] in, Indicates the first Feature vectors of each monitoring station Indicates monitoring stations Location encoding, This represents the fusion weights of the positional encoding.
[0030] Preferably, the spatial information cumulative coding unit is also used to generate a query vector based on the fused monitoring site features for the currently predicted downstream target monitoring site, and to generate a key vector and a value vector based on the fused monitoring site features of all its upstream monitoring sites; to calculate the attention weight of each upstream monitoring site to the target monitoring site by combining feature similarity with the distance decay function that characterizes the distance decay effect between monitoring sites; and to perform weighted aggregation of the value vectors of each upstream monitoring site based on the attention weight to obtain the upstream cumulative influence features.
[0031] Preferably, the distance decay function is as follows:
[0032] ;
[0033] in, Represents the distance decay function. This indicates the locational distance between monitoring stations.
[0034] The preferred formula for calculating the upstream cumulative impact characteristics is as follows:
[0035] ;
[0036] in, This indicates the characteristics of the cumulative impact upstream. This represents the final attention weight score. Indicates all upstream monitoring stations The value vector.
[0037] Preferably, the hydrological transport simulation unit processes the monitoring station characteristic sequence from the upstream monitoring station to the target monitoring station through a bidirectional gated circulation unit (BiGRU) to simulate the transport process of pollutants along the river network from upstream to downstream and output river flow characteristics.
[0038] Preferably, the monitoring station prediction unit splices together the feature vector of the target monitoring station, the upstream cumulative impact features, and the river flow features, and then fuses and maps them through a multilayer perceptron (MLP) to predict the water quality parameter concentration of the target monitoring station at a specific time in the future.
[0039] Preferably, the method uses a weighted mean squared error loss function for optimization during model training.
[0040] This invention also provides a river water quality prediction system that takes into account the accumulation of spatial information, comprising:
[0041] The data acquisition module is used to acquire historical water quality data from multiple monitoring stations in the target river basin, with the monitoring stations arranged according to the river flow direction;
[0042] The preprocessing module is used to preprocess the acquired historical water quality data, including outlier and missing value handling, data aggregation, missing value imputation, and time series alignment.
[0043] The model building module is used to build predictive models, which include:
[0044] The temporal feature encoding unit is used to extract the temporal features of each monitoring station;
[0045] The spatial information cumulative coding unit is used to integrate the spatial location information of the monitoring station into the temporal features. Using the graph attention mechanism, it dynamically calculates the cumulative influence weight of all upstream monitoring stations of the target monitoring station and aggregates them to generate upstream cumulative influence features.
[0046] The hydrological transport simulation unit is used to simulate the water quality information transport process from upstream to the target monitoring station based on a sequence modeling network, and output the river flow characteristics.
[0047] The monitoring station prediction unit is used to predict the future water quality parameter concentrations of the target monitoring station by integrating the feature vectors of the target monitoring station, the upstream cumulative impact characteristics, and the river flow characteristics.
[0048] The training and evaluation module is used to train the constructed prediction model, optimize it using the weighted mean squared error loss function, and evaluate the prediction performance of the model.
[0049] The prediction module is used to predict the future concentration of water quality parameters at the target monitoring station using a trained prediction model.
[0050] Therefore, the present invention employs the above-mentioned method and system for predicting river water quality that takes into account the accumulation of spatial information, and the beneficial technical effects are as follows:
[0051] (1) By employing a temporal feature encoding unit (such as BiLSTM) to extract the temporal features of each monitoring station and combining it with a spatial location encoding unit to integrate the spatial location information of the monitoring stations, this invention can simultaneously capture the dynamic changes of water quality data over time and their distribution relationship in the river network space. This deep fusion of spatiotemporal features overcomes the drawbacks of traditional methods that treat monitoring stations as independent individuals or simply fuse them, thereby improving the accuracy of the prediction model and its ability to perceive complex watershed environments.
[0052] (2) By using a spatial information accumulation unit, the cumulative influence weight of upstream monitoring stations on target monitoring stations is dynamically calculated based on a graph attention mechanism. Innovatively, feature similarity and distance decay function are combined, enabling the present invention to adaptively quantify the contribution of different upstream pollution sources to downstream water quality. This makes the model not only data-driven but also deeply integrates the physical prior knowledge of pollutant transport and diffusion with water flow, improving the physical rationality and interpretability of the prediction results.
[0053] (3) The process of water quality information transmission from upstream to the target monitoring station is simulated by a hydrological transport simulation unit (such as BiGRU). This not only simulates the transmission and accumulation of pollutants along the river, but also allows BiGRU to capture the information flow of both forward (downstream) and reverse (upstream) feedback, outputting flow information covering the entire river section. This makes the information transmission logic of the model highly consistent with the actual hydrological flow characteristics of the river, truly reflecting the transmission and accumulation of pollutants along the river.
[0054] (4) Monitoring Station (MLP) prediction unit, which is used to comprehensively process the aforementioned monitoring station characteristics, upstream cumulative impact characteristics and other information and use them for monitoring station prediction. This invention regards all monitoring station information in the river network as a whole for systematic prediction, which can more realistically reflect the transmission and accumulation patterns of pollutants in the river, and make the model exhibit stronger robustness and generalization ability under different hydrological conditions. Attached Figure Description
[0055] Figure 1 This is a flowchart of a river water quality prediction method that takes into account the accumulation of spatial information according to the present invention;
[0056] Figure 2 A logical diagram of a river water quality prediction model;
[0057] Figure 3 A schematic diagram for designing a river water quality prediction model;
[0058] Figure 4 This is a graph showing the predicted total nitrogen concentration at the target monitoring station using a river water quality prediction model. Figure 4 (a)-(e) in the table correspond to the comparison between the predicted and actual observation results of the total nitrogen concentration in the water bodies at monitoring stations ST10-ST14. Detailed Implementation
[0059] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0060] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0061] Example 1
[0062] like Figure 1 As shown, a river water quality prediction method that takes into account the accumulation of spatial information includes the following steps:
[0063] 1. Data preparation and preprocessing.
[0064] This embodiment uses a tributary in a certain region as the study area. Monitoring data were obtained from the China National Environmental Monitoring Centre from December 17, 2020 to January 18, 2024, from 14 water quality monitoring stations (numbered ST0 to ST8 and ST10 to ST14 according to the river's flow direction from upstream to downstream). Data was collected every 4 hours, and the monitoring parameters included eight indicators: water temperature, pH, dissolved oxygen, conductivity, turbidity, permanganate index, total phosphorus, and total nitrogen (TN).
[0065] The data preprocessing steps are as follows:
[0066] Outlier and missing value handling: First, outliers are manually screened and marked, and then the Z-score method is used for secondary detection. Samples exceeding the threshold (±3 times the standard deviation) are marked as missing values.
[0067] Data aggregation: To eliminate intraday fluctuations, the raw data is aggregated by date, the daily average of each indicator is calculated, and a daily-scale dataset is generated.
[0068] Missing value imputation: A stratified imputation strategy is employed. A sliding window of 5 days before and after the missing value (11 days in total) is constructed, and the mean of the non-empty data within the window is used for imputation. If no valid data is found within the window, the window is extended to 10 days before and after the missing value (21 days in total) for another attempt. Data with more than 10 consecutive days of missing values or an overall missing value rate exceeding 45% (such as at monitoring site ST9) are discarded.
[0069] Time series alignment: Generate a continuous date series covering the entire research period (1124 days in total), reconstruct the time index using the reindex method of the pandas library, and fill in any newly added missing values using the strategy described above.
[0070] 2. Construction of a river water quality prediction model (SRTM model).
[0071] The logical diagram and design diagram of the River Water Quality Prediction Model (SRTM) proposed in this embodiment are shown below. Figure 2 , Figure 3 As shown, the details are as follows:
[0072] 2.1 Input and target definition.
[0073] The model input is arranged from upstream to downstream according to the direction of water flow. monitoring stations Historical data for each monitoring station. At any moment Record Each water quality indicator is expressed as: Given a historical time window sky( =7 days), the model aims to predict the set of downstream target monitoring stations. In the future time( TN concentration (=1 day):
[0074] ;
[0075] in, Indicates monitoring stations exist Moment concentration, Represents the SRTM model. This represents the set of parameters that the model can learn.
[0076] 2.2 Temporal Feature Coding Unit.
[0077] For each monitoring station Place it in the time window The time-series data is input into a bidirectional LSTM (BiLSTM) to extract time-series features. :
[0078] ;
[0079] in, Indicates monitoring stations The temporal characteristics, Indicates from the most upstream monitoring station to monitoring station All monitoring stations within the time window Observational data within, Indicates the number of feature dimensions. This indicates the index of the currently monitored site.
[0080] 2.3 Spatial Information Cumulative Coding Unit.
[0081] To enable the model to perceive the spatial location of monitoring stations within the river network, a sine-cosine location coding (PE) is introduced. Monitoring stations are assigned location indices in order from upstream to downstream. (0 to 13), calculate its positional encoding vector:
[0082] ;
[0083] ;
[0084] in, , Together they constitute the first The monitoring station at the first peacekeeping Position encoding value in dimension, This indicates the location index of the monitoring station in the river. This represents the index of the location feature dimension.
[0085] The final features of the monitoring stations are fused using addition instead of concatenation, thus ensuring that the feature dimensions remain unchanged.
[0086] ;
[0087] in, Indicates the first Feature vectors of each monitoring station Indicates monitoring stations Location encoding, The fusion weights representing the positional encoding are shown in this embodiment. , A smaller size ensures that the feature vectors of monitoring stations are primarily time-series features, with location information as a secondary factor.
[0088] To simulate the cumulative impact of upstream monitoring stations on downstream targets, a cumulative attention mechanism was designed. For the target monitoring station... :
[0089] Calculate its query vector :
[0090] ;
[0091] Calculate all its upstream monitoring stations ( The key vector of ) Sum value vector :
[0092] ;
[0093] ;
[0094] in, Both represent learnable projection matrices.
[0095] Introducing distance decay function :
[0096] ;
[0097] in, This indicates the locational distance between monitoring stations (must be a positive number).
[0098] Secondly, the attention score, which combines feature similarity and distance decay, is calculated:
[0099] ;
[0100] in, Represents the query vector With key vector dot product, This represents a scaling factor used to prevent softmax saturation. To obtain an interpretable attention weight distribution, the scores of all upstream monitoring stations are softmax normalized:
[0101] ;
[0102] in, This represents the final attention weight score. This represents the natural exponential function. This indicates all upstream monitoring stations. (satisfy )of Sum of values , They represent the first Between monitoring stations and the Attention scores between monitoring sites.
[0103] By aggregating information from upstream monitoring stations, we can obtain upstream cumulative features. :
[0104] ;
[0105] in, Indicates upstream monitoring stations The value vector. Finally, the output of this unit is obtained through residual connections and layer normalization:
[0106] ;
[0107] in, This represents the normalized upstream cumulative feature matrix. Represents the linear transformation learning matrix. Represents the residual. Representation layer normalization is used to stabilize training.
[0108] 2.4 Hydrological Transmission Simulation Unit.
[0109] A two-way GRU (BiGRU) was used to simulate the transport of pollutants along the river network from upstream to downstream. The process will begin with monitoring from the upstreammost monitoring station. To the current target monitoring station Features of all monitoring sites The data is sequentially input into the BiGRU, and the output at the last time step is taken as the river flow feature. .
[0110] ;
[0111] in, Indicates target monitoring stations The river transmits feature vectors.
[0112] Compared to a single attention mechanism, this design allows the model to learn the importance weights of each monitoring station upstream, simulating the physical process of water flow transmission. Attention provides selectivity, while the transmission network provides continuity, making the two complementary.
[0113] 2.5 Monitoring Station Prediction Unit.
[0114] The monitoring station prediction unit is used to comprehensively consider the monitoring station characteristics, upstream cumulative impact characteristics, and river flow characteristics of the target monitoring station to predict the future concentration of water quality parameters at the target monitoring station.
[0115] ;
[0116] in, This indicates the prediction result after fusion. This represents a multilayer perceptron. It indicates the characteristics of river flow.
[0117] 3. Model training, evaluation, and result analysis.
[0118] 3.1 Model training.
[0119] Data partitioning: The dataset is partitioned chronologically into training set (December 2020 - February 2023, 70%), validation set (February 2023 - August 2023, 15%), and test set (August 2023 - January 2024, 15%).
[0120] Data standardization: For each input feature at each monitoring station, Z-score standardization is performed using the mean and standard deviation of the training set.
[0121] Loss function: Weighted mean squared error (MSE) loss is used, with higher weights assigned to downstream monitoring stations that are more difficult to predict. (Corresponding to ST10-ST14).
[0122] Optimization strategy: Use the AdamW optimizer with an initial learning rate of 3×10. -4 Weight decay 1×10 -4 This is combined with cosine annealing for learning rate scheduling and gradient pruning (threshold = 1.0). An early stopping mechanism is used during training; training is terminated if the validation set loss does not decrease for 40 consecutive rounds.
[0123] 3.2 Comparative experiments and evaluation indicators.
[0124] To verify the effectiveness of the SRTM model, two benchmark models were set up for comparison:
[0125] Multivariate LSTM: The data from all monitoring stations are directly weighted and averaged, and then input into an LSTM model for prediction.
[0126] River network model: an end-to-end river network water quality prediction model that integrates information from the upper, middle and lower reaches.
[0127] All models were trained and tested on the same hardware platform (NVIDIA RTX A6000 GPU) and using the same hyperparameter tuning process.
[0128] Evaluation metrics include: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Coefficient of Determination (R²). 2 ), mean absolute percentage error (MAPE) and Pearson correlation coefficient (Pearson r).
[0129] 3.3 Results Analysis.
[0130] like Figure 4 As shown, on the test sample, the proposed SRTM model showed a high degree of agreement between the predicted total nitrogen (TN) values and the observed trends, and effectively captured the fluctuation characteristics of the index over a short period of time. Even in the prediction at the downstream monitoring station ST14, the predicted TN concentration output by the model was slightly higher than the actual observed values, but the fluctuation trends of the two remained highly consistent, and no trend deviation occurred.
[0131] The performance comparisons on the test set are shown in Table 1. The SRTM model proposed in this embodiment achieved optimal performance on the vast majority of monitoring sites.
[0132] The results in Table 1 show a clear stratified prediction effect. First tier (ST10-ST12): R 2 >0.95, indicating excellent prediction accuracy. These monitoring stations are relatively simple to influence from upstream sources, with a relatively linear cumulative effect, and MAPE is below 7%. Second tier (ST13): R 2 The prediction accuracy is 0.73, indicating moderate accuracy. The significantly increased standard deviation (std=1.296) suggests the existence of wave patterns in the prediction results. However, the high Pearson correlation coefficient (0.90) indicates a generally good prediction of the overall trend. Third Tier (ST14): R 2 The prediction accuracy is 0.24, which is average. The constructed network can capture the fluctuation trend, but due to the special location of the monitoring station and the influence of other factors such as the production of industrial enterprises around the monitoring station, the model prediction value deviates from the actual value.
[0133] Table 1. Evaluation of prediction accuracy of different models at different water quality monitoring stations
[0134]
[0135] Example 2
[0136] A river water quality prediction system that takes into account the accumulation of spatial information includes:
[0137] The data acquisition module is used to acquire historical water quality data from multiple monitoring stations in the target river basin, with the monitoring stations arranged according to the river flow direction;
[0138] The preprocessing module is used to preprocess the acquired historical water quality data, including outlier and missing value handling, data aggregation, missing value imputation, and time series alignment.
[0139] The model building module is used to build predictive models, which include:
[0140] The temporal feature encoding unit is used to extract the temporal features of each monitoring station;
[0141] The spatial information cumulative coding unit is used to integrate the spatial location information of the monitoring station into the temporal features. Using the graph attention mechanism, it dynamically calculates the cumulative influence weight of all upstream monitoring stations of the target monitoring station and aggregates them to generate upstream cumulative influence features.
[0142] The hydrological transport simulation unit is used to simulate the water quality information transport process from upstream to the target monitoring station based on a sequence modeling network, and output the river flow characteristics.
[0143] The monitoring station prediction unit is used to predict the future water quality parameter concentrations of the target monitoring station by integrating the feature vectors of the target monitoring station, the upstream cumulative impact characteristics, and the river flow characteristics.
[0144] The training and evaluation module is used to train the constructed prediction model, optimize it using the weighted mean squared error loss function, and evaluate the prediction performance of the model.
[0145] The prediction module is used to predict the future concentration of water quality parameters at the target monitoring station using a trained prediction model.
[0146] It is worth noting that all contents not described in detail in this invention are existing technologies and are well known to those skilled in the art.
[0147] Therefore, the present invention adopts the above-mentioned river water quality prediction method and system that takes into account the accumulation of spatial information, which can simultaneously capture the spatiotemporal dynamic changes of water quality to improve prediction accuracy, accurately quantify the spatial accumulation effect of pollutants through graph attention mechanism and distance decay function to enhance physical rationality, and use sequence modeling to simulate the river network transmission process to improve the generalization ability of the model under complex watershed conditions.
[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the scope of the technical solutions of the present invention.
Claims
1. A method for predicting river water quality that takes into account the accumulation of spatial information, characterized in that, Includes the following steps: Historical water quality data from multiple monitoring stations in the target river basin were obtained, with the monitoring stations arranged according to the river's flow direction. Constructing a river water quality prediction model, including: The temporal feature encoding unit is used to extract the temporal features of each monitoring station; The spatial information cumulative coding unit is used to integrate the spatial location information of monitoring stations into temporal features, forming query vectors for each monitoring station feature with fused spatial location information, and generating key vectors and value vectors based on the fused monitoring station features of all its upstream monitoring stations; combining feature similarity with the distance decay function that characterizes the distance decay effect between monitoring stations, the attention weight of each upstream monitoring station to the target monitoring station is calculated; the value vectors of each upstream monitoring station are weighted and aggregated based on the attention weights to obtain the upstream cumulative influence features; The hydrological transport simulation unit is used to process the monitoring station feature sequence from the upstream monitoring station to the target monitoring station through the bidirectional gated recirculation unit BiGRU, simulate the water quality information transport process from upstream to the target monitoring station, and output the river flow characteristics. The monitoring station prediction unit is used to predict the future water quality parameter concentrations of the target monitoring station by integrating the feature vectors of the target monitoring station, the cumulative influence characteristics of the upstream, and the river flow characteristics.
2. The river water quality prediction method considering spatial information accumulation according to claim 1, characterized in that, The temporal feature encoding unit processes historical water quality data from each monitoring station using a bidirectional long short-term memory (BiLSTM) network to extract temporal features for each station. The specific formula is as follows: ; in, Indicates monitoring stations The temporal characteristics, Indicates from the most upstream monitoring station to monitoring station All monitoring stations within the time window Observational data within, Indicates time, Indicates a historical time window, Indicates the number of feature dimensions. This indicates the index of the currently monitored site.
3. The river water quality prediction method considering spatial information accumulation according to claim 2, characterized in that, The spatial information cumulative coding unit generates a location code for each monitoring station and fuses the location code with the corresponding temporal features to form a monitoring station feature that integrates spatial location information. The position code is generated using a sine-cosine position code function: ; ; in, , Indicates the first The monitoring station at the first peacekeeping Position encoding value in dimension, This indicates the location index of the monitoring station in the river. Indicates the index of the location feature dimension; The formula for calculating the feature vector of a monitoring station is as follows: ; in, Indicates the first Feature vectors of each monitoring station Indicates monitoring stations Location encoding, This represents the fusion weights of the positional encoding.
4. The river water quality prediction method considering spatial information accumulation according to claim 3, characterized in that, The distance decay function is as follows: ; in, Represents the distance decay function. This indicates the locational distance between monitoring stations.
5. A river water quality prediction method considering spatial information accumulation according to claim 4, characterized in that, The formula for calculating the cumulative impact characteristics of upstream sources is as follows: ; in, This indicates the characteristics of the cumulative impact upstream. This represents the final attention weight score. Indicates all upstream monitoring stations The value vector.
6. The river water quality prediction method considering spatial information accumulation according to claim 1, characterized in that, The monitoring station prediction unit splices together the feature vector of the target monitoring station, the upstream cumulative impact features, and the river flow features, and then fuses and maps them through a multilayer perceptron (MLP) to predict the water quality parameter concentration of the target monitoring station at a specific time in the future.
7. A river water quality prediction method considering spatial information accumulation according to claim 1, characterized in that, The method employs a weighted mean squared error loss function for optimization during model training.
8. A river water quality prediction system considering spatial information accumulation, used to execute the river water quality prediction method considering spatial information accumulation as described in any one of claims 1-7, characterized in that, include: The data acquisition module is used to acquire historical water quality data from multiple monitoring stations in the target river basin, with the monitoring stations arranged according to the river flow direction; The preprocessing module is used to preprocess the acquired historical water quality data, including outlier and missing value handling, data aggregation, missing value imputation, and time series alignment. The model building module is used to build predictive models, which include: The temporal feature encoding unit is used to extract the temporal features of each monitoring station; The spatial information cumulative coding unit is used to integrate the spatial location information of the monitoring station into the temporal features. Using the graph attention mechanism, it dynamically calculates the cumulative influence weight of all upstream monitoring stations of the target monitoring station and aggregates them to generate upstream cumulative influence features. The hydrological transport simulation unit is used to simulate the water quality information transport process from upstream to the target monitoring station based on a sequence modeling network, and output the river flow characteristics. The monitoring station prediction unit is used to predict the future water quality parameter concentrations of the target monitoring station by integrating the feature vectors of the target monitoring station, the upstream cumulative impact characteristics, and the river flow characteristics. The training and evaluation module is used to train the constructed prediction model, optimize it using the weighted mean squared error loss function, and evaluate the prediction performance of the model. The prediction module is used to predict the future concentration of water quality parameters at the target monitoring station using a trained prediction model.
Citation Information
Patent Citations
River water quality prediction method considering space-time correlation and meteorological factors
CN112381292A
River water quality prediction method based on graph convolution STG-LSTM
CN114676887A