A method for generating static graph data of power data with structural feature preservation

By combining the sampling module, generative adversarial network and reconstruction module, and utilizing the graph self-attention network encoder with multi-head self-attention mechanism and gating mechanism, the problems of low static image generation efficiency and insufficient feature preservation in the existing technology are solved, and efficient and high-quality static image data generation is achieved.

CN119179802BActive Publication Date: 2025-09-12STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411129516.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2025-09-12
Estimated Expiration
2044-08-16

AI Technical Summary

Technical Problem

Existing static graph generation methods have difficulty in effectively maintaining the structural characteristics of the original data when processing power data, and the generation efficiency is low. In particular, the computational complexity is high when processing large-scale graph data, and parallel processing is impossible.

Method used

A static graph data generation method including a sampling module, a generative adversarial network and a reconstruction module is adopted. The graph self-attention network encoder with a multi-head self-attention mechanism and a gating mechanism is used to generate a central graph and generate static graph data through a decoder, and the generator and discriminator are combined for optimization.

Benefits of technology

It improves the efficiency and quality of static graph data generation, can effectively preserve the structural characteristics of the original power data, adapt to large-scale complex data processing, reduce the gradient disappearance problem, and enhance the learning ability and generation effect of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179802B_ABST
    Figure CN119179802B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for generating static graph data of electric power data with structural feature preservation, comprising the following steps: obtaining electric power data, inputting a static graph data generation model into the model, and generating corresponding static graph data; the static graph data generation model comprises a sampling module, a generative adversarial network, and a reconstruction module connected in sequence; wherein the sampling module is used to sample the electric power data using a central graph sampling method to generate a central 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 central graph using a graph self-attention network constructed based on a multi-head self-attention mechanism; the decoder is used to decode the output of the encoder to obtain a central graph score matrix; and the reconstruction module is used to generate static graph data based on the central graph score matrix. Compared with the prior art, the present invention can preserve the structural features of the original electric power data as much as possible while improving the efficiency of generating static graph data.
Need to check novelty before this filing date? Find Prior Art

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 preserved structural features. Background Art

[0002] Power data involves a large amount of security information and is not suitable for direct use. Instead, graph generation technology is used to desensitize the data, generating simulated data with a similar topological structure to the original data. This desensitized simulated data can then be used for power system analysis and research. Therefore, generating high-quality graph data while preserving 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 existing static graph data generation technologies have made some progress, they still face challenges in terms of training efficiency and preserving graph structure features. 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 distributions, small diameters, and local clustering. Traditional graph generators include ER, BA, WS, BTER, and Kronecker. While these methods have a solid theoretical foundation, they are limited by their structure and often struggle to accurately generate graph data with a similar topological structure to the original data when processing complex and variable power data. Furthermore, these methods rely on pre-set structural assumptions, and their performance often degrades significantly when encountering new graph sets that do not conform to these assumptions.

[0006] (2) Static graph generation method based on autoregression

