Hierarchical entity neighbor multi-relation fusion knowledge graph completion network algorithm

By introducing dynamic attention mechanism and adjacency relationship fusion technology into the knowledge graph, the problem of ignoring the importance differences of different neighbor nodes and relationship paths in the existing technology is solved, and the entity representation accuracy and link prediction performance of the knowledge graph are improved.

CN119539056APending Publication Date: 2025-02-28STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411650756.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

Existing knowledge graph technology based on graph neural networks ignores the importance differences between different neighbor nodes and the importance differences in relational paths, making it difficult to accurately capture subtle connections between entities and affect the performance of link prediction.

Method used

The knowledge graph completion network algorithm of hierarchical entity neighbor multi-relationship fusion is used to aggregate the information around the entity in each relational subgraph through a dynamic attention mechanism, and all neighbor information under different relational subgraphs are integrated using adjacent relational fusion technology.

Benefits of technology

It realizes an accurate evaluation of the importance of different neighbor nodes, improves the accuracy of entity representation and model prediction performance, and allows more detailed understanding and construction of complex relationship paths.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539056A_ABST
    Figure CN119539056A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph completion network algorithm based on hierarchical entity neighbor multi-relation fusion. The knowledge graph completion network algorithm comprises the steps that S1, relation sub-graphs are constructed for all target entities in a knowledge graph; s2, aggregating information around the entities in each relation sub-graph by using a dynamic attention mechanism, and connecting and aggregating the entities under different embedding relations; and S3, integrating all neighbor information under different relation sub-graphs by utilizing an adjacency relation fusion technology. According to the method, accurate evaluation of importance differences of different neighbor nodes and weight distribution of relation paths are realized, and the understanding and processing capabilities of the model for complex data are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a knowledge graph completion network algorithm that integrates multiple relations of hierarchical entities and neighbors. Background Art

[0002] Knowledge Graph is a graphical data model used to represent and organize large amounts of structured knowledge. It represents entities in the real world and the relationships between them in the form of nodes (entities) and edges (relationships), thereby constructing a complex and semantically rich knowledge network.

[0003] Existing knowledge graph technologies based on graph neural networks (GNNs) usually assume that all neighbor nodes have the same contribution, that is, they assign the same weight to all neighbor nodes. However, different neighbor nodes do not have the same impact on the central entity. This assumption ignores the importance differences between neighbors, making it difficult for existing models to accurately capture the subtle connections between entities, thus affecting the performance of link prediction.

[0004] Secondly, when dealing with different relationship paths, existing methods fail to fully consider the differences in the importance of each relationship path to the central entity representation, and often treat all paths equally, which may weaken the semantic contribution of certain key paths in knowledge representation and limit the model's ability to model complex relationships. Summary of the invention

[0005] The purpose of the present invention is to provide a knowledge graph completion network algorithm that integrates multiple relationships of hierarchical entity neighbors, which can solve the problems that the existing models ignore the importance differences between different neighbor nodes and the relationship path processing is insufficient in the construction.

[0006] To achieve the above objectives, the present invention provides a knowledge graph completion network algorithm for hierarchical entity neighbor multi-relation fusion, including:

[0007] S1, construct a relational subgraph for each target entity in the knowledge graph;

[0008] S2, uses the dynamic attention mechanism to aggregate the information around the entities in each relationship subgraph, and connects and aggregates entities under different embedding relationships;

[0009] S3, utilizes the adjacency relationship fusion technology to integrate all neighbor information under different relationship subgraphs.

[0010] Optionally, step S1 includes:

[0011] S1.1, divide the entity triples in the knowledge graph; get a target entity h v The core entity e1 and each neighbor entity e i, and different embedding relations r between core entities and neighbor entities i ;

[0012] S1.2, embedding r according to different relations i , construct the relation subgraph for the divided entity triples.

[0013] Optionally, step S2 comprises:

[0014] S2.1, first-layer fusion: perform relation fusion on relation subgraphs under the same embedding relation;

