Interpretable knowledge graph reasoning method and device based on graph neural network

By adopting a graph-based neural network method in knowledge graph inference, building a knowledge graph subgraph and using the attention mechanism of relationship perception, the problem of insufficient ability to characterize relationship paths in the existing technology is solved, and more accurate and reliable knowledge inference results are achieved.

CN117217312BActive Publication Date: 2025-02-28INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311085481.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2025-02-28
Estimated Expiration
2043-08-25

AI Technical Summary

Technical Problem

In the process of knowledge inference, the prior art only considers the structural information between the relationship table and the entity representation, resulting in weak ability to represent the relationship paths between each entity and inaccurate reasoning results.

Method used

The interpretable knowledge graph inference method based on graph neural network is adopted, and the knowledge graph subgraph is constructed by obtaining the triplets to be queried, and the subgraph and entity relationships are encoded using the attention mechanism of relationship perception to obtain the relationship weight. Then, based on these weights, the relationship path of the source entity is aggregated to obtain the relationship path characterization to predict the reply entity.

Benefits of technology

The accuracy of knowledge reasoning is improved, and the relationship paths between entities are comprehensively analyzed by combining structural information, entity relationships and context information, thereby enhancing the reliability of inference results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117217312B_ABST
    Figure CN117217312B_ABST
Patent Text Reader

Abstract

The present invention provides an interpretable knowledge graph reasoning method and device based on a graph neural network, and the interpretable knowledge graph reasoning method based on a graph neural network includes: obtaining a triple to be queried input by a user, the triple to be queried includes a source entity and an entity relationship; constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and the entity relationship according to a relationship-aware attention mechanism to obtain a relationship weight; based on the relationship weight, aggregating the relationship paths associated with the source entity in the knowledge graph to obtain a relationship path representation. The method of the present invention comprehensively analyzes the relationship paths of the source entity by combining structural information, the contribution of entity relationships to different entities, and their importance in various rule paths, making full use of the context information of the knowledge graph and the surrounding neighbor node information, and improving the accuracy of the reasoning results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge reasoning technology, and in particular to an interpretable knowledge graph reasoning method and device based on graph neural network. Background Art

[0002] Knowledge reasoning is a key technical means to complete the knowledge graph. Through knowledge reasoning, it is possible to determine whether the predicted facts are valid and to discover missing facts.

[0003] In related technologies, the entity relationship representation is incorporated into the entity representation through the knowledge graph embedding method to obtain the structural information of the entity representation to achieve knowledge reasoning. This process only considers the structural information between the relationship table and the entity representation, while the structural information has a weak ability to represent the relationship path between entities in the knowledge graph, resulting in inaccurate reasoning results. Summary of the invention

[0004] The present invention provides an interpretable knowledge graph reasoning method and device based on graph neural network, which is used to solve the defect that the prior art only considers the structural information between the relationship table and the entity representation in the knowledge reasoning process, has weak representation ability of the relationship path between each entity, and leads to inaccurate reasoning results, thereby improving the accuracy of knowledge reasoning.

[0005] The present invention provides an interpretable knowledge graph reasoning method based on a graph neural network, comprising:

[0006] Acquire a triple to be queried input by a user, wherein the triple to be queried includes a source entity and an entity relationship;

[0007] Constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and the entity relationship according to a relationship-aware attention mechanism to obtain a relationship weight, wherein the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph;

[0008] The relationship paths associated with the source entity in the knowledge graph are aggregated according to the relationship weights to obtain a relationship path representation, and the relationship path representation is used to predict the response entity corresponding to the source entity.

[0009] According to an interpretable knowledge graph reasoning method based on a graph neural network provided by the present invention, the knowledge graph subgraph and the entity relationship are encoded according to the relationship-aware attention mechanism to obtain the relationship weight, which includes:

[0010] Performing word embedding, center embedding and position embedding processing on the knowledge graph subgraph to obtain an encoded input sequence;

[0011] The encoded input sequence and the triple to be queried are input into a relational attention encoder to obtain the relational weight.

