Quantum walk and quantum thermodynamics based power grid dynamic knowledge graph link prediction method
Through the grid dynamic knowledge graph link prediction method of quantum roaming and quantum thermodynamics, the problem of insufficient utilization of tense information in the diagnosis of defects of main equipment of the power system is solved, and more accurate and real-time fault prediction is achieved, which improves the stability of the power grid and Security.
Patent Information
- Application Number
- CN202411132667.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-08-19
AI Technical Summary
In the diagnosis of defects of main equipment of power systems, it is difficult to effectively use dynamic diagrams to characterize tense information, ignoring the equipment environment and fault correlation, resulting in inaccurate and real-time diagnosis.
Using quantum roaming and quantum thermodynamics' dynamic knowledge graph link prediction method, the grid is constructed and the grid equipment is captured through the quantum migration perception encoder and the hybrid expert model decoder, combined with the graph attention network and multi-layer perception machine. Dynamic changes and fault correlation enable efficient link prediction.
This method not only considers the current status of the equipment, but also effectively characterizes tense information, improves the accuracy and real-time prediction of grid equipment faults, and enhances the stability and safety of the power grid.
Smart Images

Figure CN118657256B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power system main equipment defect diagnosis and dynamic graph representation learning, and in particular to a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method. Background Art
[0002] The power system is the key to maintaining modern production and life, and its stable operation is directly related to the normal operation of society and economic development. Main equipment defects are one of the main factors threatening the stable operation of the power system. Once key equipment such as transformers, generators, and reactors fail, it will not only cause power supply interruptions, but may also cause more serious secondary disasters. Therefore, timely and accurate diagnosis of main equipment defects is particularly important. However, main equipment often has complex structures, many components, and cumbersome inspection and daily maintenance work. Its defect analysis and diagnosis are not only affected by the current status of the equipment, but also need to consider the equipment's operation and maintenance records and other temporal information. Although the existing main equipment defect diagnosis methods have achieved certain results, they often only rely on the current status of the equipment, ignoring the complex environment in which the equipment is located and the correlation between faults, and it is difficult to cope with more complex situations. In addition, quantum walks are a simulation of a quantum state of random walks, which are often used to measure the relationship between static graph nodes, but have not been used to characterize dynamic graphs before. These problems limit the reliability and safety of the power system, and new technologies and methods are urgently needed to improve the effectiveness and accuracy of main equipment defect diagnosis.
[0003] A dynamic graph is a graph model used to describe the changes of nodes and edges in a dynamic system over time. Unlike traditional static graphs, temporal graphs introduce a time dimension into the structure of the graph, which can reflect the topological changes and relationship evolution of the system at different time points. Typical dynamic graphs include social networks, citation networks, transportation networks, disease transmission networks, etc. There are natural topological relationships between power grid devices. Converting power equipment into graphs can effectively capture the associations between devices, help analyze the defect associations between different devices, identify whether certain defects are propagable or whether they will cause failures in other devices, and improve the overall fault prediction ability of the system. The introduction of timing information can accurately track the occurrence time of each defect, help analyze the time distribution and evolution of faults, identify potential periodic problems or high-incidence defects in a specific time period, reflect the dynamic changes of defects in the power system, provide a basis for real-time monitoring and analysis, and help operation and maintenance personnel take preventive and repair measures in time to avoid further expansion of faults.
[0004] Graph neural networks and structural learning are the two basic methods of dynamic graph representation learning: the former is based on graph neural networks and models node representation through neighbor node aggregation and temporal encoding; the latter focuses on learning the temporal structure of the network, which can achieve better representation results, but because the random walk process is difficult to accelerate, it often leads to higher time overhead. In actual production, the operation of the power system is a long-term process. As time goes by, the amount of data in the dynamic graph will grow rapidly, causing a surge in the number of neighbor nodes, making the training and operation of traditional graph neural networks face greater pressure. In addition, the power scenario requires real-time defect analysis and diagnosis, making the structural learning method based on temporal random walk unsustainable. How to deal with the problem of data expansion and ensure the real-time and effectiveness of defect diagnosis is the key to using dynamic graph representation learning to realize main equipment defect diagnosis. Summary of the invention
[0005] To this end, an embodiment of the present invention provides a method and system for predicting links in a power grid dynamic knowledge graph based on quantum walks and quantum thermodynamics, which is used to solve the problems in the prior art that the current state of the device is only relied on, the device environment and fault association are ignored, it is difficult to deal with complex situations, and dynamic graphs are not effectively used to characterize temporal information.
[0006] In order to solve the above problems, an embodiment of the present invention provides a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method, the method comprising:
[0007] Collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, build a data set, and divide the data set into a training set and a test set;
[0008] Constructing a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder;
[0009] The quantum migration-aware encoder is used to perform subgraph sampling based on a dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node; based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node; based on the subgraph structure and the quantum bias value, a graph attention network is used to aggregate information from neighboring nodes, and quantum bias is introduced to adjust the attention weight to obtain an updated embedding of the central node;
[0010] The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous time data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained;
[0011] Use the training set data to train the model, optimize the model parameters through the back propagation algorithm, and obtain the trained model;
[0012] Use the test set to evaluate the trained model.
[0013] Preferably, the dynamic knowledge graph is a quadruple arranged in chronological order, and the form of the quadruple includes a head entity, a relationship, a tail entity, and time; the entities are power grid equipment and faults, the edges are between the power grid equipment and the faults, and the quadruple represents that a certain fault occurred in a certain power grid equipment at a certain time.
[0014] Preferably, the method for performing subgraph sampling based on the dynamic knowledge graph and taking the node to be inferred currently as the central node is:
[0015] Based on the dynamic knowledge graph, subgraph sampling is performed with the node to be inferred as the central node. The sampling range is within the k-step range of the central node. The sampling has a fixed upper limit, and edges that appear later are prioritized.
[0016] Preferably, the quantum walk is performed on the subgraph based on the subgraph structure to calculate the quantum bias value from the central node to each node, specifically including:
[0017] Based on the subgraph structure, a virtual self-loop is added to the sampled subgraph to calculate the quantum bias value from the central node to other sampled nodes. The virtual self-loop means that when inferring possible edges, an edge pointing to the central node is added to the central node, and the time is the inference time. The quantum bias value is defined as the average probability that the quantum can be observed at each node of the subgraph after a sufficiently long time from the central node. The calculation formula is:
[0018]
[0019] in, is the system Hamiltonian matrix, and λ 1 ,λ 2 ,…,λ n is the n different eigenvalues of the Hamiltonian matrix, P i is the sum of the characteristic matrices with the same eigenvalue; T1 is the time upper limit; t is an unspecified time; U(t) and U(-t) are the quantum conjugate matrices at time t; Q(t) is the probability matrix of quantum starting from different nodes being observed at the node at time t;
[0020] After calculating the quantum bias matrix Q, the quantum bias value of the central node relative to other nodes can be obtained according to the sequence number of the central node.
[0021] Preferably, based on the subgraph structure and the quantum bias value, the graph attention network is used to aggregate information from neighbor nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node, which specifically includes:
[0022] Based on the subgraph structure, the attention value of the central node compared to the neighboring nodes is calculated. First, the original feature-based attention value is calculated by the graph attention network method, and then the quantum bias value calculated in the previous step is added to calculate it by the following formula:
[0023]
[0024] in, is the matrix transpose symbol; is the quantum bias value; is the quantum bias value of node u relative to node v; It is the subgraph sampled with u as the central node at time t; is the value of the central node after the embedding linear change; d h is the embedding dimension, which is used to scale the attention value so that it is not too sparse; and It is the value after the linear change of the embedding of the central node, neighboring nodes and edges connecting the central node. The calculation process is as follows:
[0025]
[0026] Among them, ||·|| is a concatenation operation that merges multiple vectors into a longer vector; φ(·) is a time coding model based on trigonometric functions; is at k At this moment, the total number of edges between u and v; is the node embedding of layer l-1; t q is the time at which the inference occurs; t k is the timestamp of the selected edge, that is, the time when the corresponding time occurs; W q and W K is the parameter projection matrix;
[0027] Nodes aggregate neighbor information, the formula is as follows:
[0028]
[0029] Among them, V v (t) is the embedding of the edge connecting the neighbor node to the central node; softmax(·) is the softmax activation function; is the updated node embedding of layer l; Represents the set of neighbor nodes of the central node v;
[0030] Finally, a multi-layer perceptron network is used to fuse the aggregation of neighbor information and the historical embedding of the node itself to generate the final node embedding. The formula is as follows:
[0031]
[0032] Among them, MLP (||) is a multi-layer perceptron; is the node embedding of layer l.
[0033] Preferably, the continuous time data of the dynamic knowledge graph is used to calculate the global evolution characteristics of the dynamic knowledge graph, specifically including:
[0034] Assuming that the dynamic knowledge graph system is a system with constant volume, we get Where T is the temperature, U represents the energy of the system, and S represents the entropy of the system; the von Neumann entropy is used as the entropy of the system, and the von Neumann entropy is calculated by an approximate calculation method. The calculation formula is as follows:
[0035]
[0036] Where V is the number of nodes; S VN is the von Neumann entropy; d u d v Respectively represent the degree of nodes u and v, that is, the number of edges connected to nodes u and v; E represents all the edges contained in the dynamic knowledge graph at the current moment; it is approximately considered that the scale of the dynamic knowledge graph represents the energy of the graph, expressed as U = a·|E|, where a is a constant; determine two moments, and calculate the quantum thermodynamic temperature by calculating the changes in entropy and energy at the two moments
[0037] By using different times, multiple quantum thermodynamic temperatures are obtained. They reflect the changing trend of the current network state compared with the previous network state from different angles, and constitute the global evolution characteristics of the dynamic knowledge graph at the current moment, which are expressed as follows:
[0038] T M =[T 1 ,T 2 ,…,T n ];
[0039] Among them, T M is the global evolution feature, T 1 ,T 2 ,…,T n Represents the temperature values at different angles.
[0040] Preferably, the prediction results of possible future edges are obtained based on the embedding of the central node, the edge connection time, and the global evolution characteristics, and specifically include:
[0041] A multi-layer perceptron is selected as the sub-decoder. Based on the embedding of the central node and the edge time, the sub-decoder predicts whether a given node will have a corresponding connection with the head node at this time.
[0042] Based on the global evolution characteristics, the expert mixture model is used to generate corresponding weights for different sub-decoders. Finally, the weighted sum of the results of all sub-decoders is used to obtain the prediction results of the edges that may exist in the future. The decoding process is expressed as follows:
[0043]
[0044] α=softmax(T M W d );
[0045] Among them, score(u,v) represents the probability score of the connection; h v 、h u Respectively represent the embedding of central nodes u and v; N e is the number of experts; T M is the global evolution feature; W d is the projection parameter matrix; α is the normalized weight, which represents the importance of the expert to the expert in judging whether this connection exists or not; MLP i (,) is a multi-layer perceptron; softmax(·) is a softmax activation function.
[0046] The embodiment of the present invention further provides a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system, which is used to implement the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method described above, specifically including:
[0047] The data collection and division module is used to collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, build a data set, and divide the data set into a training set and a test set;
[0048] A model building module, used to build a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, wherein the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder;
[0049] The quantum migration-aware encoder is used to perform subgraph sampling based on a dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node; based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node; based on the subgraph structure and the quantum bias value, a graph attention network is used to aggregate information from neighboring nodes, and quantum bias is introduced to adjust the attention weight to obtain an updated embedding of the central node;
[0050] The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous time data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained;
[0051] The model training module is used to train the model using the training set data and optimize the model parameters through the back propagation algorithm to obtain a trained model;
[0052] The model evaluation module is used to evaluate the trained model using the test set.
[0053] An embodiment of the present invention also provides an electronic device, comprising a processor, a memory and a bus system, wherein the processor and the memory are connected through the bus system, the memory is used to store instructions, and the processor is used to execute the instructions stored in the memory to implement the above-mentioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method.
[0054] An embodiment of the present invention also provides a computer storage medium, which stores a computer software product. The computer software product includes several instructions for enabling a computer device to execute the above-mentioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method.
[0055] It can be seen from the above technical solutions that the present invention has the following beneficial effects:
[0056] (1) The present invention not only considers the current status of power grid equipment, but also effectively characterizes temporal information through dynamic knowledge graphs, including the connection relationship and timestamp of the equipment, so that the model can capture the dynamic change characteristics of the power grid.
[0057] (2) This invention uses quantum walks to calculate the degree of association between a node and its neighboring nodes in the graph topology, providing a new method for measuring the relationship between nodes in a dynamic knowledge graph. At the same time, the introduction of quantum thermodynamic temperature as a dynamic knowledge graph evolution feature provides a new perspective for dynamic knowledge graph link prediction.
[0058] (3) The present invention builds a prediction model based on the encoder-decoder structure. The encoder effectively extracts and aggregates information from the subgraph through quantum walks and graph attention networks to obtain updated embeddings of the central nodes. The decoder uses global evolution features and the embeddings of the central nodes to accurately predict possible future edges and achieve efficient link prediction.
[0059] (4) The present invention is particularly suitable for predicting possible future failures of power grid equipment, which helps power grid workers to check the status of equipment in a timely manner, take preventive measures, and improve the stability and safety of the power grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the implementation cases of the present invention or the technical solutions in the prior art, the following is a brief description of the drawings required for use in the embodiments. By referring to the drawings, the features and advantages of the present invention will be more clearly understood. The drawings are schematic and should not be understood as limiting the present invention in any way. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0061] Figure 1 A flowchart of a method for predicting links in a power grid dynamic knowledge graph of quantum walk and quantum thermodynamics provided in an embodiment;
[0062] Figure 2 A model architecture diagram based on an encoder-decoder structure in an embodiment;
[0063] Figure 3 The link prediction accuracy of the present invention on four knowledge graphs in the embodiment and the comparison with other methods;
[0064] Figure 4 A block diagram of a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system provided in an embodiment. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0066] Embodiment 1
[0067] like Figure 1 As shown, an embodiment of the present invention proposes a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method, the method comprising:
[0068] Step S1: Collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, construct a data set, and divide the data set into a training set and a test set;
[0069] Step S2: constructing a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, wherein the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder;
[0070] The quantum migration-aware encoder is used to sample subgraphs based on the dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node. Based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node. Based on the subgraph structure and the quantum bias value, the graph attention network is used to aggregate information from neighboring nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node.
[0071] The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous moment data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained;
[0072] Step S3: Use the training set data to train the model, optimize the model parameters through the back propagation algorithm, and obtain a trained model;
[0073] Step S4: Use the test set to evaluate the trained model.
[0074] It can be seen from the above technical scheme that the present invention provides a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method. First, by collecting relevant data of the power grid dynamic knowledge graph and constructing a data set, the present invention can comprehensively capture the status, connection relationship and timestamp information of the power grid equipment, providing a rich and accurate data basis for subsequent predictions. Secondly, by constructing a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, the present invention adopts an innovative method to measure the relationship between nodes and introduces global evolution characteristics, thereby improving the accuracy of the prediction. Then, in the model training process, the back propagation algorithm is used to optimize the model parameters to ensure that the model can learn the deep laws in the data. Finally, by evaluating the trained model, the present invention not only verifies its prediction performance, but also demonstrates its potential and value in practical applications. In summary, the present invention provides an efficient and accurate new method for link prediction of the power grid dynamic knowledge graph through the comprehensive application of four steps, which helps to improve the fault prediction and prevention capabilities of power grid equipment.
[0075] In this embodiment, in step S1, relevant data of the power grid dynamic knowledge graph is collected, including the status, connection relationship, and timestamp of the power grid equipment, a data set is constructed, and the data set is divided into a training set and a test set. The dynamic knowledge graph is defined as: the dynamic knowledge graph is a knowledge graph with time on the edge, which represents that a certain event occurred between nodes at a certain time, a certain interaction occurred, or a certain relationship was generated. In this embodiment, the dynamic knowledge graph is a quadruple arranged in chronological order, and the form of the quadruple is (head entity, relationship, tail entity, time). The entity is the power grid equipment and fault, the edge is between the power grid equipment and the fault, and the quadruple represents that a certain fault occurred in a certain power grid equipment at a certain time. The method of data collection is to collect the fault data of power grid operation and maintenance, extract the equipment and fault events and their occurrence time, (appropriately abstract the fault event) and arrange them by time to obtain the original data.
[0076] In this embodiment, in step S2, a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics is constructed. Figure 2 As shown, the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder. The quantum migration-aware encoder is used to sample subgraphs based on the dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node; based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node; based on the subgraph structure and the quantum bias value, the graph attention network is used to aggregate information from neighboring nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node. The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous moment data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained.
[0077] Specifically, based on the dynamic knowledge graph, subgraph sampling is performed with the node to be inferred as the central node. As the basic local structure of quantum walks, subgraphs can reduce time complexity. The sampling range is within the k-step range of the central node (k-step node means that the central node can reach the node through at most k walks on the edge. For example, in a relationship ABC, A is the center and can reach C through two steps of walks (A->B; B->C), so C is within the 2-step range of A), and the sampling has a fixed upper limit. At the same time, edges that appear later are sampled first, and more consideration of recently added edges can allow the model to consider the recent topological structure of the dynamic knowledge graph.
[0078] Furthermore, based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias values from the central node to each node, specifically including:
[0079] Based on the subgraph structure, a virtual self-loop is added to the sampled subgraph to calculate the quantum bias value from the central node to other sampled nodes. The virtual self-loop means that when inferring possible edges, an edge pointing to the central node is added to the central node, and the time is the inference time (that is, now). The quantum bias value is defined as the average probability that the quantum can be observed at each node of the subgraph after a sufficiently long time from the central node. The calculation formula is:
[0080]
[0081] in, is the system Hamiltonian matrix, and λ 1 ,λ 2 ,…,λ n is the n different eigenvalues of the Hamiltonian matrix, P i is the sum of characteristic matrices with the same eigenvalues; T1 is the time upper limit; t is an unspecified time; U(t) and U(-t) are the quantum conjugate matrices at time t; Q(t) is the probability matrix of quantum starting from different nodes being observed at the node at time t.
[0082] After calculating the quantum bias matrix Q, the quantum bias value of the central node relative to other nodes can be obtained according to the sequence number of the central node.
[0083] Furthermore, based on the subgraph structure and quantum bias value, the Graph Attention Network (GAT) is used to aggregate information from neighboring nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node, including:
[0084] Based on the subgraph structure, the attention value of the central node compared to the neighboring nodes is calculated. First, the original feature-based attention value is calculated by the graph attention network method, and then the quantum bias value calculated in the previous step is added to calculate it by the following formula:
[0085]
[0086] in, is the matrix transpose symbol; is the quantum bias value; is the quantum bias value of node u relative to node v; It is the subgraph sampled with u as the central node at time t; is the value of the central node after the embedding linear change; d h is the embedding dimension, which is used to scale the attention value so that it is not too sparse; and It is the value after the linear change of the embedding of the central node, neighboring nodes and edges connecting the central node. The calculation process is as follows:
[0087]
[0088] Among them, ||·|| is a concatenation operation that merges multiple vectors into a longer vector; φ(·) is a time coding model based on trigonometric functions; is at k At this moment, the total number of edges between u and v; is the node embedding of layer l-1; t q is the time at which the inference occurs; t k is the timestamp of the selected edge, that is, the time when the corresponding time occurs; W q and W K is the parameter projection matrix.
[0089] Nodes aggregate neighbor information, the formula is as follows:
[0090]
[0091] Among them, V v (t) is the embedding of the edge connecting the neighbor node to the central node; softmax(·) is the softmax activation function; is the updated node embedding of layer l; Represents the set of neighbor nodes of the central node v.
[0092] Finally, a multi-layer perceptron network is used to fuse the aggregation of neighbor information and the historical embedding of the node itself to generate the final node embedding. The formula is as follows:
[0093]
[0094] Among them, MLP (||) is a multi-layer perceptron; is the node embedding of layer l.
[0095] Furthermore, based on the continuous time data of the dynamic knowledge graph, the global evolution characteristics of the dynamic knowledge graph are calculated, including:
[0096] The present invention represents the global evolution state of the dynamic knowledge graph by calculating the quantum thermodynamic temperature on the graph. First, assuming that the dynamic knowledge graph system is a system with constant volume, we get Where T is temperature, U represents the energy of the system, and S represents the entropy of the system. The present invention adopts von Neumann entropy as the entropy of the system, and uses an approximate calculation method to calculate the von Neumann entropy. The calculation formula is as follows:
[0097]
[0098] Where V is the number of nodes; S VN is the von Neumann entropy; d u ,d v Respectively represent the degree of nodes u and v, that is, the number of edges connected to nodes u and v; E represents all the edges contained in the dynamic knowledge graph at the current moment; it is approximately considered that the scale of the dynamic knowledge graph represents the energy of the graph, expressed as U = a·|E|, where a is a constant; determine two moments, and calculate the quantum thermodynamic temperature by calculating the changes in entropy and energy at the two moments
[0099] Finally, by using different times, multiple quantum thermodynamic temperatures are obtained. They reflect the changing trend of the current network state compared with the previous network state from different angles, and constitute the global evolution characteristics of the dynamic knowledge graph at the current moment, which are expressed as follows:
[0100] T M =[T 1 ,T 2 ,…,T n ];
[0101] Among them, T M is the global evolution feature, T 1 ,T 2 ,…,T n Represents the temperature values at different angles.
[0102] Furthermore, based on the embedding of the central node, the edge connection time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained, including:
[0103] A multi-layer perceptron is selected as the sub-decoder. Based on the embedding of the central node and the edge time, the sub-decoder predicts whether a given node will have a corresponding connection with the head node at this time.
[0104] Based on the global evolution characteristics, the Mixture of Experts (MOE) model is used to generate corresponding weights for different sub-decoders. Finally, the weighted sum of the results of all sub-decoders is used to obtain the prediction results of the edges that may exist in the future. The decoding process is expressed as follows:
[0105]
[0106] α=softmax(T M W d );
[0107] Among them, score(u,v) represents the probability score of the connection; h v 、h uRespectively represent the embedding of central nodes u and v; N e is the number of experts; T M is the global evolution feature; W d is the projection parameter matrix; α is the normalized weight, which represents the importance of the expert to the expert in judging whether this connection exists or not; MLP i (,) is a multi-layer perceptron; softmax(·) is a softmax activation function.
[0108] In this embodiment, in step S3, the model is trained using the training set data, and the model parameters are optimized by the back propagation algorithm to obtain a trained model.
[0109] In this embodiment, in step S4, the trained model is evaluated using the test set. Figure 3 As shown, this implementation verifies the method of the present invention on 4 data, among which Wikipedia and MathOverflow are data sets containing corresponding data of power grids. We evaluate the accuracy of the model from two aspects. The derivation formula represents that in the process of connecting between reasoning nodes, both the head node and the tail node have appeared in the training stage, while the induction formula represents that at least one of the head node and the tail node has not appeared in the training stage. In short, the induction formula is a more stringent reasoning condition than the derivation formula, because at least one node has not appeared in the training stage, and information such as node embedding is in the initial state and has not been adjusted, which tests the generalization ability of the model even more. The experimental results show that the model constructed by the present invention surpasses all other methods in the derivation formula setting, with accuracy rates of 94.67, 93.50, 94.91, and 98.78, respectively, and also exceeds or is comparable to other methods in the induction formula setting.
[0110] Embodiment 2
[0111] like Figure 4 As shown, the present invention provides a quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system, which is used to implement the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method of the above-mentioned embodiment 1, specifically comprising:
[0112] The data collection and division module 100 is used to collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, construct a data set, and divide the data set into a training set and a test set;
[0113] A model building module 200 is used to build a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, the model includes a quantum migration perception encoder and a temperature perception hybrid expert model decoder;
[0114] The quantum migration-aware encoder is used to sample subgraphs based on the dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node. Based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node. Based on the subgraph structure and the quantum bias value, the graph attention network is used to aggregate information from neighboring nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node.
[0115] The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous moment data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained;
[0116] The model training module 300 is used to train the model using the training set data, optimize the model parameters through the back propagation algorithm, and obtain the trained model;
[0117] The model evaluation module 400 is used to evaluate the trained model using a test set.
[0118] A quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system of the present embodiment is used to implement the aforementioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method. Therefore, the specific implementation method of the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system can be seen in the embodiment part of the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method in the previous text. For example, the data collection and division module 100, the model construction module 200, the model training module 300, and the model evaluation module 400 are respectively used to implement steps S1, S2, S3, and S4 in the aforementioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method. Therefore, its specific implementation method can refer to the description of the corresponding various parts of the embodiment. In order to avoid redundancy, it will not be repeated here.
[0119] Embodiment 3
[0120] An embodiment of the present invention provides an electronic device, which includes a processor, a memory and a bus system. The processor and the memory are connected through the bus system. The memory is used to store instructions, and the processor is used to execute the instructions stored in the memory to implement the above-mentioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method.
[0121] Embodiment 4
[0122] An embodiment of the present invention provides a computer storage medium, which stores a computer software product. The computer software product includes several instructions for enabling a computer device to execute the above-mentioned quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method.
[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0126] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from them are still within the protection scope of the invention.
Claims
1. A quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method, characterized in that: include: Collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, construct a data set, and divide the data set into a training set and a test set; the dynamic knowledge graph is a quadruple arranged in chronological order, and the quadruple is in the form of a head entity, a relationship, a tail entity, and time; The entities are power grid equipment and faults, the edges are between power grid equipment and faults, and the quaternary represents that a certain fault occurred in a certain power grid equipment at a certain time; Constructing a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder; The quantum migration perception encoder is used to perform subgraph sampling based on a dynamic knowledge graph with the node to be inferred currently as the central node to obtain a subgraph structure centered on the central node; Based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node. Based on the subgraph structure and quantum bias value, a graph attention network is used to aggregate information from neighboring nodes, and quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node. The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous moment data of the dynamic knowledge graph; Based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained; The method for performing subgraph sampling based on the dynamic knowledge graph and taking the node to be inferred as the central node is as follows: Based on the dynamic knowledge graph, subgraph sampling is performed with the node to be inferred as the central node. The sampling range is within the k-step range of the central node, where k is the number of walks. The sampling has a fixed upper limit, and edges that appear later are sampled first. Based on the subgraph structure, quantum walking is performed on the subgraph to calculate the quantum bias value from the central node to each node, specifically including: Based on the subgraph structure, a virtual self-loop is added to the sampled subgraph to calculate the quantum bias value from the central node to other sampled nodes. The virtual self-loop means that when inferring possible edges, an edge pointing to the central node is added to the central node, and the time is the inference time. The quantum bias value is defined as the average probability that the quantum can be observed at each node of the subgraph after a sufficiently long time from the central node. The calculation formula is: in, is the system Hamiltonian matrix, and λ1,λ2,…,λ n is the n different eigenvalues of the Hamiltonian matrix, P i is the sum of the characteristic matrices with the same eigenvalue; T1 is the time upper limit; t is an unspecified time; U(t) and U(-t) are the quantum conjugate matrices at time t; Q(t) is the probability matrix of quantum starting from different nodes being observed at the node at time t; After calculating the quantum bias matrix Q, the quantum bias value of the central node relative to other nodes can be obtained according to the sequence number of the central node; Based on the subgraph structure and quantum bias value, the graph attention network is used to aggregate information from neighboring nodes, and the quantum bias is introduced to adjust the attention weight to obtain the updated embedding of the central node, which specifically includes: Based on the subgraph structure, the attention value of the central node compared to the neighboring nodes is calculated. First, the original feature-based attention value is calculated by the graph attention network method, and then the quantum bias value calculated in the previous step is added to calculate it by the following formula: in, is the matrix transpose symbol; is the quantum bias value; is the quantum bias value of node u relative to node v; It is the subgraph sampled with u as the central node at time t; is the value of the central node after the embedding linear change; d h is the embedding dimension, which is used to scale the attention value so that it is not too sparse; and It is the value after the linear change of the embedding of the central node, neighboring nodes and edges connecting the central node. The calculation process is as follows: Among them, ||·|| is a concatenation operation that merges multiple vectors into a longer vector; φ(·) is a time coding model based on trigonometric functions; is at k At this moment, the total number of edges between u and v; is the node embedding of layer l-1; t q is the time at which the inference occurs; t k is the timestamp of the selected edge, that is, the time when the corresponding time occurs; W q and W K is the parameter projection matrix; Nodes aggregate neighbor information, the formula is as follows: Among them, V v (t) is the embedding of the edge connecting the neighbor node to the central node; softmax(·) is the softmax activation function; is the updated node embedding of layer l; Represents the set of neighbor nodes of the central node v; Finally, a multi-layer perceptron network is used to fuse the aggregation of neighbor information and the historical embedding of the node itself to generate the final node embedding. The formula is as follows: Among them, MLP (||) is a multi-layer perceptron; is the node embedding of layer I; The continuous time data of the dynamic knowledge graph is used to calculate the global evolution characteristics of the dynamic knowledge graph, which specifically includes: Assuming that the dynamic knowledge graph system is a system with constant volume, we get Where T is the temperature, U represents the energy of the system, and S represents the entropy of the system; the von Neumann entropy is used as the entropy of the system, and the von Neumann entropy is calculated by an approximate calculation method. The calculation formula is as follows: Where V is the number of nodes; S VN is the von Neumann entropy; d u ,d v Respectively represent the degree of nodes u and v, that is, the number of edges connected to nodes u and v; E represents all the edges contained in the dynamic knowledge graph at the current moment; it is approximately considered that the scale of the dynamic knowledge graph represents the energy of the graph, expressed as U = a·|E|, where a is a constant; determine two moments, and calculate the quantum thermodynamic temperature by calculating the changes in entropy and energy at the two moments By using different times, multiple quantum thermodynamic temperatures are obtained. They reflect the changing trend of the current network state compared with the previous network state from different angles, and constitute the global evolution characteristics of the dynamic knowledge graph at the current moment, which are expressed as follows: T M =[T1,T2,…,T n ]; Among them, T M is the global evolution feature, T1,T2,…,T n Respectively represent the temperature values at different angles; The prediction results of possible edges in the future are obtained based on the embedding of the central node, the edge connection time, and the global evolution characteristics, which specifically include: A multi-layer perceptron is selected as the sub-decoder. Based on the embedding of the central node and the edge time, the sub-decoder predicts whether a given node will have a corresponding connection with the head node at this time. Based on the global evolution characteristics, the expert mixture model is used to generate corresponding weights for different sub-decoders. Finally, the weighted sum of the results of all sub-decoders is used to obtain the prediction results of the edges that may exist in the future. The decoding process is expressed as follows: α=softmax(T M W d ); Among them, score(u,v) represents the probability score of the connection; h v 、h u Respectively represent the embedding of central nodes u and v; N e is the number of experts; T M is the global evolution feature; W d is the projection parameter matrix; α is the normalized weight, which represents the importance of the expert to the expert in judging whether this connection exists or not; MLP i (,) is a multi-layer perceptron; softmax(·) is a softmax activation function; Use the training set data to train the model, optimize the model parameters through the back propagation algorithm, and obtain the trained model; Use the test set to evaluate the trained model.
2. A quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction system, characterized in that: The system is used to implement the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method of claim 1, specifically including: The data collection and division module is used to collect relevant data of the power grid dynamic knowledge graph, including the status, connection relationship, and timestamp of power grid equipment, build a data set, and divide the data set into a training set and a test set; A model building module, used to build a power grid dynamic knowledge graph link prediction model based on quantum walk and quantum thermodynamics, wherein the model includes a quantum migration-aware encoder and a temperature-aware hybrid expert model decoder; The quantum migration-aware encoder is used to perform subgraph sampling based on a dynamic knowledge graph with the node to be inferred as the central node to obtain a subgraph structure centered on the central node; based on the subgraph structure, quantum walks are performed on the subgraph to calculate the quantum bias value from the central node to each node; based on the subgraph structure and the quantum bias value, a graph attention network is used to aggregate information from neighboring nodes, and quantum bias is introduced to adjust the attention weight to obtain an updated embedding of the central node; The temperature-aware hybrid expert model decoder is used to calculate the global evolution characteristics of the dynamic knowledge graph based on the continuous time data of the dynamic knowledge graph; based on the embedding of the central node, the edge time, and the global evolution characteristics, the prediction results of the edges that may exist in the future are obtained; The model training module is used to train the model using the training set data and optimize the model parameters through the back propagation algorithm to obtain a trained model; The model evaluation module is used to evaluate the trained model using the test set.
3. An electronic device, characterized in that: The electronic device includes a processor, a memory and a bus system, the processor and the memory are connected through the bus system, the memory is used to store instructions, and the processor is used to execute the instructions stored in the memory to implement the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method described in claim 1.
4. A computer storage medium, characterized in that: The computer storage medium stores a computer software product, and the computer software product includes several instructions for enabling a computer device to execute the quantum walk and quantum thermodynamics power grid dynamic knowledge graph link prediction method described in claim 1.
Citation Information
Cited By
Direct current transmission data management method, system and device based on knowledge graph
CN120508769A
