Transferable surface water quality prediction method and device based on representation learning

Through a method based on characterization learning, water quality prediction of target sites is used to use the water quality information of each site in the source domain, which solves the problem that existing water quality models are difficult to capture complex water quality changes, and achieves more accurate water quality prediction and more effective water environment management.

CN120105282AActive Publication Date: 2025-06-06ZHEJIANG UNIV

Patent Information

Application Number
CN202510050078.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-06-06
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

Existing water quality models are difficult to accurately capture the complex mechanisms of river water quality changes, resulting in a lack of foresight in water pollution prevention and control.

Method used

The transferable surface water quality prediction method based on characterization learning is used to predict the key water quality indicators of the target site through the changes in the water quality information of each site in the source domain. The method includes obtaining historical monitoring data, building multi-site sequence grids, masking, training Transformer models to extract and fuse water quality and meteorological characteristics, and finally making predictions.

Benefits of technology

It improves the prediction accuracy of water quality indicators and provides more accurate and comprehensive water quality management references, thereby strengthening the protection and improvement of water environment quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120105282A_ABST
    Figure CN120105282A_ABST
Patent Text Reader

Abstract

The invention discloses a migratable surface water quality prediction method based on representation learning, and the method comprises the steps: 1, obtaining historical monitoring data, so as to construct a data set in a multi-site sequence format, carrying out the mask processing of the historical monitoring data in the data set, so as to obtain mask data, forming a training test set by the historical monitoring data and the mask data; 2, selecting a Transform model framework with the same total number of source domains to construct a prediction network; step 3, training the prediction network to obtain a prediction model; and step 4, inputting the water quality data collected in the station and the meteorological data of the current day into the prediction model to obtain the water quality data of the source domain where the station is located. The invention further provides a device for predicting the water quality of the transferable surface water. According to the method provided by the invention, the key water quality index of the source domain river monitoring section is predicted through the change of the water quality information of each station in the source domain, and more accurate and comprehensive reference is provided for subsequent water quality management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of water quality monitoring, and in particular relates to a method and device for predicting surface water quality that can be transferred based on representation learning. Background Art

[0002] With the continuous growth of the global economy and the sharp increase in population, the shortage of freshwater and clean water resources is becoming increasingly serious. Therefore, the management and protection of water resources has become extremely important. In the actual work of river water quality management, due to the lack of in-depth understanding of the future trends of key water quality indicators, the prevention and control of water pollution often lack foresight. If the future dynamics of these key indicators can be accurately predicted, potential pollution incidents can be warned in advance, and active management and prevention measures can be strengthened, which is of great significance for protecting and improving the quality of the water environment.

[0003] However, current water quality models have difficulty in capturing the complex mechanisms of river water quality changes, while data-driven machine learning or deep learning techniques can effectively capture the nonlinear changes of water quality parameters. With the rapid development of Internet of Things technology, the efficiency of water quality monitoring data collection has been improved, and the amount of data has also increased significantly, making deep learning technology mainstream and widely used in water environment management. In order to reduce the complexity of water quality data and improve the accuracy of prediction, data decomposition methods are widely used in the preprocessing of water quality prediction. At the same time, the use of spatiotemporal information from multiple sites can enhance the prediction ability of the model.

[0004] Patent document CN119129863A discloses a river water quality prediction method, comprising the following steps: setting an automatic water quality station at the starting position of a river section to be predicted to obtain the starting water flow data of the river section to be predicted; dividing the river section to be predicted into multiple sub-prediction sections according to multiple automatic water quality stations set in the river section to be predicted; through a preset dynamic grouping model, based on the starting water flow data of the river section to be predicted and the current water flow data of multiple sub-prediction sections, predicting and grouping the multiple sub-prediction sections to obtain a prediction group scheme composed of multiple prediction groups; through a preset river water quality prediction model, based on the starting water flow data of the river section to be predicted and the current water flow data of the prediction group, cascadingly predicting the water quality data of each prediction group of the prediction group scheme.