[0012] According to an interpretable knowledge graph reasoning method based on a graph neural network provided by the present invention, the relationship paths associated with the source entities in the knowledge graph are aggregated according to the relationship weights to obtain the relationship path representation, which includes:

[0013] The knowledge graph is input into a neural Bellman-Ford network, and the information transfer paths of each entity embedding layer of the neural Bellman-Ford network are aggregated according to the relationship weights to obtain the relationship path representation.

[0014] According to an interpretable knowledge graph reasoning method based on a graph neural network provided by the present invention, the construction of a knowledge graph subgraph according to the context information of the source entity in the knowledge graph includes:

[0015] Based on the breadth-first algorithm and the knowledge graph, the entities and entity relationships of the triples to be queried are expanded, and when the expanded triples to be queried reach the context budget, the knowledge graph subgraph is obtained.

[0016] According to an interpretable knowledge graph reasoning method based on a graph neural network provided by the present invention, after obtaining the relationship path representation, the method further includes:

[0017] The triples to be queried and the relationship path representation are input into a logic reasoner to obtain a reasoning result.

[0018] The present invention also provides an interpretable knowledge graph reasoning device based on a graph neural network, comprising:

[0019] A data acquisition module, used to acquire a triple to be queried input by a user, wherein the triple to be queried includes a source entity and an entity relationship;

[0020] An encoding module, used to construct a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encode the knowledge graph subgraph and the entity relationship according to the relationship-aware attention mechanism to obtain a relationship weight, wherein the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph;

[0021] A path generation module is used to aggregate the relationship paths associated with the source entity in the knowledge graph based on the relationship weight to obtain a relationship path representation, and the relationship path representation is used to predict the response entity of the source entity.

[0022] According to an interpretable knowledge graph reasoning device based on a graph neural network provided by the present invention, the device also includes:

[0023] The logical reasoning module is used to obtain the reasoning results based on the knowledge graph, source entity and relationship path representation after obtaining the relationship path representation.

[0024] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an interpretable knowledge graph reasoning method based on a graph neural network as described above is implemented.

[0025] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described interpretable knowledge graph reasoning methods based on graph neural networks.

[0026] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned interpretable knowledge graph reasoning methods based on graph neural networks.

[0027] The interpretable knowledge graph reasoning method and device based on graph neural network provided by the present invention constructs a knowledge graph subgraph of the triples to be queried, and encodes the knowledge graph subgraph and entities according to the relationship-aware attention mechanism to obtain relationship weights. Finally, the relationship paths of the source entities in the knowledge graph are aggregated according to the relationship weights to obtain relationship path representations to predict the response entities corresponding to the source entities. The relationship paths of the source entities are comprehensively analyzed by combining structural information, the contribution of entity relationships to different entities, and their importance in various rule paths, and the contextual information of the knowledge graph and the surrounding neighbor node information are fully utilized to improve the accuracy of the reasoning results. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 It is one of the flowcharts of the explainable knowledge graph reasoning method based on graph neural network provided by the present invention;

[0030] Figure 2 This is the second flow chart of the interpretable knowledge graph reasoning method based on graph neural network provided by the present invention;

[0031] Figure 3 It is a structural schematic diagram of an interpretable knowledge graph reasoning device based on a graph neural network provided by the present invention;

[0032] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0034] Combine the following Figure 1-Figure 3 Describe the interpretable knowledge graph reasoning method and device based on graph neural network of the present invention.

[0035] Figure 1 This is one of the flow charts of the interpretable knowledge graph reasoning method based on graph neural network provided by the present invention, such as Figure 1 As shown in the figure, the interpretable knowledge graph reasoning method based on graph neural network includes the following steps:

[0036] Step 110: Obtain the triple to be queried input by the user, where the triple to be queried includes a source entity and an entity relationship.

[0037] In this step, the triple to be queried is composed of a head entity, an entity relationship and a tail entity. For example, (h, r, t) is used to represent the above source entity, entity relationship and corresponding response entity.

[0038] In this embodiment, the source entity may be the head entity in the triple, the user input query triple may be represented as (h, r, ?), and the reasoning result to be solved is the tail entity. In this case, the tail entity is the answer entity.

