An interpretable knowledge reasoning method based on a multi-round generation strategy
Through multiple rounds of generation strategies and TransE models, entities and relationship vectors are generated, and the problem of high path generation and calculation overhead in traditional knowledge inference is solved, efficient and interpretable knowledge inference methods are realized, and a set of answer entities with high confidence is generated.
Patent Information
- Application Number
- CN202210766991.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-01
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-07-01
AI Technical Summary
Traditional knowledge inference technology cannot generate answer paths, cannot complete missing nodes, and entity relationship vectors and query vectors are difficult to calculate similarity in the same vector space, resulting in high computational overhead.
Using a method based on multiple rounds of generation strategies, the TransE model is used to generate entities and relational vectors, and the answer entity set is generated through multiple rounds of generation strategies and cosine similarity calculation. The entity relationship vector and logical query vector are trained in a coordinated manner in the same space.
It realizes interpretability knowledge inference for complex queries, generates first-order logical rules, reduces calculation overhead, improves calculation efficiency, and generates a collection of answer entities with high confidence.
Smart Images

Figure CN115688921B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly to an interpretable knowledge reasoning method based on a multi-round generation strategy. Background Art
[0002] The knowledge reasoning task is usually used for knowledge graph retrieval and question answering, aiming to query complex, multi-hop relationships in the knowledge graph, and is one of the key links in the application of the knowledge graph.
[0003] Generally, the knowledge reasoning task based on the knowledge graph is defined as: given a query q as a "question", return a sorted set of candidate entities. In this set, the entity with a higher relevance to the query q is ranked higher, and the entity ranked first is selected as the "answer" to the query q. For the knowledge reasoning task, for example: the user inputs a complex query "the country where the state is located in the city where Bill Gates was born", and the algorithm returns a sorted set of candidate entities. In this set, the entity ranked highest is "U.S.A.".
[0004] The chained logical rule for the query q "the country where the state is located in the city where Bill Gates was born" is:
[0005] q("Bill Gates") := E ? ("the country where the state is located in the city where Bill Gates was born") ← (e3:?, r3:CountryLocation, e2:?) ∧ (e2:?, r2:StateLocation, e1:?) ∧ (e1:?, r1:Bordin, e0:BillGates)
[0006] Among them, the entity e0 (Bill Gates) is the entity explicitly appearing in the query q, and the relationships r1 (Bordin, indicating "born in"), r2 (StateLocation, indicating "the state where located"), and r3 (CountryLocation, indicating "the country where located") are the relationships explicitly appearing in the query q; the entities e1, e2, and e3 are the entities not appearing in the query q (where the entity e3 is the final answer entity of the query q), thus causing the interruption of the above chain. During the knowledge reasoning process, as the chain unfolds, the entities e1, e2, and e3 will be deduced in sequence (where the entity e1 is Seattle, the entity e2 is Washington state, and the final answer entity e3 is U.S.A.), so that the chain is finally completed and finally forms a complete chain leading from the entity e0 to the entity e3, as follows:
[0007] (e3: U.S.A., r3: CountryLocation, Washington) ∧ (Washington, r2: StateLocation, Seattle) ∧ (e1: Seattle, r1: Bordin, e0: Bill Gates)
[0008] Since the given query is represented as a chained logical rule, which shows a reasoning path that can be understood by humans and reflects the multi-hop conduction of relationships.
[0009] Technical problems existing in the prior art:
[0010] Traditional knowledge reasoning techniques can either not generate the path of answer generation or cannot complete the missing nodes on the path and provide the confidence of the completed nodes. Therefore, traditional technical means lack interpretability and feasibility.
[0011] In addition, traditional knowledge reasoning methods train the entity relationship vectors and query vectors of the knowledge graph separately, making it difficult to calculate the similarity between the query vector and the entity relationship vector in the same vector space and under the same standard.
[0012] When traditional knowledge reasoning techniques generate answers, the scale of the candidate entity set selected is large, resulting in a large number of comparison times and high computational overhead. Summary of the Invention
[0013] The embodiments of the present invention provide an interpretable knowledge reasoning method based on a multi-round generation strategy, which realizes generating first-order logical rules for complex queries, using semantic similarity to measure the relevance between the given query and candidate entities, and generating an answer entity set.
[0014] The embodiments of the present invention provide an interpretable knowledge reasoning method based on a multi-round generation strategy, including:
[0015] Given a knowledge graph to be queried, and using the TransE model, generate entity vectors of each entity and relationship vectors of each relationship in the knowledge graph;
[0016] Obtain a query condition, and identify the relationships between entities in the query condition to obtain a query entity set;
[0017] Calculate the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set to obtain a candidate entity set;
[0018] Based on the entities and the relationships between entities in the query condition, generate a logical query vector according to the multi-round generation strategy;
[0019] Calculate the similarity between the candidate entities in the candidate entity set and the logical query vector, and take the entities with similarity higher than the preset threshold as the query results.
[0020] In some embodiments, obtaining a query condition and identifying the relationships between entities in the query condition to obtain a query entity set includes:
[0021] Based on the query condition, use a named entity recognition model and a relationship extraction model to identify the relationships between entities in the query condition to generate a query entity set.
[0022] In some embodiments, calculating the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set to obtain a candidate entity set includes:
[0023] The candidate entity set is generated in the following manner:
[0024] E △ (q) = {N(e0) ∪ N(e1) ∪ … ∪ N(e n ) ∪ N(r1) ∪ … ∪ N(r n )}
[0025] where N(e) is the set of neighbor entities of entity e, N(r) is the set of all entities that appear on the head entity and tail entity of relationship r, {e0, e1, …, e n} represents the entities included in the given query q, and {r1, …, r n} represents the relationships included in the given query q.
[0026] In some embodiments, based on the entities in the query condition and the relationships between the entities, a logical query vector is generated according to a multi-round generation strategy, including:
[0027] In the first round, directly assign the entity vector e0 of entity e0 to the initial logical query vector q0, q0 = e0;
[0028] In the second round, based on the relationship r1 between the entity vector e0 and the adjacent entity vector e1, generate the second logical query vector q1, q1 = e0 + r1;
[0029] Repeat the rounds to generate the logical query vector q n q n = e n-1 + r n ;
[0030] Take q n as the final logical query vector, q = q n .
[0031] In some embodiments, for any round, if the corresponding entity vector e i-1 (i ∈ (1, n)) is missing, it is generated in the following manner: i-1 :
[0032] For each entity e ∈ N(r i-1 ) in the candidate entity set, calculate its cosine similarity with the logical query vector q i-1 :
[0033] sim(e, q i-1 )
[0034] Take the entity with the highest cosine value as the entity e i-1 , and its vector representation is e i-1 .
[0035] In some embodiments, calculating the similarity between the candidate entities in the candidate entity set and the logical query vector, and taking the entities with similarity higher than a preset threshold as the query result includes:
[0036] For each entity e ∈ E △ (q) in the candidate entity set, calculate its cosine similarity with the logical query vector q:
[0037] sim(e, q)
[0038] Use this cosine similarity to sort all entities in the candidate entity set, set a threshold ρ, and take the entities with cosine similarity exceeding ρ into the answer entity set:
[0039] E ? (q) = {e|sim(e, q) ≥ ρ}
[0040] Sort the entities in the answer entity set according to cosine similarity, and take the entity with the highest ranking as the query result e n .
[0041] In some embodiments, it further includes performing model training in the following manner:
[0042] Define the objective function:
[0043]
[0044] Where m represents the number of queries in the training set, q k represents the k-th query in the training set, q k represents the vector corresponding to the k-th query q k , is the answer to the query q k , regarded as a positive example, and its vector representation is Taken from E ? (q k ) other than entities, not the query q k 's answer, regarded as a negative example, whose vector representation is η represents the boundary parameter;
[0045] Use the stochastic gradient descent algorithm and the backpropagation algorithm to perform model training until the model converges.
[0046] An embodiment of the present application also proposes an interpretability knowledge reasoning device, including a processor and a memory. A computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the aforementioned interpretability knowledge reasoning method based on the multi-round generation strategy are implemented.
[0047] An embodiment of the present application also proposes a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the aforementioned interpretability knowledge reasoning method based on the multi-round generation strategy are implemented.
[0048] The embodiment of the present invention realizes generating first-order logic rules for complex queries, using semantic similarity to measure the relevance between a given query and candidate entities, and generating a set of answer entities.
[0049] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are given below. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0051] Figure 1 is the basic flowchart of the interpretability knowledge reasoning method of the embodiment of the present application;
[0052] Figure 2 is the basic structural example of the interpretability knowledge reasoning method of the embodiment of the present application;
[0053] Figure 3 is the multi-round generation strategy flowchart example of the interpretability knowledge reasoning method of the embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0054] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0055] An embodiment of the present invention provides an interpretable knowledge reasoning method based on a multi-round generation strategy, including:
[0056] In step S101, a knowledge graph to be queried is given, and using the TransE model, entity vectors of each entity in the knowledge graph and relation vectors of each relation are generated. Specifically, for each entity e vector e in the knowledge graph G, a vector r of each relation r in the knowledge graph G is generated.
[0057] In step S102, a query condition is obtained, and the relationship between entities in the query condition is identified to obtain a query entity set. For example, for a given query q, a named entity recognition model and a relation extraction model are used to identify the entities in the query q and the relationships between them, forming a set of entities {e0, e1, …, e n} of the query q.
[0058] In step S103, the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set is calculated to obtain a candidate entity set. Since the knowledge graph G usually contains a huge number of entities, calculating the similarity between all entities and a given logical query q will incur a huge computational overhead. In this example, the above technical problem is solved by generating a candidate entity set.
[0059] In step S104, based on the entities in the query condition and the relationships between the entities, a logical query vector is generated according to the multi-round generation strategy. The multi-round generation strategy proposed in this application is used to obtain the final logical query vector.
[0060] In step S105, the similarity between the candidate entities in the candidate entity set and the logical query vector is calculated, and the entities with a similarity higher than a preset threshold are taken as the query results.
[0061] The knowledge graph in this application can be the user's own graph that applies the technology of this application or an open-source graph. In some specific examples, the knowledge reasoning method of this application is applied to the task of automatic question answering on the encyclopedic knowledge graph Freebase. The encyclopedic knowledge graph is composed of encyclopedic facts. A fact is represented as a triple (head entity, relation, tail entity), indicating that there is a specific relationship between the head entity and the tail entity. For example, taking the triple (Steve_Jobs, Founder_Of, Apple) as an example, it means that Steve Jobs is the founder (Founder_Of) of Apple Inc., that is, there is a founding relationship between Steve Jobs and Apple Inc. The task of automatic question answering on the encyclopedic knowledge graph Freebase can be defined as: given the encyclopedic knowledge graph Freebase, the user asks a question described in natural language, and the system queries in the encyclopedic knowledge graph Freebase and feeds back the answer to the user.
[0062] The embodiments of the present invention realize generating first-order logic rules for complex queries, and using semantic similarity to measure the relevance between a given query and candidate entities to generate a set of answer entities.
[0063] In some embodiments, obtaining a query condition and identifying the relationship between entities in the query condition to obtain a query entity set includes: based on the query condition, using a named entity recognition model and a relationship extraction model to identify the relationship between entities in the query condition to generate a query entity set.
[0064] Specifically, for a given query q, using a named entity recognition model and a relationship extraction model, form an entity set ({e0, e1,..., e n}, the number of entities in query q is n + 1) and a relationship set ({r1, r2,..., r n}, the number of relationships in query q is n). The entities in the above entity set may be missing, and the missing entities need to be generated in subsequent steps.
[0065] Based on the above entities and relationships, the following triples are formed:
[0066] {(e1, r1, e0), (e2, r2, e1),..., (e n , r n , e n-1 )}.
[0067] Furthermore, the given query q can be expressed in the form of a first-order logic rule:
[0068] (e n , r n,e n-1 ) ∧ … ∧ (e1, r1, e0).
[0069] In some embodiments, calculating the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set to obtain a candidate entity set includes:
[0070] Define N(e) as the set of neighbor entities of entity e, that is, the set of entities connected to entity e in the knowledge graph G; define N(r) as the set of all entities that appear on the head entity and tail entity of relation r. From this candidate entity set, it is generated in the following way:
[0071] E △ (q) = {N(e0) ∪ N(e1) ∪ … ∪ N(e n ) ∪ N(r1) ∪ … ∪ N(r n )}
[0072] where {e0, e1, …, e n} represents the entities included in the given query q, and {r1, …, r n} represents the relations included in the given query q. In this way, the set of entities for which the similarity needs to be calculated is reduced from the entire entity set E of the knowledge graph G to the set E △ (q), The present invention fully considers the entities associated with the entities and relations appearing in the given query, reduces the scale of the candidate entity set, and realizes the reduction of the calculation overhead and the improvement of the calculation efficiency.
[0073] In some embodiments, based on the entities in the query conditions and the relations between the entities, according to a multi-round generation strategy, generating a logical query vector includes:
[0074] In the first round, directly assign the entity vector e0 of entity e0 to the initial logical query vector q0, q0 = e0;
[0075] In the second round, based on the relation r1 between the entity vector e0 and the adjacent entity vector e1, generate the second logical query vector q1, q1 = e0 + r1;
[0076] Repeat the round to generate the logical query vector q n , q n = e n-1 + r n ;
[0077] Take q n as the final logical query vector, q = q n .
[0078] An important step in the knowledge reasoning task based on representation learning is to generate a vector q with representational ability for a given logical query q. This vector should cover the semantic information of the numerous entities ({e0, e1, …, e n}) and relationships ({r1, r2, …, r n}) contained in the logical query q.
[0079] As Figure 2 , Figure 3 shown, this example also proposes a multi-round generation strategy to generate the vector q. In each round, a representation of the vector q is generated (successively represented as {q0, q1, …, q n}). Iterations are carried out round by round. Finally, after n + 1 rounds, the vector q n is obtained as the final representation of the vector q. The specific steps are as follows:
[0080] The first round (generating q0): Directly assign the vector e0 of the entity e0 to q0 to complete the initialization:
[0081] q0 = e0
[0082] The second round (generating q1): When generating q1, considering the semantics of the relationship r1 and the semantic relationships of the entities associated with the relationship r1 helps to model the semantics of the neighbors of the entity e0:
[0083] q1 = e0 + r1
[0084] If the entity e1 is missing (i.e., the entity e1 does not explicitly appear in the query q and is represented as "e1:?" in the chained logical rule), the method for generating the entity e1 is as follows: For each entity e ∈ N(r1) in the candidate entity set, calculate its cosine similarity with the logical query vector q1:
[0085] sim(e, q1)
[0086] Take the entity with the highest cosine value as the entity e1 (its entity vector is represented by e1 and has been generated by module (1)).
[0087] The third round (generating q2: When generating q2, considering the semantics of the relationship r2 and the semantic relationships of the entities associated with the relationship r2 helps to model the semantics of the neighbors of the entity e1:
[0088] q2 = e1 + r2
[0089] If the entity e2 is missing (i.e., the entity e2 does not explicitly appear in the query q and is represented as "e2:?" in the chained logical rule), the method for generating the entity e2 is as follows: For each entity e ∈ N(r2) in the candidate entity set, calculate its cosine similarity with the logical query vector q2:
[0090] sim(e, q2)
[0091] Take the entity with the highest cosine value as entity e2 (its entity vector is represented by e2 and has been generated by module (1)).
[0092] Similarly:
[0093] In the i-th round (generating q i-1 ): When generating q i-1 , consider the semantics of relation r i-1 and the semantic relationships of the entities associated with relation r i-1 , which helps to model the semantics of the neighbors of entity e i-2 :
[0094] q i-1 = e i-2 + r i-1
[0095] If entity e i-1 is missing (i.e., entity e i-1 does not explicitly appear in query q and is represented as "e i-1 :?) in the chain logic rule), the method for generating entity e i-1 is as follows: For each entity e ∈ N(r i-1 ) in the candidate entity set, calculate its cosine similarity with the logical query vector q i-1 :
[0096] sim(e, q i-1 )
[0097] Take the entity with the highest cosine value as entity e i-1 (its entity vector is represented by e i-1 and has been generated by module (1)). The method of this application realizes the automatic generation of the multi-hop inference path for generating answers, and gives a confidence level (sim(e, q i-1 )) for each completed node, solving the deficiencies of the traditional scheme.
[0098] In the (n + 1)-th round (generating q n ): When generating q n , consider the semantics of relation r n and the semantic relationships of the entities associated with relation r n , which helps to model the semantics of the neighbors of entity e n-1 :
[0099] q n = e n-1 + r n
[0100] Finally, take the vector q nAs the final representation of vector q:
[0101] q = q n
[0102] In some embodiments, for any round, if the corresponding entity vector e i-1 (i ∈ (1, n)) is missing, then e is generated in the following manner i-1 :
[0103] For each entity e ∈ N(r i-1 ) in the candidate entity set, calculate its cosine similarity with the logical query vector q i-1 :
[0104] sim(e, q i-1 )
[0105] Take the entity with the highest cosine value as entity e i-1 , and its vector representation is e i-1 .
[0106] In some embodiments, calculating the similarity between the candidate entities in the candidate entity set and the logical query vector, and taking the entities with similarity higher than a preset threshold as the query result includes:
[0107] For each entity e ∈ E △ (q) in the candidate entity set, calculate its cosine similarity with the logical query vector q:
[0108] sim(e, q)
[0109] Use this cosine similarity to sort all entities in the candidate entity set, set a threshold ρ, and take the entities with cosine similarity exceeding ρ into the answer entity set:
[0110] E ? (q) = {e|sim(e, q) ≥ ρ}
[0111] Sort the entities in the answer entity set according to cosine similarity, and take the entity with the highest ranking as the query result e n , which is the final output result of knowledge reasoning (the answer to query q).
[0112] In some embodiments, it further includes performing model training in the following manner:
[0113] Define the objective function:
[0114]
[0115] Among them, m represents the number of queries in the training set, q k represents the kth query in the training set, qk denotes the vector corresponding to the k-th query q k , is the answer to the query q k , regarded as a positive example, and its vector representation is taken from E ? (outside q k ) Entities other than are not the answers to the query q k , regarded as negative examples, and their vector representations are η represents the boundary parameter;
[0116] Using the stochastic gradient descent algorithm and the backpropagation algorithm, model training is performed until the model converges. The method of this application co-trains the entity relationship vectors and logical query vectors of the knowledge graph in the same space, achieving a more accurate, scientific, and fair similarity measurement of the entity relationship vectors and logical query vectors.
[0117] The module relationships in this example are as Figure 2 shown, including:
[0118] (1) Entity vector and relationship vector initialization module: Map all elements (including entities and relationships) in the knowledge graph G to a unified semantic space to become vectors in this semantic space.
[0119] (2) Query understanding module: For the task of interpretable knowledge reasoning, it aims to understand the logical form of the query q given by the user and represent it in the form of first-order logic rules.
[0120] (3) Candidate entity set generation module: Extract entities from all entities E in the knowledge graph G to form a candidate entity set.
[0121] (4) Logical query vector generation module: Based on a multi-round generation strategy, map the given query q to a unified semantic space to become a vector in this semantic space. Among them, the logical query embedding is generated through a folding mechanism.
[0122] (5) Answer entity set generation module: Use semantic similarity to measure the relevance between the given query and candidate entities to generate an answer entity set.
[0123] (6) Objective function training module: By constructing and training the objective function, generate and iteratively update the parameters of the interpretable knowledge reasoning method based on the multi-round generation strategy proposed in this invention until convergence.
[0124] The method of this application, based on a multi-round generation strategy, realizes the generation and modeling of first-order logic rules for complex queries, uses semantic similarity to measure the relevance between the given query and candidate entities, and generates an answer entity set.
[0125] The method of the present application can effectively locate candidate entities and generate a set of candidate entities, avoiding the selection of answers from all entities with a large number of knowledge graphs, and effectively reducing the computational overhead.
[0126] The embodiment of the present application also provides an interpretable knowledge reasoning device, including a processor and a memory. A computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the aforementioned interpretable knowledge reasoning method based on the multi-round generation strategy are implemented.
[0127] The embodiment of the present application also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the aforementioned interpretable knowledge reasoning method based on the multi-round generation strategy are implemented.
[0128] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the element.
[0129] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0130] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0131] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the spirit and scope protected by the claims of the present invention. These all fall within the protection scope of the present invention.
Claims
1. An interpretable knowledge reasoning method based on a multi-round generation strategy, characterized in that Including: Given a knowledge graph to be queried, and using the TransE model to generate entity vectors of each entity and relationship vectors of each relationship in the knowledge graph; Obtain a query condition, and identify the relationships between entities in the query condition to obtain a query entity set; Calculate the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set to obtain a candidate entity set; Generate a logical query vector based on the entities and the relationships between entities in the query condition according to a multi-round generation strategy; Calculate the similarity between the candidate entities in the candidate entity set and the logical query vector, and take the entities with similarity higher than a preset threshold as the query result; Generating a logical query vector based on the entities and the relationships between entities in the query condition according to a multi-round generation strategy includes: In the first round, the entity 's entity vector is directly assigned to the initial logical query vector , ; In the second round, based on the entity vector and the relationship between the adjacent entity vectors generate the second logical query vector , , ; Repeat the round to generate a logical query vector , ; Take as the final logical query vector, ; For any round, if the corresponding entity vector is missing, it is generated in the following way : For each entity in the candidate entity set , calculate its cosine similarity with the logical query vector : Take the entity with the highest cosine value as the entity , and its vector representation is .
2. The interpretable knowledge reasoning method based on a multi-round generation strategy according to claim 1, wherein Obtaining a query condition, and identifying the relationships between entities in the query condition to obtain a query entity set includes: Based on the query condition, use a named entity recognition model and a relationship extraction model to identify the relationships between entities in the query condition to generate a query entity set.
3. The interpretable knowledge reasoning method based on a multi-round generation strategy according to claim 2, wherein Calculating the similarity between the entity vectors of each entity in the knowledge graph and the entities in the query entity set to obtain a candidate entity set includes: The candidate entity set is generated in the following manner: Among them, is the set of neighbor entities of the entity , is the set of all entities that appear on the head entity and the tail entity of the relationship , represents the entities included in the given query , represents the relationships included in the given query .
4. The interpretable knowledge reasoning method based on a multi-round generation strategy according to claim 1, wherein Calculating the similarity between the candidate entities in the candidate entity set and the logical query vector, and taking the entities with similarity higher than a preset threshold as the query result includes: For each entity in the candidate entity set , calculate its cosine similarity with the logical query vector : Sort all entities in the candidate entity set using this cosine similarity, and set a threshold , and select entities with a cosine similarity exceeding to enter the answer entity set: Sort the entities in the answer entity set according to cosine similarity, and take the entity with the highest ranking as the query result 。 5. The interpretable knowledge reasoning method based on the multi-round generation strategy according to claim 4, wherein It also includes performing model training in the following manner: Define an objective function: Among them, represents the number of queries in the training set, represents the -th query in the training set, represents the -th query corresponding vector, is the answer to query and is regarded as a positive example, and its vector representation is , is taken from an entity outside and is not the answer to query and is regarded as a negative example, and its vector representation is , represents the boundary parameter; Use the stochastic gradient descent algorithm and the backpropagation algorithm to perform model training until the model converges.
6. An interpretability knowledge reasoning device, characterized in that, Including a processor and a memory, where a computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the interpretable knowledge reasoning method based on the multi-round generation strategy as described in any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the interpretable knowledge reasoning method based on the multi-round generation strategy as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Personalized tourist attraction recommending method based on knowledge domains map
CN107729444A
Q&a method, q&a device, computer equipment and storage medium
WO2021000676A1