[0005] Patent document CN119168176A discloses a multi-site water quality prediction method based on the fusion of spatiotemporal features. It models multi-site water quality index data from three perspectives: causality, space, and semantics. For complex water scenes, it takes into account more relevant factors. Based on the neural ordinary differential equation, it provides a more interpretable modeling scheme for the water quality propagation process. Compared with traditional neural ordinary differential modeling, it uses a multi-hop propagation method to improve the utilization and propagation rate of information. Summary of the invention

[0006] The purpose of the present invention is to provide a transferable surface water quality prediction method and device based on representation learning. This method predicts the key water quality indicators of the source domain river monitoring section through the changes in water quality information of each station in the source domain, providing a more accurate and comprehensive reference for subsequent water quality management.

[0007] In order to achieve the first object of the present invention, the following technical solution is provided: a transferable surface water quality prediction method based on representation learning, comprising the following steps: Step 1: Obtain historical monitoring data, which includes historical water quality data and historical meteorological data for each site; Constructing a multi-site sequence grid based on the time axis and site location, and filling the historical monitoring data into the multi-site sequence grid to construct a corresponding data set; Performing mask processing on the historical monitoring data of each station in the target source domain selected from the data set to obtain mask data, and combining the historical monitoring data and the mask data into a training test set; Step 2: Select a Transformer model framework with the same total number of source domains to build a prediction network, where the prediction network includes a feature extraction module, a feature fusion module, and a prediction module; The feature extraction module includes a water quality feature extractor and a meteorological feature extractor, wherein the water quality feature extractor is used to extract data features of input water quality data to output a water quality feature vector, and the meteorological feature extractor is used to extract data features of input meteorological data to output a meteorological feature vector; The feature fusion module performs point multiplication processing on the water quality feature vector and the meteorological feature vector through an attention mechanism to obtain a fused feature vector; The prediction module performs prediction based on the input fusion feature vector to output a prediction result; Step 3: Train the prediction network using the training test set: input the mask data corresponding to all historical water quality data of a source domain into the corresponding Transformer model framework in the upstream and downstream order of the site, calculate the loss with the prediction result and the historical water quality data, and adjust the parameter weights in the Transformer model framework based on the result of the loss calculation, and repeat the adjustment operation to adjust the Transformer model framework corresponding to all source domains; All adjusted Transformer model frameworks are fitted using linear fusion to obtain the temporal and parameter relationships between different sites in the source domain; The time relationship and parameter relationship between different stations in the source domain are loaded into the prediction network, and the prediction network is fine-tuned using historical water quality data and historical meteorological data to obtain a prediction model; Step 4: Input the water quality data collected at the site and the current day's meteorological data into the prediction model to obtain the water quality data of the source area where the site is located.

[0008] The method of the present invention extracts the historical water quality information of each station in the source domain by introducing a representation learning method, and uses transfer learning to fuse and reorganize this part of effective information and use it in the water quality prediction model of the target station, thereby improving the accuracy of the prediction results of key water quality indicators.

[0009] Specifically, the data set needs to be preprocessed when filling in historical monitoring data. The data preprocessing includes removing outliers in the historical monitoring data using a four-difference calculation method and filling the positions of the removed outliers by linear interpolation.

[0010] Specifically, before the historical monitoring data is masked, position encoding is performed on the linear functions of all sites in a single source domain. The position encoding encodes the historical monitoring data in the time dimension and parameter dimension with a preset time step to obtain encoded data with unified dimension and format.

[0011] Specifically, the masking process includes one or more of random masking, time masking, space masking or parameter masking.

[0012] Specifically, random masking: This strategy is similar to the method used in the masked autoencoder model, which randomly masks the spatiotemporal data. Its purpose is to capture fine-grained spatiotemporal relationships.

[0013] Temporal Masking: In this method, the data is masked along the time dimension, forcing the model to reconstruct the data based on only partial temporal information. The purpose is to improve the model's ability to capture temporal dependencies.