[0039] For example, a specific set of simple query data is represented as follows: User A’s wife is User B, and the corresponding triple to be queried is (User A, wife,?), which is used to reason about “Who is User A’s wife?”, where User A is the source entity, Wife is the entity relationship, and User B is the response object.

[0040] In this embodiment, the source entity may also be the tail entity in the triple, the user input query triple may be represented as (?, r, h), and the reasoning result to be solved is the head entity. In this case, the head entity is the answer entity.

[0041] For example, the triple to be queried is (?, wife, user B), where user B is the source entity, wife is the entity relationship, and user B is the response object, which is used to reason about "Whose wife is user B?"

[0042] Step 120: construct a knowledge graph subgraph based on the contextual information of the source entity in the knowledge graph, and encode the knowledge graph subgraph and the entity according to the relationship-aware attention mechanism to obtain the relationship weight, which is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph.

[0043] In this step, a graph search algorithm can be used to take the source node in the triple to be queried as the search starting point and the entity relationship as the search direction, and search within a limited range in the knowledge graph to construct a knowledge graph subgraph related to the query triple.

[0044] In this embodiment, the graph search algorithm may be a breadth first search (Breadth First Search, BFS), a depth first search (Depth First Search, DFS), or a greedy best first search (Greedy Best First Search, GBFS).

[0045] In this embodiment, in the knowledge graph, there are multiple entity relationships associated with a source entity. For example, the entity relationship corresponding to user A may be user A's identity information, kinship relationship, social relationship, etc.; there may also be multiple response entities corresponding to each entity relationship, for example, user A's classmates are user C and user D, etc.; in summary, in the knowledge graph, the subgraph constructed based on the source entity includes multiple other entities and corresponding entity relationships.

[0046] In this embodiment, searching within a limited range in the knowledge graph means that the number of searches can be set according to user needs to prevent the knowledge graph subgraph from having too much content and increasing the computational complexity.

[0047] For example, the number of searches may be 20.

[0048] In this embodiment, an encoder is designed using a relation-aware attention mechanism to encode knowledge graph subgraphs and entity relationships. For example, the relation-attention encoder can be a variant Transformer encoder with a relation-attention mechanism.

[0049] In this embodiment, the knowledge graph subgraph corresponding to (h, r, ?) is a connected subset of the knowledge graph, which consists of nodes {e1, e2, ..., e m , ..., pad}∈E and edges {r1, r2, ..., r n}∈R, where m and n are the number of entities and relations in the knowledge graph subgraph. A variant Transformer encoder with a relational attention mechanism is used to encode the knowledge graph subgraph and the query and generate relation weights in the decoder part for subsequent reasoning, which makes it possible to utilize side information while ensuring effective information exchange.

[0050] In this embodiment, the decoder then generates a weight relationship, that is, the encoder outputs Se, and dynamically generates weights for the query to obtain multiple weight relationships [w1, w2, ..., w l ], different weight relationships correspond to different source entities, response relationships, and response entities in the knowledge graph subgraph.

[0051] Step 130: Aggregate the relationship paths associated with the source entity in the knowledge graph according to the relationship weights to obtain a relationship path representation, which is used to predict the response entity corresponding to the source entity.

[0052] In this step, the relationship path representation is used to reflect the accuracy of obtaining the answer entity according to different relationship paths.

[0053] In this embodiment, the source entity has a large number of entity relationships and corresponding response entities in the entire knowledge graph, that is, in the knowledge graph, there are multiple relationship paths associated with the above source entity.

[0054] In this embodiment, the relationship path of the source entity in the knowledge graph is predicted by a link prediction model, and the optimal relationship path is solved based on the predicted relationship path.

[0055] In this embodiment, the link prediction model may be a neural Bellman-Ford network or a graph neural network (GNN) for performing link prediction tasks.

[0056] In this embodiment, the encoder encodes multiple groups of entities in a mutually replying relationship in the subgraph, and outputs weights of different relationship paths.

