Knowledge graph completion method and system for power system

By applying the knowledge graph completion method based on meta-learning and graph attention network in the power system, the problem of insufficient reliability and accuracy of knowledge graph completion in the existing technology is solved, and more efficient and accurate power system data management and analysis is achieved.

CN119962648AActive Publication Date: 2025-05-09STATE GRID HUNAN ELECTRIC POWER COMPANY LIMITED +2

Patent Information

Application Number
CN202510057296.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-05-09
Estimated Expiration
2045-01-14

AI Technical Summary

Technical Problem

The existing power system knowledge graph completion solution has shortcomings in reliability and accuracy, and it is difficult to effectively solve the problems of data incompleteness and noise interference in power grid data management and analysis.

Method used

The method based on meta-learning and graph attention network is used to build a power system knowledge graph completion model, and the knowledge graph completion and update is achieved through feature extraction, alignment embedding, edge prediction and self-attention mechanisms.

Benefits of technology

It improves the reliability and accuracy of knowledge graph completion and enhances the completeness and accuracy of data management and analysis of power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119962648A_ABST
    Figure CN119962648A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph completion method for an electric power system. The method comprises the following steps: acquiring data information of the electric power system; constructing a knowledge graph support set and a query set of the power system; constructing a power system knowledge graph completion primary model based on meta learning and a graph attention network, and training to obtain a power system knowledge graph completion model; and performing knowledge graph completion of the electric power system by adopting the obtained knowledge graph completion model of the electric power system. The invention also discloses a system for realizing the knowledge graph completion method for the power system. According to the method, the power system knowledge graph completion model is constructed and trained based on meta-learning and the graph attention network, so that the method not only can complete the knowledge graph of the power system, but also is higher in reliability and better in accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of electrical automation, and specifically relates to a knowledge graph completion method and system for a power system. Background Art

[0002] With the development of economy and technology and the improvement of people's living standards, electricity has become an indispensable secondary energy source in people's production and life, bringing endless convenience to people's production and life. Therefore, ensuring the stable and reliable supply of electricity has become one of the most important tasks of the power system.

[0003] With the acceleration of the digitalization process of power grids, power companies have accumulated a large amount of heterogeneous and multi-source data, including equipment information, topological relationships, operating status, fault records, dispatch history, etc. These data contain rich knowledge, but usually have problems such as incomplete data, noise interference, and information islands. Therefore, in the management and analysis of power grid data, knowledge graph completion technology has gradually become one of the important methods to solve the informatization and intelligence of power systems.

[0004] At present, researchers have proposed various types of power system knowledge graph completion solutions, such as embedding methods based on graph neural networks, prediction solutions based on self-supervised learning, and completion solutions based on multimodal data. However, these existing solutions have problems of poor reliability and accuracy in the actual operation process. Summary of the invention

[0005] One of the purposes of the present invention is to provide a knowledge graph completion method for a power system with high reliability and good accuracy.

[0006] A second objective of the present invention is to provide a system for implementing the knowledge graph completion method for the power system.

[0007] The knowledge graph completion method for the power system provided by the present invention comprises the following steps:

[0008] S1. Obtain data information of the power system;

[0009] S2. Based on the data information obtained in step S1, construct a knowledge graph support set and a query set for the power system;

[0010] S3. Based on meta-learning and graph attention network, a primary model for completing the knowledge graph of power system is constructed;

[0011] S4. Using the data set obtained in step S2, the primary model for completing the knowledge graph of the power system constructed in step S3 is trained to obtain a model for completing the knowledge graph of the power system;

[0012] S5. Use the power system knowledge graph completion model obtained in step S4 to complete the knowledge graph of the power system.

[0013] The primary model for completing the knowledge graph of the power system described in step S3 is constructed based on meta-learning and graph attention network, which specifically includes the following steps:

[0014] The constructed power system knowledge graph completes the primary model, and the processing process includes the following steps:

[0015] A. Construct a feature extraction network based on meta-learning to extract the embedding features of input data;

[0016] B. Align the embedded features obtained in step A to obtain aligned embedding;

[0017] C. Based on the aligned embedding obtained in step B, predict the missing edges in the knowledge graph and obtain candidate triples;

[0018] D. Based on the graph neural network, the node embedding of the completed knowledge graph is obtained, and the edge set of the graph neural network is updated to generate enhanced entity embedding;

[0019] E. Based on the self-attention mechanism, adjust the feature weight coefficient and generate the final entity embedding;

[0020] F. Based on the entity embedding obtained in step E, perform confidence assessment and completion, and select triples to update the knowledge graph.

[0021] The feature extraction network based on meta-learning described in step A is used to extract the embedded features of the input data, which specifically includes the following steps:

[0022] The support set is processed by the first local encoder to obtain the first feature embedding of the support set;

[0023] The query set is processed by the second local encoder to obtain the first feature embedding of the query set;

[0024] The first feature embedding of the support set is processed by the first global encoder to obtain the long-range feature embedding of the support set;

[0025] The first feature embedding of the query set is processed by the second global encoder to obtain the long-range feature embedding of the query set;