[0014] Spatial masking: The strategy simulates a scenario where the data of some spatial units is completely lost in all instances in time, reflecting the real situation that some sensors may not work. The purpose is to improve the spatial extrapolation capability.

[0015] Parameter Masking: Parameter masking involves the complete absence of entire blocks of parameter units at all instances in time. The reconstruction task becomes more complex due to the limitation of contextual information and aims to improve the transferability of water quality parameters.

[0016] Specifically, the parameter weights of the Transformer model framework are adjusted based on the mean square error loss between the prediction results and the historical water quality data.

[0017] Specifically, the prediction network is fine-tuned based on an objective function constructed based on the coefficient of determination and the root mean square error.

[0018] Specifically, the expression of the objective function is as follows: in, Indicates the actual value of the water quality data to be predicted, Represents the predicted value of water quality data to be predicted, Indicates the average value of the actual value of water quality data, Represents the number of data values ​​in the time series, represents the coefficient of determination, Root mean square error.

[0019] Specifically, the meteorological data include 2-meter air temperature (°C), ground air pressure (Pa), specific humidity (kg / kg), 10-meter wind speed (m / s), downward shortwave radiation (W / m2), downward longwave radiation (W / m2) and precipitation (mm / d).

[0020] In order to achieve the second purpose of the present invention, the following technical solution is provided: a portable surface water quality prediction device, used to implement the steps of the above-mentioned portable surface water quality prediction method based on representation learning.

[0021] Compared with the prior art, the present invention has the following beneficial effects: By extracting and integrating the information of each site in the source domain through representation learning, it helps to understand the water quality changes of the target site, and thus more accurately predict the water quality changes of the river monitoring section. This is of great significance to changing the water quality management strategy from "after-the-fact control" to "pre-emptive prevention" and improving the surface water environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A flow chart of a portable surface water quality prediction method based on representation learning provided in this embodiment; Figure 2 A result diagram of water quality data provided for different river basins as source areas in this embodiment; DETAILED DESCRIPTION

[0023] In addition, the terms "upper", "lower", "inner", "outer", "front", "rear" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps described in these embodiments do not limit the scope of the present invention.

[0024] Of course, the above description is only a specific embodiment of the present invention and is not intended to limit the scope of implementation of the present invention. All equivalent changes or modifications made according to the structure, characteristics and principles described in the patent application scope of the present invention should be included in the patent application scope of the present invention.

[0025] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

[0026] like Figure 1 As shown, a transferable surface water quality prediction method based on representation learning is provided in this embodiment, which includes the following steps: Step 1: Obtain historical monitoring data, which includes historical water quality data and historical meteorological data for each site; Constructing a multi-site sequence grid based on the time axis and site location, and filling the historical monitoring data into the multi-site sequence grid to construct a corresponding data set; In the data set, the historical monitoring data of each station in the target source domain is masked to obtain masked data, and the historical monitoring data and the masked data are combined into a training test set.

[0027] Step 2: Select a Transformer model framework with the same total number of source domains to build a prediction network, where the prediction network includes a feature extraction module, a feature fusion module, and a prediction module; The feature extraction module includes a water quality feature extractor and a meteorological feature extractor, wherein the water quality feature extractor is used to extract data features of input water quality data to output a water quality feature vector, and the meteorological feature extractor is used to extract data features of input meteorological data to output a meteorological feature vector; The feature fusion module performs point multiplication on the water quality feature vector and the meteorological feature vector through the attention mechanism to obtain a fused feature vector; The prediction module performs prediction based on the input fusion feature vector to output the prediction result; Step 3: Train the prediction network using the training test set: input the mask data corresponding to all historical water quality data of a source domain into the corresponding Transformer model framework in the upstream and downstream order of the site, calculate the loss with the prediction result and the historical water quality data, and adjust the parameter weights in the Transformer model framework based on the result of the loss calculation, and repeat the adjustment operation to adjust the Transformer model framework corresponding to all source domains; All adjusted Transformer model frameworks are fitted using linear fusion to obtain the temporal and parameter relationships between different sites in the source domain; The temporal and parameter relationships between different stations in the source domain are loaded into the prediction network, and the prediction network is fine-tuned using historical water quality data and historical meteorological data to obtain a prediction model.