[0057] In this embodiment, each response relationship corresponds to a weight, and a relationship path may include multi-hop reasoning. For example, the weights corresponding to relationships a, b, c, and d are w1, w2, w3, and w4, respectively. For the relationship path: head entity h->relationship a->middle entity x->tail entity t, there will be a set of weights corresponding to abcd when performing the first hop reasoning, and when performing the second hop reasoning, another set of weights corresponding to abcd will be obtained based on h and x, and so on.

[0058] In this embodiment, multiple relationship weights output by the encoder are utilized, and the relationship weights are applied each time the link prediction model is aggregated to focus on more relevant relationship paths and entities.

[0059] In this embodiment, the importance of each relationship path is approximated by the sum of the edge importances on the path, where the edge importance is obtained by automatic differentiation, for example, the top k important paths are equivalent to solving the top k longest paths on the edge importance graph.

[0060] In this embodiment, the link prediction model aggregates the weights of each relationship path, outputs the probability of obtaining the answer entity according to the current relationship path, and uses the relationship path with the maximum probability as the relationship path representation of this query.

[0061] An interpretable knowledge graph reasoning method based on a graph neural network provided by an embodiment of the present invention constructs a knowledge graph subgraph of a triple to be queried, encodes the knowledge graph subgraph and entities according to a relationship-aware attention mechanism, obtains relationship weights, and finally aggregates the relationship paths of source entities in the knowledge graph according to the relationship weights to obtain relationship path representations to predict response entities corresponding to source entities. A comprehensive analysis of the relationship paths of source entities is performed by combining structural information, the contribution of entity relationships to different entities, and their importance in various rule paths, thereby making full use of the contextual information of the knowledge graph and the surrounding neighbor node information to improve the accuracy of the reasoning results.

[0062] In some embodiments, knowledge graph subgraphs and entity relationships are encoded according to a relationship-aware attention mechanism to obtain relationship weights, including: performing aggregate word embedding, center embedding, and position embedding processing on the knowledge graph subgraph to obtain an encoded input sequence; inputting the encoded input sequence and the triple to be queried into a relational attention encoder to obtain relationship weights.

[0063] In this embodiment, the skip-word model is used to infer the response entity associated with the source entity, that is, by performing word embedding, center embedding and position embedding operations on the source entity in the knowledge graph subgraph, the relationship path associated with the source entity is obtained.

[0064] In this embodiment, different relationship paths are obtained through k-hop reasoning, for example, by performing 1-hop reasoning, 2-hop reasoning and 3-hop reasoning on the source entity in the knowledge graph subgraph, so as to obtain a variety of different relationship paths.

[0065] For example, E represents a known source entity; M represents an unknown response entity and cannot appear in the position of a response relationship; R represents a response relationship and cannot appear in the entity position; A represents an answer and can be an entity or a relationship. There are the following situations:

[0066] (1) For the triple M->R1->E1, which represents a directional relationship, such as father, mother, etc., the internal order cannot be interchanged. For example, "M->R1->E1" and "E1->R1->M" are not a triple. For non-directional relationships, such as spouse, brother, sister, colleague, etc., the internal order can be interchanged.

[0067] (2) For the triples M->R1->E1 and M->R2->A, the order between the triples can be interchanged, but the internal order cannot be interchanged. For example, "M->R1->E1, M->R2->A" is equivalent to "M->R2->A, M->R1->E1";

[0068] (3) For one-hop reasoning, E1->R1->E2; for two-hop reasoning, (E1->R1->E3)&(E2->R2->E3), (E1->R1->E2)&(E1->R2->E3) and E1->R1->E2->R2->E3. Three-hop reasoning is deduced in this way, which will not be repeated in this embodiment.

[0069] Figure 2 This is the second flow chart of the interpretable knowledge graph reasoning method based on graph neural network provided by the present invention. Figure 2 In the illustrated embodiment, the weight generator performs 0-hop reasoning, 1-hop reasoning, 2-hop reasoning, and 3-hop reasoning on the source entity to obtain different relationship paths, and converts the knowledge graph subgraph into an input sequence of the Transformer encoder by summarizing word embedding, center embedding, and position embedding. The Transformer encoder (corresponding to the encoder with a relational attention mechanism) encodes the subgraph and entity relationship, and generates relationship weights in the decoder part (corresponding to the decoder for generating weights) for subsequent reasoning, and effective information exchange is guaranteed by encoding the knowledge graph subgraph.