[0015] S2.2, second layer fusion: the entity information under different embedding relationships after the first layer fusion is fused again;

[0016] The first layer fusion includes:

[0017] S2.1.1, first feature fusion;

[0018] S2.1.2, second feature fusion;

[0019] S2.1.3, the third feature fusion;

[0020] S2.1.4, information integration.

[0021] Optionally, the first feature fusion in S2.1.1 includes:

[0022] Perform feature fusion on the relation subgraphs under the same embedding relation to form a feature fusion vector:

[0023]

[0024] In the formula, h v represents the feature vector of the central node v in the relation subgraph, h u Represents the feature vector of the neighbor node u of the central node v in the relationship subgraph, operator represents the feature fusion operation, Represents the fused feature vector.

[0025] Optionally, the second feature fusion in S2.1.2 includes:

[0026] S2.1.2.1, the attention value after the first feature fusion is obtained through the dynamic attention function The attention value The calculation formula is as follows:

[0027]

[0028] In the formula, exp represents the exponential function, is a learnable vector, LeakyReLU is an activation function, and W1 represents a learnable weight matrix; represents the set of neighbor nodes u connected to the central node v under the embedding relationship r;

[0029] S2.1.2.2, Use attention value The fusion feature vector Update to get the secondary fusion feature vector

[0030]

[0031] In the formula, h n Represents the feature vector of neighbor node n; Represents the number of relationships between the central node v and its neighboring nodes u.

[0032] Optionally, the third feature fusion in S2.1.3 includes:

[0033] The secondary fusion feature vector is obtained by K-head attention. Update again to get three fusion feature vectors

[0034]

[0035] Where K represents the number of multi-head attention heads.

[0036] Optionally, the information in S2.1.4 is integrated into:

[0037] The information related to the entity is integrated into the entity after feature fusion through the information integration formula, and n information integration feature vectors corresponding to different relationship subgraphs are obtained. The calculation formula is:

[0038]

[0039] In the formula, h r Represents the relationship node between entities, and W3 represents the linear transformation matrix.

[0040] Optionally, the step S2.2 comprises:

[0041] S2.2.1, obtain the importance of relation subgraphs based on different embedding relations, the capture process is as follows:

[0042]

[0043] Among them, att represents the attention function, Indicates the importance of relation subgraphs under different embedding relations, Indicates that the information based on different relationship subgraphs is integrated into the feature vector;

[0044] S2.2.2, according to the importance of the relationship subgraphs of different embedded relationships, the entities under different embedded relationships are connected and aggregated to obtain the aggregate vector

[0045]

[0046] In the formula, express Any one of Indicates that The corresponding learning coefficient.

[0047] Optionally, step S3 includes:

[0048] S3.1, using the adjacency fusion technology to aggregate vectors Perform adjacent fusion calculation to obtain the adjacent fusion vector

[0049] S3.2, through negative sampling, gradient training is performed to obtain the Loss difference between the model prediction value and the true value, and then optimize the model.

[0050] Optionally, the calculation formula of the adjacency relationship fusion technology used in step S3.1 is:

[0051]

[0052] Where W5 and W6 are linear transformation matrices; ⊙ represents the Hadamard product operator; σ is the fusion operator.

[0053] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0054] 1. The present invention provides a knowledge graph completion network algorithm that integrates multiple relationships of hierarchical entity neighbors. By introducing a dynamic attention mechanism, it realizes accurate evaluation of the importance of different neighbor nodes, so as to effectively capture the neighbor node information that is crucial to link prediction, thereby improving the accuracy of entity representation and the prediction performance of the model.

[0055] 2. The present invention provides a knowledge graph completion network algorithm that integrates hierarchical entity neighbor multi-relationships. By combining the relationship subgraph with the adjacency relationship fusion technology (ARF), the weight is dynamically assigned according to the importance of each relationship path, so that the model can understand and construct these relationship paths in more detail. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is the algorithm step diagram of the present invention;