[0028] Step 4: Input the water quality data collected at the site and the current day's meteorological data into the prediction model to obtain the water quality data of the source area where the site is located.

[0029] In order to better illustrate the technical effect of the method provided in this embodiment, the water quality parameters in this embodiment include COD, DO, NH 3 -N and pH.

[0030] These monitoring points are concentrated in East China, covering the six major river basins of Heilongjiang, Songhuajiang, Yellow River, Huaihe River, Yangtze River and Pearl River. The length of water quality data at different stations varies greatly, with the longest station data from October 29, 2007 to December 24, 2018 (a total of 583 data points). Although a few stations have less than 200 records, 66.4% and 87.9% of the stations have more than 500 and 300 data points, respectively. In addition, we used the China Meteorological Forcing Dataset (CMFD), one of the most widely used climate datasets in China, to obtain meteorological data for the corresponding stations. This dataset is a fusion of remote sensing products, reanalysis datasets and field station data. CMFD provides seven near-surface meteorological elements, including 2-meter air temperature (°C), surface air pressure (Pa), specific humidity (kg / kg), 10-meter wind speed (m / s), downwelling shortwave radiation (W / m2), downwelling longwave radiation (W / m2), and precipitation (mm / d). According to the station location and timestamp, the meteorological data are extracted and preprocessed using Python language.

[0031] The data collected above were sorted to extract the monitoring data of 149 surface water quality stations, and preprocessed to construct a sequence format data set.

[0032] From the sequence format dataset, we selected sites in the Heilongjiang, Songhuajiang, Yellow River, Huaihe River, Yangtze River, and Pearl River as source domains, and built and trained the Transformer model. We manually tested the hyperparameter combination, and used a sequence length of 8, a Transformer layer size of 3, and a mask ratio of 0.5 for a total of 300 epochs.

[0033] In the fine-tuning stage, the input data was divided into a training set (the first 80% of the data) and a test set (the last 20% of the data). Standardization was applied to all inputs to ensure numerical stability. The prediction model for 149 monitoring points was trained using the corresponding meteorological and water quality data in the same training cycle, and the model performance was evaluated based on the data in the test cycle. To ensure the feasibility of parameter transfer, the input sequence length of the prediction model is still 8, while the prediction sequence length is 1. However, unlike the pre-training stage, the training time in the fine-tuning stage is only 50, which will greatly save training time.

[0034] The obtained model was used to predict the water quality of 149 stations, and R2 and RMSE were calculated for quantitative comparison.

[0035] like Figure 2 As shown in the figure, the test results of the prediction model obtained by training in the above way are shown, in which the actual water quality parameters of each source area are basically consistent with the results predicted by the prediction model, and the evaluation R of all stations is 2 It reached 0.80, indicating that the prediction accuracy of this method is high and can fully reach the level of practical application.

[0036] As shown in Table 1, it is a schematic diagram of the distribution of water quality data in each station predicted by the prediction model provided in the above embodiment, wherein good performance means NSE>0.7, medium performance means 0.7<NSE>0.4, and poor performance means NSE<0.4.

[0037] Table 1 From the prediction results of each site in the table, we can clearly feel that the performance of the prediction model is stable and maintains good performance in spatial sites. In terms of quantity, more than 70% of the 149 sites have an R2 greater than 0.7, and more than 99% have an R2 greater than 0.4.

[0038] In addition, this embodiment also provides a portable surface water quality prediction device, which is used to implement the steps of the portable surface water quality prediction method based on representation learning provided in the above embodiment.

[0039] The above-described embodiment is only an application scheme of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation is within the protection scope of the present invention.

Claims

