A water quality prediction method, device and computer readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU UNIV
- Filing Date
- 2023-11-22
- Publication Date
- 2026-08-07
AI Technical Summary
[0005]为此,本发明所要解决的技术问题在于克服现有技术中的水质预测方法由于没有兼顾水质数据的时间依赖性和空间依赖性特点,导致模型无法有效提取水质数据的时间特征和空间特征,使得预测得到的水质预测指标的准确性较低的问题
[0051]本发明提供的水质预测方法将待预测区域中不同监测站点对应的时间序列数据作为一个时间序列数据集输入至ResNet网络中,由于不同时间序列数据对应不同监测站点,因此,ResNet网络提取的每个时间序列数据的空间特征向量能够充分反映不同监测站点之间的影响,考虑了水质数据的空间性特点;另外,本申请还将每个时间序列数据的空间特征向量输入至BiLSTM网络以提取时间序列数据的时间特征向量,充分考虑了水质数据的时序性特点,最后将提取到的时间序列数据的时间特征向量输入至全连接层,得到待预测区域中每个监测站点的水质预测指标。除此之外,本申请使用ResNet网络和BiLSTM网络形成级联学习架构,提高了特征提取的有效性,降低了模型的复杂性。本申请提供的水质预测方法充分考虑了水质数据的时间依赖性和空间依赖性,有效提取了水质数据的空间特征和时间特征,提高了水质预测结果的准确性。
Smart Images

