Abstract: Based on the basic concept of knowledge reasoning, this paper introduces the application and method of knowledge graph knowledge reasoning.
This article is shared by CheriChen from Huawei cloud community “Superpower of Knowledge Graph of 0 Basic Introduction — Knowledge Reasoning”.
First, the concept of knowledge reasoning
Reasoning is the use of logical thinking ability, starting from the existing knowledge, to obtain unknown, implicit knowledge.
Specifically in the knowledge graph, the so-called knowledge inference is to use the existing knowledge in the graph (triples) to get some new relationships between entities or attributes of entities (triples). As shown in the figure below: If there are two triples in the original knowledge graph, < Yao Ming, wife, Ye Li > and < Yao Ming, daughter, Yao Qinlei >, < Yao Ming, daughter, Yao Qinlei > can be obtained through knowledge reasoning.
Second, the application of knowledge reasoning
The completion of knowledge
The actual constructed knowledge graph usually has the problem of incomplete, that is, some relations or attributes will be missing. Knowledge completion is to complete the missing attributes or relations in the knowledge graph through the algorithm.
As can be seen in the picture below, take “Who is Yao Qinlei’s mother” as an example. There is a common sense that “the father’s wife is the mother”, so it can be inferred that Yao Qinlei’s mother is Ye Li according to this common sense, so as to complete the relationship between “Yao Qinlei” and “Ye Li” and improve the completeness of our simple knowledge graph of character relationship.
Knowledge of error correction
There may be false knowledge in the knowledge graph. Among them, there may be errors in the type of entity, the relationship between entities, and the value of entity attributes. Error correction of knowledge graph is a challenging task. These errors will affect the quality of knowledge graph and then affect the application based on knowledge graph.
We can use reasoning to correct knowledge graph errors (as shown in the figure below). For example, in a certain knowledge map of film and television, the entity in the dotted box is The Pig Eight Quits in Spring, and its type is “movie”. Its attributes are set number, theme song, ending song and so on. The attributes of other entities in the same category of “film” mostly include release date and box office, and most of them do not have the attribute of episode number. Then it can be inferred that there is a large probability of error in the type of the entity, and the correct type should be a TV series.
Inference questions and answers
Q&a based on knowledge graph is also a typical application of knowledge graph reasoning. Q&a based on knowledge graph is commonly referred to as KBQA. Compared with traditional information retrieval question-and-answer, KBQA has certain reasoning ability, which is its advantage. Reasoning q&A based on knowledge graph is usually applied to complex Q&A scenarios involving multiple entities, multiple relationships, multiple hops and comparisons.
For example, “Which movies starring Andy Lau get more than 8 points on Douban? “Questions like that. The machine is required to analyze and understand the problem, complete the query, reasoning and comparison in the knowledge graph, and find a World Without Thieves and Infernal Affairs as the answer (as shown in the figure below).
Third, the method of knowledge reasoning
Ontology-based reasoning
Ontology is a description of concepts and their relationships in a domain. Ontology-based reasoning is to use the semantics and logic contained in ontology to reason about entity types and relations between entities. The description form of ontology is normative. RDFS, OWL, etc., are a class of languages that meet specific specifications and conventions for expressing ontologies.
Take RDFS as an example: RDFS defines a set of terms for describing resources: class, domain, range, and so on. It contains simple semantics and logic. We can use these semantics and logic to reason.
In the example on the left in the figure below, Google is an artificial intelligence company, and artificial intelligence company is a subclass of high-tech company, so it can be inferred that Google is also a high-tech company. In the example on the right, the domain that defines the investment relationship is the investor and range is the company. It can be simply considered that the head node of investment relationship is the investor type and the tail node is the company type. Let’s say there’s a fact that David Cheriton invested in Google. It follows that David Cheriton’s type is investor. These two examples take advantage of the semantics and logic inherent in RDFS for reasoning.
Rule-based reasoning
Rule-based inference means that a series of rules can be abstracted and applied to knowledge graph to complete and correct errors. This idea is also very simple and intuitive. The advantage of rule-based reasoning is that the inference results are accurate and interpretable. So rule reasoning is widely used in academia and industry.
In the example, some rules are artificially defined, such as “if B is A’s wife, then A is B’s husband”, “if B is A’s daughter, then A is B’s father”, etc. Using these rules to carry on reasoning, and then complete the missing relation of knowledge graph. We can use these rules to deduce new knowledge such as “Michelle’s husband is Obama” and “Malia’s father is Obama”.
Inference based on representation learning
The first two methods, ontology reasoning and rule reasoning, are based on the knowledge representation of discrete symbols. They have the advantages of strong logical constraints, high accuracy and easy to explain. But it’s not easy to scale. Reasoning based on representation learning, the discrete symbols are mapped to vector space for numerical representation through mapping function, and the association between entities and relations is captured, and then the reasoning is carried out in the vector space after mapping.
Knowledge graph is composed of entities and relations, usually expressed in the form of triples: head(head entity), relation(relation of entities), tail(tail entity), abbreviated (H, R, T). The task of knowledge representation learning is to learn vector representations of H, R, and t. As shown in the figure below, different points represent different knowledge. We can find a mapping function that works so that the points that are closer together are semantically similar.
Reasoning based on representation learning is abstract and complex. Here is a simple example of reasoning “where is Yao Qinlei’s birthplace?”
Suppose we have found a perfect mapping function that maps the knowledge graph and a piece of text containing relevant information into the same vector space. For example, after simply adding the vectors “Yao Qinlei”, “zai”, “local hospital” and “birth”, the vector “Houston” is reached. Then it can be inferred that Yao Qinlei’s birthplace is Houston.
[2021 Huawei Cloud AI Combat Camp] — Six combat camp course unit system, as you learn, for everyone to learn for free.
Click to follow, the first time to learn about Huawei cloud fresh technology ~