[0057] Figure 2 It is a schematic diagram of the model framework of the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the attached Figures 1-2 , the technical content, structural features, objectives achieved and effects of the present invention are described in detail through preferred embodiments.

[0059] It should be noted that the drawings are in a very simplified form and use non-precise proportions. They are only used to conveniently and clearly assist in explaining the embodiments of the present invention, and are not used to limit the conditions for the implementation of the present invention. Therefore, they have no substantive technical significance. Any structural modification, change in proportional relationship or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical content disclosed by the present invention.

[0060] In the description of the present invention, it should be noted that the terms "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0061] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0062] The present invention provides a knowledge graph completion network algorithm that integrates multiple relations of hierarchical entity neighbors, such as Figure 1 As shown in the figure, the knowledge graph completion network algorithm includes the following steps:

[0063] S1, construct a relational subgraph for each target entity in the knowledge graph;

[0064] S2, using the dynamic attention mechanism to aggregate the information around the entities in each relationship subgraph, that is, to capture the neighbor information around the entities in each relationship subgraph, and connect and aggregate entities under different embedding relationships;

[0065] S3, utilizes the adjacency relation fusion technology (ARF) to integrate all neighbor information under different relationship subgraphs.

[0066] Wherein, step S1 specifically includes the following steps:

[0067] S1.1, divide the entity triples in the knowledge graph; that is, use the head and tail entities in the triples in the knowledge graph and the relationship between the head and tail entities to divide a given knowledge graph. The target entities in the dataset are divided to obtain the core entity, neighbor entities, and different embedding relationships between the core entity and the neighbor entities.

[0068] Figure 2 Shown is a target entity h v The core entity e1 and each neighbor entity e i , and different embedding relations r between core entities and neighbor entities i , and formed the target entity h v The star-shaped subgraph

[0069] The star-shaped subgraphs of the target entities can be represented as a set: in, represents a star-shaped subgraph, h i represents any one of the target entities, and ε represents the entity set.

[0070] S1.2 Embedding r according to different relations i , construct a relationship subgraph for the divided entity triples (i.e., the star-shaped subgraph). In this embodiment, a relationship subgraph including but not limited to the following is formed. Figure 2 The first relationship subgraph sub r1 , the second relationship subgraph sub r2 , the third relationship subgraph sub r3 ;

[0071] The first relationship subgraph sub r1 The second relation subgraph sub is formed by partitioning the embedded relation r1; r2 The third relationship subgraph sub is formed by partitioning the embedded relationship r2; r3 It is formed by partitioning through the embedding relation r3.

[0072] The relationship subgraph is represented as Among them, h v is the target entity, h k is the neighbor entity of the target entity, r ij is the central entity h v With neighbor entity h kThe connection relationship between them, R represents the set of all entity relationships, Represents the set of all triples in the knowledge graph.

[0073] Wherein, step S2 specifically includes the following steps:

[0074] S2.1, first layer fusion: perform relational fusion on relational subgraphs under the same embedding relation.

[0075] S2.1.1, first feature fusion: feature fusion is performed on the relation subgraphs under the same embedding relationship, that is, including but not limited to the first relation subgraph sub r1 , the second relationship subgraph sub r2 , the third relationship subgraph sub r3 The core entity e1 and its neighbor entity e i Perform feature fusion to form a fused feature vector:

[0076]

[0077] In the formula, h v represents the feature vector of the central node v in the relation subgraph, h u Represents the feature vector of the neighbor node u of the central node v in the relationship subgraph, operator represents the feature fusion operation, Represents the fused feature vector.

[0078] S2.1.2, Second feature fusion

[0079] S2.1.2.1, the attention value after the first feature fusion is obtained through the dynamic attention function That is, in the embedding relation r(r∈r i ), the weight coefficient between the neighbor node u and the central node v.

[0080] The attention value The calculation formula is as follows:

[0081]

