Structural feature maintained power data static graph data generation method
By introducing central graph sampling, multi-head self-attention and gating mechanisms into the static graph data generation model, the problem of low maintenance and generation efficiency of power data graph structure characteristics in the existing technology is solved, and efficient and reliable static graph data is achieved Generate, suitable for complex power data scenarios.
Patent Information
- Application Number
- CN202411129516.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-08-16
AI Technical Summary
Existing static graph data generation techniques have challenges in training efficiency and graph structure feature maintenance. Especially when processing complex and variable power data, it is difficult to accurately generate graph data with a topological structure similar to the original data, and the generation efficiency is low.
A method of generating static graph data of power data maintained by structural features is designed, and a static graph data generation model including sampling module, generation adversarial network and reconstruction module is adopted. Through the central graph sampling method, multi-head self-attention mechanism and gate mechanism , generate and retain the structural characteristics of power data, and improve the generation efficiency and quality.
This method can effectively capture the structural characteristics of key nodes and their neighbor nodes in the graph, improve the reliability and efficiency of the generated smart grid dynamic data graph, adapt to large-scale power data processing scenarios, maintain high learning effect, avoid gradient disappearance problems, and improve the problem of improving The model's ability to process complex data.
Smart Images

Figure CN119179802A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of electric power information technology, and in particular relates to a method for generating static graph data of electric power data with structural feature preservation. Background Art
[0002] Power data involves a lot of security information and is not suitable for direct use. It is necessary to use graph generation technology to desensitize the power data and generate simulated data with a similar topological structure to the original data. Then, the power system analysis and research is carried out based on the desensitized simulated data. Therefore, how to generate high-quality graph data and keep the structural characteristics of the original data as much as possible has become an important research direction in the field of power information technology.
[0003] Static graph data has the advantages of high computational efficiency and strong portability. Although the existing static graph data generation technology has made some progress, it still faces some challenges in terms of training efficiency and maintaining graph structure features. The existing static graph generation methods mainly include the following categories:
[0004] (1) Static graph generation method based on structural assumptions
[0005] Traditional graph generation methods use specific structural assumptions to model specific graph sets. Common structural assumptions include heavy-tailed degree distribution, small diameter, local clustering, etc. Traditional graph generators include ER, BA, WS, BTER, Kronecker, etc. Although these methods have a solid foundation in theory, they are limited by the structure and often have difficulty accurately generating graph data with similar topological structures to the original data when processing complex and changeable power data. In addition, these methods rely on preset structural assumptions, and when encountering new graph sets that do not meet the assumptions, the performance often drops significantly.
[0006] (2) Static graph generation method based on autoregression
[0007] The autoregressive graph generation method decomposes the graph generation process into a series of sequential decisions, each decision depends on the previous decision, and the complete graph structure is constructed by gradually generating nodes and edges. GraphRNN is a typical autoregressive graph generation model. GraphRNN consists of two parts: graph-level RNN and edge-level RNN. The graph-level RNN is used to store the generated nodes and generate new nodes, and the edge-level RNN is used to store the information of new nodes and infer whether to generate new edges based on the relationship between nodes. However, since the generation process depends on the order of nodes and edges, the model is not permutation-invariant; in addition, since the generation process of GraphRNN is carried out step by step, each step depends on the generation result of the previous step, and the graph generation process cannot be processed in parallel, resulting in low generation efficiency.
[0008] (3) Static Image Generation Method Based on Variational Autoencoder (VAE)
[0009] Variational autoencoder is a generative model based on unsupervised learning. It consists of two parts: encoder and decoder. The encoder maps the input data into the latent space and encodes the structure and node information of the graph into latent variables. The decoder samples the latent variables from the latent space and decodes the latent variables to generate a new graph. The model assumes that the latent variables obey a known prior distribution, uses variational inference technology to learn the distribution of the latent variables, and approximates the true posterior distribution by maximizing the variational lower bound. GraphVAE is a graph generation model based on VAE. Its encoder uses GCN to embed the input graph into a continuous feature space, and the decoder uses a multi-layer perceptron (MLP) to output a probabilistic fully connected graph with the maximum number of nodes at one time. Since the generated graph and the real graph do not specify the node order, in order to calculate the reconstruction loss, GraphVAE uses an approximate graph matching algorithm to align the nodes of the generated graph and the real graph, thereby calculating the difference between the generated graph and the real graph. However, this graph matching algorithm has a high time complexity, which makes the model unable to learn and generate large-scale graphs.
[0010] (4) Static graph generation method based on generative adversarial network
[0011] Generative adversarial networks (GANs) generate graph data through adversarial training of generators and discriminators. NetGAN is a classic static graph generation model based on generative adversarial networks. It uses a biased second-order strategy to sample random walk sequences. This strategy can not only maintain the invariance of node arrangement, but also effectively utilize the sparsity of real-world networks. NetGAN's generator uses a long short-term memory network (LSTM) to learn and generate the next node node by node, and generate a complete random walk sequence through an iterative process. The discriminator uses another LSTM to process these node sequences and judge the authenticity of the random walk sequence by learning the characteristics of the real random walk sequence. After the training is completed, the generator generates random walk sequences multiple times, and these sequences are converted into complete graphs through a graph reconstruction algorithm. Although NetGAN has excellent performance in the quality of generated graphs, the model uses LSTM for sequence generation and discrimination, which has high computational complexity. When processing large-scale graphs and long sequences, the computational efficiency and memory requirements of LSTM may become bottlenecks, limiting the scalability of the model.
[0012] In summary, it is necessary to design a static graph data generation method to further improve the generation efficiency and quality of static graph data of power data. Summary of the invention
[0013] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a method for generating static graph data of power data with preserved structural features, so as to retain the structural features of the original power data as much as possible and improve the efficiency of static graph data generation.
[0014] The purpose of the present invention can be achieved by the following technical solutions:
[0015] The present invention provides a method for generating static graph data of electric power data with structural feature preservation, comprising the following steps:
[0016] Obtain power data, input the static graph data generation model, and generate corresponding static graph data;
[0017] The static graph data generation model includes a sampling module, a generative adversarial network and a reconstruction module connected in sequence; wherein the sampling module is used to sample the power data using a central graph sampling method to generate a central graph;
[0018] The generative adversarial network includes a generator and a discriminator. The generator includes a decoder and an encoder. The encoder is used to encode the central graph through a graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variables of the central graph; the decoder is used to decode the hidden variables of the central graph to obtain the central graph score matrix; the discriminator is used to distinguish between real data and generated data;
[0019] The reconstruction module is used to generate the classification distribution probability of each edge according to the central graph score matrix, and then generate static graph data.
[0020] Furthermore, the generation process of the central graph is specifically as follows:
[0021] S101, determining an initial node according to input power data;
[0022] S102, taking the initial node as the center, recursively sampling its neighboring nodes, with a sampling depth of k;
[0023] S103 , obtaining a central graph with a radius of k, wherein the central graph includes any node u and all neighboring nodes whose shortest path lengths to the node u are less than or equal to k.
[0024] Furthermore, in step S101, the sampling probability of any node in the power data is calculated according to the node degree, and then the initial node is determined.
[0025] Furthermore, the calculation formula for the sampling probability of any node u is as follows:
[0026]
[0027] Among them, P(u) represents the sampling probability of node u, deg(·) represents the node degree, V represents the set of all nodes, and v represents the node.
[0028] Furthermore, the encoder includes multiple parallel graph self-attention networks, each of which calculates the aggregated features of the central graph through a multi-head self-attention mechanism, and then outputs them as latent variables of the central graph through a gating mechanism.
[0029] Furthermore, the generation process of the central graph latent variables is as follows:
[0030] S201, mapping the feature vector of each node of the central graph to the hidden layer space R d′×n , obtain the mapping feature vector, where d′ is the target dimension and n is the number of attention heads;
[0031] S202. Calculate the attention coefficient between each node and its neighboring nodes and normalize it:
[0032] e uv =LeakyReLU(a T [h u ||h v ])
[0033]
[0034] Among them, e uv is the attention coefficient of node u and node v, α uv is the normalized attention coefficient, h u and h v are the mapping feature vectors of node u and node v respectively, a is the attention weight of each attention head in the multi-head self-attention mechanism, [·||·] represents vector concatenation, and LeakyReLU is the nonlinear activation function;
[0035] S203, based on normalized attention coefficient α uv Weighted aggregation of the mapping feature vectors of each node’s neighbor nodes to obtain the aggregated features of each node as the output of each attention head;
[0036]
[0037] Among them, σ is a nonlinear activation function;
[0038] S204. Concatenate the outputs of all attention heads to obtain the current features of each node:
[0039] h′ u =Concat(Head1, ..., Head n )W o
[0040] Among them, Concat means vector concatenation, Head i represents the output of the i-th head in the graph self-attention network, W o represents the output projection matrix;
[0041] S205. Use the gating mechanism to combine the current features and original features of each node to obtain the hidden variable y of the central graph. u :
[0042] y u =σ(W g [h′ u ||x u ||(h′ u -x u )])⊙h′ u +(1-σ(W g [h′ u ||x u ||(h′ u -x u )]))⊙x u
[0043] Among them, W g is the weight matrix, and ⊙ represents element multiplication.
[0044] Furthermore, the decoder decodes the latent variables of the central graph through a gated recurrent unit to obtain a score matrix of the central graph. The expression of the score matrix is as follows:
[0045] s=W o (GRU(y u ,h0))+b o
[0046] Among them, s is the score matrix, W o is the weight matrix, y u is the central graph hidden variable output by the encoder, h0 is the initial hidden state of the gated recurrent unit, b o is the bias term.
[0047] Furthermore, the discriminator distinguishes between real data and generated data through a multi-layer perceptron.
[0048] Furthermore, the generative adversarial network is optimized by minimizing a loss function, wherein 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:
[0049]
[0050] Among them, V sRepresents the initial node set of the central graph, n s represents the number of central graphs, A u represents the adjacency matrix of the central graph, P u 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;
[0051] The expression of the discriminator loss function is as follows:
[0052]
[0053] Among them, x represents the real data.
[0054] Furthermore, the specific process of the reconstruction module generating the smart grid dynamic data graph is as follows:
[0055] S301. Generate the classification distribution probability of each edge according to the central graph score matrix:
[0056]
[0057] Among them, p(u,v) is the classification distribution probability of edge (u,v), S u,v is the final score matrix, which is obtained by summing up all the central graph score matrices and then averaging the probability of each edge generation;
[0058] S302: Generate corresponding edges using the probability of classification distribution. When the number of generated edges is consistent with the number of edges in the original power data, the generation of static graph data is completed.
[0059] Compared with the prior art, the present invention has the following beneficial effects:
[0060] 1. The present invention designs a static graph data generation model, which can generate corresponding static graph data according to power data. The static graph data generation model includes a sampling module, a generative adversarial network and a reconstruction module connected in sequence, wherein the sampling module is used to sample the power data using a central graph sampling method to generate a number of central graphs. The central 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 conducive to improving the reliability of the generated smart grid dynamic data graph; the encoder is used to encode the central graph through a graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variables of the central graph, and the decoder is used to decode the hidden variables of the central graph to obtain the central graph score matrix. The multi-head self-attention mechanism can realize parallel computing on the one hand, improve the speed of model training and generating static graph data, and can well adapt to power data processing scenarios with a large amount of information. On the other hand, it can dynamically allocate different attention weights according to the importance of neighbor nodes, focusing on nodes that play a key role in the static graph data, thereby effectively aggregating the information of neighbor nodes and retaining the structural characteristics of the original power data as much as possible.
[0061] 2. The present invention adds a gating mechanism after each graph self-attention network, which can further enhance the learning ability of the encoder. The gating mechanism integrates the current features and original features of each node, and can selectively retain or discard information, thereby alleviating the gradient vanishing problem and accelerating model convergence. The introduction of the gating mechanism enables the model to maintain a high learning effect when processing graph data with a long time span, avoiding the loss of important historical information during long-term transmission, and improving the model's ability to process complex data. By combining the multi-head self-attention mechanism and the gating mechanism, the model can not only flexibly and efficiently process large-scale complex data, but also effectively retain the structural characteristics of the original power data.
[0062] 3. The present invention summarizes all central graph score matrices through a reconstruction module, and then takes the average of the probability generated by each edge to obtain the final score matrix, generating a classification distribution for each edge. On the one hand, it can realize the fusion of multi-source information, and on the other hand, it can reduce the impact of extreme values or noise on the results and improve the reliability of the score matrix; using the probability of classification distribution to generate corresponding edges can make the generated static graph data closer to the actual situation; the above process does not depend on a specific power grid structure or data format, and can be flexibly applied to different types of power data static graph data generation scenarios, with strong interpretability and scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 Schematic diagram of the structure of the model generated for static graph data. DETAILED DESCRIPTION
[0064] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0065] Example 1
[0066] Power data involves a large amount of security information and is not suitable for direct use. It is necessary to use graph generation technology to desensitize the power data, generate simulation data with a similar topological structure to the original data, and then analyze and study the power system based on the desensitized simulation data. This embodiment provides a method for generating static graph data of power data with structural features preserved, which generates corresponding static graph data based on power data that is not time-series, and can be used for desensitized generation of power grid topology maps, such as power equipment relationship maps, transmission network maps, etc., and includes the following steps:
[0067] According to the purpose and requirements of generating static graph data, corresponding power data (such as equipment data, grid structure data, etc.) is obtained, and the static graph data generation model is input to generate corresponding static graph data.
[0068] The structure of the static graph data generation model is as follows Figure 1 As shown, it includes a sampling module, a generative adversarial network and a reconstruction module connected in sequence. Among them, the sampling module is used to sample the power data using the central graph sampling method to generate a central graph. The generative adversarial network includes a generator and a discriminator. The discriminator is used to distinguish between real data and generated data. The generator includes a decoder and an encoder. The encoder is used to encode the central graph through a graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variables of the central graph. The decoder is used to decode the hidden variables of the central graph and obtain the central graph score matrix. The reconstruction module is used to generate the classification distribution probability of each edge according to the central graph score matrix, and then generate static graph data.
[0069] Specifically, in the sampling module, the process of generating the central graph is as follows:
[0070] S101. Determine an initial node according to input power data.
[0071] For the selection of the initial node, this implementation calculates the sampling probability of each node in the power data according to the node degree, and selects the node with higher degree as the initial node. For any node u, the calculation formula of the sampling probability is as follows:
[0072]
[0073] Among them, P(u) represents the sampling probability of node u, deg(·) represents the node degree, V represents the set of all nodes, and v represents the node.
[0074] S102: Taking the initial node as the center, recursively sample its neighboring nodes. The specific steps are as follows:
[0075] First, sample from the direct neighbor nodes of the initial node, then continue sampling from the neighbor nodes of the direct neighbor nodes, and so on, until the sampling depth reaches k.
[0076] S103, obtain the central graph G with radius k ego (u)=(V ego (u), E ego (u)), the central graph includes any node u and all neighboring nodes whose shortest path length to any node u is less than or equal to k.
[0077] The central graph sampling method can effectively capture the structural characteristics of key nodes and their neighboring nodes in the graph, thereby improving the learning ability and generation effect of the model.
[0078] Traditional encoders usually use memory networks such as RNN, LSTM, or GCN, but both networks have limitations. Memory networks are good at processing sequence data and capture information in the sequence through a cyclically connected structure, but the cyclic structure needs to process data in order, which makes the model unable to be calculated in parallel, the training efficiency is limited, and it cannot be applied to large-scale data sets. GCN can effectively capture the spatial relationship between nodes by performing convolution operations on graph data, but GCN is essentially static and cannot handle dynamic graph problems, and GCN has difficulty assigning different weights to node neighbors. In order to solve the problems of these two networks, in this embodiment, the encoder uses a graph self-attention network to encode the central graph. The encoder includes k parallel graph self-attention networks, each of which calculates the aggregated features of the central graph through a multi-head self-attention mechanism, and then outputs them as hidden variables of the central graph through a gating mechanism. The specific process is as follows:
[0079] S201, the feature vector x of the node v in the central graph v , mapped to the hidden layer space R d′×n , get the mapping feature vector h v , where d′ is the target dimension, n is the number of attention heads, and h v =Wx v ;
[0080] S202, calculate the attention coefficient e of each pair of nodes consisting of the edge (u, v) uv , and normalize to get α uv :
[0081] e uv =LeakyReLU(a T [h u ||h v])
[0082]
[0083] Among them, h u and h v are the mapping feature vectors of node u and node v respectively, a is the attention weight of each attention head in the multi-head self-attention mechanism, [·||·] represents vector concatenation, and LeakyReLU is the nonlinear activation function;
[0084] S203, based on normalized attention coefficient α uv Weighted aggregation of the mapping feature vectors of each node’s neighbor nodes to obtain the aggregated features of each node as the output of each attention head;
[0085]
[0086] Among them, σ is a nonlinear activation function;
[0087] S204, concatenate the outputs of all attention heads to obtain the current feature h′ of each node u :
[0088] h′ u =Concat(Head1, ..., Head n )W o
[0089] Among them, Concat means vector concatenation, Head i represents the output of the i-th head in the graph self-attention network, W o represents the output projection matrix;
[0090] S205. Use the gating mechanism to combine the current features and original features of each node to obtain the hidden variable y of the central graph. u :
[0091] y u =σ(W g [h′ u ||x u ||(h′ u -x u )])⊙h′ u +(1-σ(W g [h′ u ||x u ||(h′ u -x u )]))⊙x u
[0092] Among them, W g is the weight matrix, and ⊙ represents element multiplication.
[0093] On the one hand, the multi-head self-attention mechanism can improve the training efficiency of the model while ensuring the quality of the graph data generated by the model, so that the model can efficiently process large-scale graph data. On the other hand, it can enable the model to dynamically allocate different attention weights according to the importance of 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 the complex relationships in the graph data, so that it can effectively aggregate the information of the neighbor nodes and retain the structural characteristics of the original power data as much as possible. In order to further enhance the learning ability of the encoder, this embodiment adds a gating mechanism after each graph self-attention network. The gating mechanism can selectively retain or discard information to control the flow of information, thereby alleviating the gradient disappearance problem and accelerating the convergence of the model. The introduction of the gating mechanism enables the model to maintain a high learning effect when processing graph data with a long span, avoiding the loss of important historical information during the long transmission process, not only ensuring that the model performs well in capturing short-term features, but also being equally efficient when analyzing data with a long span, and improving the model's ability to process complex data. By combining the multi-head self-attention mechanism and the gating mechanism, the model can process large-scale and complex power data more flexibly and effectively.
[0094] The decoder decodes the hidden variables of the central graph through the gated recurrent unit to obtain the score matrix of the central graph. The expression of the score matrix s is as follows:
[0095] s=W o (GRU(y u ,h0))+b o
[0096] Among them, W o is the weight matrix, y u is the central graph hidden variable output by the encoder, h0 is the initial hidden state of the gated recurrent unit, b o is the bias term.
[0097] The goal of the generator is to deceive the discriminator so that the discriminator determines the generated data as real data. The loss function of the generator consists of two parts: one is the adversarial loss, which is used to measure the degree to which the generated data is judged as real data; the other is the reconstruction loss, which is used to improve the quality of the decoder output. In this embodiment, the cross entropy loss is used as the reconstruction loss to ensure the quality of the generated data. The expression of the generator loss function is as follows:
[0098]
[0099] Among them, V s Represents the initial node set of the central graph, n s represents the number of central graphs, Au represents the adjacency matrix of the central graph, P u 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.
[0100] The goal of the discriminator is to accurately distinguish between real data and generated data, aiming to provide effective feedback to guide the optimization of the generator. In this embodiment, the discriminator distinguishes between real data and generated data through a multi-layer perceptron (MLP), which is defined as follows:
[0101]
[0102] in, represents the parameters of MLP, and σ represents the nonlinear activation function.
[0103] The loss function of the discriminator is used to measure the accuracy of the discriminator in distinguishing between real data and generated data. The expression of the loss function is as follows:
[0104]
[0105] Among them, x represents the real data.
[0106] The specific process of the reconstruction module generating the smart grid dynamic data graph is as follows:
[0107] S301. Generate the classification distribution probability of each edge according to the central graph score matrix:
[0108]
[0109] Among them, p(u,v) is the classification distribution probability of edge (u,v), S u,v The final score matrix is obtained by summing up all the central graph score matrices and then averaging the probability of each edge generation.
[0110] S302: Sample the corresponding edges from the classification distribution by sampling without replacement. Specifically, sample from the neighbor node set of node u to determine the edges connected to u. The calculation formula is as follows:
[0111]
[0112] Among them, Cat represents the classification distribution, E u Represents the set of edges adjacent to node u.
[0113] The above process generates corresponding edges using the probability of classification distribution. When the number of generated edges is consistent with the number of edges in the original power data, the generation of static graph data is completed.
[0114] The static graph data generated by the above method is consistent with the structural characteristics of the corresponding power data. The sampling and training process does not consider the timing information, but only the topological information of the data. To verify the effectiveness of the above method, this embodiment conducted the following experiments:
[0115] The model and evaluation scripts are implemented in Python 3.7 and PyTorch 1.8.1 and trained in 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 with 4 heads. The experiments are performed on a machine equipped with Intel(R) Xeon(R) Gold 5220CPU@2.20GHz, 62GB RAM and NVIDIA Tesla V100, 32GB, using one CPU core and one GPU for each algorithm.
[0116] This embodiment uses the Louvain community detection algorithm to evaluate the community structure similarity between the generated graphs and the original graphs of multiple existing models and CPGAN (i.e., the static graph data generation model proposed in the present invention), and the results are shown in Table 1. Due to memory limitations, some baseline models cannot be generated on the experimental data set, and the corresponding data are marked as "OOM" in Table 1. It can be seen from Table 1 that the model CPGAN of the present invention performs best among all baseline models, and has a significant improvement in the ARI indicator (Adjusted Rand Index). The value range of ARI is -1 to 1, and the larger the value, the better the clustering result. Although BTER has the best performance among traditional static graph generation methods (the first 4 baseline models), it is not competitive compared with graph generation models based on deep learning.
[0117] Table 1 Comparison of the ability of models to preserve graph community structure
[0118]
[0119]
[0120] This embodiment also evaluates the quality of generated graphs by multiple existing models and CPGAN (i.e., the static graph data generation model proposed in the present invention), and the results are shown in Table 2, where the first 6 are traditional graph generation models, and the 7th to 12th are graph generation models based on deep learning. As can be seen from Table 2, BTER has the best quality of generated graphs among traditional graph generation models, while the quality of generated graphs by graph generation models based on deep learning is significantly improved compared with traditional graph generation models. The model CPGAN of the present invention has excellent performance in the quality of generated graphs. Specifically, in the Citeseer dataset, CPGAN achieved one-fifth of the best results; in the 3D PointCloud dataset, CPGAN achieved three-fifths of the best results; and in the Google dataset, CPGAN achieved all the best results. On the 3D PointCloud and Google datasets, some baseline models based on deep learning have memory overflows due to excessive spatial complexity, while CPGAN can well balance the quality of generated graphs and model memory usage.
[0121] Table 2 Comparison of model generated graph quality
[0122]
[0123] Example 2
[0124] This embodiment provides an electronic device, including a memory and a processor, wherein the processor is used to execute a program stored in the memory, wherein the program includes a number of instructions and can execute all or part of the steps of the method described in Example 1. The memory includes 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 other media that can store program codes.
[0125] The above description of the embodiments is to facilitate the understanding and use of the invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention 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 invention without departing from the scope of the present invention should be within the scope of protection of the present invention.
Claims
1. A method for generating static graph data of electric power data with structural feature preservation, characterized in that: The following steps are involved: Obtain power data, input the static graph data generation model, and generate corresponding static graph data; The static graph data generation model includes a sampling module, a generative adversarial network and a reconstruction module connected in sequence; wherein the sampling module is used to sample the power data using a central graph sampling method to generate a central graph; The generative adversarial network includes a generator and a discriminator. The generator includes a decoder and an encoder. The encoder is used to encode the central graph through a graph self-attention network constructed based on a multi-head self-attention mechanism to obtain the hidden variables of the central graph; the decoder is used to decode the hidden variables of the central graph to obtain the central graph score matrix; the discriminator is used to distinguish between real data and generated data; The reconstruction module is used to generate the classification distribution probability of each edge according to the central graph score matrix, and then generate static graph data.
2. The method for generating static graph data of power data with structural feature preservation according to claim 1, characterized in that: The generation process of the central graph is as follows: S101, determining an initial node according to input power data; S102, taking the initial node as the center, recursively sampling its neighboring nodes, with a sampling depth of k; S103 , obtaining a central graph with a radius of k, wherein the central graph includes any node u and all neighboring nodes whose shortest path lengths to the node u are less than or equal to k.
3. The method for generating static graph data of electric power data with structural feature preservation according to claim 2, characterized in that: In step S101, the sampling probability of any node in the power data is calculated according to the node degree, and then the initial node is determined.
4. The method for generating static graph data of electric power data with structural feature preservation according to claim 3, characterized in that: The calculation formula for the sampling probability of any node u is as follows: Among them, P(u) represents the sampling probability of node u, deg(·) represents the node degree, V represents the set of all nodes, and v represents the node.
5. The method for generating static graph data of electric power data with structural feature preservation according to claim 1, characterized in that: The encoder includes multiple parallel graph self-attention networks, each of which calculates the aggregated features of the central graph through a multi-head self-attention mechanism, and then outputs them as hidden variables of the central graph through a gating mechanism.
6. The method for generating static graph data of electric power data with structural feature preservation according to claim 5, characterized in that: The generation process of the central graph latent variables is as follows: S201, mapping the feature vector of each node of the central graph to the hidden layer space R d′×n , obtain the mapping feature vector, where d′ is the target dimension and n is the number of attention heads; S202. Calculate the attention coefficient between each node and its neighboring nodes and normalize it: have been uv =LeakyReLU(a T [h u ‖h v ]) Among them, e uv is the attention coefficient of node u and node v, α uv is the normalized attention coefficient, h u and h v are the mapping feature vectors of node u and node v respectively, a is the attention weight of each attention head in the multi-head self-attention mechanism, [·‖·] represents vector concatenation, and LeakyReLU is the nonlinear activation function; S203, based on normalized attention coefficient α uv Weighted aggregation of the mapping feature vectors of each node’s neighbor nodes to obtain the aggregated features of each node as the output of each attention head; Among them, σ is a nonlinear activation function; S204. Concatenate the outputs of all attention heads to obtain the current features of each node: h′ u =Concat(Head1,…,Head n )W o Among them, Concat means vector concatenation, Head i represents the output of the i-th head in the graph self-attention network, W o represents the output projection matrix; S205. Use the gating mechanism to combine the current features and original features of each node to obtain the hidden variable y of the central graph. u : y u =σ(W g [h′ u ‖x u ‖(h′ u -x u )])⊙h′ u +(1σ(W g [h′ u ‖x u ‖(h′ u -x u )]))⊙x u Among them, W g is the weight matrix, and ⊙ represents element multiplication.
7. The method for generating static graph data of electric power data with structural feature preservation according to claim 1, characterized in that: The decoder decodes the hidden variables of the central graph through a gated recurrent unit to obtain a score matrix of the central graph. The expression of the score matrix is as follows: s=W o (GRU(y u ,h0))+b o Among them, s is the score matrix, W o is the weight matrix, y u is the central graph hidden variable output by the encoder, h0 is the initial hidden state of the gated recurrent unit, b o is the bias term.
8. The method for generating static graph data of electric power data with structural feature preservation according to claim 1, characterized in that: The discriminator distinguishes between real data and generated data through a multi-layer perceptron.
9. The method for generating static graph data of electric power data with structural feature preservation according to claim 1, characterized in that: The generative adversarial network is optimized by minimizing the loss function, which includes a generator loss function and a discriminator loss function. The expression of the generator loss function is as follows: Among them, V s Represents the initial node set of the central graph, n s represents the number of central graphs, A u represents the adjacency matrix of the central graph, P u 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; The expression of the discriminator loss function is as follows: Among them, x represents the real data.
10. The method for generating static graph data of electric power data with structural feature preservation according to claim 1, characterized in that: The specific process of generating the smart grid dynamic data graph by the reconstruction module is as follows: S301. Generate the classification distribution probability of each edge according to the central graph score matrix: Among them, p(u,v) is the classification distribution probability of edge (u,v), S u, is the final score matrix, which is obtained by summing up all the central graph score matrices and then averaging the probability of each edge generation; S302: Generate corresponding edges using the probability of classification distribution. When the number of generated edges is consistent with the number of edges in the original power data, the generation of static graph data is completed.
Citation Information
Patent Citations
Deep map attentive adversarial variation automatic encoder training method and system
CN113361606A
Large-scale graph generation method based on deep adversarial learning
CN115879507A
Wind power extreme scene generation method based on conditional generative adversarial network
CN117350161A
