# A must-see for beginners&#39; introductory knowledge graph: reasoning

Abstract: Starting from the basic concepts of knowledge reasoning, this article introduces the application and methods of knowledge reasoning of knowledge graph in an easy-to-understand manner.

This article is shared from the HUAWEI cloud community " 0 basic introductory knowledge graph super power-knowledge reasoning ", author: Cheri Chen.

## 1. The concept of knowledge reasoning

Reasoning is the use of logical thinking ability, starting from existing knowledge, to derive unknown and tacit knowledge.

Specifically in the knowledge graph, the so-called knowledge reasoning is to use the existing knowledge (triplets) in the graph to obtain some new relationships between entities or entity attributes (triplets). As shown in the figure below: If there are such two triples in the original knowledge graph, <Yao Ming, wife, Ye Li> and <Yao Ming, daughter, Yao Qinlei>, through knowledge reasoning, you can get <Yao Ming, daughter, Yao Qin Lei>.

## Second, the application of knowledge reasoning

### Knowledge completion

Actually constructed knowledge graphs usually have incomplete problems, that is, some relationships or attributes will be missing. Knowledge completion is to use algorithms to complete missing attributes or relationships in the knowledge graph.

As shown in the figure below, take "Who is Yao Qinlei's mother" as an example. There is a common sense that “father’s wife is a mother”. Based on this common sense, it can be inferred that Yao Qinlei’s mother is Ye Li, which can then complement the relationship between “Yao Qinlei” and “Ye Li” and improve our simple The completeness of the knowledge graph of character relationships.

### Knowledge error correction

There may be erroneous knowledge in the actual knowledge graph. Among them, there may be errors in the type of the entity, the relationship between the entities, and the attribute value of the entity. The error correction of the knowledge graph is a very challenging task. These errors will affect the quality of the knowledge map, and then affect the application based on the knowledge map.

We can correct the knowledge graph error through reasoning (as shown in the figure below). For example, in a certain film and television knowledge map, the entity "Spring Bright Pig Bajie" in the dotted frame is of the type "movie". Its attributes include episode number, theme song, ending song, etc. Other entities that belong to the category of "movies" mostly include the release period and box office, and most of them do not have the attribute of episode number. The reasoning shows that there is a high probability that there is an error in the genre of the entity "Bright Spring Pig Bajie", and the correct genre should be a TV series.

### Reasoning Questions and Answers

Reasoning question answering based on knowledge graph is also a typical application of knowledge graph reasoning. Questions and answers based on knowledge graphs are generally referred to as KBQA. Compared with traditional information retrieval question and answer, KBQA can have certain reasoning ability, which is its advantage. Reasoning Q&A based on the knowledge graph is usually applied to relatively complex Q&A scenarios involving multiple entities, multiple relationships, multiple hops, and comparisons.

For example, "Which of the films starring Andy Lau have a Douban score greater than 8?" Such a question. The machine needs to analyze and understand the question, complete the query, reasoning, and comparison actions in the knowledge graph, and find "A World Without Thieves" and "Infernal Affairs" as the answer to return (as shown in the figure below).

## Third, the method of knowledge reasoning

### Ontology-based reasoning

Ontology is the description of the concepts in the field and the relationship between them. Ontology-based reasoning uses the semantics and logic contained in the ontology to reason about the types of entities and the relationships between entities. The description form of the ontology is standardized. RDFS, OWL, etc. are a kind of language that satisfies specific specifications and is used to express ontology.

Take RDFS as an example: RDFS defines a set of vocabulary for resource description: including class, domain, range, etc. 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’s type is an artificial intelligence company, and artificial intelligence company is a subcategory of high-tech companies, so it can be inferred that Google’s is also a high-tech company. In the example on the right, the domain that defines the investment relationship is the investor, and the range is the company. It can be simply considered that the head node of the investment relationship is the investor type, and the tail node is the company type. Suppose there is a fact that David Cheriton invested in Google. It can be inferred that David Cheriton is an investor. These two examples use the semantics and logic contained in the RDFS itself for reasoning.

### Rule-based reasoning

Rule-based reasoning means that a series of rules can be abstracted, and these rules can be applied to the knowledge graph to complete and correct errors. This idea is also very simple and intuitive. The advantage of rule-based reasoning is that the result of reasoning is accurate and interpretable. Therefore, rule-based reasoning is widely used in academia and industry.

The example in the figure is artificially defined some rules, including "B is A's wife, then A is B's husband", "B is A's daughter, then A is B's father" and so on. Use these rules to reason, and then fill in the missing relationships in the knowledge graph. We can use these rules to infer new knowledge such as "Michelle's husband is Obama" and "Maria'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 to reason. They have the advantages of strong logic constraints, high accuracy, and easy interpretation. But it is not easy to expand. Based on the reasoning of representation learning, through the mapping function, the discrete symbols are mapped to the vector space for numerical representation, while the association between entities and relationships is captured, and then the inference is performed in the mapped vector space.

The knowledge graph is composed of entities and relationships, usually expressed in the form of triples: head (head entity), relation (relationship of entities), tail (tail entity), abbreviated as (h, r, t). The knowledge representation learning task is to learn the vector representation of h, r, t. As shown in the figure below, different points represent different knowledge. We can find a suitable mapping function so that the points closer together are semantically similar.

The reasoning based on representation learning is abstract and complicated. Here is a simple example to reason "Where is Yao Qinlei's birthplace?"

Suppose we have found a perfect mapping function that can map the knowledge graph and a piece of text containing relevant information to the same vector space. Then calculate these vectors, such as simply adding the vectors "Yao Qinlei", "Zai", "local hospital", and "Birth" to arrive at the "Houston" vector, you can infer Yao Qinlei Was born in Houston.

[2021 HUAWEI CLOUD AI Practical Camp ]——The six practical camps are based on the unit system, which is free for everyone to learn.

Click to follow and learn about Huawei Cloud's fresh technology for the first time~

1.2k 声望
1.7k 粉丝
0 条评论