[0026] The processing process of the first local encoder and the second local encoder is the same, and both include the following steps:

[0027] Set the size of both the input entity embedding and relation embedding to d;

[0028] The obtained data information is subjected to feature extraction through convolution to obtain local features between entities and adjacent relationships; the convolution kernel size is 3×3, the number of input channels is d, the number of output channels is d, and the step size is 1;

[0029] The output of the convolution is processed by an activation function; the activation function f(x) is

[0030] The obtained data information is processed by maximum pooling to achieve dimensionality reduction; the kernel size of the maximum pooling is 2×2 and the step size is 2;

[0031] Perform a full connection operation on the obtained data information and map the feature information into embedded output;

[0032] The embedded output is processed again through the activation function; the activation function f(x) is

[0033] The processing process of the first global encoder and the second global encoder is the same, and both include the following steps:

[0034] Adjust the dimension of the input knowledge graph triples so that the output embedding dimension is d2;

[0035] The obtained data information is subjected to graph convolution operation to generate long-distance embedding features based on relational adjacency information; the kernel size of the graph convolution is 1×1, the step size is 1, and the number of output channels is d2;

[0036] The obtained data information is processed globally, and the embedding of all nodes is aggregated to generate global features;

[0037] Perform a fully connected operation on the global features to map them into embedding outputs;

[0038] The embedded output is processed by the activation function; the activation function f(x) is

[0039] Step B aligns the embedded features obtained in step A to obtain aligned embedding, which specifically includes the following steps:

[0040] Embed the global features of the support set obtained in step A into g S and query set global feature embedding g Q After concatenation, the global feature embedding g after concatenation of the support set and the query set is obtained. con g con =αg S +(1-α)g Q , α is the set weight;

[0041] G con Perform a fully connected operation to map and generate the aligned embedding gA ;

[0042] G A The activation function is used for processing; the activation function f(x) is

[0043] The obtained data information is subjected to attention weight calculation operation to obtain g S , g Q and g A The weight matrix of .

[0044] Step C predicts the missing edges in the knowledge graph based on the aligned embedding obtained in step B to obtain candidate triples, which specifically includes the following steps:

[0045] Based on the aligned embedding results obtained in step B, edge prediction and knowledge graph expansion are performed to predict missing edges in the knowledge graph and generate new candidate triples;

[0046] Calculate the expansion score of the obtained data information and normalize it to obtain the new attention distribution;

[0047] Add the predicted edge set to the knowledge graph, add the candidate edges with confidence higher than the set value to the knowledge graph, and update the node set to obtain the expanded knowledge graph;

[0048] The method of performing edge prediction and knowledge graph expansion based on the aligned embedding result obtained in step B, predicting missing edges in the knowledge graph, and generating new candidate triples specifically includes the following steps:

[0049] The aligned embedding result obtained in step B is:

[0050] If (h, r, ?), then t is calculated p1 t p1 =g a -(h+r);

[0051] If (?, r, t), then h is calculated p1 h p1 =g a -(r+t);

[0052] In the knowledge graph, a set of triples (h, r, t) is represented by a head entity h, a relation r, and a tail entity t, where (h, r, ?) represents an incomplete set of triples in the knowledge graph that lacks a tail entity, and ? is a missing entity; (?, r, t) represents an incomplete set of triples in the knowledge graph that lacks a head entity; t p1 To calculate the tail entity in the query set through feature embedding, g a is the feature embedding after alignment, h p1To calculate the head entity in the query set through feature embedding;

[0053] The score function score(h,r,t) is used to calculate the score of each candidate edge, and the first several edges with the highest scores are selected as the completion candidate edges;

[0054] To complete the candidate edges:

[0055] If (h, r, ?), then t is calculated p2 t p2 = argmax t score(h,r,t);

[0056] If (?, r, t), then h is calculated p2 h p2 = argmax h score(h,r,t);

[0057] Among them, t p2 is the tail entity predicted by the scoring function; argmax t () represents the parameter function, the value of t when the score reaches the maximum; h p2 is the head entity predicted by the scoring function; argmax h () represents the parameter function, the value of h when the score reaches the maximum;

[0058] Finally, the candidate edge set is output;

[0059] The step of calculating the expansion score of the obtained data information and normalizing it to obtain a new attention distribution specifically includes the following steps:

[0060] For missing query entity e n (h,r,?), obtained by the adjacent entity e n-1 (h, r, t) and initialize the expansion score. The candidate entity e n The expansion score S in k steps k {e n}for

[0061]

[0062] Where e n-1 Yes n The adjacent entities, || is the feature connector, is the entity e at step k n-1 The query set global feature embedding; is the entity e at step k n The query set global feature embedding; MLP() is the multi-layer perceptron processing function;

[0063] Select several edges with the highest probability to update the knowledge graph;

[0064] Add the selected edges to the edge set E, add the unvisited tail entities to the node set V, and complete the expansion of the knowledge graph G. After k steps, the expansion scores of the entities in the expanded graph can be obtained. The scores are normalized to obtain the new attention distribution.

