A river water quality prediction method integrating quantum-like features with graph-time series models
By integrating quantum features and graph-time-series models, the problems of strong sparseness and model dependence in large-scale watershed basins are solved, and high-precision and stable prediction of river water quality are achieved.
Patent Information
- Application Number
- CN202510866867.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-06-26
AI Technical Summary
现有水质数据获取方法在大尺度流域中存在数据稀疏性、气象条件敏感性和模型依赖性强的问题,传统深度学习模型在处理大尺度流域空间结构信息及空间-时间交互特征方面存在局限性。
Using the method of fusion quantum features and graph-time-series model, we perform high-dimensional quantum feature transformation on multi-source heterogeneous data to generate spatiotemporal quantum feature vectors, and use graph-series models to capture spatially dependent features between sites to perform continuous prediction of time scale.
It improves the water quality prediction accuracy and generalization performance of the model in the context of large-scale watershed watershed, effectively alleviates the modeling problems caused by sparse observation data, and improves the stability and adaptability of the model.
Smart Images

Figure CN120372425B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of hydrological simulation, and in particular relates to a river water quality prediction method that integrates quantum-like features and a graph-time series model. Background Art
[0002] Acquiring river water quality data is a key task in water resource management and ecological and environmental protection, providing important decision-making support for watershed management and pollution prevention and control. Existing methods for acquiring water quality data primarily include ground-based observations, remote sensing monitoring, and numerical simulations, but these methods face numerous limitations in practical applications. While ground-based observations offer high data accuracy, the limited number and uneven distribution of observation sites results in severe data sparsity. Satellite remote sensing monitoring, while capable of large-scale spatial coverage, is sensitive to meteorological conditions, and data quality is affected by cloud cover and proximity to land. Numerical simulations, while capable of providing continuous spatiotemporal estimates, rely heavily on model structure and parameter settings, and can easily reduce data prediction accuracy due to simplified assumptions.
[0003] In recent years, with the development of artificial intelligence, deep learning methods have garnered widespread attention in water quality prediction. Models including support vector machines (SVM), random forests (RF), and gradient boosted tree (GBDT) have achieved some success in modeling nonlinear input-output relationships. However, traditional deep learning models have limitations in modeling large-scale watershed spatial structural information and processing spatial-temporal interaction features. Quantum machine learning (QML), an emerging direction that integrates artificial intelligence and quantum computing, has demonstrated potential in processing high-dimensional data and modeling complex nonlinear relationships. By simulating the quantum embedding process, stronger feature expression capabilities can be achieved at the data input stage, providing a richer representation space for data modeling. Furthermore, the graph-series model is a composite modeling framework that integrates graph neural networks and time series neural networks, capable of simultaneously modeling the spatial dependencies between nodes and the dynamic changes in node features over time. This type of model typically uses graph convolutional networks (GCN, GAT, etc.) as a spatial modeling unit to capture the spatial adjacency relationships between river stations based on static attributes such as topography, land use, and climate. Simultaneously, it introduces temporal structures such as LSTM or GRU to model the temporal evolution of variables such as water quality and hydrometeorological conditions at river stations. This enables continuous prediction of river water quality changes over long timescales, thereby improving the accuracy of time series infill for sparse observational data.
[0004] Based on this, the present invention proposes a river water quality prediction method that integrates quantum-like features with a graph-time series model. The quantum-like feature enhancement method, a technical approach that simulates high-dimensional mapping of quantum states, constructs a feature vector space with higher discriminative and expressive capabilities by performing high-dimensional nonlinear feature transformations on the original input features. This provides a more discriminative initial expression for the graph-time series model to process the spatiotemporal dependency characteristics of rivers. The graph-time series model is also introduced to mine the spatiotemporal information between river stations, enabling the model to extract information related to water quality changes from multi-scale spatiotemporal features. This can effectively improve the model's water quality prediction accuracy and generalization performance in large-scale, complex watershed scenarios, and has excellent engineering practical value and promotion prospects. Summary of the Invention
[0005] To address the shortcomings of the aforementioned prior art, the present invention aims to provide a river water quality prediction method that integrates quantum-like features with a graph-time series model. This method improves the model's prediction accuracy and stability for sparse water quality observations in the context of large-scale watersheds. This method performs high-dimensional quantum-like feature transformations on multi-source heterogeneous data (time-series meteorological data and static watershed attribute data) to generate corresponding spatiotemporal quantum-like feature vectors, enhancing the model's ability to characterize nonlinear interactions between spatiotemporal features. Furthermore, the graph-time series model is utilized to capture spatial dependencies between stations, enabling continuous time-scale prediction of river water quality. This method enables daily prediction of water quality variables (such as dissolved oxygen, water temperature, and runoff) for multiple river stations, effectively alleviating modeling challenges associated with sparse observation data.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0007] The present invention provides a river water quality prediction method that integrates quantum-like features and a graph-time series model, comprising the following steps:
[0008] Step S1: Obtain multivariate water quality observation data, time series meteorological data, and static watershed attribute data for multiple river stations;
[0009] Step S2: preprocess the data obtained in step S1 and divide the preprocessed data into a training set and a test set;
[0010] Step S3: Perform high-dimensional quantum feature transformation on the pre-processed time series meteorological data and static watershed attribute data to generate corresponding meteorological quantum feature vectors and static watershed attribute quantum feature vectors respectively;
[0011] Step S4: Use the graph-time series model to extract spatial dependency features, and concatenate and fuse the meteorological quantum feature vectors and static watershed attribute quantum feature vectors in step S3 with the spatial dependency features. Then, input the spatial dependency features together with the multivariate water quality observation data preprocessed in step S2 into the graph-time series model for training and optimization of model parameters.
[0012] Step S5: Denormalize the simulation output calculated by the trained graph-time series model to obtain continuous daily river water quality simulation data, and evaluate the model performance to predict the continuous daily river water quality data.
[0013] Furthermore, the multivariate water quality observation data, time series meteorological data and static watershed attribute data in step S1 are organized in a site-time structure and constructed as a tensor structure of site×time×feature dimensions, with a time resolution of daily scale; wherein,
[0014] Multivariate water quality observation data, including dissolved oxygen, runoff, and water temperature. Depending on the needs of the specific prediction task, one or more of these variables can be selected for data prediction;
[0015] Time series meteorological data, including: dew point temperature at 2 meters, potential evaporation, ground pressure, temperature of the first soil layer, net surface solar radiation, net surface thermal radiation, total surface runoff, total precipitation, U component of wind speed at 10 meters, V component of wind speed at 10 meters, volumetric water content of the first soil layer, and air temperature at 2 meters;
[0016] Static watershed attribute data, including 100-200 different watershed attributes, covers land use, topographic characteristics, soil type, watershed area, slope distribution, and vegetation index of different watersheds. They are used as invariant features of each river station for spatial modeling.
[0017] Furthermore, the data preprocessing in step S2 specifically includes:
[0018] The multivariate water quality observation data, time series meteorological data, and static watershed attribute data in step S1 are all normalized to transform the data into a distribution with a mean of 0 and a standard deviation of 1, and to ensure that the data have similar scales and distributions. The formula is as follows:
[0019] ;
[0020] in, is the original data, is the average value of the original data, is the standard deviation of the original data, is the preprocessed data.
[0021] Further, in step S2, based on the time series of the preprocessed water quality observation data, the normalized water quality observation data, time series meteorological data, and static basin attribute data are divided into a training set and a test set according to the ratios of 75% and 25%.
[0022] Further, step S3 specifically includes:
[0023] The meteorological vector of the \(i\)-th river site on the \(t\)-th day is expressed as:
[0024] ;
[0025] where represents the meteorological vector of the \(i\)-th river site on the \(t\)-th day, represents that the meteorological vector belongs to the real vector space with a dimension of , \(t = 1, 2, \cdots, T\), and \(T\) is the total number of time steps;
[0026] The static basin attribute vector corresponding to each river site is expressed as:
[0027] ;
[0028] where represents the static basin attribute vector of the \(i\)-th river site; represents that the static basin attribute vector belongs to the real vector space with a dimension of ;
[0029] For each meteorological vector , the following high-dimensional quantum-like feature transformation is defined:
[0030] Step S31: Perform sine and cosine non-linear transformations on the meteorological vector of the \(t\)-th day for each river site as follows:
[0031] ;
[0032] ;
[0033] where and respectively represent the meteorological sine feature and meteorological cosine feature after non-linear transformation;
[0034] Step S32: Perform bivariate interaction transformation on any two different feature dimensions \(d1\) and \(d2\) in the meteorological vector of each river site at time step \(t\), calculate the interaction feature, \(d1, d2 \in \{1, 2, \cdots, D\}\), \(d1 < d2\), as follows:
[0035] ;
[0036] in, , Respectively The values of the d1th and d2th dimensions in , The meteorological interaction characteristics generated by the i-th river station on day t are generated Interaction dimensions;
[0037] Step S33: Combine the meteorological vector, meteorological sine feature, meteorological cosine feature and meteorological interaction feature to obtain the meteorological quantum feature vector of the i-th river station on the t-th day ,as follows:
[0038] ;
[0039] in, Indicates concatenating multiple vectors of the same dimension and merging them into an expanded high-dimensional feature vector along the feature dimension. , Indicates that the meteorological quantum eigenvector belongs to the dimension The real vector space of ;
[0040] The meteorological quantum feature vectors generated by the meteorological time series are stacked along the time dimension t=1,2,...,T to form a meteorological quantum feature matrix as follows:
[0041] ;
[0042] in, is the meteorological quantum characteristic matrix corresponding to the i-th hydrological observation station, is the meteorological quantum feature vector generated by the i-th river station on the t-th day, T is the length of the time series, is the dimension of meteorological quantum eigenvector, Indicates that the meteorological quantum characteristic matrix belongs to the dimension The real vector space of ;
[0043] For each river station, the static attribute vector , perform high-dimensional quantum-like feature transformation as follows:
[0044] ;
[0045] ;
[0046] ;
[0047] ;
[0048] in, is the static watershed attribute vector of the i-th river station; 、 They represent the static watershed attribute sine characteristics and the static watershed attribute cosine characteristics after the nonlinear transformation of the static watershed attribute vector; , Respectively The values of the d1th and d2th dimensions in , Represents the interactive characteristics of static watershed attributes; Represents the quantum eigenvector of static watershed attributes; , The quantum eigenvector representing the static watershed attribute class belongs to the dimension The real vector space of .
[0049] Furthermore, the step S4 of extracting spatial dependency features using the graph-time series model specifically includes:
[0050] Using the static watershed attribute vector for each river station , calculate the cosine similarity between all river sites as follows:
[0051] ;
[0052] in, 、 denote the static watershed attribute vectors of the ith and jth river stations, respectively; cosine similarity between the static watershed attribute vectors of the ith and jth river stations;
[0053] Constructing adjacency matrix based on similarity matrix , define the edge connection relationship in the graph structure, and the connection rules are as follows:
[0054] ;
[0055] in, is the similarity threshold; Represents the element in row i and column j in the adjacency matrix;
[0056] Construct a spatially dependent node feature matrix and input the initial node feature matrix , where the i-th row is the static attribute vector of river station i , using graph convolutional neural network for embedding learning and extracting spatial dependency information, the formula is as follows:
[0057] ;
[0058] in, is the initial node feature matrix; Indicates that the node feature matrix belongs to the dimension The real vector space of ; Indicates the total number of river stations involved in mapping, that is, the number of nodes in the graph; represents the static watershed attribute dimensions for each site; For the The node feature matrix output by the layer; is the activation function; For the The node feature matrix of the layer input; is the normalized adjacency matrix; For the The layer's trainable weight parameter matrix;
[0059] After l layers of graph convolution, the output spatial dependency feature matrix is as follows:
[0060] ;
[0061] in, Represents the spatial dependency feature matrix output after l layers of graph convolution, represents the spatial embedding dimension of the output, The spatial dependence feature matrix of the output is of dimension The real vector space of .
[0062] Furthermore, in step S4, the time series meteorological quantum feature vector and the static watershed attribute quantum feature vector in step S3 are spliced and fused with the spatial dependency feature, and input together with the multivariate water quality observation data preprocessed in step S2 into the graph-time series model for training to optimize the model parameters; specifically, the step includes:
[0063] The time series meteorological quantum eigenvectors and the static watershed attribute quantum eigenvectors are spliced together to obtain a high-dimensional space-time quantum eigenmatrix. , , where T is the input time step length, is the total feature dimension, including the nonlinear mapping term of meteorological characteristics and the embedding term of regional attributes, Represents a high-dimensional feature matrix Belong to dimension The real vector space of ;
[0064] The spatial dependency features are copied in the time dimension to construct a spatial feature matrix as follows:
[0065] ;
[0066] in, represents the spatial characteristic matrix of the i-th river station after replication and expansion at each time step, represents the spatial dependence eigenvector of the i-th river station;
[0067] The spatial dependence eigenvector of the i-th river station It is expanded to T time steps, forming a dimension that matches the high-dimensional space-time quantum characteristic matrix;
[0068] Construct the fusion features of each time step as follows:
[0069] ;
[0070] in, is the high-dimensional space-time quantum-like eigenvector of site i at time t; , Both are fusion weight coefficients, and their value range is [0,1]; represents the fused feature vector of the i-th river station at the t-th time step;
[0071] Construct the fused input feature matrix as follows:
[0072] ;
[0073] Among them, the fusion dimension The expression is as follows:
[0074] ;
[0075] Fusion Features is the final input feature sequence of river station i, Represents fusion features Belongs to the dimension The real vector space of ;
[0076] The fusion features Input graph - time series model, input in the format of (N,T,D); there are N river stations, and the feature vector dimension of each river station is satisfy , then the final input data dimension is (N, T, ), joint input Expressed as:
[0077] ;
[0078] Among them, F represents the fused feature vector of N river stations, represents the water quality observation data after preprocessing in step S2;
[0079] Set hyperparameters for the graph-to-series model, including defining the total number of training epochs, model save frequency, batch size, time step, number of hidden layer units, and dropout rate;
[0080] The test set As input, the model is forward propagated during training, and the simulated output is calculated layer by layer. The specific process is as follows:
[0081] At each time step t, the water quality forecast information of the river station at the previous time step that the model determines needs to be retained under the current meteorological and hydrological conditions is calculated;
[0082] ;
[0083] in, represents the output vector, express function, represents the weight matrix, represents the hidden state of the previous time step, represents the input of the current time step, represents the bias term;
[0084] Calculate the input data for the current time step Impact ratio when updating the water quality forecast status of river stations and candidate unit status The value of
[0085] ;
[0086] ;
[0087] in, represents the output vector, represents the weight matrix, represents the input data at the current time step t, Indicates the candidate unit status, represents the hyperbolic tangent activation function, The weight matrix representing the candidate unit state, A bias vector representing the candidate cell state;
[0088] Update the cumulative river station water quality prediction information C at the current time step t , C t Including the input of the current time step and the water quality prediction information of the river station in the previous time step, the calculation formula is as follows:
[0089] ;
[0090] in, and Represent the cell states at the current time step and the previous time step respectively, represents element-wise multiplication;
[0091] By calculating the activation value To control the information output ratio of the unit state at the current time step, and then calculate the hidden state of the current time step As output information, the calculation formula is as follows:
[0092] ;
[0093] ;
[0094] in, represents the activation value of the output gate, represents the hidden state at the current time step, represents the weight matrix, Represents the bias vector of the output gate;
[0095] The hidden state at the last time step As the feature representation of the sequence, it is passed to the output layer and the expression is as follows:
[0096] ;
[0097] in, represents the weight matrix of the output layer, represents the bias term, represents the simulation output obtained by the model calculation;
[0098] The model parameters are updated through the back-propagation algorithm, with the goal of minimizing the loss function L. The expression of the loss function L is as follows:
[0099] ;
[0100] in, represents the simulation output obtained by the model calculation; represents the multivariate water quality observation data after preprocessing in step S2, Take 1×10 −8 , n is the number of samples; calculate the gradient of the loss function L with respect to the model parameter θ , the parameter θ includes all weight matrices and bias terms in the time series model;
[0101] Use the gradient descent method to update the model parameters. The update rule is:
[0102] ;
[0103] Where k represents the current number of iterations, θ(k) is the parameter value at the kth iteration, and η is the learning rate. is the gradient of the loss function with respect to the parameter θ, and θ(k+1) is the updated parameter value;
[0104] Multiple iterations are performed to gradually optimize the model parameters until the loss function converges to the minimum value or reaches the predetermined number of training cycles, completing the model training.
[0105] Furthermore, in step S5, the simulation output of the trained graph-time series model is denormalized to restore it to the continuous daily river water quality simulation value at the original physical quantity scale, which is expressed as:
[0106] ;
[0107] Among them, Y represents the continuous daily river water quality simulation value after denormalization, represents the multivariate water quality observation data after preprocessing in step S2, represents the standard deviation of multivariate water quality observation data, Represents the average value of multivariate water quality observation data.
[0108] The model was evaluated using denormalized continuous daily river water quality simulation values and multivariate water quality observation data as follows:
[0109] ;
[0110] ;
[0111] ;
[0112] ;
[0113] Where, Indicates the continuous daily simulated river water quality value, represents the multivariate water quality observation data, n represents the total number of paired continuous daily river water quality simulation data and multivariate water quality observation data during the model testing period, It represents the average value of the simulated river water quality values for consecutive days. represents the average value of multivariate water quality simulation data, represents the percentage deviation, represents the Nash efficiency coefficient, represents the root mean square error, Represents the Pearson correlation coefficient; after the reliability of the model output results is evaluated based on the four evaluation parameters Pbias, NSE, RMSE and Pcorr, the denormalized continuous daily river water quality simulation value is the final predicted daily continuous river water quality data.
[0114] Beneficial effects of the present invention:
[0115] 1. The present invention improves the model's ability to express nonlinear interactions between complex spatiotemporal variables by performing high-dimensional quantum-like feature transformation on multi-source heterogeneous meteorological and static watershed attribute data, thereby improving the fitting accuracy and generalization ability of the water quality prediction model.
[0116] 2. The present invention models the spatial dependency relationship between multiple river stations in a large-scale spatial context, and constructs an adjacency matrix using the static attribute similarity of each station in the basin, thereby achieving effective modeling and reasoning of the large-scale basin spatial structure, and solving the problem that traditional water quality prediction methods cannot effectively capture spatial characteristics in complex geographical environments.
[0117] 3. The present invention conducts spatiotemporal joint modeling and fully explores the spatiotemporal coupling relationship of water quality data, which not only improves the accuracy of the model in long-term, dynamic prediction tasks, but also enhances the stability and adaptability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0118] Figure 1 Flowchart of the method of the present invention. DETAILED DESCRIPTION
[0119] In order to facilitate understanding by those skilled in the art, the present invention will be further described below with reference to embodiments and drawings. The contents mentioned in the embodiments are not intended to limit the present invention.
[0120] Reference Figure 1 As shown, the present invention is a method for predicting river water quality by integrating quantum-like features with a graph-time series model, and the steps are as follows:
[0121] Step S1: Obtain multivariate water quality observation data, time series meteorological data, and static watershed attribute data for multiple river stations;
[0122] Specifically, the multivariate water quality observation data, time series meteorological data and static watershed attribute data in step S1 are organized in a site-time structure and constructed as a tensor structure of site×time×feature dimensions, with a time resolution of daily scale; wherein,
[0123] Multivariate water quality observation data, including dissolved oxygen, runoff, and water temperature. Depending on the needs of the specific prediction task, one or more of these variables can be selected for data prediction;
[0124] Time series meteorological data, including: dew point temperature at 2 meters, potential evaporation, ground pressure, temperature of the first soil layer, net surface solar radiation, net surface thermal radiation, total surface runoff, total precipitation, U component of wind speed at 10 meters, V component of wind speed at 10 meters, volumetric water content of the first soil layer, and air temperature at 2 meters;
[0125] Static watershed attribute data, including 100-200 different watershed attributes, covers land use, topographic characteristics, soil type, watershed area, slope distribution, and vegetation index of different watersheds. They are used as invariant features of each river station for spatial modeling.
[0126] Step S2: preprocess the data obtained in step S1 and divide the preprocessed data into a training set and a test set;
[0127] Specifically, the data preprocessing in step S2 specifically includes:
[0128] The multivariate water quality observation data, time series meteorological data, and static watershed attribute data in step S1 are all normalized to transform the data into a distribution with a mean of 0 and a standard deviation of 1, and to ensure that the data have similar scales and distributions. The formula is as follows:
[0129] ;
[0130] in, is the original data, is the average value of the original data, is the standard deviation of the original data, is the preprocessed data.
[0131] Among them, in step S2, based on the time series of the preprocessed water quality observation data, the normalized water quality observation data, the time series meteorological data and the static watershed attribute data are divided into a training set and a test set according to the ratio of 75% and 25%.
[0132] Step S3: Perform high-dimensional quantum feature transformation on the pre-processed time series meteorological data and static watershed attribute data to generate corresponding meteorological quantum feature vectors and static watershed attribute quantum feature vectors respectively;
[0133] Specifically, the step S3 includes:
[0134] The meteorological vector of the i-th river station on day t is expressed as:
[0135] ;
[0136] in, Denote the meteorological vector of the \(i\)-th river site on the \(t\)-th day, where the meteorological vector belongs to a real vector space of dimension , \(t = 1, 2, \cdots, T\), and \(T\) is the total number of time steps;
[0137] The static catchment attribute vector corresponding to each river site is denoted as:
[0138] ;
[0139] where denotes the static catchment attribute vector of the \(i\)-th river site; where the static catchment attribute vector belongs to a real vector space of dimension ;
[0140] For each meteorological vector , define the following high-dimensional quantum-like feature transformation:
[0141] Step S31: Perform sine and cosine non-linear transformations on the meteorological vector of each river site on the \(t\)-th day, as follows:
[0142] ;
[0143] ;
[0144] where and respectively represent the meteorological sine feature and meteorological cosine feature after non-linear transformation;
[0145] Step S32: Perform bivariate interaction transformation on any two different feature dimensions \(d_1, d_2\) of the meteorological vector of each river site at time step \(t\), calculate the interaction feature, \(d_1, d_2\in\{1, 2, \cdots, D\}\), \(d_1\lt d_2\), as follows:
[0146] ;
[0147] where , respectively represent the values of the \(d_1\)-th and \(d_2\)-th dimensions in the meteorological interaction feature generated by the \(i\)-th river site on the \(t\)-th day, and a total of interaction dimensions are generated;
[0148] Step S33: Concatenate the meteorological vector, meteorological sine feature, meteorological cosine feature and meteorological interaction feature to obtain the meteorological quantum-like feature vector of the \(i\)-th river site on the \(t\)-th day, as follows:
[0149] ;
[0150] in, Indicates concatenating multiple vectors of the same dimension and merging them into an expanded high-dimensional feature vector along the feature dimension. , Indicates that the meteorological quantum eigenvector belongs to the dimension The real vector space of ;
[0151] The meteorological quantum feature vectors generated by the meteorological time series are stacked along the time dimension t=1,2,...,T to form a meteorological quantum feature matrix as follows:
[0152] ;
[0153] in, is the meteorological quantum characteristic matrix corresponding to the i-th hydrological observation station, is the meteorological quantum feature vector generated by the i-th river station on the t-th day, T is the length of the time series, is the dimension of meteorological quantum eigenvector, Indicates that the meteorological quantum characteristic matrix belongs to the dimension The real vector space of ;
[0154] For each river station, the static attribute vector , perform high-dimensional quantum-like feature transformation as follows:
[0155] ;
[0156] ;
[0157] ;
[0158] ;
[0159] in, is the static watershed attribute vector of the i-th river station; 、 They represent the static watershed attribute sine characteristics and the static watershed attribute cosine characteristics after the nonlinear transformation of the static watershed attribute vector; , Respectively The values of the d1th and d2th dimensions in , Represents the interactive characteristics of static watershed attributes; Represents the quantum eigenvector of static watershed attributes; , The quantum eigenvector representing the static watershed attribute class belongs to the dimension The real vector space of .
[0160] Step S4: Use the graph-time series model to extract spatial dependency features, and concatenate and fuse the meteorological quantum feature vectors and static watershed attribute quantum feature vectors in step S3 with the spatial dependency features. Then, input the spatial dependency features together with the multivariate water quality observation data preprocessed in step S2 into the graph-time series model for training and optimization of model parameters.
[0161] Specifically, the step S4 of extracting spatial dependency features using the graph-time series model specifically includes:
[0162] Using the static watershed attribute vector for each river station , calculate the cosine similarity between all river sites as follows:
[0163] ;
[0164] in, 、 denote the static watershed attribute vectors of the ith and jth river stations, respectively; cosine similarity between the static watershed attribute vectors of the ith and jth river stations;
[0165] Constructing adjacency matrix based on similarity matrix , define the edge connection relationship in the graph structure, and the connection rules are as follows:
[0166] ;
[0167] in, is the similarity threshold; Represents the element in row i and column j in the adjacency matrix;
[0168] Construct a spatially dependent node feature matrix and input the initial node feature matrix , where the i-th row is the static attribute vector of river station i , using graph convolutional neural network for embedding learning and extracting spatial dependency information, the formula is as follows:
[0169] ;
[0170] in, is the initial node feature matrix; Indicates that the node feature matrix belongs to the dimension The real vector space of ; Indicates the total number of river stations involved in mapping, that is, the number of nodes in the graph; represents the static watershed attribute dimensions for each site; For the The node feature matrix output by the layer; is the activation function; For the The node feature matrix of the layer input; is the normalized adjacency matrix; For the The layer's trainable weight parameter matrix;
[0171] After l layers of graph convolution, the output spatial dependency feature matrix is as follows:
[0172] ;
[0173] in, Represents the spatial dependency feature matrix output after l layers of graph convolution, represents the spatial embedding dimension of the output, The spatial dependence feature matrix of the output is of dimension The real vector space of .
[0174] The step S4 comprises: fusing the time series meteorological quantum feature vector and the static watershed attribute quantum feature vector in step S3 with the spatial dependency feature, and inputting the data into the graph-time series model together with the multivariate water quality observation data preprocessed in step S2 for training to optimize the model parameters; specifically, the step S4 comprises:
[0175] The time series meteorological quantum eigenvectors and the static watershed attribute quantum eigenvectors are spliced together to obtain a high-dimensional space-time quantum eigenmatrix. , , where T is the input time step length, is the total feature dimension, including the nonlinear mapping term of meteorological characteristics and the embedding term of regional attributes, Represents a high-dimensional feature matrix Belong to dimension The real vector space of ;
[0176] The spatial dependency features are copied in the time dimension to construct a spatial feature matrix as follows:
[0177] ;
[0178] in, represents the spatial characteristic matrix of the i-th river station after replication and expansion at each time step, represents the spatial dependence eigenvector of the i-th river station;
[0179] The spatial dependence eigenvector of the i-th river station It is expanded to T time steps, forming a dimension that matches the high-dimensional space-time quantum characteristic matrix;
[0180] Construct the fusion features of each time step as follows:
[0181] ;
[0182] in, is the high-dimensional space-time quantum-like eigenvector of site i at time t; , Both are fusion weight coefficients, and their value range is [0,1]; represents the fused feature vector of the i-th river station at the t-th time step;
[0183] Construct the fused input feature matrix as follows:
[0184] ;
[0185] Among them, the fusion dimension The expression is as follows:
[0186] ;
[0187] Fusion Features is the final input feature sequence of river station i, Represents fusion features Belongs to the dimension The real vector space of ;
[0188] The fusion features Input graph - time series model, input in the format of (N,T,D); there are N river stations, and the feature vector dimension of each river station is satisfy , then the final input data dimension is (N, T, ), joint input Expressed as:
[0189] ;
[0190] Among them, F represents the fused feature vector of N river stations, represents the water quality observation data after preprocessing in step S2;
[0191] Set hyperparameters for the graph-to-series model, including defining the total number of training epochs, model save frequency, batch size, time step, number of hidden layer units, and dropout rate;
[0192] The test set As input, the model is forward propagated during training, and the simulated output is calculated layer by layer. The specific process is as follows:
[0193] At each time step t, the water quality forecast information of the river station at the previous time step that the model determines needs to be retained under the current meteorological and hydrological conditions is calculated;
[0194] ;
[0195] in, represents the output vector, express function, represents the weight matrix, represents the hidden state of the previous time step, represents the input of the current time step, represents the bias term;
[0196] Calculate the input data for the current time step Impact ratio when updating the water quality forecast status of river stations and candidate unit status The value of
[0197] ;
[0198] ;
[0199] in, represents the output vector, represents the weight matrix, represents the input data at the current time step t, Indicates the candidate unit status, represents the hyperbolic tangent activation function, The weight matrix representing the candidate unit state, A bias vector representing the candidate cell state;
[0200] Update the cumulative river station water quality prediction information C at the current time step t , C t Including the input of the current time step and the water quality prediction information of the river station in the previous time step, the calculation formula is as follows:
[0201] ;
[0202] in, and Represent the cell states at the current time step and the previous time step respectively, represents element-wise multiplication;
[0203] By calculating the activation value To control the information output ratio of the unit state at the current time step, and then calculate the hidden state of the current time step As output information, the calculation formula is as follows:
[0204] ;
[0205] ;
[0206] in, represents the activation value of the output gate, represents the hidden state at the current time step, represents the weight matrix, Represents the bias vector of the output gate;
[0207] The hidden state at the last time step As the feature representation of the sequence, it is passed to the output layer and the expression is as follows:
[0208] ;
[0209] in, represents the weight matrix of the output layer, represents the bias term, represents the simulation output obtained by the model calculation;
[0210] The model parameters are updated through the back-propagation algorithm, with the goal of minimizing the loss function L. The expression of the loss function L is as follows:
[0211] ;
[0212] in, represents the simulation output obtained by the model calculation; represents the multivariate water quality observation data after preprocessing in step S2, Take 1×10 −8 , n is the number of samples; calculate the gradient of the loss function L with respect to the model parameter θ , the parameter θ includes all weight matrices and bias terms in the time series model;
[0213] Use the gradient descent method to update the model parameters. The update rule is:
[0214] ;
[0215] Where k represents the current number of iterations, θ(k) is the parameter value at the kth iteration, and η is the learning rate. is the gradient of the loss function with respect to the parameter θ, and θ(k+1) is the updated parameter value;
[0216] Multiple iterations are performed to gradually optimize the model parameters until the loss function converges to the minimum value or reaches the predetermined number of training cycles, completing the model training.
[0217] Step S5: Denormalizing the simulation output calculated by the trained graph-time series model to obtain continuous daily river water quality simulation data, and evaluating the model performance to predict the continuous daily river water quality data;
[0218] Specifically, in step S5, the simulation output of the trained graph-time series model is denormalized to restore it to the continuous daily river water quality simulation value at the original physical quantity scale, which is expressed as:
[0219] ;
[0220] Among them, Y represents the continuous daily river water quality simulation value after denormalization, represents the multivariate water quality observation data after preprocessing in step S2, represents the standard deviation of multivariate water quality observation data, Represents the average value of multivariate water quality observation data.
[0221] The model was evaluated using denormalized continuous daily river water quality simulation values and multivariate water quality observation data as follows:
[0222] ;
[0223] ;
[0224] ;
[0225] ;
[0226] Where, Indicates the continuous daily simulated river water quality value, represents the multivariate water quality observation data, n represents the total number of paired continuous daily river water quality simulation data and multivariate water quality observation data during the model testing period, It represents the average value of the simulated river water quality values for consecutive days. represents the average value of multivariate water quality simulation data, represents the percentage deviation, represents the Nash efficiency coefficient, represents the root mean square error, Represents the Pearson correlation coefficient; after the reliability of the model output results is evaluated based on the four evaluation parameters Pbias, NSE, RMSE and Pcorr, the denormalized continuous daily river water quality simulation value is the final predicted daily continuous river water quality data.
[0227] The present invention has many specific application paths. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements can be made without departing from the principles of the present invention. These improvements should also be considered as the scope of protection of the present invention.
Claims
1. A river water quality prediction method that integrates quantum-like features and graph-time series models, characterized by: Here are the steps: Step S1: Obtain multivariate water quality observation data, time series meteorological data, and static watershed attribute data for multiple river stations; Step S2: preprocess the data obtained in step S1 and divide the preprocessed data into a training set and a test set; Step S3: Perform high-dimensional quantum feature transformation on the pre-processed time series meteorological data and static watershed attribute data to generate corresponding meteorological quantum feature vectors and static watershed attribute quantum feature vectors respectively; Step S4: Use the graph-time series model to extract spatial dependency features, and concatenate and fuse the meteorological quantum feature vectors and static watershed attribute quantum feature vectors in step S3 with the spatial dependency features. Then, input the spatial dependency features together with the multivariate water quality observation data preprocessed in step S2 into the graph-time series model for training and optimization of model parameters. Step S5: Denormalizing the simulation output calculated by the trained graph-time series model to obtain continuous daily river water quality simulation data, and evaluating the model performance to predict the continuous daily river water quality data; The step S3 specifically includes: The meteorological vector of the i-th river station on day t is expressed as: in, represents the meteorological vector of the ith river station on day t, R D Indicates that the meteorological vector belongs to the real vector space of dimension D, t = 1, 2, ..., T, where T is the total time step; The static watershed attribute vector corresponding to each river station is expressed as: Among them, s (i) represents the static watershed attribute vector of the i-th river station; Indicates that the static watershed attribute vector belongs to dimension D s The real vector space of ; For each meteorological vector The following high-dimensional quantum-like characteristic transformation is defined: Step S31: For each river station, the meteorological vector of day t Perform sine and cosine nonlinear transformations as follows: in, and They represent the meteorological sine characteristics and meteorological cosine characteristics after nonlinear transformation respectively; Step S32: For each meteorological vector of each river site at time step t perform a bivariate interaction transformation on any two different feature dimensions d1, d2, calculate the interaction features, where d1, d2 ∈ {1, 2,..., D}, d1 < d2, as follows: in, Respectively The values of the d1th and d2th dimensions in , The meteorological interaction characteristics generated by the i-th river station on day t are generated Interaction dimensions; Step S33: Combine the meteorological vector, meteorological sine feature, meteorological cosine feature and meteorological interaction feature to obtain the meteorological quantum feature vector of the i-th river station on the t-th day as follows: Among them, concat means concatenating multiple vectors of the same dimension and merging them into an expanded high-dimensional feature vector along the feature dimension. Indicates that the meteorological quantum eigenvector belongs to dimension D z The real vector space of ; The meteorological quantum feature vectors generated by the meteorological time series are stacked along the time dimension t = 1, 2, ..., T to form a meteorological quantum feature matrix as follows: Among them, Z (i) is the meteorological quantum characteristic matrix corresponding to the i-th hydrological observation station, is the meteorological quantum feature vector generated by the i-th river station on the t-th day, T is the length of the time series, D z is the dimension of meteorological quantum eigenvector, Indicates that the meteorological quantum characteristic matrix belongs to the dimension T×D z The real vector space of ; For each river station, the static attribute vector s (i) , perform high-dimensional quantum-like feature transformation as follows: Among them, s (i) is the static watershed attribute vector of the i-th river station; They represent the static watershed attribute sine characteristics and the static watershed attribute cosine characteristics after the nonlinear transformation of the static watershed attribute vector; Respectively represent s (i) The values of the d1th and d2th dimensions in , Represents the interactive characteristics of static watershed attributes; Represents the quantum eigenvector of static watershed attributes; The quantum eigenvector representing the static watershed attribute class belongs to the dimension D h The real vector space of .
2. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 1 is characterized in that: The multivariate water quality observation data, time series meteorological data and static watershed attribute data in step S1 are organized in a site-time structure and constructed as a tensor structure of site×time×feature dimensions, with a time resolution of daily scale; wherein, Multivariate water quality observation data, including dissolved oxygen, runoff, and water temperature. Depending on the needs of the specific prediction task, one or more of these variables can be selected for data prediction; Time series meteorological data, including: dew point temperature at 2 meters, potential evaporation, ground pressure, temperature of the first soil layer, net surface solar radiation, net surface thermal radiation, total surface runoff, total precipitation, U component of wind speed at 10 meters, V component of wind speed at 10 meters, volumetric water content of the first soil layer, and air temperature at 2 meters; Static watershed attribute data, including 100-200 different watershed attributes, covering land use, topographic characteristics, soil type, watershed area, slope distribution and vegetation index of different watersheds, are used as invariant features of each river station for spatial modeling.
3. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 1 is characterized in that: The data preprocessing in step S2 specifically includes: The multivariate water quality observation data, time series meteorological data, and static watershed attribute data in step S1 are all normalized to transform the data into a distribution with a mean of 0 and a standard deviation of 1, and to ensure that the data have similar scales and distributions. The formula is as follows: Among them, x is the original data, is the average value of the original data, σ x is the standard deviation of the original data, and z is the preprocessed data.
4. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 2 is characterized in that: In step S2, based on the time series of the preprocessed water quality observation data, the normalized water quality observation data, the time series meteorological data and the static watershed attribute data are divided into a training set and a test set according to a ratio of 75% and 25%.
5. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 1 is characterized in that: The step S4 of extracting spatial dependency features using the graph-temporal model specifically includes: Using the static watershed attribute vector s for each river station (i) , calculate the cosine similarity between all river sites as follows: Among them, s i 、s j Represent the static watershed attribute vectors of the i-th and j-th river stations respectively; cos(s i ,s j ) cosine similarity between the static watershed attribute vectors of the ith and jth river stations; Constructing adjacency matrix based on similarity matrix Define the edge connection relationship in the graph structure. The connection rules are as follows: Among them, τ is the similarity threshold; A ij Represents the element in row i and column j in the adjacency matrix; Construct a spatially dependent node feature matrix and input the initial node feature matrix The i-th row is the static attribute vector s of river station i (i) , using graph convolutional neural network for embedding learning and extracting spatial dependency information, the formula is as follows: Among them, H (0) is the initial node feature matrix; Indicates that the node feature matrix belongs to the dimension N×D s The real vector space of D is: s represents the static watershed attribute dimension of each site; H (l+1) is the node feature matrix output by the l+1 layer; ρ is the activation function; H (l) is the node feature matrix input to the lth layer; is the normalized adjacency matrix; W (l) is the trainable weight parameter matrix of the lth layer; After l layers of graph convolution, the output spatial dependency feature matrix is as follows: Among them, H l Represents the spatial dependency feature matrix output after l layers of graph convolution, D gcn represents the spatial embedding dimension of the output, Indicates that the output spatial dependency feature matrix is of dimension N×D gcn The real vector space of .
6. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 5 is characterized in that: In step S4, the time series meteorological quantum feature vector and the static watershed attribute quantum feature vector in step S3 are spliced and fused with the spatial dependency feature, and input together with the multivariate water quality observation data preprocessed in step S2 into the graph-time series model for training to optimize the model parameters; specifically, the step includes: The time series meteorological quantum eigenvectors and the static watershed attribute quantum eigenvectors are spliced together to obtain the high-dimensional space-time quantum eigenmatrix Z. Where T is the input time step length, D q is the total feature dimension, including the nonlinear mapping term of meteorological characteristics and the embedding term of regional attributes, Indicates that the high-dimensional feature matrix Z belongs to the dimension T×D q The real vector space of ; The spatial dependency features are copied in the time dimension to construct a spatial feature matrix as follows: H i =repeat(h i ,T); Among them, H i represents the spatial characteristic matrix of the i-th river station after replication and expansion at each time step, h i represents the spatial dependence eigenvector of the i-th river station; The spatial dependence eigenvector h of the i-th river station i It is expanded to T time steps, forming a dimension that matches the high-dimensional space-time quantum characteristic matrix; Construct the fusion features of each time step as follows: in, is the high-dimensional space-time quantum eigenvector of site i at time t; α, β are both fusion weighting coefficients with a value range of [0,1]; f t (i) represents the fused feature vector of the i-th river station at the t-th time step; Construct the fused input feature matrix as follows: Among them, the fusion dimension D f The expression is as follows: D f =D q +D gcn ; Fusion feature F (i) is the final input feature sequence of river station i, Represents the fusion feature F (i) Belongs to the dimension T×D f The real vector space of ; The fusion feature F (i) Input graph - time series model, input in the format of (N, T, D); assume that there are N river stations, and the dimension D of the feature vector of each river station satisfies D = D f , then the final input data dimension is (N, T, D f ), combined input x t Expressed as: Among them, F represents the fused feature vector of N river stations, represents the water quality observation data after preprocessing in step S2; Set hyperparameters for the graph-to-series model, including defining the total number of training epochs, model save frequency, batch size, time step, number of hidden layer units, and dropout rate; The test set x t As input, the model is forward propagated during training, and the simulated output is calculated layer by layer. The specific process is as follows: At each time step t, the water quality forecast information of the river station at the previous time step that the model determines needs to be retained under the current meteorological and hydrological conditions is calculated; f t =σ(W f ·[h t-1 ,x t ]+b f ); Among them, f t represents the output vector, σ represents the sigmoid function, W f represents the weight matrix, h t-1 represents the hidden state of the previous time step, x t represents the input of the current time step, b f represents the bias term; Calculate the current time step input data x t The impact ratio when updating the water quality prediction status of the river station i t and candidate unit status The value of i t =σ(W i ·[h t-1 ,x t ]+b i ); Among them, i t represents the output vector, W i represents the weight matrix, x t represents the input data at the current time step t, represents the candidate unit state, tanh represents the hyperbolic tangent activation function, W C The weight matrix representing the candidate unit state, b C A bias vector representing the candidate cell state; Update the cumulative river station water quality prediction information C at the current time step t , C t Including the input of the current time step and the water quality prediction information of the river station in the previous time step, the calculation formula is as follows: Among them, C t and C t-1 Represent the cell states of the current time step and the previous time step respectively, * represents element-by-element multiplication; By calculating the activation value o t To control the information output ratio of the unit state of the current time step, and then calculate the hidden state h of the current time step t As output information, the calculation formula is as follows: the t =σ(W o ·[h t-1 ,x t ]+b o ); h t =o t *tan h(C t ); Among them, t represents the activation value of the output gate, h t represents the hidden state of the current time step, W o represents the weight matrix, b o Represents the bias vector of the output gate; The hidden state h at the last time step t As the feature representation of the sequence, it is passed to the output layer and the expression is as follows: Among them, Wout represents the weight matrix of the output layer, bout represents the bias term, represents the simulation output obtained by the model calculation; The model parameters are updated through the back-propagation algorithm, with the goal of minimizing the loss function L. The expression of the loss function L is as follows: Among them, y m Represents the simulation output obtained by model calculation; y obs represents the multivariate water quality observation data after preprocessing in step S2, and ε is 1×10 -8 , n is the number of samples; calculate the gradient of the loss function L with respect to the model parameter θ The parameter θ includes all weight matrices and bias terms in the time series model; Use the gradient descent method to update the model parameters. The update rule is: Where k represents the current number of iterations, θ(k) is the parameter value at the kth iteration, and η is the learning rate. is the gradient of the loss function with respect to the parameter θ, and θ(k+1) is the updated parameter value; Multiple iterations are performed to gradually optimize the model parameters until the loss function converges to the minimum value or reaches the predetermined number of training cycles, completing the model training.
7. The river water quality prediction method integrating quantum-like features and graph-time series models according to claim 6 is characterized in that: In step S5, the simulated output of the trained graph-time series model is denormalized to restore it to the continuous daily river water quality simulation value at the original physical quantity scale, which is expressed as: Y=Y norm ×σ w +μ; Among them, Y represents the continuous daily river water quality simulation value after denormalization, T norm represents the multivariate water quality observation data after preprocessing in step S2, σ w represents the standard deviation of multivariate water quality observation data, and μ represents the mean value of multivariate water quality observation data; The model was evaluated using denormalized continuous daily river water quality simulation values and multivariate water quality observation data as follows: Where y mod Represents the continuous daily river water quality simulation value, y obs represents the multivariate water quality observation data, n represents the total number of paired continuous daily river water quality simulation data and multivariate water quality observation data during the model testing period, It represents the average value of the simulated river water quality values for consecutive days. represents the average value of the multivariate water quality simulation data, Pbias represents the percentage bias, NSE represents the Nash efficiency coefficient, RMSE represents the root mean square error, and Pcorr represents the Pearson correlation coefficient; after the reliability of the model output results is evaluated based on the four evaluation parameters Pbias, NSE, RMSE and Pcorr, the denormalized continuous daily river water quality simulation value is the final predicted daily continuous river water quality data.
Citation Information
Patent Citations
Meteorological prediction method and device, medium and electronic device
CN117849904A
Water quality prediction method based on graph neural network and spatial-temporal feature fusion
CN119598402A