[0070] An interpretable knowledge graph reasoning method based on a graph neural network provided by an embodiment of the present invention obtains an encoded input sequence by summarizing word embedding, center embedding and position embedding of a knowledge graph subgraph; the encoded input sequence and the triple to be queried are input into a relational attention encoder to obtain relational weights, thereby making full use of contextual information to assist reasoning and thereby improving the reliability of the reasoning results.

[0071] In some embodiments, the relationship paths associated with source entities in the knowledge graph are aggregated according to the relationship weights to obtain the relationship path representation, including: inputting the knowledge graph into a neural Bellman-Ford network, and aggregating the information transfer paths of each entity embedding layer of the neural Bellman-Ford network according to the relationship weights to obtain the relationship path representation.

[0072] In this embodiment, the neural Bellman-Ford network includes multiple entity embedding layers, and the entity embedding layer can weight the entity representations obtained by different aggregation methods to obtain the information of the entity representation; for example, the information output by the average aggregation, the minimum aggregation, the maximum aggregation and the mean square aggregation can be weighted to obtain the aggregated entity representation.

[0073] In this embodiment, each entity embedding layer of the neural Bellman-Ford network can apply different relationship weights at each aggregation to infuse more relevant paths and entities. For example, the influence of each relationship path is quantified by the partial derivatives of the relationship weights corresponding to different relationship paths, thereby calculating its weight; specifically, the importance of each relationship path is approximated by the sum of the edge importances on the path, where the edge importance is obtained by automatic differentiation.

[0074] In this embodiment, the neural Bellman-Ford network aggregates entity embeddings by introducing different relationship weights and outputs the importance of different relationship paths, that is, the accuracy of the answer entity is obtained according to different relationship paths.

[0075] An interpretable knowledge graph reasoning method based on a graph neural network provided in an embodiment of the present invention obtains a relationship path representation by aggregating the information transmission paths of each entity embedding layer of the neural Bellman-Ford network based on the relationship weights. This can help the model focus on more important information and reduce the impact of noise. It can also alleviate the problems of over-smoothing and limited scalability of the representation, thereby improving the credibility and generalization ability of the relationship path representation.

[0076] In some embodiments, constructing a knowledge graph subgraph based on the context information of the source entity in the knowledge graph includes: expanding the entities and entity relationships of the query triples based on the breadth-first algorithm and the knowledge graph, and obtaining the knowledge graph subgraph when the expanded query triples reach the context budget.

[0077] In this embodiment, the context budget is used to indicate that the number of times the source entity and its entity relationship are expanded is limited, and the expanded subgraph is a local graph of the knowledge graph to reduce computational overhead.

[0078] In this embodiment, possible response entities of a source entity and corresponding entity relationships are searched in the knowledge graph by a breadth-first algorithm, and after a limited number of searches, a knowledge graph subgraph is obtained based on the response entities, entity relationships and source entities obtained by the search.

[0079] For example, the triple to be queried is (user A, brother,?). Since in the entire knowledge graph, the entity relationships directly related to user A include: spouse, brother, teacher, mother, father, children, etc., the above entity relationships can be used as relationship expansion objects to obtain the query graph associated with user A as the knowledge graph query subgraph of this query event.

[0080] exist Figure 2 In the illustrated embodiment, the expanded subgraph of the source entity h includes multiple relationship paths, and there is at least one other entity on different relationship paths, and the other entities belong to entities in the knowledge graph.

[0081] An interpretable knowledge graph reasoning method based on a graph neural network provided by an embodiment of the present invention expands the entities and entity relationships of query triples by utilizing a breadth-first algorithm and a knowledge graph, and obtains a knowledge graph subgraph when the expanded query triples reach a context budget. By introducing the context information of the source entity, the content of the encoded data is enriched and the reliability of the reasoning result is improved, while the introduction of the knowledge graph subgraph of the source entity can reduce the computational overhead.