[0007] Autoregressive graph generation methods decompose the graph generation process into a series of sequential decisions, each of which depends on the previous ones. The complete graph structure is constructed by gradually generating nodes and edges. GraphRNN, a typical autoregressive graph generation model, consists of two components: a graph-level RNN and an edge-level RNN. The graph-level RNN is used to store already generated nodes and generate new nodes, while the edge-level RNN is used to store information about new nodes and infer whether to generate new edges based on the relationships between nodes. However, because the generation process depends on the order of nodes and edges, the model is not permutation-invariant. Furthermore, because GraphRNN's generation process is step-by-step, with each step dependent on the previous step's generation results, 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] A variational autoencoder is a generative model based on unsupervised learning. It consists of an encoder and a decoder. The encoder maps input data into a latent space, encoding the graph's structure and node information as latent variables. The decoder samples the latent variables from the latent space and decodes them to generate a new graph. The model assumes that the latent variables follow a known prior distribution and uses variational inference techniques to learn the distribution of the latent variables, approximating the true posterior distribution by maximizing the variational lower bound. GraphVAE is a graph generation model based on VAE. Its encoder uses a GCN to embed the input graph into a continuous feature space, while the decoder uses a multi-layer perceptron (MLP) to output a probabilistic fully connected graph with the maximum number of nodes at once. Because the generated and ground-truth graphs do not have a specified node order, GraphVAE uses an approximate graph matching algorithm to align the nodes of the generated and ground-truth graphs to calculate the difference between the generated and ground-truth graphs in order to compute the reconstruction loss. However, this graph matching algorithm has a high time complexity, making it difficult for the model 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 a generator and a discriminator. NetGAN is a classic static graph generation model based on GANs. It uses a biased second-order strategy to sample random walk sequences. This strategy maintains node permutation invariance while effectively exploiting the sparsity of real-world networks. NetGAN's generator uses a long short-term memory (LSTM) network to learn and generate the next node one by one, generating a complete random walk sequence through an iterative process. The discriminator uses another LSTM to process these node sequences, learning the characteristics of real random walk sequences and determining their authenticity. After training, the generator generates random walk sequences multiple times, which are then converted into complete graphs using a graph reconstruction algorithm. Although NetGAN achieves excellent performance in generated graphs, the model's use of LSTM for sequence generation and discrimination results in high computational complexity. When processing large-scale graphs and long sequences, the computational efficiency and memory requirements of LSTM can become bottlenecks, limiting the model's scalability.

[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, thereby retaining the structural features of the original power data as much as possible and improving 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 latent variables of the central graph; the decoder is used to decode the latent 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 process of generating the central graph is 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 : Obtain a central graph with a radius of k, where 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] Where 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 The mapping feature vectors of the neighboring nodes of each node are weighted and aggregated 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-wise 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 real data from generated data through a multi-layer perceptron.

[0048] Furthermore, the generative adversarial network is optimized by minimizing a loss function, which includes a generator loss function and a discriminator loss function. The expression of the generator loss function is 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 the classification distribution. When the number of generated edges is consistent with the number of edges in the original power data, the generation of the 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 several 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 neighboring 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 latent variables of the central graph, and the decoder is used to decode the latent 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 large amounts 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 the reconstruction module, and then takes the average of the probabilities generated by each edge to obtain the final score matrix, and generates the classification distribution of 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 Generate a schematic diagram of the structure of the model for static graph data. DETAILED DESCRIPTION

[0064] The present invention is described in detail below with reference to 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 and generate simulated data with a similar topological structure to the original data. Then, the power system analysis and research are carried out based on the desensitized simulated data. This embodiment provides a method for generating static graph data of power data with preserved structural features. It generates corresponding static graph data based on power data that does not have time series, which 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, the system includes a sampling module, a generative adversarial network, and a reconstruction module, which are connected in sequence. The sampling module uses a central graph sampling method to sample power data and generate a central graph. The generative adversarial network includes a generator and a discriminator. The discriminator distinguishes between real data and generated data. The generator includes a decoder and an encoder. The encoder encodes the central graph using a graph self-attention network built based on a multi-head self-attention mechanism to obtain the latent variables of the central graph. The decoder decodes the latent variables of the central graph to obtain the central graph score matrix. The reconstruction module generates the classification distribution probability of each edge based on the central graph score matrix, thereby generating 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 based on the node degree, and selects the node with a higher degree as the initial node. For any node u, the calculation formula for the sampling probability is as follows:

[0072]

[0073] Where 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 immediate neighbor nodes of the initial node, then continue sampling from the immediate neighbor nodes' neighbor nodes, and so on, until the sampling depth is 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, 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 sequential data and capturing information in the sequence through a cyclically connected structure, but the cyclic structure requires processing data in sequence, 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 it is difficult for GCN to assign 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 graph self-attention network 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. 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 , obtain 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 (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 The mapping feature vectors of the neighboring nodes of each node are weighted and aggregated 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-wise multiplication.