1. A transferable surface water quality prediction method based on representation learning, characterized in that: The following steps are involved: Step 1: Obtain historical monitoring data, which includes historical water quality data and historical meteorological data for each site; Constructing a multi-site sequence grid based on the time axis and site location, and filling the historical monitoring data into the multi-site sequence grid to construct a corresponding data set; Performing mask processing on the historical monitoring data of each station in the target source domain selected from the data set to obtain mask data, and combining the historical monitoring data and the mask data into a training test set; Step 2: Select a Transformer model framework with the same total number of source domains to build a prediction network, where the prediction network includes a feature extraction module, a feature fusion module, and a prediction module; The feature extraction module includes a water quality feature extractor and a meteorological feature extractor, wherein the water quality feature extractor is used to extract data features of input water quality data to output a water quality feature vector, and the meteorological feature extractor is used to extract data features of input meteorological data to output a meteorological feature vector; The feature fusion module performs point multiplication processing on the water quality feature vector and the meteorological feature vector through an attention mechanism to obtain a fused feature vector; The prediction module performs prediction based on the input fusion feature vector to output a prediction result; Step 3: Train the prediction network using the training test set: input the mask data corresponding to all historical water quality data of a source domain into the corresponding Transformer model framework in the upstream and downstream order of the site, calculate the loss with the prediction result and the historical water quality data, and adjust the parameter weights in the Transformer model framework based on the result of the loss calculation, and repeat the adjustment operation to adjust the Transformer model framework corresponding to all source domains; All adjusted Transformer model frameworks are fitted using linear fusion to obtain the temporal and parameter relationships between different sites in the source domain; The time relationship and parameter relationship between different stations in the source domain are loaded into the prediction network, and the prediction network is fine-tuned using historical water quality data and historical meteorological data to obtain a prediction model; Step 4: Input the water quality data collected at the site and the current day's meteorological data into the prediction model to obtain the water quality data of the source area where the site is located.

2. The method for predicting surface water quality based on representation learning according to claim 1 is characterized in that: The data set needs to be preprocessed when filling in historical monitoring data. The data preprocessing includes removing outliers in the historical monitoring data using a four-difference calculation method and filling the positions of the removed outliers by linear interpolation.

3. The method for predicting surface water quality based on representation learning according to claim 1 is characterized in that: Before the historical monitoring data is masked, position encoding is performed on the linear functions of all sites in a single source domain. The position encoding encodes the historical monitoring data in the time dimension and parameter dimension with a preset time step to obtain encoded data with unified dimension and format.

4. The method for predicting surface water quality based on representation learning according to claim 1 is characterized in that: The masking process includes one or more of random masking, temporal masking, spatial masking or parameter masking.

5. The method for predicting surface water quality based on representation learning according to claim 1 is characterized in that: The parameter weights of the Transformer model framework are adjusted based on the mean square error loss between the prediction results and the historical water quality data.

6. The method for predicting surface water quality based on representation learning according to claim 1 is characterized in that: The prediction network is fine-tuned based on an objective function constructed using the coefficient of determination and the root mean square error.

7. The method for predicting surface water quality based on representation learning according to claim 6 is characterized in that: The expression of the objective function is as follows: in, Indicates the actual value of the water quality data to be predicted, Represents the predicted value of water quality data to be predicted, Indicates the average value of the actual value of water quality data, Represents the number of data values ​​in the time series, represents the coefficient of determination, Root mean square error.

8. A portable surface water quality prediction device, characterized in that: Steps for implementing the method for predicting the quality of surface water that can be transferred based on representation learning as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • River water quality prediction method

    CN119129863A

  • Multi-site water quality prediction method based on spatio-temporal feature fusion

    CN119168176A

  • Method for predicting water quality non-stationary time sequence based on improved TFT model

    CN116956120A

  • Connectome Ensemble Transfer Learning

    US20240161017A1

  • Systems and methods for cross-lingual transfer learning

    US20240330603A1

Cited By

  • River water quality prediction method based on generative data enhancement

    CN121145103A