Figure CN117851802B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water quality testing technology, and in particular to a water quality prediction method, apparatus, and computer-readable storage medium. Background Technology
[0002] Rapid industrialization and urbanization have had a significant impact on global water pollution, particularly in industrialized developing countries. However, in the process of strengthening water pollution monitoring, early warning, and management, the lack of water quality data due to inadequate monitoring and reporting equipment means that even with advanced equipment, the collected data cannot be effectively utilized. Therefore, how to use limited water quality information for water quality forecasting is crucial for relevant departments to identify pollution sources and take effective prevention and control measures.
[0003] Existing water quality prediction methods typically rely on historical data from individual stations, assuming linear relationships between variables, such as Vector Autoregression (VAR) and Autoregressive Integrated Moving Average (ARIMA). However, these methods neglect the inherent long-term and spatial dependencies of water quality data, i.e., they ignore the temporal and spatial characteristics of the data. To address this issue, Recurrent Neural Networks (RNNs) and their variants, such as Long Short-Term Memory (LSTM) and Gate Recurrent Units (GRUs), have been used for water quality prediction. These neural networks can focus on the long-term dependencies of water quality data, i.e., the temporal characteristics of the data, but they neglect the influence of external meteorological factors, hydrological data, and the relationships between adjacent monitoring stations, i.e., they ignore the spatial dependencies of the water quality data. Therefore, due to the insufficient consideration of the temporal and spatial characteristics of water quality data, existing models cannot effectively extract the temporal and spatial features of water quality data, resulting in low accuracy of the predicted water quality indicators.
[0004] In summary, existing water quality prediction methods fail to take into account the temporal and spatial dependencies of water quality data, resulting in models that cannot effectively extract the temporal and spatial characteristics of water quality data, thus leading to low accuracy in the predicted water quality indicators. Summary of the Invention
[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the existing water quality prediction methods do not take into account the time and space dependence of water quality data, resulting in the model being unable to effectively extract the time and space characteristics of water quality data, and thus the accuracy of the predicted water quality indicators is low.
[0006] To address the aforementioned technical problems, this invention provides a water quality prediction method, comprising:
[0007] Obtain a time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t;
[0008] The time series dataset is input into the ResNet network of the trained water quality prediction model, and the spatial feature vector of each time series data in the time series dataset is output.
[0009] The spatial feature vector of each time series data is input into the BiLSTM network in the trained water quality prediction model, and the hidden state vector of each time series data is output. The temporal feature vector of each time series data is calculated based on the hidden state vector of each time series data.
[0010] The hidden state vector and time feature vector of each time series data are input into the fully connected layer of the trained water quality prediction model, and the water quality prediction index of each monitoring station corresponding to each time series data at time t+1 is output.
[0011] In one embodiment of the present invention, before inputting the time series dataset into the ResNet network of the trained water quality prediction model, the method further includes preprocessing the time series dataset, which specifically includes:
[0012] Use imputation to fill in missing values in time series datasets;
[0013] The mean replacement method is used to replace outliers in a time series dataset.
[0014] In one embodiment of the present invention, the spatial feature vector of the time series data is:
[0015] ,
[0016] in, Represents the first in the time series dataset Spatial feature vectors of time series data Representing spatial eigenvectors The Middle One spatial characteristic value;
[0017] ,
[0018] in, Indicates the first The first time series data One data point, This represents the computation function of the ResNet network. This represents the output of the nth reconstruction unit in the ResNet network. eigenvalues;
[0019] ,
[0020] in, This represents the input learned by the nth reconstruction unit. and weight parameters The calculation function, express The weight parameters, Represents the residual function of a trainable nonlinear mapping;
[0021] ,
[0022] in, This represents the activation function. Represents the weight matrix. Indicates bias.
[0023] In one embodiment of the present invention, the hidden state vector of the time series data is:
[0024] ,
[0025] in, Represents the first in the time series dataset The hidden state vector of a time series data. This indicates a merge function. The output of the BiLSTM network represents the first... The forward sequence of a time series data. The output of the BiLSTM network represents the first... A backward sequence of time series data, Represents the hidden state vector The Middle One eigenvalue;
[0026] The time feature vector of time series data is:
[0027] ,
[0028] in, Represents the first in the time series dataset The time feature vector of a time series data. Indicates the length of the time series data. Represents the hidden state vector The Middle 1 eigenvalue, express Attention coefficient.
[0029] In one embodiment of the present invention, the water quality prediction index for each time series data corresponding to the monitoring station at time t+1 is as follows:
[0030] ,
[0031] in, Represents the first in the time series dataset Water quality prediction indicators for monitoring stations at time t+1 corresponding to each time series data point Denotes the first trainable parameter. This represents the second trainable parameter. Represents the first in the time series dataset The hidden state vector of a time series data. Represents the first in the time series dataset The time feature vector of a time series data. This represents the third trainable parameter.
[0032] In one embodiment of the present invention, the process of obtaining the trained water quality prediction model includes:
[0033] Obtain the time series dataset in the training set; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the same area to be predicted;
[0034] The time series dataset is input into the ResNet network, and the spatial feature vector of each time series data in the time series dataset is output.
[0035] The spatial feature vector of each time series data is input into the BiLSTM network, and the hidden state vector of each time series data is output. The temporal feature vector of each time series data is calculated based on the hidden state vector of each time series data.
[0036] The hidden state vector and time feature vector of each time series data are input into a fully connected layer, and a loss function is constructed based on the output of the fully connected layer.
[0037] The ResNet network, BiLSTM network, and fully connected layer are iteratively trained using the time series dataset in the training set until the value of the loss function is minimized, resulting in a trained ResNet network, BiLSTM network, and fully connected layer. A trained water quality prediction model is then obtained based on the trained ResNet network, BiLSTM network, and fully connected layer.
[0038] In one embodiment of the present invention, the loss function is:
[0039] ,
[0040] in, Represents the loss function. This indicates the number of time series data points in the time series dataset. Indicates the first Water quality prediction indicators for monitoring stations corresponding to each time series data point Indicates the first The actual water quality indicators of the monitoring stations corresponding to the time series data.
[0041] In one embodiment of the present invention, iterative training of the ResNet network, the BiLSTM network, and the fully connected layer using a time-series dataset in the training set includes:
[0042] Based on the magnitude of the loss function after each training iteration, the backpropagation algorithm is used to pass the value of the loss function to the ResNet network, the BiLSTM network, and the fully connected layer.
[0043] The parameters in the ResNet network, the BiLSTM network, and the fully connected layer are updated based on the value of the loss function using mini-batch stochastic gradient descent and the Adam optimizer.
[0044] Reacquire the time series dataset from the training set and iteratively train the ResNet network, the BiLSTM network, and the fully connected layer until the value of the loss function is minimized.
[0045] The present invention also provides a water quality prediction device, comprising:
[0046] The data acquisition module is used to acquire the time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t;
[0047] The spatial feature vector extraction module is used to input the time series dataset into the ResNet network of the trained water quality prediction model and output the spatial feature vector of each time series data in the time series dataset.
[0048] The time feature vector extraction module is used to input the spatial feature vector of each time series data into the BiLSTM network in the trained water quality prediction model, output the hidden state vector of each time series data, and calculate the time feature vector of each time series data based on the hidden state vector of each time series data.
[0049] The water quality prediction module is used to input the hidden state vector and time feature vector of each time series data into the fully connected layer of the trained water quality prediction model, and output the water quality prediction index of each monitoring station corresponding to each time series data at time t+1.
[0050] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described water quality prediction method.
[0051] The water quality prediction method provided by this invention inputs time-series data corresponding to different monitoring stations in the area to be predicted into a ResNet network as a time-series dataset. Since different time-series data correspond to different monitoring stations, the spatial feature vector of each time-series data extracted by the ResNet network can fully reflect the influence between different monitoring stations, taking into account the spatial characteristics of water quality data. In addition, this application also inputs the spatial feature vector of each time-series data into a BiLSTM network to extract the temporal feature vector of the time-series data, fully considering the temporal characteristics of water quality data. Finally, the extracted temporal feature vector of the time-series data is input into a fully connected layer to obtain the water quality prediction index for each monitoring station in the area to be predicted. Furthermore, this application uses a cascaded learning architecture of ResNet and BiLSTM networks to improve the effectiveness of feature extraction and reduce the complexity of the model. The water quality prediction method provided by this application fully considers the temporal and spatial dependencies of water quality data, effectively extracts the spatial and temporal features of water quality data, and improves the accuracy of water quality prediction results. Attached Figure Description
[0052] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein...
[0053] Figure 1 A flowchart of the water quality prediction method provided by the present invention;
[0054] Figure 2 A schematic diagram of the structure of the trained water quality prediction model provided by the present invention;
[0055] Figure 3 A schematic diagram comparing the predicted and actual results of potassium dichromate concentration using the model provided in this application and the RCL-Learning model; wherein, Figure 3 Figure (a) shows a schematic diagram of the curves comparing the predicted and actual results of the two models for the concentration of potassium dichromate manganate. Figure 3 Figure (b) shows a schematic diagram of the scatter plot fitting of the predictions and observations for the two models;
[0056] Figure 4 A schematic diagram comparing the predicted and actual dissolved oxygen content results of the model provided in this application and the RCL-Learning model; wherein, Figure 4 Figure (a) shows a schematic diagram of the curves comparing the predicted and actual dissolved oxygen content of the two models. Figure 4 Figure (b) shows a schematic diagram of the scatter plot fitting of the predictions and observations for the two models;
[0057] Figure 5 A schematic diagram comparing the predicted and actual results of the antimony content using the model provided in this application and the RCL-Learning model; wherein, Figure 5 Figure (a) shows a schematic diagram of the curves comparing the predicted and actual antimony content of the two models. Figure 5 Figure (b) shows a schematic diagram of the scatter plot fitting of the predictions and observations for the two models;
[0058] Figure 6 A schematic diagram comparing the predicted and actual results of ammonia nitrogen levels using the model provided in this application and the RCL-Learning model; wherein, Figure 6 Figure (a) shows a schematic diagram of the curves comparing the predicted and actual ammonia nitrogen levels for the two models. Figure 6 Figure (b) shows a schematic diagram of the scatter plot fitting of the predictions and observations for the two models;
[0059] Figure 7 A schematic diagram comparing the predicted and actual results of hydrogen ion concentration using the model provided in this application and the RCL-Learning model; wherein, Figure 7 Figure (a) shows a schematic diagram of the curves comparing the predicted and actual hydrogen ion concentrations of the two models. Figure 7 Figure (b) shows a schematic diagram of the scatter plot fitting of the predictions and observations for the two models;
[0060] Figures 8-11 The figures show a comparison between the predicted and actual results of the potassium permanganate index at different monitoring points in the region to be predicted, using the model provided in this application and the RCL-Learning model, respectively; where, Figures 8-11 In the diagram (a), each line represents a curve showing the predicted concentration of potassium permanganate index versus the actual concentration for the two models. Figures 8-11 (b) in the diagram represents a schematic diagram of the scatter plot fitting of the predictions and observations of the two models;
[0061] Figure 12 A schematic diagram showing the comparison between the long-term prediction results of the potassium permanganate index provided in this application and the actual results of the RCL-Learning model;
[0062] Figure 13 A schematic diagram illustrating the fitting of the predicted and observed scatter points of the model provided in this application with the RCL-Learning model, wherein, Figure 13 (a) in the diagram is a schematic diagram of the prediction and observation scatter fitting of the RCL-Learning model. Figure 13 (b) in the figure is a schematic diagram of the prediction and observation scatter fitting of the model provided in this application;
[0063] Figure 14 This is a schematic diagram of the water quality prediction device provided in this application. Detailed Implementation
[0064] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0065] Please see Figure 1 , Figure 1 The diagram shown is a flowchart of a water quality prediction method provided in this application, which specifically includes:
[0066] S10: Obtain the time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t;
[0067] For example, if the area to be predicted includes 5 monitoring stations, the water quality data and meteorological data of each monitoring station at times 1 to t are taken as a time series data, and a time series dataset is obtained based on the 5 time series data corresponding to the 5 monitoring stations.
[0068] Optionally, in some embodiments of this application, the water quality data includes dissolved oxygen (DO), permanganate index (CODmn), ammonia nitrogen (NH), phosphorus (TP), nitrogen (TN), antimony (Sb), hydrogen ion concentration (PH), conductivity (EC), and dichromate index (CODcr).
[0069] S20: Input the time series dataset into the ResNet network of the trained water quality prediction model, and output the spatial feature vector of each time series data in the time series dataset;
[0070] S30: Input the spatial feature vector of each time series data into the BiLSTM network in the trained water quality prediction model, output the hidden state vector of each time series data, and calculate the time feature vector of each time series data based on the hidden state vector of each time series data.
[0071] S40: Input the hidden state vector and time feature vector of each time series data into the fully connected layer of the trained water quality prediction model, and output the water quality prediction index of each monitoring station corresponding to each time series data at time t+1.
[0072] The water quality prediction method provided in this application inputs time-series data corresponding to different monitoring stations in the area to be predicted as a time-series dataset into a ResNet network. Since different time-series data correspond to different monitoring stations, the spatial feature vector of each time-series data extracted by the ResNet network can fully reflect the influence between different monitoring stations, taking into account the spatial characteristics of water quality data. In addition, this application also inputs the spatial feature vector of each time-series data into a BiLSTM network to extract the temporal feature vector of the time-series data, fully considering the temporal characteristics of water quality data. Finally, the extracted temporal feature vector of the time-series data is input into a fully connected layer to obtain the water quality prediction index for each monitoring station in the area to be predicted. Furthermore, this application uses a cascaded learning architecture of ResNet and BiLSTM networks to improve the effectiveness of feature extraction and reduce the complexity of the model. The water quality prediction method provided in this application fully considers the temporal and spatial dependencies of water quality data, effectively extracts the spatial and temporal features of water quality data, and improves the accuracy of water quality prediction results.
[0073] Optionally, to make the water quality prediction indicators more accurate, this application also preprocesses the time series dataset. Specifically, in some embodiments of this application, step S20 is preceded by:
[0074] Use imputation to fill in missing values in time series datasets;
[0075] The mean replacement method is used to replace outliers in a time series dataset.
[0076] Furthermore, the spatial feature vectors of each time series data extracted in step S20 can be represented as:
[0077] ,
[0078] in, Represents the first in the time series dataset Spatial feature vectors of time series data Representing spatial eigenvectors The Middle One spatial characteristic value;
[0079] ,
[0080] in, Indicates the first The first time series data One data point, This represents the computation function of the ResNet network. This represents the output of the nth reconstruction unit in the ResNet network. eigenvalues;
[0081] ,
[0082] in, This represents the input learned by the nth reconstruction unit. and weight parameters The calculation function, express The weight parameters, Represents the residual function of a trainable nonlinear mapping;
[0083] ,
[0084] in, Represents the activation function, for Perform nonlinear transformation, Represents the weight matrix. This represents the bias, which is a constant term.
[0085] Specifically, in some embodiments of this application, the ResNet network is implemented through convolutional layers with different kernel sizes. Multiple convolutional layers are interconnected through residuals. The enhancement residual units adopt convolutional filters with sizes of 2*2 and 3*3. The first enhancement residual unit in each stacked reconstruction unit is downsampled through convolution or pooling with a stride of 2. Such a structure can solve the gradient vanishing and gradient exploding problems in deep network training, thereby enhancing the model's ability to express spatial features.
[0086] Furthermore, after extracting the spatial feature vectors of each time series data using the ResNet network, the temporal feature vectors of each time series data are extracted using the BiLSTM network.
[0087] Specifically, an LSTM network has a forget gate, an input gate, and an output gate, with each LSTM unit outputting three inputs. And produce three outputs. ,state It serves as long-term memory, accumulating information from the past and present. Acting as short-term memory and retaining more recent information, the operating mechanism of LSTM is described by the following equation:
[0088] ,
[0089] ,
[0090] ,
[0091] ,
[0092] ,
[0093] Based on the output state of the above LSTM network Since the information influencing the output comes not only from past states but also from anticipated future states, this application uses a bidirectional long short-term memory (BiLSTM) network in its embodiments. BiLSTM consists of a forward LSTM and a backward LSTM, which processes the forward sequence... and backward sequence This forms the hidden state vector that serves as the output.
[0094] Specifically, the hidden state vector of each time series data in step S30 is:
[0095] ,
[0096] in, Represents the first in the time series dataset The hidden state vector of a time series data. This indicates a merge function. The output of the BiLSTM network represents the first... The forward sequence of a time series data. The output of the BiLSTM network represents the first... A backward sequence of time series data, Represents the hidden state vector The Middle One eigenvalue;
[0097] The time feature vector of time series data is:
[0098] ,
[0099] in, Represents the first in the time series dataset The time feature vector of a time series data. Indicates the length of the time series data. Represents the hidden state vector The Middle 1 eigenvalue, express Attention coefficient.
[0100] In this application, an attention mechanism is introduced to perform a weighted summation of the hidden state vector output by the BiLSTM network. Furthermore, the attention coefficients corresponding to different time steps in the hidden state vector are different, which makes the model pay more attention to different parts of different time steps when processing the temporal feature vector, rather than simply performing the same processing on the entire vector.
[0101] Furthermore, the water quality prediction indicators for each time series data point at time t+1 in step S40 are as follows:
[0102] ,
[0103] in, Represents the first in the time series dataset Water quality prediction indicators for monitoring stations at time t+1 corresponding to each time series data point Denotes the first trainable parameter. This represents the second trainable parameter. Represents the first in the time series dataset The hidden state vector of a time series data. Represents the first in the time series dataset The time feature vector of a time series data. This represents the third trainable parameter.
[0104] In some embodiments of this application, after obtaining the water quality prediction index of each monitoring station at time t+1, the obtained water quality prediction index at time t+1 is used as the input data for the next prediction. By setting the parameters of the model, the water quality prediction index obtained from each prediction is used as the input for the next prediction, and the water quality prediction index for a future preset time period can be output.
[0105] For example, as a specific example of this application, the future can be output by setting model parameters. Predicted water quality indicators at each time point.
[0106] Specifically, the process of obtaining the trained water quality prediction model in this application includes:
[0107] Step 1: Obtain the time series dataset in the training set; the time series dataset contains multiple time series data corresponding to different monitoring stations in the same area to be predicted;
[0108] Step 2: Input the time series dataset into the ResNet network and output the spatial feature vector of each time series data in the time series dataset;
[0109] Step 3: Input the spatial feature vector of each time series data into the BiLSTM network, output the hidden state vector of each time series data, and calculate the temporal feature vector of each time series data based on the hidden state vector of each time series data;
[0110] Step 4: Input the hidden state vector and temporal feature vector of each time series data into the fully connected layer, and construct the loss function based on the output of the fully connected layer;
[0111] Specifically, the loss function is:
[0112] ,
[0113] in, Represents the loss function. This indicates the number of time series data points in the time series dataset. Indicates the first Water quality prediction indicators for monitoring stations corresponding to each time series data point Indicates the first The actual water quality indicators of the monitoring stations corresponding to each time series data;
[0114] Step 5: Iteratively train the ResNet network, BiLSTM network, and fully connected layer using the time series dataset in the training set until the loss function is minimized, obtaining the trained ResNet network, BiLSTM network, and fully connected layer. Based on the trained ResNet network, BiLSTM network, and fully connected layer, a trained water quality prediction model is obtained, such as... Figure 2 The image shows the trained water quality prediction model provided in this application.
[0115] For example, as a specific example of this application, the process of obtaining the training set includes:
[0116] Time series data on water quality and meteorological changes over a period of more than 5 years were collected from different monitoring stations in multiple regions to form a dataset. The water quality data over time included at least the following parameters: dissolved oxygen (DO), potassium permanganate index (CODmn), ammonia nitrogen (NH), phosphorus (TP), nitrogen (TN), antimony (Sb), hydrogen ion concentration (PH), conductivity (EC), and dichromate index (CODcr).
[0117] The missing values in the dataset are filled using interpolation, outliers are replaced using the mean replacement method, and the pandas rolling function is used to smooth, perform trend analysis, and periodic analysis on each time series data in the dataset.
[0118] The dataset is divided into training, testing, and validation sets using the residue method.
[0119] Specifically, in some embodiments of this application, the backpropagation algorithm is used to facilitate the parameter update of the network in the model. Specifically, the value of the loss function after each iteration of training is returned to the ResNet network, BiLSTM network and fully connected layer.
[0120] The parameters in ResNet, BiLSTM, and fully connected layers are adjusted using mini-batch stochastic gradient descent and the Adam optimizer method.
[0121] Reacquire the time series dataset from the training set and iteratively train the ResNet network, BiLSTM network, and fully connected layers until the loss function is minimized.
[0122] To verify the efficiency and accuracy of the water quality detection model provided in this application, the following performance comparison data between this model and eight benchmark models are provided; the eight benchmark models are: ARIMA, LSTM, AT-LSTM, BiLSTM, CNN-LSTM, ResNet-LSTM, DA-RNN, and RCL-Learning.
[0123] This embodiment uses four statistical metrics to comprehensively understand the accuracy and reliability of each model's predictions on the test dataset. The four statistical metrics are: root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and accuracy (Acc).
[0124] The calculation formula for each statistical indicator is as follows:
[0125] ;
[0126] ;
[0127] ;
[0128] .
[0129] Table 2 shows the comparison data of four statistical indicators between the water quality prediction model (WaterPre) provided in this application and eight benchmark models:
[0130] Table 2
[0131]
[0132] Table Indicates the treatment of the predicted region's future As shown in Table 2, the water quality prediction model provided in this application has an MAE ranging from 1.7438 to 1.9143 and an RMSE ranging from 1.8427 to 3.1724. Compared with the RCL model, which has the second-best performance, the maximum and minimum RMSE of the model provided in this application are improved by 5.7% and 18.7%, respectively, and the maximum and minimum MAE are improved by 3.8% and 28.7%, respectively.
[0133] Please see Figure 3 , Figure 3 The figure shows a comparison of the prediction results and actual results of the model provided in this application and the RCL-Learning model for potassium dichromate (CODcr) in the same region to be predicted; wherein, (a) in the figure shows a schematic diagram of the curves of the predicted concentration and the actual concentration of potassium dichromate by the two models, and the Ground Truth curve in the figure represents the actual concentration of potassium dichromate; (b) in the figure shows a schematic diagram of the scatter fitting of the prediction and observation of the two models.
[0134] Please see Figure 4 , Figure 4 The figure shows a comparison of the predicted and actual results of the model provided in this application and the RCL-Learning model for the dissolved oxygen content (DO) in the same region to be predicted; wherein, (a) in the figure shows a schematic diagram of the curves of the predicted concentration and the actual concentration of dissolved oxygen content by the two models, and (b) in the figure shows a schematic diagram of the scatter plot fitting of the prediction and observation of the two models.
[0135] Please see Figure 5 , Figure 5 The figure shows a comparison of the predicted and actual results of the model provided in this application and the RCL-Learning model for the antimony content (Sb) in the same region to be predicted; wherein, (a) in the figure shows a schematic diagram of the curves of the predicted concentration and the actual concentration of dissolved oxygen content by the two models, and (b) in the figure shows a schematic diagram of the scatter plot fitting of the prediction and observation of the two models.
[0136] Please see Figure 6 , Figure 6 The figure shows a comparison of the prediction results of the model provided in this application and the RCL-Learning model for the ammonia nitrogen (NH) in the same region to be predicted with the actual results; wherein, (a) in the figure shows a schematic diagram of the curves of the predicted concentration and the actual concentration of ammonia nitrogen by the two models, and (b) in the figure shows a schematic diagram of the scatter plot fitting of the prediction and observation of the two models.
[0137] Please see Figure 7 , Figure 7The figure shows a comparison of the predicted and actual results of the hydrogen ion concentration (PH) in the same region to be predicted by the model provided in this application and the RCL-Learning model; wherein, (a) in the figure shows a schematic diagram of the curves of the predicted and actual concentrations of hydrogen ions by the two models, and (b) in the figure shows a schematic diagram of the scatter plot fitting of the prediction and observation of the two models.
[0138] from Figures 3 to 7 As can be seen from the data, the model provided in this application provides more accurate predictions for the concentrations of potassium dichromate (CODcr), dissolved oxygen (DO), antimony (Sb), ammonia nitrogen (NH), and hydrogen ion concentration (PH), and its performance is superior to that of the RCL-Learning model.
[0139] Please see Figures 8-11 , Figures 8-11 The figures shown are schematic diagrams comparing the predicted and actual results of the potassium permanganate index (CODmn) at different monitoring points in the area to be predicted using the model provided in this application and the RCL-Learning model, respectively; where, Figures 8-11 In the diagram (a), each line represents a curve showing the predicted concentration of potassium permanganate index versus the actual concentration for the two models. Figures 8-11 (b) in the diagram represents a schematic diagram of the scatter plot fitting of the predictions and observations of the two models;
[0140] As can be seen from the figure, the accuracy of the water quality prediction results provided by the model in this application at different monitoring points in the area to be predicted is still better than that of the RCL-Learning model.
[0141] Please see Figure 12 , Figure 12 The diagram shows a comparison between the long-term prediction results and the actual results of the model provided in this application and the RCL-Learning model for the potassium permanganate index (CODmn).
[0142] from Figure 12 As can be seen, even in long-term prediction tasks, the water quality prediction results obtained by the water quality prediction model provided in this application are still closer to the actual results, indicating that the model provided in this application still has better performance in long-term prediction tasks.
[0143] Please see Figure 13 , Figure 13 The figure shows a schematic diagram of the prediction and observation scatter fitting of the model provided in this application and the RCL-Learning model. In the figure, (a) is a schematic diagram of the prediction and observation scatter fitting of the RCL-Learning model, and (b) is a schematic diagram of the prediction and observation scatter fitting of the model provided in this application.
[0144] from Figure 13 As can be seen, the model provided in this application produces a more aggregated predicted scatter plot, and its goodness of fit is higher. A higher value indicates that the model's predictions are closer to the expected values, and the relationship between the independent and dependent variables is more consistent with the actual situation.
[0145] Based on the water quality prediction method provided in the above embodiments, this application also provides a water quality prediction device, such as... Figure 14 As shown, it specifically includes:
[0146] The data acquisition module 10 is used to acquire the time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t;
[0147] The spatial feature vector extraction module 20 is used to input the time series dataset into the ResNet network in the trained water quality prediction model and output the spatial feature vector of each time series data in the time series dataset.
[0148] The time feature vector extraction module 30 is used to input the spatial feature vector of each time series data into the BiLSTM network in the trained water quality prediction model, output the hidden state vector of each time series data, and calculate the time feature vector of each time series data based on the hidden state vector of each time series data.
[0149] The water quality prediction module 40 is used to input the hidden state vector and time feature vector of each time series data into the fully connected layer of the trained water quality prediction model, and output the water quality prediction index of each monitoring station corresponding to each time series data at time t+1.
[0150] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the water quality prediction method described above.
[0151] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0152] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0153] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0154] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0155] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A water quality prediction method, characterized in that, include: Obtain a time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t; The time-series dataset is input into the ResNet network of the trained water quality prediction model, and the spatial feature vector of each time-series data point in the dataset is output; wherein, the spatial feature vector of the time-series data is: , in, Represents the first in the time series dataset Spatial feature vectors of time series data Representing spatial eigenvectors The Middle One spatial characteristic value; , in, Indicates the first The first time series data One data point, This represents the computation function of the ResNet network. This represents the output of the nth reconstruction unit in the ResNet network. eigenvalues; , in, This represents the input learned by the nth reconstruction unit. and weight parameters The calculation function, express The weight parameters, Represents the residual function of a trainable nonlinear mapping; , in, This represents the activation function. Represents the weight matrix. Indicates bias; The spatial feature vector of each time series data point is input into the BiLSTM network of the trained water quality prediction model, which outputs the hidden state vector of each time series data point. Based on the hidden state vector of each time series data point, the temporal feature vector of each time series data point is calculated. The hidden state vector of the time series data point is: , in, Represents the first in the time series dataset The hidden state vector of a time series data. This indicates a merge function. The output of the BiLSTM network represents the first... The forward sequence of a time series data. The output of the BiLSTM network represents the first... A backward sequence of time series data, Represents the hidden state vector The Middle One eigenvalue; The time feature vector of time series data is: , in, Represents the first in the time series dataset The time feature vector of a time series data. Indicates the length of the time series data. Represents the hidden state vector The Middle 1 eigenvalue, express Attention coefficient; The hidden state vector and time feature vector of each time series data are input into the fully connected layer of the trained water quality prediction model, and the water quality prediction index of each monitoring station corresponding to each time series data at time t+1 is output.
2. The water quality prediction method according to claim 1, characterized in that, Before inputting the time series dataset into the ResNet network of the trained water quality prediction model, the process includes preprocessing the time series dataset, specifically including: Use imputation to fill in missing values in time series datasets; The mean replacement method is used to replace outliers in a time series dataset.
3. The water quality prediction method according to claim 1, characterized in that, The predicted water quality indicators for each monitoring station at time t+1 are as follows: , in, Represents the first in the time series dataset Water quality prediction indicators for monitoring stations at time t+1 corresponding to each time series data point Denotes the first trainable parameter. This represents the second trainable parameter. Represents the first in the time series dataset The hidden state vector of a time series data. Represents the first in the time series dataset The time feature vector of a time series data. This represents the third trainable parameter.
4. The water quality prediction method according to claim 1, characterized in that, The process of obtaining the trained water quality prediction model includes: Obtain the time series dataset in the training set; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the same area to be predicted; The time series dataset is input into the ResNet network, and the spatial feature vector of each time series data in the time series dataset is output. The spatial feature vector of each time series data is input into the BiLSTM network, and the hidden state vector of each time series data is output. The temporal feature vector of each time series data is calculated based on the hidden state vector of each time series data. The hidden state vector and time feature vector of each time series data are input into a fully connected layer, and a loss function is constructed based on the output of the fully connected layer. The ResNet network, BiLSTM network, and fully connected layer are iteratively trained using the time series dataset in the training set until the value of the loss function is minimized, resulting in a trained ResNet network, BiLSTM network, and fully connected layer. A trained water quality prediction model is then obtained based on the trained ResNet network, BiLSTM network, and fully connected layer.
5. The water quality prediction method according to claim 4, characterized in that, The loss function is: , in, Represents the loss function. This indicates the number of time series data points in the time series dataset. Indicates the first Water quality prediction indicators for monitoring stations corresponding to each time series data point Indicates the first The actual water quality indicators of the monitoring stations corresponding to the time series data.
6. The water quality prediction method according to claim 4, characterized in that, Iterative training of the ResNet network, the BiLSTM network, and the fully connected layer using the time-series dataset in the training set includes: The backpropagation algorithm is used to pass the value of the loss function after each iteration of training to the ResNet network, the BiLSTM network, and the fully connected layer. The parameters in the ResNet network, the BiLSTM network, and the fully connected layer are updated based on the value of the loss function using mini-batch stochastic gradient descent and the Adam optimizer. Reacquire the time series dataset from the training set and iteratively train the ResNet network, the BiLSTM network, and the fully connected layer until the value of the loss function is minimized.
7. A water quality prediction device, characterized in that, include: The data acquisition module is used to acquire the time series dataset of the area to be predicted; wherein, the time series dataset contains multiple time series data corresponding to different monitoring stations in the area to be predicted, and each time series data contains water quality data and meteorological data changing over time from time 1 to t; The spatial feature vector extraction module is used to input the time series dataset into the ResNet network of the trained water quality prediction model and output the spatial feature vector of each time series data in the time series dataset; wherein, the spatial feature vector of the time series data is: , in, Represents the first in the time series dataset Spatial feature vectors of time series data Representing spatial eigenvectors The Middle One spatial characteristic value; , in, Indicates the first The first time series data One data point, This represents the computation function of the ResNet network. This represents the output of the nth reconstruction unit in the ResNet network. eigenvalues; , in, This represents the input learned by the nth reconstruction unit. and weight parameters The calculation function, express The weight parameters, Represents the residual function of a trainable nonlinear mapping; , in, This represents the activation function. Represents the weight matrix. Indicates bias; The time feature vector extraction module is used to input the spatial feature vector of each time series data into the BiLSTM network of the trained water quality prediction model, output the hidden state vector of each time series data, and calculate the time feature vector of each time series data based on the hidden state vector of each time series data; wherein, the hidden state vector of the time series data is: , in, Represents the first in the time series dataset The hidden state vector of a time series data. This indicates a merge function. The output of the BiLSTM network represents the first... The forward sequence of a time series data. The output of the BiLSTM network represents the first... A backward sequence of time series data, Represents the hidden state vector The Middle One eigenvalue; The time feature vector of time series data is: , in, Represents the first in the time series dataset The time feature vector of a time series data. Indicates the length of the time series data. Represents the hidden state vector The Middle 1 eigenvalue, express Attention coefficient; The water quality prediction module is used to input the hidden state vector and time feature vector of each time series data into the fully connected layer of the trained water quality prediction model, and output the water quality prediction index of each monitoring station corresponding to each time series data at time t+1.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the water quality prediction method according to any one of claims 1-6.
Citation Information
Patent Citations
Continuous sign language recognition method based on adaptive multi-scale attention sequential network
CN115188079A
BiLSTM-based ultrasonic wood nondestructive testing method and system
CN115356400A