[0065] p k (e q )=softmax(S k {e1},...,S k {e n})

[0066] Where p k (e q ) is the answer score distribution of all graphs; output probability distribution, if an entity is not added to the extended graph, the corresponding score is 0.

[0067] The step D described above is based on the graph neural network to obtain the node embedding of the completed knowledge graph enhancement, and update the edge set of the graph neural network to generate the enhanced entity embedding, which specifically includes the following steps:

[0068] Process the data information obtained in step C based on the R-GCN network;

[0069] The obtained data information is processed using global pooling to aggregate entity embeddings and generate enhanced graph embeddings;

[0070] Process the enhanced graph embedding data information through a graph neural network to generate enhanced entity embeddings;

[0071] The processing of the data information obtained in step C based on the R-GCN network specifically includes the following steps:

[0072] Perform graph convolution operation on the input data information; the step size of the graph convolution is 1;

[0073] Perform a full connection operation on the obtained data information to perform a linear transformation; the full connection operation is represented by h′ i =W·h i +b, where h′ i is the new feature vector of node i after transformation, W is the weight matrix, h i is the original eigenvector of node i, and b is the bias term used to translate the transformed eigenvector;

[0074] Perform attention operation on the obtained data information: set up a K-head attention mechanism to calculate the attention coefficient between each adjacent node; perform node splicing, represented by eij =LeakyReLU(a T ·[Wh i ||Wh j ]), where e ij is the original attention score between node i and node j, LeakyReLU() is the enhanced nonlinear activation function, and a T is the transpose of the attention weight vector, which is used to calculate the attention weight between node i and node j, Wh i is the new feature vector of node i after being transformed by weight matrix W, Wh j is the new feature vector of node j after being transformed by the weight matrix W, [Wh i ||Wh j ] is the weighted summation formula and [Wh i ||Wh j ]=α1Wh i +(1-α1)Wh j , α1 is the set weight; the attention weight normalization operation is performed, expressed as α ij is the normalized attention coefficient;

[0075] The weighted sum of neighbor node features is expressed as in is the new feature representation of node i after being updated by the graph attention network, h′ j is the new feature representation of node j after being processed by the fully connected layer;

[0076] For the obtained data information, several independent attention heads are used to calculate the features, which can be expressed as:

[0077] Given the feature h of each node i , features are mapped to several subspaces through different linear transformations;

[0078] Assume that there are H attention heads, and the feature space dimension of each attention head is d', then each attention head has a corresponding weight matrix W h , the value of h is 1, 2, ..., H;

[0079] Each attention head uses its own attention weight Weighted aggregation of the features of node i’s neighbor node j Expressed as is the feature of node i after being updated by the hth attention head;

[0080] Concatenate the outputs of all attention heads to get the output features for || is the splicing operation;

[0081] For output features The activation function is used and expressed as is the updated feature vector of node i, and ReLU() is the activation function.

[0082] The self-attention mechanism described in step E adjusts the feature weight coefficient and generates the final entity embedding, which specifically includes the following steps:

[0083] The obtained data information is processed based on the self-attention mechanism and expressed as To generate the final embedding; where Att(Q,K,V) is the final feature embedding, softmax() is the activation function; Q is the query matrix, which represents the query feature of each node; K is the key matrix, which represents the key feature of each node; V is the value matrix, which represents the value feature of each node; d k is the scaling factor;

[0084] Based on the obtained data information, the query matrix, key matrix and value matrix are generated; and through QK T Generate attention weight matrix;

[0085] According to the obtained attention weight matrix, V is weighted summed to generate the final entity embedding.

[0086] Step F performs confidence assessment and completion based on the entity embedding obtained in step E, and selects triples to update the knowledge graph, which specifically includes the following steps:

[0087] The confidence level of the data information is calculated using the following formula:

[0088]

[0089] Where Con is the confidence; z is the normalization factor;

[0090] According to the obtained confidence level, the following steps are used to obtain the final prediction result:

[0091] According to the size of the confidence, all predicted triplets are sorted, and the higher the confidence, the higher the ranking;

[0092] Set a confidence threshold; when the confidence corresponding to a triple is greater than the confidence threshold, the triple is determined to be a valid prediction triple, otherwise the triple is determined to be an invalid prediction triple;

[0093] Update all valid prediction triplets into the knowledge graph to enhance the integrity of the graph and complete and update the knowledge graph.

[0094] The present invention also provides a system for implementing the method for completing the knowledge graph for the power system, comprising a data acquisition module, a data set construction module, a model construction module, a model training module and a knowledge graph completion module; the data acquisition module, the data set construction module, the model construction module, the model training module and the knowledge graph completion module are connected in series in sequence; the data acquisition module is used to acquire data information of the power system, and upload the data information to the data set construction module; the data set construction module is used to construct a knowledge graph support set and a query set of the power system according to the received data information and the acquired data information, and upload the data information to the model construction module; the model construction module is used to construct a primary model for completing the knowledge graph of the power system based on meta-learning and a graph attention network according to the received data information, and upload the data information to the model training module; the model training module is used to train the constructed primary model for completing the knowledge graph of the power system according to the received data information and the obtained data set, obtain the knowledge graph completion model of the power system, and upload the data information to the knowledge graph completion module; the knowledge graph completion module is used to complete the knowledge graph of the power system according to the received data information and the obtained knowledge graph completion model of the power system.