[0082] In the formula, exp represents the exponential function, which is used to map the calculated attention value to the non-negative space; is a learnable vector used to map features to attention scores; LeakyReLU is an activation function used to increase nonlinear expression capabilities; W1 represents a learnable weight matrix, which is used to capture the relationship information between nodes; represents the set of neighbor nodes u connected to the central node v under the embedding relationship r; ‖ represents the connection operation.

[0083] S2.1.2.2, Use attention value The fusion feature vector Update to get the secondary fusion feature vector The updated calculation formula is as follows:

[0084]

[0085] In the formula, h n Represents the feature vector of neighbor node n; Represents the number of relationships between the central node v and its neighboring nodes u.

[0086] S2.1.3, the third feature fusion: the secondary fusion feature vector is fused by K-head attention Update again to get three fusion feature vectors Update the calculation formula again as follows:

[0087]

[0088] Where K represents the number of multi-head attention heads.

[0089] S2.1.4, information integration, that is, to integrate the information related to the entity into the entity after feature fusion through the information integration formula, and obtain n information integration feature vectors corresponding to different relationship subgraphs. The calculation formula is:

[0090]

[0091] In the formula, h r ∈R represents the relationship node between entities, W3∈R d×2d Represents a linear transformation matrix.

[0092] The range of R is obtained by the following formula:

[0093] R=R 0 W2 (6)

[0094] In the formula, R 0 represents the initial representation of the embedded relation r, R represents the relation embedding vector, W2∈R d×d is the linear transformation matrix.

[0095] Through the first feature fusion, the second feature fusion, the third feature fusion and the information integration operation, the subgraph corresponding to the first relationship sub r1 , the second relationship subgraph sub r2 ,…,Nth relation subgraph sub rn The n information is integrated into the feature vector

[0096] S2.2, second layer fusion: The entity information under different embedding relationships after the first layer fusion is fused again to highlight the semantic information under different relationships.

[0097] S2.2.1, integrate n sets of information into the feature vector, including As semantic input, to obtain the importance of relation subgraphs based on different embedding relations, the process is as follows:

[0098]

[0099] in, a tt represents the attention function, which is used to capture the importance of the relationship subgraph based on different embedding relationships

[0100] S2.2.2, according to the importance of the relationship subgraphs of different embedded relationships, the entities under different embedded relationships are connected and aggregated to obtain the aggregate vector

[0101] The process of connection and aggregation can be expressed as:

[0102]

[0103] In the formula, express Any one of Indicates that The corresponding learning coefficient.

[0104] Wherein, step S3 specifically includes the following steps:

[0105] S3.1, using the adjacency fusion technology to aggregate vectors Perform adjacent fusion calculation to obtain the adjacent fusion vector

[0106] The calculation formula for the adjacency fusion calculation is:

[0107]

[0108] Where W5∈R d×d and W6∈R d×d is the linear transformation matrix; ⊙ represents the Hadamard product operator; σ is the fusion operator.

[0109] S3.2, through negative sampling, that is, the method of randomly replacing the head and tail entities of the positive sample, to perform gradient training to obtain the Loss difference between the model prediction value and the true value, and then optimize the model.

[0110] In summary, the knowledge graph completion network algorithm with hierarchical entity neighbor multi-relation fusion provided by the present invention realizes the accurate evaluation of the importance of different neighbor nodes by introducing the dynamic attention mechanism; secondly, by combining the relationship subgraph with the adjacency relationship fusion technology (ARF), the model can dynamically assign weights according to the importance of each relationship path, thereby improving the model's understanding and processing capabilities for complex paths.

[0111] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the invention. After reading the above content, it will be obvious to those skilled in the art for various modifications and substitutions of the present invention. Therefore, the protection scope of the present invention should be limited by the attached claims.

Claims

1. A knowledge graph completion network algorithm based on hierarchical entity neighbor multi-relation fusion, characterized by: Include: S1, construct a relational subgraph for each target entity in the knowledge graph; S2, uses the dynamic attention mechanism to aggregate the information around the entities in each relationship subgraph, and connects and aggregates entities under different embedding relationships; S3, utilizes the adjacency relationship fusion technology to integrate all neighbor information under different relationship subgraphs.