[0082] In some embodiments, after obtaining the relationship path representation, the method further includes: inputting the triple to be queried and the relationship path representation into a logical reasoner to obtain a reasoning result.

[0083] In this embodiment, since the link prediction model can output the accuracy of the source entity obtaining the response entity through different relationship paths, specifically, the relationship path with the highest accuracy can be determined according to the output probability of the link prediction model, and the source entity can determine the effective response entity according to the relationship path.

[0084] exist Figure 2 In the illustrated embodiment, the logical reasoner determines the relationship path with the highest accuracy based on P(t|h, r) obtained by aggregation of the neural Bellman-Ford network, and determines the response entity X of the source entity h according to the relationship path.

[0085] An interpretable knowledge graph reasoning method based on a graph neural network provided in an embodiment of the present invention obtains reasoning results by inputting the triples to be queried and the relationship path representation into a logical reasoner, generates an interpretable path based on each information aggregation and edge weight, and uses the path edge weight accumulation to perform probabilistic prediction on possible relationship paths, interprets the reasoning results, and improves the accuracy of the reasoning process.

[0086] The interpretable knowledge graph reasoning device based on graph neural network provided by the present invention is described below. The interpretable knowledge graph reasoning device based on graph neural network described below and the interpretable knowledge graph reasoning method based on graph neural network described above can be referenced to each other.

[0087] Figure 3 is a schematic diagram of the structure of the interpretable knowledge graph reasoning device based on graph neural network provided by the present invention, such as Figure 3 As shown, the interpretable knowledge graph reasoning device based on graph neural network includes a data acquisition module 310, an encoding module 320 and a path generation module 330.

[0088] The data acquisition module 310 is used to acquire the triple to be queried input by the user, where the triple to be queried includes a source entity and an entity relationship;

[0089] An encoding module 320 is used to construct a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encode the knowledge graph subgraph and the entity relationship according to the relationship-aware attention mechanism to obtain the relationship weight, which is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph;

[0090] The path generation module 330 is used to aggregate the relationship paths associated with the source entity in the knowledge graph based on the relationship weights to obtain the relationship path representation, and the relationship path representation is used to predict the response entity of the source entity.

[0091] An interpretable knowledge graph reasoning device based on a graph neural network provided by an embodiment of the present invention constructs a knowledge graph subgraph of a triple to be queried, encodes the knowledge graph subgraph and entities according to a relationship-aware attention mechanism, obtains relationship weights, and finally aggregates the relationship paths of source entities in the knowledge graph according to the relationship weights to obtain relationship path representations to predict response entities corresponding to source entities. The relationship paths of source entities are comprehensively analyzed by combining structural information, the contribution of entity relationships to different entities, and their importance in various rule paths, thereby making full use of the contextual information of the knowledge graph and the surrounding neighbor node information to improve the accuracy of the reasoning results.

[0092] In some embodiments, the interpretable knowledge graph reasoning device based on graph neural network further includes:

[0093] The logical reasoning module 340 is used to obtain the reasoning result based on the knowledge graph, source entity and relationship path representation after obtaining the relationship path representation.

[0094] An interpretable knowledge graph reasoning device based on a graph neural network provided by an embodiment of the present invention obtains reasoning results by inputting the triples to be queried and the relationship path representation into a logical reasoner, generates an interpretable path based on the weight of each information aggregation and entity relationship, and uses the path edge weight accumulation to perform probabilistic prediction on possible relationship paths, interprets the reasoning results, and improves the accuracy of the reasoning process.

[0095] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute an interpretable knowledge graph reasoning method based on a graph neural network, the method comprising: obtaining a triple to be queried input by a user, the triple to be queried includes a source entity and an entity relationship; constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and the entity relationship according to the relationship-aware attention mechanism to obtain a relationship weight, the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph; based on the relationship weight, the relationship path associated with the source entity in the knowledge graph is aggregated to obtain a relationship path representation, the relationship path representation is used to predict the response entity of the source entity.