[0095] The knowledge graph completion method and system for the power system provided by the present invention constructs and trains the power system knowledge graph completion model based on meta-learning and graph attention network. Therefore, the present invention can not only realize the completion of the knowledge graph for the power system, but also has higher reliability and better accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0096] Figure 1 The figure is a schematic diagram of the method flow of the present invention.

[0097] Figure 2 Schematic diagram of the functional modules of the system of the present invention. DETAILED DESCRIPTION

[0098] like Figure 1 The method flow diagram of the method of the present invention is shown as follows: The knowledge graph completion method for the power system provided by the present invention comprises the following steps:

[0099] S1. Obtain data information of the power system;

[0100] S2. Based on the data information obtained in step S1, construct a knowledge graph support set and a query set for the power system;

[0101] S3. Based on meta-learning and graph attention network, a primary model for completing the knowledge graph of the power system is constructed. The specific steps include:

[0102] The constructed power system knowledge graph completes the primary model, and the processing process includes the following steps:

[0103] A. Construct a feature extraction network based on meta-learning to extract the embedded features of input data; specifically, the following steps are included:

[0104] The support set is processed by the first local encoder to obtain the first feature embedding of the support set;

[0105] The query set is processed by the second local encoder to obtain the first feature embedding of the query set;

[0106] The first feature embedding of the support set is processed by the first global encoder to obtain the long-range feature embedding of the support set;

[0107] The first feature embedding of the query set is processed by the second global encoder to obtain the long-range feature embedding of the query set;

[0108] The processing process of the first local encoder and the second local encoder is the same, and both include the following steps:

[0109] Set the size of both the input entity embedding and relation embedding to d (preferably 256);

[0110] The obtained data information is subjected to feature extraction through convolution to obtain local features between entities and adjacent relationships; the convolution kernel size is 3×3, the number of input channels is d, the number of output channels is d, and the step size is 1;

[0111] The output of the convolution is processed by an activation function; the activation function f(x) is

[0112] The obtained data information is processed by maximum pooling to achieve dimensionality reduction; the kernel size of the maximum pooling is 2×2 and the step size is 2;

[0113] Perform a full connection operation on the obtained data information and map the feature information into embedded output;

[0114] The embedded output is processed again through the activation function; the activation function f(x) is

[0115] The processing process of the first global encoder and the second global encoder is the same, and both include the following steps:

[0116] Adjust the dimension of the input knowledge graph triples so that the output embedding dimension is d2;

[0117] The obtained data information is subjected to graph convolution operation to generate long-distance embedding features based on relational adjacency information; the kernel size of the graph convolution is 1×1, the step size is 1, and the number of output channels is d2;

[0118] The obtained data information is processed globally, and the embedding of all nodes is aggregated to generate global features;

[0119] Perform a fully connected operation on the global features to map them into embedding outputs;

[0120] The embedded output is processed by the activation function; the activation function f(x) is

[0121] B. Align the embedded features obtained in step A to obtain aligned embedding; specifically, the steps include:

[0122] Embed the global features of the support set obtained in step A into g S and query set global feature embedding g Q After concatenation, the global feature embedding g after concatenation of the support set and the query set is obtained. con g con =αg S +(1-α)g Q , α is the set weight;

[0123] G con Perform a fully connected operation to map and generate the aligned embedding g A ;

[0124] G A The activation function is used for processing; the activation function f(x) is

[0125] The obtained data information is subjected to attention weight calculation operation to obtain g S , g Q and g A The weight matrix of

[0126] In addition, during training, the following formula is used for optimization:

[0127] L=Σ||g S -g Q || 2 +λ·R(f θ )

[0128] Where L is the loss function; λ is the regularization coefficient; R(f θ ) is the regularization term;

[0129] C. Based on the aligned embedding obtained in step B, predict the missing edges in the knowledge graph and obtain candidate triples; specifically, the following steps are included:

[0130] Based on the aligned embedding results obtained in step B, edge prediction and knowledge graph expansion are performed to predict missing edges in the knowledge graph and generate new candidate triples;

[0131] Calculate the expansion score of the obtained data information and normalize it to obtain the new attention distribution;

[0132] Add the predicted edge set to the knowledge graph, add the candidate edges with confidence higher than the set value to the knowledge graph, and update the node set to obtain the expanded knowledge graph;

[0133] The method of performing edge prediction and knowledge graph expansion based on the aligned embedding result obtained in step B, predicting missing edges in the knowledge graph, and generating new candidate triples specifically includes the following steps:

[0134] The aligned embedding result obtained in step B is:

[0135] If (h, r, ?), then t is calculated p1 t p1 =g a -(h+r);

