Water Quality Prediction Method Based on Graph Convolution and Spatiotemporal Interleaved Attention Mechanism
By integrating graph convolution and space-time interleaving attention mechanisms in the water quality prediction model, the problem that existing technology is difficult to capture space-time information of water quality data is solved, and a more efficient water quality prediction effect is achieved.
Patent Information
- Application Number
- CN202510420773.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-06
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2045-04-06
AI Technical Summary
The existing deep learning-based water quality prediction methods fail to fully integrate the spatiotemporal information of water quality data, and it is difficult to capture the spatial heterogeneity between monitoring points and the dynamic evolution law of water quality parameters, resulting in poor prediction results.
The water quality prediction method based on graph convolution and space-time interleaving attention mechanism is adopted. By constructing a prediction model containing four layers of Transformer architecture, the graph convolution and space-time interleaving attention mechanism are integrated, and the spatial and temporal information of water quality data is deeply integrated.
This method can better capture the complex changes in space and time of water quality, improve the expression and prediction performance of the model, and improve the anti-interference ability of sudden interference factors.
Smart Images

Figure CN119918982B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of spatiotemporal data prediction technology, and in particular to a water quality prediction method based on graph convolution and spatiotemporal interleaved attention mechanism. Background Art
[0002] Sensor technology is widely used, which can monitor water pH, dissolved oxygen, concentration of various pollutants and other multi-indicator data in real time, and realize rapid data collection. Internet of Things technology helps to build a data transmission network, so that the collected data can be remotely and efficiently transmitted to the processing end. Big data technology can store, manage and integrate massive and complex water quality data. These technologies have generated a large amount of spatiotemporal data in the field of water quality.
[0003] Compared with traditional spatiotemporal data, water quality data involves multi-indicator coupling and highly dynamic mutation characteristics. Its collection process needs to deal with the problem of multi-source heterogeneous signal fusion under complex environmental interference. Data processing needs to combine physical driving models with spatiotemporal heterogeneity analysis to resolve nonlinear causal relationships and achieve accurate predictions.
[0004] At present, with the development of machine learning technology, deep learning methods are commonly used in water quality prediction. Deep learning can handle complex nonlinear relationships. For example, neural networks can accurately capture the complex correlations between various factors affecting agricultural water quality and improve prediction accuracy. It can handle high-dimensional data, automatically screen key features, and has strong generalization capabilities. It can also make good predictions under new data. It can also automatically learn features and tap into deep value.
[0005] However, existing water quality prediction methods based on deep learning still have the following shortcomings:
[0006] First, most existing technologies do not fully integrate the spatiotemporal information of water quality data. Traditional methods mostly use static analysis of a single time or space dimension. Some traditional models use convolutional neural networks to extract spatial features alone or realize spatiotemporal interactions through simple concatenation. It is difficult to capture the spatial heterogeneity between monitoring points and the dynamic evolution of water quality parameters. It cannot simultaneously reflect the spatial differences in water quality at different monitoring points and the dynamic changes over time, and the ability to utilize and dynamically adjust real-time data is weak, making it difficult to adapt to rapid changes in water quality, resulting in poor prediction results;
[0007] Second, existing water quality prediction methods often use static statistical models or shallow machine learning algorithms. The main defect of these models is that they separate time and space for analysis. Specifically, existing systems usually treat spatial topology and time series in isolation and lack the ability to adapt to the dynamic characteristics of data. These methods may not accurately capture complex water quality change patterns, resulting in insufficient or inaccurate feature extraction.
[0008] Thirdly, the generalization ability of traditional water quality prediction systems mainly depends on the comprehensiveness of training data and the complexity of the model. However, in practice, it is difficult to collect water quality data covering all possible situations. When such water quality prediction systems encounter data outside the distribution range of the training data, they often struggle to handle it effectively, resulting in poor overall performance of the system and failing to achieve the expected prediction effect. Summary of the Invention
[0009] An object of the embodiments of the present invention is to provide a water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism, aiming to solve the technical problems proposed in the above background art.
[0010] To achieve the above object, the present invention provides the following technical solutions.
[0011] The water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism provided by the embodiments of the present invention includes the following steps:
[0012] Construct a prediction model including a four-layer Transformer architecture based on the spatio-temporal interleaved attention mechanism;
[0013] The first layer is the Embedding, which is used to transform the spatio-temporal sequence;
[0014] The second layer is the position encoding module, which is used to encode the corresponding position information in the water quality data;
[0015] The third layer is N identical Transformer encoder modules with spatio-temporal interleaved attention mechanism, which are used to deeply fuse the spatial information and time information of the water quality data. In the spatio-temporal interleaved attention mechanism, by integrating graph convolution into the Transformer framework, a time attention module and a spatial attention module are constructed, and the time attention module and the spatial attention module are stacked to form a Transformer encoder module;
[0016] The fourth layer is the output layer, and the output layer is a fully connected layer, which is used to map the output features of the encoder to the predicted target dimension;
[0017] Train the constructed prediction model, calculate the gradient of the loss function through the backpropagation algorithm, and use the optimizer to update the parameters of the model. The trained model is used to predict the target water quality.
[0018] Further, in the Embedding of the first layer of the prediction model, it is used to convert the original water quality data into a feature representation suitable for model processing; among them, the spatio-temporal sequence of water quality data with an input of [B, T, C, H, W] is converted into a vector of [B, T, N, D], where B represents the batch size, T represents the time step, N is the number of spatial nodes, and D is the hidden dimension.
[0019] Furthermore, in the position encoding module of the second layer of the prediction model, the sine-cosine absolute position encoding method is adopted to provide position information for the Transformer model, expressed as:
[0020] When i is odd: ;
[0021] When i is even: ;
[0022] Where d represents the dimension of the embedding vector in the water quality data, P represents the position information, ps represents the index of the position information, and i represents the index of the embedding vector dimension.
[0023] Furthermore, in the Transformer encoder module of the third layer of the prediction model, the encoder module includes a time block TB, a space block SB, and an encoder architecture that constructs spatio-temporal interleaving. The time block TB is used to perform attention calculation in the time dimension; the space block SB is used to calculate attention in the space dimension;
[0024] Each encoder is stacked by the time block TB and the space block SB;
[0025] Each sub-layer is followed by a residual connection;
[0026] The time block TB integrates the multi-head attention mechanism and a feed-forward neural network based on Bilinear GLU;
[0027] The multi-head attention mechanism calculates the relationship between the query vector Q, the key vector K, and the value vector V, and performs weighted summation on the input, expressed as:
[0028] ;
[0029] Where Q = xW q ,K = xW k ,V = xW v ; W q 、W k 、W v represent the weight matrices of the corresponding vectors respectively; x represents the input information; T represents the transpose operation of the vector; D k represents the dimension of the key vector;
[0030] As a part of the feed-forward neural network, Bilinear GLU divides the input x into two parts, x1 and x2, and captures the feature combination of the input information through two linear transformations and matrix multiplication, expressed as:
[0031] ;
[0032] Among them, σ represents the Sigmoid activation function, x1 and x2 are segmentation sub-vectors, represents the element-wise product; U1 and U2 represent linear transformation matrices; T represents the transpose operation; W1 represents the weight matrix; b1 and b2 represent the bias vectors.
[0033] Furthermore, during the calculation of the time block TB, first, the input I l is normalized, and then it is calculated through the multi-head attention mechanism MHA. Its calculation formula is:
[0034] ;
[0035] Next, the obtained T l is layer-normalized, processed by a Bilinear GLU-based feed-forward neural network, and I l+1 is calculated. Its calculation formula is:
[0036] ;
[0037] In the formula, LN() represents the normalization process;
[0038] The spatial block SB is used to calculate the spatial attention. The spatial block SB fuses graph convolution and the attention mechanism, and updates the node features through the graph convolution formula. For node i, its updated feature vector is calculated through the following formula:
[0039] ;
[0040] In the formula, W (l) is a trainable weight matrix, N(i) is the set of neighbor nodes of node i, b (l) is the bias term, and σ is the ReLU activation function;
[0041] Then, the attention scores are calculated based on the graph convolution. The calculation formula for the attention scores is:
[0042] ;
[0043] Among them, i and j are neighbor nodes, represents the attention score between neighbor nodes i and j, is the query vector of node i, and k j is the key vector of node j;
[0044] Next, the obtained attention scores are normalized to calculate the attention weights α ij , and the neighbor features of the nodes are weighted and aggregated to update the feature representation of the nodes. The calculation formula is:
[0045] ;
[0046] In the formula, h i represents the feature representation of node i; h j represents the feature representation of node j; W represents the weight matrix; N(i) represents the set of neighbor nodes of node i; σ represents the activation function;
[0047] By calculation, extract and fuse the features of the data in the water quality.
[0048] Furthermore, in the constructed spatio-temporal interleaved encoder architecture, the architecture is composed of a time block and a space block, and an encoder layer with a spatio-temporal interleaved attention mechanism is formed based on the order from the time block TB to the space block SB;
[0049] In the encoder layer, the input [B, T, N, D] is reshaped into [B, N, T, D], then the attention is calculated on the time series through the time block TB. After the calculation is completed, the data is reshaped into an appropriate dimension as the input of the space block SB, and the attention is calculated on the spatial dimension using graph convolution.
[0050] Furthermore, during the training of the constructed prediction model, the mean squared error loss function MSE is used for training, and the mean squared error loss function MSE is expressed as:
[0051] ;
[0052] where y i is the true value, is the predicted value; n is the number of samples, and N represents the number of samples participating in the calculation.
[0053] Compared with the prior art, the beneficial effects of the water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism of the present invention are:
[0054] First, by integrating graph convolution into the spatio-temporal interleaved attention mechanism, the model can simultaneously consider the spatial distribution and temporal changes of water quality, enabling the model to capture more complex patterns and relationships, and improving the expression ability and prediction performance of the model; integrating graph convolution into the encoder can effectively capture spatial dependence relationships and improve the generalization ability of model prediction;
[0055] Third, in the construction of the Transformer model with a spatio-temporal interleaved attention mechanism of the present invention, two attention calculation modules are designed. The first module calculates the attention for time, and the second module calculates the attention for space, and the two modules are connected in a stacked manner, improving the adaptability and timeliness of model prediction.
[0056] In summary, the present invention fully integrates the spatio-temporal information of water quality data, can well reflect the spatial differences and dynamic changes over time of water quality at different monitoring points; combined with graph convolution, it can extract features more accurately; due to the ability to comprehensively consider spatio-temporal information, the present invention has strong anti-interference ability against some sudden interference factors. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention.
[0058] Figure 1 It is a schematic diagram of the system architecture of the water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism of the present invention;
[0059] Figure 2 It is a flowchart of the water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0060] In order to make the objectives, technical solutions and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0061] The following describes the specific implementation of the present invention in detail with reference to specific embodiments.
[0062] In an embodiment of the present invention, a water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism is provided. The water quality prediction method first preprocesses the water quality data. Specifically, the present invention collects and integrates water quality data from multiple sources, uses the obtained water quality data as a data set, and performs data cleaning, data standardization, feature engineering, and data partitioning on the obtained data set;
[0063] In one implementation, during the preprocessing of the data, various water quality-related index data collected from water quality monitoring stations and environmental data that may affect water quality are collected and integrated according to the time and space dimensions to construct a unified data set; and the missing values in the data set are filled with statistical values;
[0064] Then, normalization processing of the data is performed, including:
[0065] The Z-score standardization method is used to convert the data into a standard normal distribution with a mean of 0 and a standard deviation of 1;
[0066] For each data point, its normalized value X normThe calculation formula is expressed as:
[0067] ;
[0068] In the formula, μ is the mean of the data, and σ is the standard deviation of the data.
[0069] Please refer to Figure 1 and Figure 2 , the water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism provided by the embodiments of the present invention further includes the following steps:
[0070] S1. Construct a prediction model including a four-layer Transformer architecture based on the spatio-temporal interleaved attention mechanism;
[0071] S2. The first layer is Embedding, which is used to transform the spatio-temporal sequence;
[0072] S3. The second layer is a position encoding module, which is used to encode the corresponding position information in the water quality data;
[0073] S4. The third layer is N identical Transformer encoder modules with spatio-temporal interleaved attention mechanism, which are used to deeply fuse the spatial information and time information of the water quality data. In the spatio-temporal interleaved attention mechanism, by integrating graph convolution into the Transformer framework, a time attention module and a spatial attention module are constructed, and the time attention module and the spatial attention module are stacked to form a Transformer encoder module;
[0074] S5. The fourth layer is an output layer, and the output layer is a fully connected layer, which is used to map the output features of the encoder to the predicted target dimension;
[0075] Specifically, in the Embedding of the first layer of the prediction model, it is used to convert the original water quality data into a feature representation suitable for model processing; among them, the spatio-temporal sequence of water quality data with an input of [B, T, C, H, W] is converted into a vector of [B, T, N, D], where B represents the batch size, T represents the time step, N is the number of spatial nodes, and D is the hidden dimension; such processing can convert complex original water quality data into a format easy for the model to process, facilitating subsequent feature extraction;
[0076] Specifically, in the position encoding module of the second layer of the prediction model, the water quality data has sequential characteristics in time and space. The position encoding module can provide position information for the Transformer model, thereby enhancing the model's ability to capture water quality changes. Among them, the position encoding module uses the sine-cosine absolute position encoding method to provide position information for the Transformer model. Specifically, for the position ps (counting from 0) and the dimension i (counting from 0), the calculation formula of the sine-cosine encoding is as follows:
[0077] When i is odd:
[0078] ;
[0079] When i is even:
[0080] ;
[0081] Among them, d represents the dimension of the embedding vector in the water quality data, P represents the position information, ps represents the index of the position information, and i represents the index of the embedding vector dimension.
[0082] Furthermore, in the construction of the Transformer model with a spatio-temporal interleaved attention mechanism in the present invention, two attention calculation modules are designed. The first module calculates the attention for time, and the second module calculates the attention for space. The two modules are connected in a stacked manner, improving the adaptability and timeliness of the model prediction. Specifically, in the Transformer encoder module of the third layer of the prediction model, the encoder module includes a time block TB, a space block SB, and an encoder architecture for constructing spatio-temporal interleaving. The time block TB and the space block SB are the core components in the encoder module. Each encoder is stacked by the time block TB and the space block SB. Each sublayer is followed by a residual connection. The time block TB is used to calculate the attention in time. The space block SB is used to calculate the attention in space.
[0083] Among them, the time block TB of the embodiment of the present invention integrates the multi-head attention mechanism and the feed-forward neural network based on Bilinear GLU. Among them, the multi-head attention mechanism calculates the relationship between the query vector Q, the key vector K, and the value vector V, and performs weighted summation on the input, which is expressed as:
[0084] ;
[0085] Among them, Q = xW q , K = xW k , V = xW v ; W q , W k , W vrespectively represent the weight matrices corresponding to the vectors; x represents the input information; T represents the transpose operation of the vector; D k represents the dimension of the key vector;
[0086] Furthermore, as part of the feed-forward neural network, Bilinear GLU divides the input x into two parts, x1 and x2, and captures the feature combinations of the input information through two linear transformations and matrix multiplication interactions, expressed as:
[0087] ;
[0088] where σ represents the Sigmoid activation function, x1 and x2 are the split sub-vectors, represents the element-wise product; U1 and U2 represent the linear transformation matrices; T represents the transpose operation; W1 represents the weight matrix; b1 and b2 represent the bias vectors.
[0089] Furthermore, during the calculation of the time block TB, first, the input I l is normalized, and then calculated through the multi-head attention mechanism MHA, and its calculation formula is:
[0090] ;
[0091] Next, the obtained T l is layer-normalized, and after being processed by the Bilinear GLU-based feed-forward neural network, I l+1 is calculated, and its calculation formula is:
[0092] ;
[0093] In the formula, LN() represents the normalization process;
[0094] Furthermore, the spatial block SB is used to calculate the spatial attention. The spatial block SB fuses the graph convolution and the attention mechanism, and updates the node features through the graph convolution formula. For node i, its updated feature vector can be calculated by the following formula:
[0095] ;
[0096] In the formula, W (l) is the trainable weight matrix, N(i) is the set of neighbor nodes of node i, b (l) is the bias term, and σ is the ReLU activation function;
[0097] Then, the attention score is calculated based on the graph convolution, and the calculation formula of the attention score is:
[0098] ;
[0099] Among them, i and j are neighbor nodes, representing the attention score between neighbor nodes i and j, is the query vector of node i, and k j is the key vector of node j;
[0100] Next, normalize the obtained attention score to calculate the attention weight α ij , and perform weighted aggregation on the neighbor features of the node to update the feature representation of the node. The calculation formula is:
[0101] ;
[0102] In the formula, h i represents the feature representation of node i; h j represents the feature representation of node j; W represents the weight matrix; N(i) represents the set of neighbor nodes of node i; σ represents the activation function;
[0103] Through calculation, the features of the data in the water quality can be further extracted and fused.
[0104] Furthermore, in the constructed spatio-temporal interleaved encoder architecture, this architecture is composed of a time block and a space block, and an encoder layer with a spatio-temporal interleaved attention mechanism is formed based on the order from the time block TB to the space block SB;
[0105] In the encoder layer, the input [B, T, N, D] is reshaped into [B, N, T, D], and then the attention is calculated on the time series through the time block TB. After the calculation is completed, the data is reshaped into an appropriate dimension as the input of the space block SB, and the attention is calculated on the spatial dimension using graph convolution.
[0106] In the present invention, by integrating graph convolution into the spatio-temporal interleaved attention mechanism, the model can simultaneously consider the spatial distribution and temporal variation of water quality, enabling the model to capture more complex patterns and relationships, and enhancing the expression ability and prediction performance of the model; integrating graph convolution into the encoder can effectively capture spatial dependence relationships and improve the generalization ability of model prediction.
[0107] Furthermore, please continue to refer to Figure 1 and Figure 2 , the water quality prediction method based on graph convolution and spatio-temporal interleaved attention mechanism provided by the present invention further includes the following steps:
[0108] S6. Train the constructed prediction model, calculate the gradient of the loss function through the backpropagation algorithm, and update the parameters of the model using an optimizer. The trained model is used to predict the target water quality;
[0109] Specifically, during the training of the constructed prediction model, the mean squared error loss function MSE is used for training. The mean squared error loss function MSE is expressed as:
[0110] ;
[0111] where y i is the true value, is the predicted value; n is the number of samples, and N represents the number of samples participating in the calculation.
[0112] Finally, the present invention inputs the divided test set into the spatio-temporal sequence prediction model after training, conducts tests and outputs the prediction results.
[0113] In summary, the present invention fully integrates the spatio-temporal information of water quality data, can well reflect the spatial differences and dynamic changes over time of water quality at different monitoring points; in addition, the present invention can extract features more accurately by combining graph convolution; since the present invention can comprehensively consider spatio-temporal information, it has strong anti-interference ability for some sudden interference factors.
[0114] Although the embodiments of the present invention have been disclosed as above, it is not limited to the applications listed in the specification and embodiments. It can be fully applied to various fields suitable for the present invention. For those familiar with the field, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and the illustrated and described examples here.
Claims
1. A water quality prediction method based on graph convolution and spatiotemporal attention mechanism, characterized by: The water quality prediction method includes the following steps: A prediction model with a four-layer Transformer architecture is built based on the spatiotemporal staggered attention mechanism; The first layer is embedding, which is used to transform spatiotemporal sequences; The second layer is the position encoding module, which is used to encode the corresponding position information in the water quality data; The third layer is N identical Transformer encoder modules with a time-space interleaved attention mechanism, which is used to deeply fuse the spatial information and time information of water quality data. In the time-space interleaved attention mechanism, by integrating graph convolution into the Transformer framework, a time attention module and a space attention module are constructed, and the time attention module and the space attention module are stacked to form a Transformer encoder module; wherein, the encoder module includes a time block TB, a space block SB and a time-space interleaved encoder architecture, the time block TB is used for time attention calculation; the space block SB is used for space attention calculation; each encoder is formed by stacking the time block TB and the space block SB; each sublayer is followed by a residual connection; the time block TB integrates the multi-head attention mechanism and the feedforward neural network based on Bilinear GLU; As part of a feedforward neural network, the Bilinear GLU divides the input x into and The two parts interact through two linear transformations and matrix multiplication to capture the feature combination of the input information, expressed as: ; Among them, σ represents the Sigmoid activation function, , is the segmentation vector, represents element-wise product; , represents a linear transformation matrix; T represents a transpose operation; represents the weight matrix; and represents the bias vector; The fourth layer is the output layer, which is a fully connected layer used to map the output features of the encoder to the predicted target dimension; The constructed prediction model is trained, the gradient of the loss function is calculated through the back propagation algorithm, and the parameters of the model are updated using the optimizer. The trained model is used to predict the target water quality.
2. The water quality prediction method based on graph convolution and temporal and spatial staggered attention mechanism according to claim 1 is characterized in that: In the embedding of the first layer of the prediction model, it is used to convert the original water quality data into a feature representation suitable for model processing; the spatiotemporal sequence of water quality data input as [B, T, C, H, W] is converted into a vector of [B, T, N, D], where B represents the batch size, T represents the time step, N is the number of spatial nodes, and D is the hidden dimension.
3. The water quality prediction method based on graph convolution and time-space staggered attention mechanism according to claim 2 is characterized in that: In the position encoding module of the second layer of the prediction model, the sine and cosine absolute position encoding method is used to provide position information for the Transformer model, which is expressed as: When i is an odd number: ; When i is an even number: ; Among them, d represents the dimension of the embedded vector in the water quality data, P represents the position information, ps represents the index of the position information, and i represents the index of the embedded vector dimension.
4. The water quality prediction method based on graph convolution and temporal and spatial staggered attention mechanism according to claim 3 is characterized in that: In the Transformer encoder module of the third layer of the prediction model, the multi-head attention mechanism performs a weighted sum of the inputs by calculating the relationship between the query vector Q, the key vector K, and the value vector V, expressed as: ; Where Q = xW q , K = xW k , V = xW v ; W q , W k , W v They represent the weight matrices of the corresponding vectors; x represents the input information; T represents the transposition operation of the vector; D k Indicates the dimension of the key vector.
5. The water quality prediction method based on graph convolution and time-space staggered attention mechanism according to claim 4 is characterized in that: In the calculation process of the time block TB, first the input I l Normalize it and then calculate it through the multi-head attention mechanism MHA, the calculation formula is: ; Next, for the desired T l After layer normalization and Bilinear GLU-based feedforward neural network processing, I is calculated. l+1 , the calculation formula is: ; In the formula, LN() represents normalization processing; The spatial block SB is used to calculate the attention in space. The spatial block SB integrates graph convolution and attention mechanism, and updates the node features through the graph convolution formula. For node i, its updated feature vector Calculate using the following formula: ; Where W (l) is a trainable weight matrix, N(i) is the set of neighbor nodes of node i, b (l) is the bias term, σ is the ReLU activation function; Then the attention score is calculated based on the graph convolution. The calculation formula of the attention score is: ; Among them, i and j are neighbor nodes, represents the attention score between neighbor nodes i and j, is the query vector of node i, is the key vector of node j; Next, the attention score is normalized and the attention weight is calculated , perform weighted aggregation on the node's neighbor features and update the node's feature representation. The calculation formula is: ; In the formula, represents the feature representation of node i; h j represents the feature representation of node j; W represents the weight matrix; N(i) represents the set of neighbor nodes of node i; σ represents the activation function; Through calculation, the characteristics of water quality data are extracted and integrated.
6. The water quality prediction method based on graph convolution and temporal and spatial staggered attention mechanism according to claim 5 is characterized in that: In constructing a spatiotemporal interleaved encoder architecture, the architecture consists of a temporal block and a spatial block, and an encoder layer with a spatiotemporal interleaved attention mechanism is formed based on the order of the temporal block TB to the spatial block SB; In the encoder layer, the input [B, T, N, D] is reshaped into [B, N, T, D], and then the attention is calculated on the time series through the time block TB. After the calculation is completed, the data is reshaped according to the required dimension and used as the input of the spatial block SB. The attention is calculated on the spatial dimension using graph convolution.
7. The water quality prediction method based on graph convolution and temporal and spatial staggered attention mechanism according to claim 6 is characterized in that: In the process of training the constructed prediction model, the mean square error loss function MSE is used for training. The mean square error loss function MSE is expressed as: ; in, is the true value, is the predicted value, n is the number of samples, and N represents the number of samples involved in the calculation.
Citation Information
Patent Citations
Water quality prediction method based on graph neural network and spatial-temporal feature fusion
CN119598402A