2. The knowledge graph completion network algorithm according to claim 1, characterized in that: The step S1 comprises: S1.1, divide the entity triples in the knowledge graph; get a target entity h v The core entity e1 and each neighbor entity e i , and different embedding relations r between core entities and neighbor entities i ; S1.2, embedding r according to different relations i , construct the relation subgraph for the divided entity triples.

3. The knowledge graph completion network algorithm according to claim 2, characterized in that: The step S2 comprises: S2.1, first-layer fusion: relational fusion of relational subgraphs under the same embedding relation; S2.2, second layer fusion: the entity information under different embedding relationships after the first layer fusion is fused again; The first layer fusion includes: S2.1.1, first feature fusion; S2.1.2, second feature fusion; S2.1.3, the third feature fusion; S2.1.4, information integration.

4. The knowledge graph completion network algorithm according to claim 3, characterized in that: The first feature fusion in S2.1.1 includes: Perform feature fusion on the relation subgraphs under the same embedding relation to form a feature fusion vector: In the formula, h v represents the feature vector of the central node v in the relation subgraph, h u Represents the feature vector of the neighbor node u of the central node v in the relationship subgraph, operator represents the feature fusion operation, Represents the fused feature vector.

5. The knowledge graph completion network algorithm according to claim 4, characterized in that: The second feature fusion in S2.1.2 includes: S2.1.2.1, the attention value after the first feature fusion is obtained through the dynamic attention function The attention value The calculation formula is as follows: In the formula, exp represents the exponential function, a T is a learnable vector, LeakyReLU is an activation function, and W1 represents a learnable weight matrix; represents the set of neighbor nodes u connected to the central node v under the embedding relationship r; S2.1.2.2, Use attention value The fusion feature vector Update to get the secondary fusion feature vector In the formula, h n Represents the feature vector of neighbor node n; Represents the number of relationships between the central node v and its neighboring nodes u.

6. The knowledge graph completion network algorithm according to claim 5, characterized in that: The third feature fusion in S2.1.3 includes: The secondary fusion feature vector is obtained by K-head attention. Update again to get three fusion feature vectors Where K represents the number of multi-head attention heads.

7. The knowledge graph completion network algorithm according to claim 6, characterized in that: The S2.1.4 information integration includes: The information related to the entity is integrated into the entity after feature fusion through the information integration formula, and n information integration feature vectors corresponding to different relationship subgraphs are obtained. The calculation formula is: In the formula, h r Represents the relationship node between entities, and W3 represents the linear transformation matrix.

8. The knowledge graph completion network algorithm according to claim 7, characterized in that: The step S2.2 comprises: S2.2.1, obtain the importance of relation subgraphs based on different embedding relations, the capture process is as follows: Among them, att represents the attention function, …,γsub rn Indicates the importance of relation subgraphs under different embedding relations, Indicates that the information based on different relationship subgraphs is integrated into the feature vector; S2.2.2, according to the importance of the relationship subgraphs of different embedded relationships, the entities under different embedded relationships are connected and aggregated to obtain the aggregate vector In the formula, express Any one of Indicates that The corresponding learning coefficient.

9. The knowledge graph completion network algorithm according to claim 8, characterized in that: The step S3 comprises: S3.1, using the adjacency fusion technology to aggregate vectors Perform adjacent fusion calculation to obtain the adjacent fusion vector S3.2, through negative sampling, gradient training is performed to obtain the Loss difference between the model prediction value and the true value, and then optimize the model.

10. The knowledge graph completion network algorithm according to claim 9, characterized in that: The calculation formula of the adjacency relationship fusion technology used in step S3.1 is: Where W5 and W6 are linear transformation matrices; ⊙ represents the Hadamard product operator; σ is the fusion operator.