[0096] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0097] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the interpretable knowledge graph reasoning method based on graph neural network provided by the above methods, and the method includes: obtaining a triple to be queried input by a user, and the triple to be queried includes a source entity and an entity relationship; constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and entity relationship according to a relationship-aware attention mechanism to obtain a relationship weight, and the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph; based on the relationship weight, the relationship path associated with the source entity in the knowledge graph is aggregated to obtain a relationship path representation, and the relationship path representation is used to predict the response entity of the source entity.

[0098] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the interpretable knowledge graph reasoning method based on graph neural network provided by the above-mentioned methods, the method comprising: obtaining a triple to be queried input by a user, the triple to be queried comprising a source entity and an entity relationship; constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and the entity relationship according to a relationship-aware attention mechanism to obtain a relationship weight, the relationship weight being used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph; aggregating the relationship paths associated with the source entity in the knowledge graph based on the relationship weight to obtain a relationship path representation, the relationship path representation being used to predict the response entity of the source entity.

[0099] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An interpretable knowledge graph reasoning method based on graph neural network, characterized in that: include: Acquire a triple to be queried input by a user, wherein the triple to be queried includes a source entity and an entity relationship; Constructing a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encoding the knowledge graph subgraph and the entity relationship according to a relationship-aware attention mechanism to obtain a relationship weight, wherein the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph; Aggregate the relationship paths associated with the source entity in the knowledge graph according to the relationship weights to obtain relationship path representations, where the relationship path representations are used to predict the response entity corresponding to the source entity; The knowledge graph subgraph and the entity relationship are encoded according to the relationship-aware attention mechanism to obtain the relationship weights, including: Performing word embedding, center embedding and position embedding processing on the knowledge graph subgraph to obtain an encoded input sequence; Inputting the encoded input sequence and the entity relationship into a relational attention encoder to obtain the relation weight; After obtaining the relationship path representation, the method further includes: The triples to be queried and the relationship path representation are input into a logic reasoner to obtain a query result.

2. The interpretable knowledge graph reasoning method based on graph neural network according to claim 1 is characterized in that: The aggregating the relationship paths associated with the source entities in the knowledge graph according to the relationship weights to obtain the relationship path representations includes: The knowledge graph is input into a neural Bellman-Ford network, and the information transfer paths of each entity embedding layer of the neural Bellman-Ford network are aggregated according to the relationship weights to obtain the relationship path representation.

3. The interpretable knowledge graph reasoning method based on graph neural network according to claim 1 is characterized in that: The constructing of a knowledge graph subgraph according to the context information of the source entity in the knowledge graph comprises: Based on the breadth-first algorithm and the knowledge graph, the entities and entity relationships of the triples to be queried are expanded, and when the expanded triples to be queried reach the context budget, the knowledge graph subgraph is obtained.

4. An interpretable knowledge graph reasoning device based on graph neural network, characterized in that: include: A data acquisition module, used to acquire a triple to be queried input by a user, wherein the triple to be queried includes a source entity and an entity relationship; An encoding module, used to construct a knowledge graph subgraph according to the context information of the source entity in the knowledge graph, and encode the knowledge graph subgraph and the entity relationship according to the relationship-aware attention mechanism to obtain a relationship weight, wherein the relationship weight is used to represent the importance of the relationship path between the source entity and each entity in the knowledge graph subgraph; A path generation module, configured to aggregate the relationship paths associated with the source entity in the knowledge graph based on the relationship weights to obtain a relationship path representation, wherein the relationship path representation is used to predict a response entity of the source entity; The device also includes: A logical reasoning module is used to obtain a query result based on the knowledge graph, the source entity and the relationship path representation after the relationship path representation is obtained.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the interpretable knowledge graph reasoning method based on graph neural network as described in any one of claims 1 to 3.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the interpretable knowledge graph reasoning method based on graph neural network as described in any one of claims 1 to 3.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the interpretable knowledge graph reasoning method based on graph neural network as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Knowledge graph completion method

    CN113360664A

  • Generative common sense reasoning method based on knowledge graph

    CN114817574A