[0136] If (?, r, t), then h is calculated p1 h p1 =g a -(r+t);

[0137] In the knowledge graph, a set of triples (h, r, t) is represented by a head entity h, a relation r, and a tail entity t, where (h, r, ?) represents an incomplete set of triples in the knowledge graph that lacks a tail entity, and ? is a missing entity; (?, r, t) represents an incomplete set of triples in the knowledge graph that lacks a head entity; t p1 To calculate the tail entity in the query set through feature embedding, g a is the feature embedding after alignment, h p1 To calculate the head entity in the query set through feature embedding;

[0138] The score function score(h,r,t) is used to calculate the score of each candidate edge, and the first several edges with the highest scores are selected as the completion candidate edges;

[0139] To complete the candidate edges:

[0140] If (h, r, ?), then t is calculated p2 t p2 = argmax t score(h,r,t);

[0141] If (?, r, t), then h is calculated p2 h p2 = argmax h score(h,r,t);

[0142] Among them, tp2 is the tail entity predicted by the scoring function; argmax t () represents the parameter function, the value of t when the score reaches the maximum; h p2 is the head entity predicted by the scoring function; argmax h () represents the parameter function, the value of h when the score reaches the maximum;

[0143] Finally, the candidate edge set is output;

[0144] The step of calculating the expansion score of the obtained data information and normalizing it to obtain a new attention distribution specifically includes the following steps:

[0145] For missing query entity e n (h,r,?), obtained by the adjacent entity e n-1 (h, r, t) and initialize the expansion score. The candidate entity e n The expansion score S in k steps k {e n}for

[0146]

[0147] Where e n-1 Yes n The adjacent entities, || is the feature connector, is the entity e at step k n-1 The query set global feature embedding; is the entity e at step k n The query set global feature embedding; MLP() is the multi-layer perceptron processing function;

[0148] Select several edges with the highest probability to update the knowledge graph;

[0149] Add the selected edges to the edge set E, add the unvisited tail entities to the node set V, and complete the expansion of the knowledge graph G. After k steps, the expansion scores of the entities in the expanded graph can be obtained. The scores are normalized to obtain the new attention distribution.

[0150] p k (e q )=softmax(S k {e1},...,S k {e n})

[0151] Where p k (e q ) is the answer score distribution of all graphs; output probability distribution, if an entity is not added to the extended graph, the corresponding score is 0;

[0152] D. Based on the graph neural network, the node embedding of the completed knowledge graph is obtained, and the edge set of the graph neural network is updated to generate enhanced entity embedding; specifically, the steps include:

[0153] Process the data information obtained in step C based on the R-GCN network;

[0154] The obtained data information is processed using global pooling to aggregate entity embeddings and generate enhanced graph embeddings;

[0155] Process the enhanced graph embedding data information through a graph neural network to generate enhanced entity embeddings;

[0156] The processing of the data information obtained in step C based on the R-GCN network specifically includes the following steps:

[0157] Perform graph convolution operation on the input data information; the step size of the graph convolution is 1;

[0158] Perform a full connection operation on the obtained data information to perform a linear transformation; the full connection operation is represented by h′ i =W·h i +b, where h′ i is the new feature vector of node i after transformation, W is the weight matrix, h i is the original eigenvector of node i, and b is the bias term used to translate the transformed eigenvector;

[0159] Perform attention operation on the obtained data information: set up a K-head attention mechanism to calculate the attention coefficient between each adjacent node; perform node splicing, represented by e ij =LeakyReLU(a T ·[Wh i ||Wh j ]), where e ij is the original attention score between node i and node j, LeakyReLU() is the enhanced nonlinear activation function, and a T is the transpose of the attention weight vector, which is used to calculate the attention weight between node i and node j, Wh i is the new feature vector of node i after being transformed by weight matrix W, Wh j is the new feature vector of node j after being transformed by the weight matrix W, [Wh i ||Wh j ] is the weighted summation formula and [Wh i ||Wh j ]=α1Wh i +(1-α1)Wh j, α1 is the set weight; the attention weight normalization operation is performed, expressed as α ij is the normalized attention coefficient;

[0160] The weighted sum of neighbor node features is expressed as in is the new feature representation of node i after being updated by the graph attention network, h′ j is the new feature representation of node j after being processed by the fully connected layer;

[0161] For the obtained data information, several independent attention heads are used to calculate the features, which can be expressed as:

[0162] Given the feature h of each node i , features are mapped to several subspaces through different linear transformations;

[0163] Assume that there are H attention heads, and the feature space dimension of each attention head is d', then each attention head has a corresponding weight matrix W h , the value of h is 1, 2, ..., H;

[0164] Each attention head uses its own attention weight Weighted aggregation of the features of node i’s neighbor node j Expressed as is the feature of node i after being updated by the hth attention head;

[0165] Concatenate the outputs of all attention heads to get the output features for || is the splicing operation;

[0166] For output features The activation function is used and expressed as is the updated feature vector of node i, ReLU() is the activation function;

