Space-time self-supervised runoff data completion method and device and storage medium
By constructing a spatiotemporal self-supervised runoff data completion model, using weighted directed graphs and self-supervised learning strategies, the problem of failure to effectively incorporate spatial information in the existing technology is solved, and the completion accuracy and adaptability of runoff data are improved.
Patent Information
- Application Number
- CN202411152618.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-06-25
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-06
AI Technical Summary
The existing runoff data completion method has failed to effectively incorporate spatial information, making it more challenging to fill the daily flow series in different climate regions in environments where the temporal and spatial variation of water flows is high, especially in different climatic regions, and the hydrological model is in real time. Not very practical in application.
Using the self-supervised runoff data completion method of space-time self-supervised runoff data, by constructing a weighted directed graph, combining the data enhancement module, similarity query module and spatiotemporal encoder-decoder module, the loss function is constructed using the self-supervised learning strategy and training The model completes the results with output runoff data.
Improve the accuracy of runoff data, enhance the model's completion accuracy and adaptability to missing data, and can provide accurate fill results in different data missing modes.
Smart Images

Figure CN119088793A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of water conservancy planning, and in particular to a spatiotemporal self-supervised runoff data completion method, device and storage medium. Background Art
[0002] Daily runoff data is an important data in hydrology and water resources management. These data are crucial for predicting floods, planning hydropower stations, designing irrigation systems, and evaluating water resource sustainability. However, daily runoff data are often missing. The incompleteness of the data not only affects the quality of the data, but also seriously restricts the accuracy and reliability of the above applications.
[0003] Incompleteness of data sets is often caused by a variety of factors, such as interruptions in data recording or loss of data during storage. In the field of environmental monitoring, monitoring models are often highly dependent on automatic data acquisition systems equipped with numerous physical sensors whose readings are often incomplete for various reasons. Sensor devices may face a variety of risks due to extreme environmental conditions, physical damage, or battery exhaustion. In addition, unfavorable climatic conditions, instrument failures, difficult access to measurement sites due to terrain or security issues, unexpected absence of observers collecting data, errors caused by human error or negligence, or failure of storage devices may all lead to missing data during the collection process. These problems will cause daily runoff data to be missing to varying degrees and in different modes.
[0004] However, historical daily streamflow data are essential for understanding long-term changes in water flow, which is necessary for sustainable water resource management. Historical streamflow data can also be used to assess the impact of human activities, such as dam construction and water use, on water resources. In addition, incorporating historical river flow data into hydrological models or other machine learning models can improve the accuracy of predicting future river patterns. Therefore, accurately filling in missing flow values is crucial for basin water resource management.
[0005] Techniques for filling missing traffic data range from simple interpolation to models and complex statistical analysis. Early traffic data interpolation models mainly rely on temporal patterns and hardly exploit the spatial structure of traffic data. The simplest method is the historical average, which fills missing values based on the average of the same time interval in the past. Several basic methods are commonly used to fill missing data for univariate variables, including median, last observation (LOCF), and interpolation techniques. These methods provide acceptable results when there are only one or a few consecutive missing data points. However, when the missing gap is large, the results are poor. With the continuous development of machine learning, many machine learning methods have been applied to fill missing traffic data, including artificial neural networks (ANN), k-nearest neighbor algorithm (KNN), random forest (RF), and multiple inference of chain equations (MICE) and extreme gradient boosting (XGB). Results show that machine learning methods are generally better than traditional statistical methods in estimating the accuracy of missing values. In recent years, various studies have used deep learning to infer missing data. For example, models based on long short-term memory (LSTM) and its improved models have been widely and successfully used in flow estimation. LSTM is used to learn the temporal dependencies of data to complete missing data, and a bidirectional LSTM is introduced to simultaneously learn the temporal features before and after the missing point. Missing values are completed by averaging the predictions of the gated recurrent unit (GRU) with the information before and after the missing gap. The time-delay deep neural network (TDNN) is strengthened to use supporting variables such as temperature, precipitation and river flux data to predict groundwater levels for many years to come.
[0006] However, due to the higher spatiotemporal variability of water flow, the missing data in daily water flow series in different climate zones are more challenging than previous applications. Previous machine learning and deep learning methods only learn the temporal characteristics of flow data, but do not incorporate the spatial information within the basin into the reconstruction of missing data. Although some studies have combined hydrological models with deep learning to better simulate water flow processes through hydrological models, hydrological models require a large amount of input and are time-consuming, which makes them less practical in real-time applications such as water level analysis and flood prediction. Summary of the invention
[0007] The purpose of the present invention is to solve the problem that the existing runoff data completion method fails to incorporate spatial information. The present invention provides a spatiotemporal self-supervised runoff data completion method, device and storage medium. The method mainly includes the following steps:
[0008] S1. Obtain hydrological data of the basin station network;
[0009] S2, constructing a runoff raw map for the basin site network based on hydrological data;
[0010] S3, build a spatiotemporal self-supervised runoff data completion model and use the original runoff map for training;
[0011] S4. Use the trained model to process the hydrological data of the basin station network containing missing stations and output the runoff data completion results.
[0012] Furthermore, the basin site network is composed of hydrological nodes in the runoff, and the hydrological data include the topological relationship of each hydrological site, longitude and latitude data, runoff direction, and runoff flow.
[0013] Furthermore, the original runoff graph is a weighted directed graph, which is mathematically expressed as:
[0014] G=(V,A,X)
[0015] In the formula, V represents the node set, each node represents a hydrological station; A is the adjacency matrix of the node; X represents the feature matrix of the node, which is constructed by the flow data of the hydrological station;
[0016] The adjacency matrix A is established based on the geographical correlation and traffic pattern correlation between nodes. The mathematical expression is:
[0017]
[0018] In the formula, A ij is an element in the adjacency matrix A, indicating the connectivity between nodes i and j; K g , K s is the threshold for controlling the sparsity of the adjacency matrix; a g,ij is the weight of the geographical similarity between nodes i and j; a s,ij is the weight of the similarity of traffic patterns between nodes i and j.
[0019] Furthermore, the spatiotemporal self-supervised runoff data completion model includes a data enhancement module, a similarity query module, a spatiotemporal encoder-decoder module, and a self-supervised learning strategy;
[0020] The data enhancement module processes the original runoff image to obtain an enhanced view;
[0021] The similarity query module processes the original runoff graph, retrieves similar nodes, extracts and fuses the spatiotemporal features of similar nodes, and obtains the global spatiotemporal features of the fused similar nodes;
[0022] The self-supervised learning strategy constructs a loss function based on the runoff feature reconstruction matrix and the original runoff graph to guide model training and updating.
[0023] Furthermore, step S3 is specifically as follows:
[0024] S31, inputting the original runoff map into the data enhancement module for data enhancement, and obtaining two runoff enhanced views, specifically:
[0025] Two enhanced views of runoff are obtained by using data augmentation on the original runoff image. and They are The adjacency matrix of the midpoint nodes; They are The feature matrix of the midpoint;
[0026] S32, the two enhanced views are input into the encoder structure for encoding, and the original embedding code of the runoff is obtained, which is mathematically expressed as:
[0027]
[0028]
[0029] Among them, h1 and h2 represent the spatiotemporal encoder processing The encoding result of ST Encoder () represents the spatiotemporal encoder;
[0030] S33, inputting the original runoff graph into the similarity query module, using cosine similarity to measure the similarity of flow patterns between sites, and then retrieving nodes with similarity in the original graph, and outputting the global spatiotemporal features of the fused similar nodes;
[0031] S34, based on the encoding vectors of the two enhanced views, the corresponding global spatiotemporal features of the fused similar nodes are integrated to obtain the final embedding vector of the runoff, which is mathematically expressed as:
[0032] H1=σ(W[h1;H′]+b)
[0033] H2=σ(W[h2;H′]+b)
[0034] Among them, H1 and H2 represent The final embedding code; H′ represents the global spatiotemporal feature matrix of fused similar nodes; W and b are trainable parameters, and σ is a nonlinear activation function;
[0035] S35, the decoder structure processes the final embedding vectors of the two runoff enhanced views and obtains the feature reconstruction matrix of the runoff, which is mathematically expressed as:
[0036]
[0037]
[0038] Among them, X′1,X′2 represent the corresponding The characteristic reconstruction matrix of runoff; ST Decoder () represents the spatiotemporal decoder;
[0039] S36. Input the original runoff map and the feature reconstruction matrix of the runoff into the self-supervised learning strategy, construct the total loss function, update the model parameters through the back propagation algorithm, and use the model that minimizes the total loss function as the spatiotemporal self-supervised runoff data completion model.
[0040] Furthermore, the data enhancement module adopts both random node feature masking and edge discarding strategies.
[0041] The mathematical expression of random node feature masking is as follows:
[0042]
[0043] In the formula, is the augmented feature matrix The elements in x [mask] is the mask feature; v i is an element in the node set V; x i is the element in the node's feature matrix X; V m is a set of randomly selected feature masking nodes;
[0044] The mathematical expression of edge drop is as follows:
[0045]
[0046] In the formula, represents the augmented adjacency matrix; A Drop Indicates E Drop The adjacency matrix, E Drop It is an edge set randomly sampled from the original edge set E.
[0047] Furthermore, the spatiotemporal encoder-decoder module is composed of an encoder structure and a decoder structure, wherein the encoder structure includes two spatiotemporal convolution blocks and an output layer, and the decoder structure includes a spatiotemporal convolution block and an output layer;
[0048] The spatiotemporal convolution block is constructed using a sandwich block structure, which is a temporal convolution layer-graph convolution layer-temporal convolution layer.
[0049] Furthermore, the total loss function includes two components: reconstruction loss and contrast loss, which can be expressed mathematically as:
[0050] L=L rec -αL con
[0051] Among them, L is the total loss function; L rec is the reconstruction loss; Lcon is the contrast loss; α is a hyperparameter that controls the balance between the two loss components;
[0052] The contrast loss is constructed by the contrast between the feature reconstruction matrices of the two enhanced views, mathematically expressed as:
[0053]
[0054] The reconstruction loss is constructed by the mean square error between the feature reconstruction matrix and the feature matrix of the original image, and the mathematical expression is:
[0055]
[0056] Here, n is the number of samples.
[0057] A storage medium stores instructions and data for implementing a spatiotemporal self-supervised runoff data completion method.
[0058] A computer device comprises: a processor and the storage medium; the processor loads and executes instructions and data in the storage medium to implement a spatiotemporal self-supervised runoff data completion method.
[0059] The beneficial effects of the technical solution provided by the present invention are as follows: the present invention uses a spatiotemporal encoder-decoder framework to consider the temporal characteristics of runoff data while taking into account the spatial characteristics, thereby improving the accuracy of runoff data; when the model is working, a similarity query module is used to share the global spatiotemporal characteristics of the watershed network, and combined with a self-supervised learning strategy, the accuracy of the model in completing missing data is improved, and the adaptability of the model under different data missing modes is also enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0061] Figure 1 is a flow chart of a spatiotemporal self-supervised runoff data completion method in an embodiment of the present invention;
[0062] Figure 2 is a schematic diagram of a spatiotemporal self-supervised runoff data completion model in an embodiment of the present invention;
[0063] Figure 3 is a schematic diagram of a spatiotemporal encoder-decoder structure in an embodiment of the present invention;
[0064] Figure 4 It is a schematic diagram of the operation of the hardware device in the embodiment of the present invention. DETAILED DESCRIPTION
[0065] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0066] Embodiments of the present invention provide a spatiotemporal self-supervised runoff data completion method, device, and storage medium.
[0067] Please refer to Figure 1 , Figure 1 : is a flow chart of a spatiotemporal self-supervised runoff data completion method in an embodiment of the present invention, which specifically includes the following steps:
[0068] The first step is to obtain hydrological data of the basin station network.
[0069] The basin site network is composed of hydrological nodes in the runoff, and the hydrological data include the topological relationship, longitude and latitude data, runoff direction and runoff flow of each hydrological site.
[0070] In the second step, a raw runoff map was constructed for the watershed site network based on the hydrological data.
[0071] The original runoff graph is a weighted directed graph, which is mathematically expressed as:
[0072] G=(V,A,X)
[0073] Where V represents the node set, each node represents a hydrological station; A is the adjacency matrix of the node; X represents the feature matrix of the node, which is constructed from the flow data of the hydrological station.
[0074] For each node v in the watershed site, we denote its observation value at timestamp t as If no data are observed, then At each time t, the observed daily river runoff data is represented on the river network as a graph signal X t Represents the runoff data of each station at time t in the X matrix.
[0075] Existing methods usually define the adjacency matrix as distance or connectivity. However, due to the different topographic conditions of the hydrological stations, the flow rates of adjacent stations may not be similar. The present invention determines the adjacency matrix A based on the correlation between geography and flow patterns.
[0076] For each node pair in the original runoff graph, two similarity weights are defined, one for geographic proximity and the other for traffic pattern similarity. The adjacency matrix A is established based on the geographic correlation and traffic pattern correlation between nodes, and the mathematical expression is:
[0077]
[0078] In the formula, Aij is an element in the adjacency matrix A, indicating the connectivity between nodes i and j; K g , K s is the threshold for controlling the sparsity of the adjacency matrix; a g,ij is the weight of the geographical similarity between nodes i and j; a s,ij is the weight of the similarity of traffic patterns between nodes i and j.
[0079] Among them, the geographical similarity between two nodes is defined as:
[0080]
[0081] Among them, a g,ij is the weight of the geographical proximity between nodes i and j; dist ,j is the straight-line distance between i and j; δ g is the standard deviation of the straight-line distance. g,ij =1, otherwise 0.
[0082] The traffic pattern similarity between two nodes is defined as:
[0083]
[0084] Among them, a s,ij is the weight of the pattern similarity between nodes i and j; p i and p j is the historical traffic time series of nodes i and j; δ s is the standard deviation of the time series. In the case of incomplete training data, the historical time series is defined based on the time periods when nodes i and j are observed simultaneously.
[0085] If nodes i and j are observed simultaneously for less than two time periods, then a s,ij =1. At this time A ij It just depends on geographical proximity.
[0086] The third step is to build a spatiotemporal self-supervised runoff data completion model and use the original runoff map for training.
[0087] The spatiotemporal self-supervised runoff data completion model includes a data enhancement module, a similarity query module, a spatiotemporal encoder-decoder module, and a self-supervised learning strategy.
[0088] The data augmentation module processes the original runoff image to obtain an enhanced view.
[0089] The similarity query module processes the original runoff graph, retrieves similar nodes, and extracts and fuses the spatiotemporal features of similar nodes to obtain the global spatiotemporal features of the fused similar nodes.
[0090] The encoder structure in the spatiotemporal encoder-decoder module processes the enhanced view encoding to obtain the runoff embedding vector, and the decoder structure combines the runoff embedding vector with the global spatiotemporal features of fused similar nodes to obtain the runoff feature reconstruction matrix.
[0091] The self-supervised learning strategy constructs a loss function based on the runoff feature reconstruction matrix and the original runoff graph to guide model training and updating.
[0092] The specific training process is as follows:
[0093] Step 1: Input the original runoff image into the data enhancement module for data enhancement to obtain two runoff enhanced views.
[0094] The data augmentation module adopts both random node feature masking and edge discarding strategies to help the model reconstruct missing features, thereby facilitating the model to capture deeper feature dependencies.
[0095] Random node feature masking is the elimination of random node features at the beginning of training. A subset of nodes for masking is randomly selected. For each node in the subset, its feature is replaced with a special mask mark. The mathematical expression is as follows:
[0096]
[0097] In the formula, is the augmented feature matrix The elements in x [mask] is the mask feature; v i is an element in the node set V; x i is the element in the node's feature matrix X; V m is a set of randomly selected feature masking nodes;
[0098] Edge dropping is to randomly drop some edges at the beginning of training to destroy the connectivity of the graph. The mathematical expression is as follows:
[0099]
[0100] In the formula, represents the augmented adjacency matrix; A Drop Indicates E Drop The adjacency matrix, E Drop It is an edge set randomly sampled from the original edge set E.
[0101] Two enhanced views of runoff are obtained by using data augmentation on the original runoff image. and They are The adjacency matrix of the midpoint nodes; They are The feature matrix of the midpoint.
[0102] Step 2: Input the two enhanced views into the encoder structure for encoding to obtain the original embedding code of the runoff, which is mathematically expressed as:
[0103]
[0104]
[0105] Among them, h1 and h2 represent the spatiotemporal encoder processing The encoding result of ST Encoder () represents a space-time encoder.
[0106] After the data enhancement module is processed, the encoding process is carried out to learn the hidden spatiotemporal features of the data, generate feature vectors, and reconstruct the enhanced data through the decoder to output the predicted missing values. First, a spatiotemporal (ST) encoder is proposed to encode the spatiotemporal context information in the runoff enhancement view, modeling the temporal correlation of the sequential patterns of runoff data at different time steps and the geographical correlation between spatial regions. To this end, our spatiotemporal encoder integrates the temporal convolution component with the graph convolutional propagation network. The spatiotemporal encoder-decoder architecture is shown in Figure 2. Figure 3 As shown:
[0107] The spatiotemporal encoder-decoder module consists of an encoder structure and a decoder structure. The encoder structure contains two spatiotemporal convolution blocks and an output layer, and the decoder structure contains a spatiotemporal convolution block and an output layer.
[0108] In order to fuse features from the spatial and temporal domains, a spatiotemporal convolution block is constructed to jointly process the time series of the graph structure. The spatiotemporal convolution block is constructed using a sandwich block structure, which is sequentially a temporal convolution layer (TC)-spatial convolution layer (SC)-temporal convolution layer.
[0109] The temporal convolution layer (TC) uses a one-dimensional convolution along the time dimension and adopts a gating mechanism. Specifically, the temporal convolution layer takes the flow tensor as input and outputs a time-aware embedding for each station.
[0110] (B t-Tout ,...,B t )=TC(X t-T ,...,X t )
[0111] in, Represents the region embedding matrix at time step t; the nth row corresponds to the embedding of site v; D represents the embedding dimension. outis the length of the output embedding sequence after the TC encoder convolution operation.
[0112] The embedding obtained after the time convolution layer is further input into the spatial convolution layer to extract spatial features. The spatial convolution layer (SC) is designed based on the message passing mechanism of the graph to capture the spatial correlation of the watershed. The mathematical representation is as follows:
[0113] E t =SC(B t ,A)
[0114] After the spatial convolution layer, we can obtain the refined embedding (E t-Tout ,…,E t ). The feature embedding after spatial convolution is input into the temporal convolution layer again, thus forming a "sandwich" structure of temporal convolution layer (TC)-spatial convolution layer (SC)-temporal convolution layer. Different layers in the block are connected by residual connection and bottleneck strategy.
[0115] After a spatiotemporal convolution block, we can get a T-dimensional embedding matrix (h t-T′ ,…,h t ). These feature representations are passed to the next spatiotemporal convolutional block as its input. By stacking multiple spatiotemporal convolutional blocks, the time dimension T′ is reduced to zero, and the ST encoder generates the final embedding vector where each row represents the final embedding for site v.
[0116] Step three, input the original runoff graph into the similarity query module, use cosine similarity to measure the similarity of traffic patterns between sites, and then retrieve nodes with similarity in the original graph, and output the global spatiotemporal features of the fused similar nodes.
[0117] Due to the influence of topography and other hydrological factors, such as slope, soil conditions and station location, different hydrological stations in the same basin have different flow patterns. However, due to proximity or similar hydrological conditions, different stations may have similar flow patterns.
[0118] In order to make better use of this spatial feature similarity, the present invention introduces a similarity query module to capture the global spatiotemporal information from different nodes. The main idea is to extract and fuse the spatiotemporal features of similar traffic model sites as global spatiotemporal features, which can be further transferred to missing data points to improve the interpolation accuracy.
[0119] The similarity query module works as follows: query based on similarity, and then perform feature fusion based on similarity, as follows:
[0120] First, a similarity function S(i,j) is defined to measure the similarity between different sites. The mathematical expression is:
[0121]
[0122] Among them, S() is the cosine similarity function, S(i,j) represents the traffic pattern similarity between nodes i and j; p i and p j Respectively represent the flow data of nodes i and j; θ is the set similarity threshold, which is used to exclude nodes with low or no similarity. Only when the similarity score between nodes exceeds this threshold, the similarity between them will be considered. This can help the model focus on those hydrological sites with high similarity, thereby improving the accuracy and efficiency of feature fusion.
[0123] After obtaining the similarity score, it is converted into a normalized weight through a softmax function, which is mathematically expressed as follows:
[0124]
[0125] Among them, w ij represents the similarity weight of node j to node i; exp() is an exponential function; N(i) represents the set of nodes similar to node i, and k is the sequence number of the node.
[0126] Finally, the calculated similarity weight is used to weight the fusion of the traffic data of all similar nodes similar to the target node as the global spatiotemporal characteristics of the fused similar sites of the target node, which is mathematically expressed as:
[0127] h i ′=∑ j∈N(i) w ij p j
[0128] Where h1′ represents the global spatiotemporal characteristics of the fused similar sites of the target node i.
[0129] This method can be applied to situations where there is a large amount of missing data. Due to various unexpected circumstances, the data may be missing for a long time for nodes within a continuous spatial range. Due to too much missing data, it is impossible to learn enough features, and it is impossible to use adjacent stations for missing value estimation. The similarity query mechanism is adopted to calculate the similarity of flow patterns between hydrological stations, and use the global spatiotemporal characteristics of similar stations to supplement them, thereby improving the accuracy of missing value filling in the case of a large amount of missing data.
[0130] Step 4: Based on the encoding vectors of the two enhanced views, the corresponding global spatiotemporal features of the fused similar nodes are integrated to obtain the final embedding vector of the runoff, which is mathematically expressed as:
[0131] H1=σ(W[h1;H′]+b)
[0132] H2=σ(W[h2;H′]+b)
[0133] Among them, H1 and H2 represent The final embedding code; H′ represents the global spatiotemporal feature matrix that fuses similar nodes; W and b are trainable parameters, and σ is a nonlinear activation function.
[0134] When there is a lot of missing data, the global features of fused similar sites obtained by the similarity query module are added to the encoded node representation, and the final embedding vector will be input into the decoder structure. At this time, the vector representation input to the decoder includes not only the characteristics of the data itself, but also the global features of sites with similar traffic patterns.
[0135] Step 5: The decoder structure processes the final embedding vectors of the two runoff-enhanced views to obtain the feature reconstruction matrix of the runoff, which is mathematically expressed as:
[0136]
[0137]
[0138] Among them, X′1,X′2 represent the corresponding The feature reconstruction matrix of the runoff completes the masked data in the enhanced view; ST Decoder () represents a spatiotemporal decoder.
[0139] The decoder structure is the same as the encoder structure, but uses reverse temporal convolution and graph convolution structures to convert the final embedding vector into the final output reconstructed feature matrix.
[0140] Step six, the original runoff map and the feature reconstruction matrix of the runoff are input into the self-supervised learning strategy to construct the total loss function, and the model is updated through the back propagation algorithm. The model that minimizes the total loss function is used as the spatiotemporal self-supervised runoff data completion model.
[0141] The self-supervised learning strategy is the core part of the present invention. The self-supervised learning strategy allows the model to learn without external supervision labels and guides the learning process by predicting the output of the model itself. This strategy is particularly suitable for scenarios where the labeling cost is high or it is difficult to obtain labeled data. The core of self-supervised learning is to use the structural characteristics of the data itself for learning, so as to make up for the lack of external label information. In order to enable the model to better learn the temporal and spatial dependencies of traffic data, the self-supervised learning strategy of the present invention adopts two main self-supervised learning techniques: contrastive learning and reconstruction learning.
[0142] The loss function guides the learning process in a way that minimizes the difference between the original image and the feature reconstruction matrix, and minimizes the contrast between the two feature reconstruction matrices derived from the same propagation image. We define the loss function corresponding to contrastive learning and reconstruction learning as two parts: reconstruction loss and contrast loss. By minimizing these losses, the model is encouraged to generate similar representations for an augmented image, so that the model can fully learn the spatiotemporal characteristics of the data. The total loss function is the weighted sum of the reconstruction loss and the contrast loss:
[0143] L=L rec -αL con
[0144] where α is a hyperparameter that controls the balance between the two loss components. By minimizing this overall loss, our model is trained to fully learn the spatiotemporal features of the data, which can be effectively used for the missing daily runoff data filling task.
[0145] The total loss function includes two components: reconstruction loss and contrast loss, which can be expressed mathematically as:
[0146] L=L rec -αL con
[0147] Among them, L is the total loss function; L rec is the reconstruction loss; L con is the contrast loss; α is a hyperparameter that controls the balance between the two loss components;
[0148] Contrastive learning learns the intrinsic features of the data by comparing different data augmentation views, so that the model can identify the basic patterns and structures in the data. Specifically, the two runoff augmentation views obtained by the data augmentation module are processed through the same spatiotemporal encoder respectively, and the decoding results are used as self-supervisory signals to minimize the difference between the two feature reconstruction matrices derived from the same graph structure. The contrastive loss aims to minimize the difference between the two feature reconstruction matrices derived from the same original graph. This is achieved by minimizing the cosine similarity between the reconstructed features X′1 and X′2, which can be expressed mathematically as:
[0149]
[0150] The goal of reconstruction learning is to reconstruct the original features of the input data through the decoder, which helps the model learn how to accurately restore missing or masked data information. The reconstruction loss is constructed using the mean square error (MSE) between the original feature matrix and the reconstructed feature matrix, and the mathematical expression is:
[0151]
[0152] Where n is the number of samples. By minimizing this loss during the training phase, the model can generate feature reconstruction matrices that closely match the original graph, which encourages the graph encoder to better learn the data features.
[0153] By combining contrastive learning and reconstruction learning, the model can not only capture the spatiotemporal dynamics of the data, but also understand the complex dependencies between nodes. This dual learning strategy enhances the model's robustness to missing data filling, enabling it to accurately respond to different missing patterns in practical applications.
[0154] In the fourth step, the trained model is used to process the hydrological data of the basin station network containing missing stations and output the runoff data completion results.
[0155] The historical runoff series containing missing values and the constructed spatial directed graph are input into the trained model to capture and aggregate spatiotemporal features, and the reconstructed complete runoff data is output through the decoder to complete the missing data.
[0156] See also Figure 4 , Figure 4 40 is a schematic diagram of the working of the hardware device of an embodiment of the present invention, wherein the hardware device specifically comprises: a computer device 401, a processor 402 and a storage medium 403.
[0157] A computer device 401: The computer device 401 implements the spatiotemporal self-supervised runoff data completion method.
[0158] Processor 402: The processor 402 loads and executes the instructions and data in the storage medium 403 to implement the spatiotemporal self-supervised runoff data completion method.
[0159] Storage medium 403: The storage medium 403 stores instructions and data; the storage medium 403 is used to implement the spatiotemporal self-supervised runoff data completion method.
[0160] The beneficial effects of the present invention are as follows: the present invention uses a spatiotemporal encoder-decoder framework to consider the temporal characteristics of runoff data while taking into account the spatial characteristics, thereby improving the accuracy of runoff data; when the model is working, a similarity query module is used to share the global spatiotemporal characteristics of the watershed network, and a self-supervised learning strategy is combined to improve the accuracy of the model in completing missing data, and also enhance the adaptability of the model under different data missing modes.
[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A spatiotemporal self-supervised runoff data completion method, characterized in that: The specific steps include: S1. Obtain hydrological data of the basin station network; S2, constructing a runoff raw map for the basin site network based on hydrological data; S3, build a spatiotemporal self-supervised runoff data completion model and use the original runoff map for training; S4. Use the trained model to process the hydrological data of the basin station network containing missing stations and output the runoff data completion results.
2. A spatiotemporal self-supervised runoff data completion method as claimed in claim 1, characterized in that: The watershed site network is composed of hydrological nodes in the runoff, and the hydrological data includes the topological relationship of each hydrological site, longitude and latitude data, runoff direction and runoff flow.
3. A spatiotemporal self-supervised runoff data completion method as claimed in claim 2, characterized in that: The original runoff graph is a weighted directed graph, which is mathematically expressed as: G=(V,A,X) In the formula, V represents the node set, each node represents a hydrological station; A is the adjacency matrix of the node; X represents the feature matrix of the node, which is constructed by the flow data of the hydrological station; The adjacency matrix A is established based on the geographical correlation and traffic pattern correlation between nodes. The mathematical expression is: In the formula, A ij is an element in the adjacency matrix A, indicating the connectivity between nodes i and j; K g , K s is the threshold for controlling the sparsity of the adjacency matrix; a g,ij is the weight of the geographical similarity between nodes i and j; a s,ij is the weight of the similarity of traffic patterns between nodes i and j.
4. A spatiotemporal self-supervised runoff data completion method as claimed in claim 3, characterized in that: The spatiotemporal self-supervised runoff data completion model includes a data enhancement module, a similarity query module, a spatiotemporal encoder-decoder module, and a self-supervised learning strategy; The data enhancement module processes the original runoff image to obtain an enhanced view; The similarity query module processes the original runoff graph, retrieves similar nodes, extracts and fuses the spatiotemporal features of the similar nodes, and obtains the global spatiotemporal features of the fused similar nodes; The encoder structure in the spatiotemporal encoder-decoder module processes the enhanced view encoding to obtain a runoff embedding vector, and the decoder structure combines the runoff embedding vector with the global spatiotemporal features of the fused similar nodes to obtain a runoff feature reconstruction matrix; The self-supervised learning strategy constructs a loss function based on the runoff feature reconstruction matrix and the runoff original graph to guide model training and updating.
5. A spatiotemporal self-supervised runoff data completion method as claimed in claim 4, characterized in that: Step S3 is specifically as follows: S31, inputting the original runoff map into the data enhancement module for data enhancement, and obtaining two runoff enhanced views, specifically: Two enhanced views of runoff are obtained by using data augmentation on the original runoff image. and They are The adjacency matrix of the midpoint nodes; They are The feature matrix of the midpoint; S32, the two enhanced views are input into the encoder structure for encoding, and the original embedding code of the runoff is obtained, which is mathematically expressed as: Among them, h1 and h2 represent the spatiotemporal encoder processing The encoding result of ST Encoder () represents the spatiotemporal encoder; S33, inputting the original view into the similarity query module, using cosine similarity to measure the similarity of traffic patterns between sites, and then retrieving nodes with similarity in the original graph, and outputting the global spatiotemporal features of the fused similar nodes; S34, based on the encoding vectors of the two enhanced views, the corresponding global spatiotemporal features of the fused similar nodes are integrated to obtain the final embedding vector of the runoff, which is mathematically expressed as: H1=σ(W[h1;H′]+b) H2=σ(W[h2;H′]+b) Among them, H1 and H2 represent The final embedding code; H′ represents the global spatiotemporal feature matrix of fused similar nodes; W and b are trainable parameters, and σ is a nonlinear activation function; S35, the decoder structure processes the final embedding vectors of the two runoff enhanced views and obtains the feature reconstruction matrix of the runoff, which is mathematically expressed as: Among them, X1, X2 represent the corresponding The characteristic reconstruction matrix of runoff; ST Decoder () represents the spatiotemporal decoder; S36. Input the original runoff map and the feature reconstruction matrix of the runoff into the self-supervised learning strategy, construct the total loss function, update the model parameters through the back propagation algorithm, and use the model that minimizes the total loss function as the spatiotemporal self-supervised runoff data completion model.
6. A spatiotemporal self-supervised runoff data completion method as claimed in claim 5, characterized in that: The data enhancement module adopts two strategies, random node feature masking and edge discarding.
7. A spatiotemporal self-supervised runoff data completion method as claimed in claim 6, characterized in that: The spatiotemporal encoder-decoder module is composed of an encoder structure and a decoder structure, wherein the encoder structure includes two spatiotemporal convolution blocks and an output layer, and the decoder structure includes a spatiotemporal convolution block and an output layer; The spatiotemporal convolution block is constructed using a sandwich block structure, which is temporal convolution-spatial convolution-temporal convolution in sequence.
8. A spatiotemporal self-supervised runoff data completion method as claimed in claim 7, characterized in that: The total loss function includes two components: reconstruction loss and contrast loss, which can be expressed mathematically as follows: L=L rec -αL con Among them, L is the total loss function; L rec is the reconstruction loss; L con is the contrast loss; α is a hyperparameter that controls the balance between the two loss components; The contrast loss is constructed by the contrast between the feature reconstruction matrices of the two enhanced views, mathematically expressed as: The reconstruction loss is constructed by the mean square error between the feature reconstruction matrix and the feature matrix of the original image, and the mathematical expression is: Here, n is the number of samples.
9. A storage medium, characterized in that: The storage medium stores instructions and data for implementing a spatiotemporal self-supervised runoff data completion method as described in any one of claims 1 to 8.
10. A computer device, characterized in that: include: Processor and storage medium; the processor loads and executes instructions and data in the storage medium to implement a spatiotemporal self-supervised runoff data completion method as described in any one of claims 1 to 8.
Citation Information
Cited By
Heterogeneity-guided traffic flow completion method, system, medium and equipment
CN119884718A
Intelligent fault diagnosis method for rotating machinery sample under extremely unbalanced condition
CN120197065A
Vision-based sewing action recognition and positioning method and system, medium and equipment
CN120954092A
River water quality prediction method and system based on big data
CN121279555A
Multi-source satellite data driven irrigation district ecological hydrological basic model construction method
CN121542656A
