A smart grid dynamic graph data generation method based on deep adversarial training
By proposing a method for generating dynamic graph data of smart grids based on deep adversarial training, a time-series graph self-attention network is constructed using a multi-head self-attention mechanism and a gating mechanism. This solves the problems of high computational cost and insufficient capture of time-series features in existing technologies, and achieves efficient and reliable generation of dynamic graph data of smart grids.
Patent Information
- Application Number
- CN202411010831.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Existing dynamic graph generation methods are computationally expensive and inefficient in power grid data processing, cannot effectively capture time-series information, and the model assumptions do not hold in practical applications, resulting in poor fidelity of the generated graph's structure and time-series features.
A method for generating dynamic graph data for smart grids based on deep adversarial training is adopted. Through a sampling module, a generative adversarial network, and a reconstruction module, a time-series graph self-attention network is constructed using a multi-head self-attention mechanism and a gating mechanism to generate latent variables of the central graph. The generator is then optimized by a discriminator to generate dynamic data graphs for smart grids.
It improves the efficiency and reliability of dynamic graph data generation, can efficiently process large-scale power grid data, maintain the accuracy of graph structure and time series characteristics, adapt to different types of smart grid dynamic data generation scenarios, and has strong interpretability and scalability.
Smart Images

Figure CN119090994B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of smart grids, and particularly relates to a smart grid dynamic graph data generation method based on deep adversarial training. BACKGROUND
[0002] A smart grid is an important development direction of a modern power system, and its core is to realize the intelligentization and automation of the power system through advanced communication technology and data processing technology. With the development of the smart grid, the generation and processing of massive data have become one of the key problems. Dynamic graph data reflects the dynamic changes of the state of the power system, and is crucial for the monitoring, analysis and decision-making of the smart grid. However, the grid data contains a large amount of sensitive information, and a generation model needs to be used to generate time series data reflecting the dynamic changes of the grid.
[0003] Existing graph generators, such as GraphRNN, Graphite, NetGAN, VGAE, etc., are mainly designed for static graphs, ignoring the time series characteristics of the graph. The traditional method is to aggregate the timestamps to obtain a sequence of graph snapshots, and generate a corresponding graph on each graph snapshot to simulate the time series graph. This method needs to repeatedly run the graph generation algorithm, which has high time and computational cost. In addition, this method ignores the slight changes of the graph structure at consecutive time points, and cannot accurately capture the time series information.
[0004] In order to solve the problem of dynamic graph generation, Zhou et al. proposed TagGen, which added timestamps to the interaction edges of nodes, connected nodes that met the characteristic time neighborhood constraints, and converted the dynamic graph into an equivalent static graph, thereby modeling the dynamic graph. Although the model achieves the best dynamic graph simulation quality, there are two problems: first, the model uses a random walk sampling method, which is time-consuming and occupies a large amount of computing resources, and cannot effectively utilize information such as link weight and node feature; second, the time complexity of the model is as high as O(T 2 ), where T is the number of timestamps, which limits the efficiency and scalability of the model. Zeno et al. proposed a method DYMOND based on three-node motifs, which considers the dynamic changes of the overall graph structure and the type of nodes in the motif. In the modeling process, DYMOND makes two key assumptions: first, the arrival rate of the motif obeys an exponential distribution; second, the structure of the motif remains unchanged within the time range of the entire dynamic graph. However, these two assumptions may not hold in actual applications, and the structure and arrival rate of the motif may evolve over time, and the arrival rate is affected by time. This modeling method leads to poor fidelity of the structure and time series characteristics of the generated graph. Therefore, it is necessary to design a dynamic graph data generation method that can efficiently and reliably generate grid dynamic graph data. SUMMARY
[0005] The present application aims to overcome the defects of the prior art and provide a smart grid dynamic graph data generation method based on deep adversarial training to efficiently and reliably generate power grid dynamic graph data.
[0006] The object of the present application can be achieved by the following technical solutions:
[0007] The present application provides a smart grid dynamic graph data generation method based on deep adversarial training, comprising the following steps:
[0008] Obtain smart grid time series graph data, input a smart grid dynamic graph data generation model based on deep adversarial training, and generate smart grid dynamic data graph;
[0009] The smart grid dynamic graph data generation model based on deep adversarial training comprises a sampling module, a generative adversarial network and a reconstruction module connected in turn; wherein the sampling module is used to sample the smart grid time series graph data using a center graph sampling method to generate a center graph;
[0010] The generative adversarial network comprises a generator and a discriminator, the generator comprises a decoder and an encoder, the encoder is used to encode the center graph through a time series graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variable of the center graph; the decoder is used to decode the hidden variable of the center graph to obtain a center graph score matrix; the discriminator is used to distinguish between real data and generated data;
[0011] The reconstruction module is used to generate the classification distribution probability of each time series edge according to the center graph score matrix, and further generate the smart grid dynamic data graph.
[0012] Further, the generation process of the center graph is as follows:
[0013] S101, determine the initial node of the smart grid time series graph data;
[0014] S102, take the initial node as the center and recursively sample its neighbor nodes, with a sampling depth of k;
[0015] S103, obtain a center graph with a radius of k, the center graph comprising all neighbor nodes of any time series node u t and u t with a shortest path length less than or equal to k.
[0016] Further, in step S101, the sampling probability of any time series node in the smart grid time series graph data is calculated according to the node degree, and then the initial node is determined.
[0017] Further, any time series node u tThe calculation formula of the sampling probability is as follows:
[0018]
[0019] wherein P(u t ) represents the sampling probability of the time sequence node u t , deg(u t ) represents the node degree, V represents the whole node set, and v t represents the time sequence node.
[0020] Further, the encoder comprises a plurality of parallel time sequence graph self-attention networks, each of which calculates the aggregated features of the center graph through a multi-head self-attention mechanism, and then outputs the hidden variable of the center graph through a gating mechanism.
[0021] Further, the generation process of the center graph hidden variable is as follows:
[0022] S201, mapping the feature vector of each time sequence node of the center graph to a hidden layer space R d′×n to obtain a mapped feature vector, wherein d' is the target dimension, and n is the number of attention heads;
[0023] S202, calculating the attention coefficient between each time sequence node and its neighbor node, and normalizing:
[0024]
[0025] wherein, is the attention coefficient of the time sequence node u t and the time sequence node v t , is the normalized attention coefficient, and are the mapped feature vectors of the time sequence node u t and the time sequence node v t , a is the attention weight of each attention head in the multi-head self-attention mechanism, [·‖·] represents vector splicing, and LeakyReLU is a nonlinear activation function;
[0026] S203, weighting and aggregating the mapped feature vectors of the neighbor nodes of each time sequence node based on the normalized attention coefficient, to obtain the aggregated features of each time sequence node as the output of each attention head;
[0027]
[0028] wherein σ is a nonlinear activation function.
[0029] S204, splicing the outputs of all attention heads to obtain the current features of each node:
[0030]
[0031] where Concat represents vector splicing, Head i represents the output of the i-th head in the time diagram self-attention network, W o represents the output projection matrix.
[0032] S205, using a gating mechanism to integrate the current features of each node and the original features to obtain the latent variables of the center graph
[0033]
[0034] where W g is a weight matrix, and represents element multiplication.
[0035] Further, the decoder decodes the latent variables of the center graph through a gated recurrent unit to obtain a score matrix of the center graph, and the expression of the score matrix is as follows:
[0036]
[0037] where s is the score matrix, W o is a weight matrix, is the latent variable of the center graph output by the encoder, h0 is the initial hidden state of the gated recurrent unit, and b o is a bias term.
[0038] Further, the discriminator distinguishes between real data and generated data through a multi-layer perception.
[0039] Further, the generative adversarial network is optimized by minimizing a loss function, and the loss function includes a generator loss function and a discriminator loss function, and the expression of the generator loss function is specifically as follows:
[0040]
[0041] where V s represents the initial node set of the center graph, n s represents the number of center graphs, represents the adjacency matrix of the center graph, represents the probability of generating a graph edge, G represents the generator, D represents the discriminator, and G(z) represents the data generated by the generator.
[0042] The expression of the discriminator loss function is specifically as follows:
[0043]
[0044] wherein x represents real data.
[0045] Further, the specific process of generating the smart grid dynamic data graph by the reconstruction module is as follows:
[0046] S301, generating the classification distribution probability of each time sequence edge according to the center graph score matrix:
[0047]
[0048] wherein p(u, v, t) is the classification distribution probability of the time sequence edge (u t ,v t ), S u,v,t is the final score matrix, the final score matrix is obtained by summarizing all the center graph score matrices and then averaging the probability generated by each edge, and t is a time stamp;
[0049] S302, generating the time sequence edge reflecting the dynamic change of the smart grid at each time stamp by using the classification distribution probability, and when the number of generated time sequence edges is consistent with the number of edges in the original smart grid time sequence graph data, the generation process of the smart grid dynamic data graph is completed.
[0050] Compared with the prior art, the present application has the following beneficial effects:
[0051] 1、The present application designs a smart grid dynamic graph data generation model based on deep adversarial training, which can generate a smart grid dynamic data graph according to smart grid time sequence graph data, and the smart grid dynamic graph data generation model based on deep adversarial training comprises a sampling module, a generative adversarial network and a reconstruction module connected in sequence, wherein the sampling module is used for sampling the smart grid time sequence graph data by using a center graph sampling method to generate a plurality of center graphs, the center graph sampling method can dynamically adjust the sampling strategy according to the data distribution, effectively capture the structural characteristics of the key nodes and their neighbor nodes in the graph, and is beneficial to improve the reliability of the generated smart grid dynamic data graph; the encoder is used for encoding the center graph by a time sequence graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variable of the center graph, and the decoder is used for decoding the hidden variable of the center graph to obtain the center graph score matrix, the multi-head self-attention mechanism can realize parallel operation on one hand, improve the model training and generation speed of the smart grid dynamic data graph, can well adapt to the smart grid data processing scene with large volume, and efficiently process large-scale graph data, and on the other hand can dynamically allocate different attention weights according to the importance of the neighbor nodes, and focus on the nodes playing a key role in the graph data, so as to effectively aggregate the information of the neighbor nodes.
[0052] 2、The application adds a gating mechanism after each time sequence diagram attention network, which can further enhance the learning ability of the encoder, and through the gating mechanism, the current features and original features of each node are integrated, information can be selectively retained or discarded, thereby alleviating the gradient vanishing problem and accelerating model convergence, the introduction of the gating mechanism enables the model to maintain high learning effect when processing long-time span graph data, avoids the loss of important historical information in long-time transmission process, improves the ability of the model to process complex time sequence diagram data, through the combination of the multi-head self-attention mechanism and the gating mechanism, the model can more flexibly and effectively process large-scale complex time sequence diagram data, improve the training efficiency of the model, and improve the reliability of the generated intelligent power grid dynamic data graph.
[0053] 3、In the intelligent power grid dynamic graph data generation model based on deep adversarial training designed in the application, the reconstruction module collects all the center graph score matrices, then takes the average of the probability generated by each edge to obtain a final score matrix, and generates a classification distribution of each time sequence edge, which can realize the fusion of multi-source information on the one hand, and can reduce the influence of extreme values or noise on the result on the other hand, thereby improving the reliability of the score matrix; the probability of the classification distribution is used to generate a time sequence edge reflecting the dynamic changes of the intelligent power grid at each timestamp, so that the generated data graph is closer to the actual situation in the time dimension; the above process does not depend on a specific power grid structure or data format, and can be flexibly applied to different types of intelligent power grid dynamic data graph generation scenarios, and has strong interpretability and scalability. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 FIG. 1 is a structural schematic diagram of an intelligent power grid dynamic graph data generation model based on deep adversarial training. DETAILED DESCRIPTION
[0055] The application will be described in detail below in combination with the drawings and specific embodiments. The embodiments are implemented on the premise of the technical scheme of the application, and detailed implementation modes and specific operation processes are given, but the protection scope of the application is not limited to the following embodiments.
[0056] Embodiment 1
[0057] The embodiment provides an intelligent power grid dynamic graph data generation method based on deep adversarial training, which comprises the following steps:
[0058] Obtaining intelligent power grid time sequence diagram data, inputting an intelligent power grid dynamic graph data generation model based on deep adversarial training, and generating an intelligent power grid dynamic data graph.
[0059] The intelligent power grid dynamic graph data generation model based on deep adversarial training is as shown in Figure 1As shown, it comprises a sampling module, a generative adversarial network and a reconstruction module connected in sequence. The sampling module is configured to sample the smart grid time series graph data using a center graph sampling method to generate a plurality of center graphs for model training. The generative adversarial network comprises a generator and a discriminator, and the generator and the discriminator are alternately optimized by minimizing a loss function. The discriminator is configured to distinguish between real data and generated data, and the generator comprises a decoder and an encoder. The encoder is configured to encode the center graph through a time series graph self-attention network constructed based on a multi-head self-attention mechanism to obtain hidden variables of the center graph; and the decoder is configured to decode the hidden variables of the center graph to obtain a score matrix of the center graph. The reconstruction module is configured to generate a classification distribution probability of each time series edge according to the score matrix of the center graph, and further generate a smart grid dynamic data graph.
[0060] Specifically, in the sampling module, the generation process of the center graph is as follows:
[0061] S101, determining an initial node of the smart grid time series graph data according to a node degree.
[0062] For the selection of the initial node, the embodiment calculates a sampling probability of each time series node in the smart grid time series graph data according to the node degree, and selects a node with a higher degree as the initial node. For any time series node u t , the calculation formula of the sampling probability is as follows:
[0063]
[0064] Wherein, P(u t ) represents the sampling probability of the time series node u t , deg(u t ) represents the node degree, V represents the entire node set, and v t represents the time series node.
[0065] S102, taking the initial node as the center to recursively sample its neighbor nodes, and the specific steps are as follows:
[0066] First, sampling is performed from the direct neighbor nodes of the initial node, then sampling is continued from the neighbor nodes of the direct neighbor nodes, and so on, until the sampling depth reaches k.
[0067] S103, obtaining a center graph G ego (u t ) = (V ego (u t ), E ego (u t )) with a radius of k, wherein the center graph contains any time series node u t and all neighbor nodes with a shortest path length less than or equal to k from u t .
[0068] The center graph sampling method can effectively capture the structural characteristics of key nodes and their neighbor nodes in the graph, and improve the learning ability and generation effect of the model.
[0069] Traditional encoders usually use RNN, LSTM, etc. memory network or GCN, but both networks have limitations. Memory network is good at processing sequence data and capturing information in sequence through a loop-connected structure, but the loop structure needs to process data in sequence, which leads to the model unable to perform parallel computation, and the training efficiency is limited, and cannot be applied to large-scale data sets. GCN can effectively capture the spatial relationship between nodes by performing convolution operation on graph data, but GCN is essentially static and cannot handle dynamic graph problems, and GCN has difficulty in assigning different weights to node neighbors. In order to solve the problems existing in the two kinds of networks, in the embodiment, the encoder uses a time graph attention network to encode the center graph, and the encoder includes k stacked time graph self-attention networks, which can realize parallel computation. Each time graph self-attention network calculates the aggregated features of the center graph through a multi-head self-attention mechanism, and the aggregated features are output as the hidden variables of the center graph through a gating mechanism. The specific process is as follows:
[0070] S201, for each node v of the center graph t , the feature vector of the node is mapped to the hidden layer space R d′×n to obtain the mapped feature vector where d' is the target dimension, n is the number of attention heads,
[0071] S202, for each pair of nodes (u t ,v t ), the normalized attention coefficient is calculated , which represents the importance of the feature representation of node v t to node u t . The calculation formula is as follows:
[0072]
[0073] where is the attention coefficient of node u t and node v t , and are the mapped feature vectors of node u t and node v t , a is the attention weight of each attention head in the multi-head self-attention mechanism, [·‖·] represents vector splicing, and LeakyReLU is a nonlinear activation function.
[0074] S203, using the normalized attention coefficient The mapping feature vectors of the neighbor nodes are weighted and summed to obtain the aggregation features of each node as the output of each attention head;
[0075]
[0076] wherein, sigma is a nonlinear activation function;
[0077] S204, splicing the outputs of all attention heads to obtain the current features of each node
[0078]
[0079] wherein, Concat represents vector splicing, Head i represents the output of the i-th head in the time diagram self-attention network, W o represents the output projection matrix.
[0080] S205, using a gating mechanism to integrate the current features and the original features of each node to obtain the center graph hidden variable:
[0081]
[0082] wherein, W g is a weight matrix, and represents element multiplication.
[0083] The multi-head self-attention mechanism can not only ensure the quality of the generated graph while improving the training efficiency of the model, so that the model can efficiently process large-scale graph data, but also enable the model to dynamically allocate different attention weights according to the importance of the neighbor nodes. This dynamic weight allocation method enables the model to focus on the nodes that play a key role in the graph data and flexibly handle complex relationships in the graph data, thereby effectively aggregating the information of the neighbor nodes. In order to further enhance the learning ability of the encoder, the embodiment adds a gating mechanism after each time diagram attention network. The gating mechanism can selectively retain or discard information to control information flow, thereby alleviating the gradient vanishing problem and accelerating the convergence of the model. The introduction of the gating mechanism enables the model to maintain high learning effect when processing long-time span graph data, avoids the loss of important historical information during long-time transmission, ensures excellent performance of the model in capturing short-term features, and is also efficient when analyzing long-time span data, thereby improving the ability of the model to process complex data. By combining the multi-head self-attention mechanism and the gating mechanism, the model can more flexibly and effectively process large-scale complex time diagram data.
[0084] The decoder decodes the hidden variable of the center graph through the gating recurrent unit The score matrix s of the center image is obtained, and the expression for the score matrix s is as follows:
[0085]
[0086] Among them, W o Let h0 be the weight matrix, h0 be the initial hidden state of the gated recurrent unit, and b be the weight matrix. o This is a bias term.
[0087] The discriminator learns patterns in the input data to identify differences between generated and real data, thus providing effective feedback to guide the generator's optimization. The discriminator uses a multilayer perceptron (MLP) to distinguish between real and generated data. The definition of the discriminator is as follows:
[0088]
[0089] in, σ represents the parameters of the MLP, and σ represents the nonlinear activation function.
[0090] The generator's goal is to deceive the discriminator, causing it to classify the generated data as real data. The generator's loss function consists of two parts: an adversarial loss, which measures the degree to which the generated data is classified as real data; and a reconstruction loss, which improves the quality of the decoder's output. In this embodiment, cross-entropy loss is used as the reconstruction loss to ensure the quality of the generated data. The specific expression for the generator's loss function is as follows:
[0091]
[0092] Among them, V s Let n represent the initial set of nodes in the central graph. s Indicates the number of center images. Represents the adjacency matrix of the central graph. Let G represent the probability of generating graph edges, D represent the discriminator, and G(z) represent the data generated by the generator.
[0093] The goal of the discriminator is to accurately distinguish between real and generated data. The discriminator's loss function measures the accuracy with which it differentiates between real and generated data; the specific expression is as follows:
[0094]
[0095] Where x represents the actual data.
[0096] The specific process by which the reconfiguration module generates a dynamic data graph of the smart grid is as follows:
[0097] S301. Generate the classification distribution probability of each temporal edge based on the center graph score matrix:
[0098]
[0099] where p(u, v, t) is the classification distribution probability of the time-ordered edge (u t ,v t ), and S u,v,t is the final score matrix, which is obtained by aggregating all the center graph score matrices and then averaging the probabilities generated by each edge.
[0100] S302, sample the corresponding time-ordered edge from the classification distribution in a non-replacement sampling manner. Specifically, sample from the neighbor node set of the time-ordered node u t to determine the time-ordered edge connected to u t . The calculation formula is as follows:
[0101]
[0102] where Cat represents the classification distribution, and N(u t ) represents the set of edges adjacent to the node u
[0103] The above process generates time-ordered edges that reflect real dynamic changes at each timestamp using the probability of the classification distribution. Finally, when the number of generated time-ordered edges is consistent with the number of edges in the original smart grid time-ordered graph data, the generation process of the smart grid dynamic data graph is completed. The generated smart grid dynamic graph data can be used for desensitization generation of power grid topology graphs, such as power knowledge graphs, power equipment relationship graphs, and power transmission network graphs.
[0104] To verify the effectiveness of the above method, the following experiments are performed in this embodiment:
[0105] The model and evaluation script are implemented using Python 3.7 and PyTorch 1.8.1, and are trained in a CUDA-11.1 environment. The model is trained for 800 batches, with a learning rate of 0.0003, a weight decay of 1e-6, and an attention network containing 4 heads. The experiment is performed on a machine equipped with Intel(R) Xeon(R) Gold 5220 CPU @ 2.20 GHz, 62 GB RAM, and NVIDIA Tesla V100, 32 GB. Each algorithm uses one CPU core and one GPU.
[0106] This embodiment performs experiments on 6 publicly available dynamic graph datasets to evaluate the performance of the model, which cover multiple fields. The statistical information of the datasets is shown in Table 1.
[0107] Table 1: Dataset Statistics
[0108]
[0109] The method (DGGAN) proposed in this embodiment is compared with traditional graph generation methods and deep learning-based graph generation methods. The traditional graph generation methods include E-R and A-B, which are classic methods in graph theory research, and generate graph structures through random processes and scale-free characteristics, respectively. The deep learning-based graph generation methods include GraphRNN, Graphite, NetGAN and TagGen, wherein GraphRNN is an autoregressive-based graph generation method, Graphite is a variational autoencoder-based graph generation method, NetGAN is a generative adversarial network-based graph generation method, and TagGen is a dynamic graph generation method based on a generative adversarial network, which is one of the most advanced dynamic graph generation methods. It is worth noting that NetGAN, Graphite and the traditional graph generator (E-R and A-B) are designed for static graphs and cannot directly process dynamic graphs. In order to realize dynamic graph generation, the methods are used to generate static graphs on each timestamp, and then the static graphs are combined to obtain a complete dynamic graph.
[0110] The experiment uses multiple classic evaluation indicators to comprehensively evaluate the similarity of real graphs and generated graphs from multiple dimensions. The specific evaluation indicators are as follows:
[0111] Deg.: Maximum Mean Discrepancy (MMD) of degree distribution.
[0112] PLE: Power-law exponent.
[0113] GINI: Gini coefficient.
[0114] Cluster: Average clustering coefficient.
[0115] Claw Count: Number of claw-shaped structures in the graph.
[0116] Wedge Count: Number of wedges in the graph.
[0117] Triangle Count: Number of triangles in the graph.
[0118] N-Component: Number of connected components.
[0119] Since these evaluation indicators are designed for static graphs, the dynamic graph is divided into a series of snapshots according to the processing method of TagGen, and the evaluation indicators are calculated on each snapshot, and the average value and the median value are compared. Specifically, given a real graph and a synthetic graph G', which aggregates edges of the first t timestamps into a graph snapshot S t , then computes evaluation metrics f on real graph snapshots S t and synthetic graph snapshots S' t respectively, and finally computes the average and median of evaluation results of all graph snapshots. The specific calculation formula is as follows:
[0120]
[0121] The final experimental results are as follows, the average of evaluation metrics is shown in Table 2, and the median of evaluation metrics is shown in Table 3. In the two tables, the smaller the value, the better the quality
[0122] Table 2 Average of evaluation metrics of different models on multiple dynamic graph datasets
[0123]
[0124]
[0125]
[0126]
[0127] Table 3 Median of evaluation metrics of different models on multiple dynamic graph datasets
[0128]
[0129]
[0130]
[0131] From Table 2 and Table 3, the following conclusions can be drawn:
[0132] (1) The model (DGGAN) proposed in this embodiment is obviously superior to the baseline model in the quality of generated graphs. Although the N-Component average of DGGAN on the EMAIL dataset is higher than that of NetGAN, DGGAN is superior to the baseline model in other evaluation metrics on 6 datasets, verifying the effectiveness of the model. Especially in the Deg. evaluation metric, DGGAN reaches 10 -5 orders of magnitude on the DBLP and SO datasets, and reaches 10 -4 orders of magnitude on the College, MATH and USER datasets, which is significantly superior to the baseline model. In contrast, the most advanced dynamic graph generation model TagGen has a Deg. evaluation metric of 10 -2orders of magnitude, demonstrating that DGGAN has a significant advantage in the degree distribution of simulated graphs. In addition, DGGAN also performs well in other key indicators such as clustering coefficient, Gini coefficient, and the number of specific subgraphs, which indicates that the model can effectively maintain the structural characteristics of the network, such as community structure and node connection density. According to the data in the last four columns, it can be seen that the quality of the dynamic graph generated by the static graph generation method is low, which reflects the necessity of designing a generation method specifically for dynamic graphs.
[0133] (2) DGGAN has excellent generalization ability. DGGAN can generate high-quality graphs when processing different types and different sizes of graph data sets, which proves that DGGAN has excellent generalization ability and robustness on different types and different sizes of networks, and can be well applied to power networks.
[0134] (3) DGGAN has good scalability. For large-scale dynamic graphs (such as the USER data set, containing about 200,000 time-series nodes and 1.44 million time-series edges), deep learning-based models such as Graphite and GraphRNN require more than 32G memory of GPU for training, which cannot be met by the GPU used in this experiment, and cannot be trained. DGGAN can be trained on a 32G memory GPU, with excellent scalability. DGGAN can well balance the temporal and spatial consumption and training efficiency, and can simulate large-scale dynamic graphs within the affordable time and memory consumption.
[0135] The above method, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, server, or network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various program code storage media.
[0136] Example 2
[0137] The embodiment provides an electronic device, comprising a memory and a processor, wherein the processor is configured to execute a program stored in the memory, and the program comprises a plurality of instructions for executing all or part of the steps of the method in the embodiment 1. The memory comprises a computer readable storage medium, which can be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.
[0138] The above description of the embodiments is to facilitate the understanding and use of the present application by those skilled in the art. Those skilled in the art can easily make various modifications to the embodiments and apply the general principles described herein to other embodiments without creative efforts. Therefore, the present application is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present application without departing from the scope of the present application should be within the protection scope of the present application.
Claims
1. A method for generating dynamic graph data of smart grid based on deep adversarial training, characterized in that, The method comprises the following steps: obtaining smart grid time series graph data, inputting a smart grid dynamic graph data generation model based on deep adversarial training, and generating a smart grid dynamic data graph; The smart grid dynamic graph data generation model based on deep adversarial training comprises a sampling module, a generative adversarial network and a reconstruction module connected in sequence; wherein the sampling module is used to sample the smart grid time series graph data using a center graph sampling method to generate a center graph; The generative adversarial network comprises a generator and a discriminator, the generator comprises a decoder and an encoder, the encoder is used to encode the center graph through a time series graph self-attention network constructed based on a multi-head self-attention mechanism to obtain hidden variables of the center graph; the decoder is used to decode the hidden variables of the center graph to obtain a center graph score matrix; and the discriminator is used to distinguish between real data and generated data; The reconstruction module is used to generate a classification distribution probability of each time series edge according to the center graph score matrix, and then generate a smart grid dynamic data graph; The generation process of the center graph is specifically as follows: S101, determining an initial node of the smart grid time series graph data; S102. Using the initial node as the center, recursively sample its neighboring nodes, with a sampling depth of... ; S103、obtain a center graph with radius of all neighbor nodes with shortest path length between and less than or equal to In step S101, the sampling probability of any time series node in the smart grid time series graph data is calculated according to the node degree, and then the initial node is determined; Any timing node The calculation formula of the sampling probability is as follows: wherein, denotes a sampling probability of a timing node denotes a sampling probability of a timing node denotes a degree of a node denotes a set of all nodes denotes a timing node. 2.The smart grid dynamic graph data generation method based on deep adversarial training of claim 1, wherein, The encoder comprises a plurality of parallel time series graph self-attention networks, each time series graph self-attention network calculates the aggregated features of the center graph through a multi-head self-attention mechanism, and then outputs the hidden variables of the center graph through a gating mechanism. 3.The smart grid dynamic graph data generation method based on deep adversarial training of claim 2, wherein, The generation process of the center graph hidden variables is specifically as follows: S201、map the feature vector of each time-series node of the center graph to a hidden layer space obtain a mapped feature vector, wherein is a target dimension, is the number of attention heads; S202, calculating the attention coefficients between each time series node and its neighbor nodes and normalizing them: wherein, is a time step node and a time step node an attention coefficient of the time step node a normalized attention coefficient of the time step node and are mapped feature vectors of the time step node and the time step node respectively, are attention weights of respective attention heads in the multi-head self-attention mechanism, denotes vector concatenation, is a non-linear activation function; S203, weighting and aggregating the mapping feature vectors of the neighbor nodes of each time series node based on the normalized attention coefficients to obtain the aggregated features of each time series node as the output of each attention head; wherein, is a non-linear activation function; S204, concatenating the outputs of all attention heads to obtain the current features of each node: wherein, denotes vector concatenation, denotes the output of the 𝑖th head in the temporal graph self-attention network, denotes the output projection matrix; S205, use a gating mechanism to integrate the current features of each node with the original features to obtain the latent variables of the center graph : wherein, is a weight matrix, denotes element-wise multiplication. 4.The smart grid dynamic graph data generation method based on deep adversarial training of claim 1, wherein, The decoder decodes the hidden variables of the center graph through a gated recurrent unit to obtain a score matrix of the center graph, and the expression of the score matrix is as follows: wherein, is a score matrix, is a weight matrix, is a center map latent variable output by the encoder, is an initial hidden state of the gated recurrent unit, is a bias term.
5. The method of claim 1, wherein, The discriminator distinguishes between real data and generated data through a multi-layer perceptron.
6. The method of claim 1, wherein, The generative adversarial network is optimized by minimizing a loss function, the loss function comprises a generator loss function and a discriminator loss function, and the expression of the generator loss function is specifically as follows: wherein, represents an initial set of nodes of a center graph, represents a number of center graphs, represents an adjacency matrix of a center graph, represents a probability of generating an edge of a graph, represents a generator, represents a discriminator, represents data generated by a generator; The expression of the discriminator loss function is specifically as follows: wherein represents the real data.
7. The method of claim 1, wherein, The specific process of the reconstruction module generating the smart grid dynamic data graph is as follows: S301, generating a classification distribution probability of each time series edge according to the center graph score matrix: where p(u, v, t) is the temporal edge classification distribution probability, is the final score matrix, which is obtained by aggregating all the center graph score matrices and then averaging the probabilities generated by each edge, is the timestamp; S302, using the probability of the classification distribution to generate time series edges reflecting the dynamic changes of the smart grid at each timestamp, and when the number of generated time series edges is consistent with the number of edges in the original smart grid time series graph data, the generation process of the smart grid dynamic data graph is completed.
Citation Information
Patent Citations
Airsoldier agent confrontation behavior modeling method based on OptiGAN and space-time attention
CN115293022A
Remote sensing data reconstruction method combining generative adversarial network and graph neural network
CN117493786A