[0167] E. Based on the self-attention mechanism, adjust the feature weight coefficient and generate the final entity embedding; specifically, the following steps are included:

[0168] The obtained data information is processed based on the self-attention mechanism and expressed as To generate the final embedding; where Att(Q,K,V) is the final feature embedding, softmax() is the activation function; Q is the query matrix, which represents the query feature of each node; K is the key matrix, which represents the key feature of each node; V is the value matrix, which represents the value feature of each node; d k is the scaling factor;

[0169] Based on the obtained data information, the query matrix, key matrix and value matrix are generated; and through QK T Generate attention weight matrix;

[0170] According to the obtained attention weight matrix, V is weighted summed to generate the final entity embedding;

[0171] F. Based on the entity embedding obtained in step E, perform confidence assessment and completion, and select triples to update the knowledge graph; specifically, the following steps are included:

[0172] The confidence level of the data information is calculated using the following formula:

[0173]

[0174] Where Con is the confidence; z is the normalization factor;

[0175] According to the obtained confidence level, the following steps are used to obtain the final prediction result:

[0176] According to the size of the confidence, all predicted triplets are sorted, and the higher the confidence, the higher the ranking;

[0177] Set a confidence threshold; when the confidence corresponding to a triple is greater than the confidence threshold, the triple is determined to be a valid prediction triple, otherwise the triple is determined to be an invalid prediction triple;

[0178] Update all valid prediction triples to the knowledge graph to enhance the integrity of the graph and complete and update the knowledge graph;

[0179] S4. Using the data set obtained in step S2, the primary model for completing the knowledge graph of the power system constructed in step S3 is trained to obtain a model for completing the knowledge graph of the power system;

[0180] S5. Use the power system knowledge graph completion model obtained in step S4 to complete the knowledge graph of the power system.

[0181] like Figure 2The functional module schematic diagram of the system of the present invention is shown as follows: the system disclosed in the present invention for implementing the method for knowledge graph completion for the power system includes a data acquisition module, a data set construction module, a model construction module, a model training module and a knowledge graph completion module; the data acquisition module, the data set construction module, the model construction module, the model training module and the knowledge graph completion module are connected in series in sequence; the data acquisition module is used to acquire data information of the power system and upload the data information to the data set construction module; the data set construction module is used to construct a knowledge graph support set and a query set of the power system according to the received data information and the acquired data information, and upload the data information to the model construction module; the model construction module is used to construct a primary model for knowledge graph completion of the power system based on meta-learning and graph attention network according to the received data information, and upload the data information to the model training module; the model training module is used to train the constructed primary model for knowledge graph completion of the power system according to the received data information and the obtained data set, obtain the knowledge graph completion model of the power system, and upload the data information to the knowledge graph completion module; the knowledge graph completion module is used to complete the knowledge graph of the power system according to the received data information and the obtained knowledge graph completion model of the power system.

Claims

1. A knowledge graph completion method for a power system, comprising the following steps: S1. Obtain data information of the power system; S2. Based on the data information obtained in step S1, construct a knowledge graph support set and a query set for the power system; S3. Based on meta-learning and graph attention network, a primary model for completing the knowledge graph of power system is constructed; S4. Using the data set obtained in step S2, the primary model for completing the knowledge graph of the power system constructed in step S3 is trained to obtain a model for completing the knowledge graph of the power system; S5. Use the power system knowledge graph completion model obtained in step S4 to complete the knowledge graph of the power system.

2. The knowledge graph completion method for power system according to claim 1 is characterized in that The primary model for completing the knowledge graph of the power system described in step S3 is constructed based on meta-learning and graph attention network, which specifically includes the following steps: The constructed power system knowledge graph completes the primary model, and the processing process includes the following steps: A. Construct a feature extraction network based on meta-learning to extract the embedding features of input data; B. Align the embedded features obtained in step A to obtain aligned embedding; C. Based on the aligned embedding obtained in step B, predict the missing edges in the knowledge graph and obtain candidate triples; D. Based on the graph neural network, the node embedding of the completed knowledge graph is obtained, and the edge set of the graph neural network is updated to generate enhanced entity embedding; E. Based on the self-attention mechanism, adjust the feature weight coefficient and generate the final entity embedding; F. Based on the entity embedding obtained in step E, perform confidence assessment and completion, and select triples to update the knowledge graph.