[0093] The multi-head self-attention mechanism improves model training efficiency while ensuring the quality of the graph data generated by the model, enabling the model to efficiently process large-scale graph data. Furthermore, it enables the model to dynamically assign different attention weights based on the importance of neighboring nodes. This dynamic weight allocation allows the model to focus on key nodes in the graph data and flexibly handle complex relationships within the graph data, effectively aggregating information from neighboring nodes while preserving the structural characteristics of the original power data as much as possible. To further enhance the learning capability of the encoder, this embodiment adds a gating mechanism after each graph self-attention network. This gating mechanism selectively retains or discards information to control the flow of information, thereby alleviating the vanishing gradient problem and accelerating model convergence. The introduction of the gating mechanism enables the model to maintain high learning performance when processing long-span graph data, preventing the loss of important historical information during long-term transmission. This ensures that the model not only excels in capturing short-term features but also remains efficient when analyzing long-span data, improving the model's ability to process complex data. By combining the multi-head self-attention mechanism with the gating mechanism, the model can more flexibly and effectively process large-scale, complex power data.

[0094] The decoder decodes the latent 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 it identifies the generated data as real data. The generator's loss function consists of two parts: one is the adversarial loss, which measures the degree to which the generated data is identified as real data; the other is the reconstruction loss, which improves the quality of the decoder output. In this embodiment, 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 using 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 real data from 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 generated by each edge.

[0110] S302: Sample the corresponding edges from the categorical distribution by sampling without replacement. Specifically, sample from the set of neighboring nodes 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 uses the probability of classification distribution to generate corresponding edges. 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 time series 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 were implemented using Python 3.7 and PyTorch 1.8.1, and trained in a CUDA-11.1 environment. The model was trained for 800 batches with a learning rate of 0.0003 and weight decay of 1e-6. The attention network consisted of four heads. Experiments were conducted on a machine equipped with an Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz, 62GB of RAM, and an NVIDIA Tesla V100 with 32GB of RAM, 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). The results are shown in Table 1. Due to memory limitations, some baseline models cannot be generated on the experimental dataset, and the corresponding data are marked as "OOM" in Table 1. As can be seen from Table 1, the model CPGAN of the present invention performs best among all baseline models, with 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 performs best among traditional static graph generation methods (the first four 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). 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 generated graph quality among traditional graph generation models, while the quality of generated graphs by graph generation models based on deep learning is significantly improved compared to traditional graph generation models. The model CPGAN of the present invention has excellent performance in generated graph quality. 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 experienced memory overflow due to excessive spatial complexity, while CPGAN was able to strike a good balance between generated graph quality and model memory usage.

[0121] Table 2 Comparison of model generated image quality

[0122]

[0123] Example 2

[0124] This embodiment provides an electronic device comprising a memory and a processor, wherein the processor is configured to execute a program stored in the memory, wherein the program comprises a number of instructions and can execute all or part of the steps of the method described in Example 1. The memory comprises a computer-readable storage medium, which can specifically be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, among other media capable of storing program code.

[0125] The above description of the embodiments is intended to facilitate understanding and use of the invention by those skilled in the art. It will be apparent that those skilled in the art can readily make various modifications to these embodiments and apply the general principles described herein to other embodiments without requiring inventive effort. Therefore, the present invention is not limited to the above-described embodiments. 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 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 latent variables of the central graph; the decoder is used to decode the latent 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, thereby generating static graph data; The generative adversarial network is optimized by minimizing the loss function, which includes the generator loss function and the 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, z 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; The specific process of the reconstruction module generating the smart grid dynamic data graph 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,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; S302 : Generate corresponding edges using the probability of the classification distribution. When the number of generated edges is consistent with the number of edges in the original power data, the generation of the static graph data is completed.

2. The method for generating static graph data of power data with structural feature preservation according to claim 1, characterized in that: The process of generating 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 : Obtain a central graph with a radius of k, where 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 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 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: Where 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 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 latent variables of the central graph through a gating mechanism.

6. The method for generating static graph data of 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 The mapping feature vectors of the neighboring nodes of each node are weighted and aggregated 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 #W g is the weight matrix, ⊙ represents element multiplication, x u Represents the original features of node u.

7. The method for generating static graph data of power data with structural feature preservation according to claim 1, characterized in that: 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: 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 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.

Citation Information

Patent Citations

  • Large-scale graph generation method based on deep adversarial learning

    CN115879507A

  • Wind power extreme scene generation method based on conditional generative adversarial network

    CN117350161A