3. The knowledge graph completion method for power system according to claim 2 is characterized in that The feature extraction network based on meta-learning described in step A is used to extract the embedded features of the input data, which specifically includes the following steps: The support set is processed by the first local encoder to obtain the first feature embedding of the support set; The query set is processed by the second local encoder to obtain the first feature embedding of the query set; The first feature embedding of the support set is processed by the first global encoder to obtain the long-range feature embedding of the support set; The first feature embedding of the query set is processed by the second global encoder to obtain the long-range feature embedding of the query set; The processing process of the first local encoder and the second local encoder is the same, and both include the following steps: Set the size of both the input entity embedding and relation embedding to d; The obtained data information is subjected to feature extraction through convolution to obtain local features between entities and adjacent relationships; the convolution kernel size is 3×3, the number of input channels is d, the number of output channels is d, and the step size is 1; The output of the convolution is processed by an activation function; the activation function f(x) is The obtained data information is processed by maximum pooling to achieve dimensionality reduction; the kernel size of the maximum pooling is 2×2 and the step size is 2; Perform a full connection operation on the obtained data information and map the feature information into embedded output; The embedded output is processed again through the activation function; the activation function f(x) is The processing process of the first global encoder and the second global encoder is the same, and both include the following steps: Adjust the dimension of the input knowledge graph triples so that the output embedding dimension is d2; The obtained data information is subjected to graph convolution operation to generate long-distance embedding features based on relational adjacency information; the kernel size of the graph convolution is 1×1, the step size is 1, and the number of output channels is d2; The obtained data information is processed globally, and the embedding of all nodes is aggregated to generate global features; Perform a fully connected operation on the global features to map them into embedding outputs; The embedded output is processed by the activation function; the activation function f(x) is 4. The knowledge graph completion method for power system according to claim 3 is characterized in that Step B aligns the embedded features obtained in step A to obtain aligned embedding, which specifically includes the following steps: Embed the global features of the support set obtained in step A into g S and query set global feature embedding g Q After concatenation, the global feature embedding g after concatenation of the support set and the query set is obtained. con g con =αg S +(1-α)g Q , α is the set weight; G con Perform a fully connected operation to map and generate the aligned embedding g A ; G A The activation function is used for processing; the activation function f(x) is The obtained data information is subjected to attention weight calculation operation to obtain g S , g Q and g A The weight matrix of .

5. The knowledge graph completion method for power system according to claim 4 is characterized in that Step C predicts the missing edges in the knowledge graph based on the aligned embedding obtained in step B to obtain candidate triples, which specifically includes the following steps: Based on the aligned embedding results obtained in step B, edge prediction and knowledge graph expansion are performed to predict missing edges in the knowledge graph and generate new candidate triples; Calculate the expansion score of the obtained data information and normalize it to obtain the new attention distribution; Add the predicted edge set to the knowledge graph, add the candidate edges with confidence higher than the set value to the knowledge graph, and update the node set to obtain the expanded knowledge graph; The method of performing edge prediction and knowledge graph expansion based on the aligned embedding result obtained in step B, predicting missing edges in the knowledge graph, and generating new candidate triples specifically includes the following steps: The aligned embedding result obtained in step B is: If (h, r, ?), then t is calculated p1 t p1 =g a -(h+r); If (?, r, t), then h is calculated p1 h p1 =g a -(r+t); In the knowledge graph, a set of triples (h, r, t) is represented by a head entity h, a relation r, and a tail entity t, where (h, r, ?) represents an incomplete set of triples in the knowledge graph that lacks a tail entity, and ? is a missing entity; (?, r, t) represents an incomplete set of triples in the knowledge graph that lacks a head entity; t p1 To calculate the tail entity in the query set through feature embedding, g a is the feature embedding after alignment, h p1 To calculate the head entity in the query set through feature embedding; The score function score(h,r,t) is used to calculate the score of each candidate edge, and the first several edges with the highest scores are selected as the completion candidate edges; To complete the candidate edges: If (h, r, ?), then t is calculated p2 t p2 = argmax t score(h,r,t); If (?, r, t), then h is calculated p2 h p2 = argmax h score(h,r,t); Among them, t p2 is the tail entity predicted by the scoring function; argmax t () represents the parameter function, the value of t when the score reaches the maximum; h p2 is the head entity predicted by the scoring function; argmax h () represents the parameter function, the value of h when the score reaches the maximum; Finally, the candidate edge set is output; The step of calculating the expansion score of the obtained data information and normalizing it to obtain a new attention distribution specifically includes the following steps: For missing query entity e n (h,r,?), obtained by the adjacent entity e n-1 (h, r, t) and initialize the expansion score. The candidate entity e n The expansion score S in k steps k {e n }for Where e n-1 Yes n The adjacent entities, || is the feature connector, is the entity e at step k n-1 The query set global feature embedding; is the entity e at step k n The query set global feature embedding; MLP() is the multi-layer perceptron processing function; Select several edges with the highest probability to update the knowledge graph; Add the selected edges to the edge set E, add the unvisited tail entities to the node set V, and complete the expansion of the knowledge graph G. After k steps, the expansion scores of the entities in the expanded graph can be obtained. The scores are normalized to obtain the new attention distribution. p k (And q )=softmax(S k {e1},...,S k {And n }) Where p k (e q ) is the answer score distribution of all graphs; output probability distribution, if an entity is not added to the extended graph, the corresponding score is 0.

6. The knowledge graph completion method for power system according to claim 5 is characterized in that The step D described above is based on the graph neural network to obtain the node embedding of the completed knowledge graph enhancement, and update the edge set of the graph neural network to generate the enhanced entity embedding, which specifically includes the following steps: Process the data information obtained in step C based on the R-GCN network; The obtained data information is processed using global pooling to aggregate entity embeddings and generate enhanced graph embeddings; Process the enhanced graph embedding data information through a graph neural network to generate enhanced entity embeddings; The processing of the data information obtained in step C based on the R-GCN network specifically includes the following steps: Perform graph convolution operation on the input data information; the step size of the graph convolution is 1; The obtained data information is fully connected to perform linear transformation; the full connection operation is represented by h i '=W·h i +b, where h i ' is the new feature vector of node i after transformation, W is the weight matrix, h i is the original eigenvector of node i, and b is the bias term used to translate the transformed eigenvector; Perform attention operation on the obtained data information: set up a K-head attention mechanism to calculate the attention coefficient between each adjacent node; perform node splicing, represented by e ij =LeakyReLU(a T ·[Wh i ||Wh j ]), where e ij is the original attention score between node i and node j, LeakyReLU() is the enhanced nonlinear activation function, and a T is the transpose of the attention weight vector, which is used to calculate the attention weight between node i and node j, Wh i is the new feature vector of node i after being transformed by weight matrix W, Wh j is the new feature vector of node j after being transformed by the weight matrix W, [Wh i ||Wh j ] is the weighted summation formula and [Wh i ||Wh j ]=α1Wh i +(1-α1)Wh j , α1 is the set weight; the attention weight normalization operation is performed, expressed as α ij is the normalized attention coefficient; The weighted sum of neighbor node features is expressed as in is the new feature representation of node i after being updated by the graph attention network, h' j is the new feature representation of node j after being processed by the fully connected layer; For the obtained data information, several independent attention heads are used to calculate the features, which can be expressed as: Given the feature h of each node i , features are mapped to several subspaces through different linear transformations; Assume that there are H attention heads, and the feature space dimension of each attention head is d', then each attention head has a corresponding weight matrix W h , the value of h is 1, 2, ..., H; Each attention head uses its own attention weight Weighted aggregation of the features of node i’s neighbor node j Expressed as is the feature of node i after being updated by the hth attention head; Concatenate the outputs of all attention heads to get the output features for || is the splicing operation; For output features The activation function is used and expressed as is the updated feature vector of node i, and ReLU() is the activation function.

7. The knowledge graph completion method for power system according to claim 6 is characterized in that The self-attention mechanism described in step E adjusts the feature weight coefficient and generates the final entity embedding, which specifically includes the following steps: The obtained data information is processed based on the self-attention mechanism and expressed as To generate the final embedding; where Att(Q,K,V) is the final feature embedding, softmax() is the activation function; Q is the query matrix, which represents the query feature of each node; K is the key matrix, which represents the key feature of each node; V is the value matrix, which represents the value feature of each node; d k is the scaling factor; Based on the obtained data information, the query matrix, key matrix and value matrix are generated; and through QK T Generate attention weight matrix; According to the obtained attention weight matrix, V is weighted summed to generate the final entity embedding.

8. The knowledge graph completion method for power system according to claim 7 is characterized in that Step F performs confidence assessment and completion based on the entity embedding obtained in step E, and selects triples to update the knowledge graph, which specifically includes the following steps: The confidence level of the data information is calculated using the following formula: Where Con is the confidence; z is the normalization factor; According to the obtained confidence level, the following steps are used to obtain the final prediction result: According to the size of the confidence, all predicted triplets are sorted, and the higher the confidence, the higher the ranking; Set a confidence threshold; when the confidence corresponding to a triple is greater than the confidence threshold, the triple is determined to be a valid prediction triple, otherwise the triple is determined to be an invalid prediction triple; Update all valid prediction triplets into the knowledge graph to enhance the integrity of the graph and complete and update the knowledge graph.

9. A system for implementing the knowledge graph completion method for a power system according to any one of claims 1 to 8, characterized in that It includes a data acquisition module, a data set construction module, a model construction module, a model training module and a knowledge graph completion module; the data acquisition module, the data set construction module, the model construction module, the model training module and the knowledge graph completion module are connected in series in sequence; the data acquisition module is used to obtain data information of the power system and upload the data information to the data set construction module; The data set construction module is used to construct a knowledge graph support set and a query set of the power system based on the received data information and upload the data information to the model construction module; The model building module is used to build a primary model for completing the power system knowledge graph based on the received data information, based on meta-learning and graph attention network, and upload the data information to the model training module; The model training module is used to train the constructed power system knowledge graph completion primary model based on the received data information and the obtained data set, obtain the power system knowledge graph completion model, and upload the data information to the knowledge graph completion module; Knowledge Graph The completion module is used to complete the power system knowledge graph model based on the received data information. Complete the knowledge graph of the power system.

Citation Information

Patent Citations

  • Metalearning-based small sample knowledge graph completion method

    CN115438192A

  • Knowledge graph completion method based on global and local comparative learning

    CN117668256A

  • Small sample knowledge graph completion method based on graph structure information

    CN119227790A

  • Recommendation system based on knowledge graph completion

    CN119228477A

Cited By

  • Knowledge graph retrieval and classification method based on improved semi-supervised classification model

    CN120296179A