# Expert system

## Basic composition of expert system

The expert system is the application of artificial intelligence in information systems, which is an intelligent computer program system with a large amount of knowledge and experience in a certain field at the expert level, it can solve the problem in the field by using the knowledge and problem solving methods of human experts. problem. The main function of an expert system depends on a large amount of knowledge. The key to designing expert systems is the use of knowledge representation and knowledge. The most essential difference between an expert system and a general computer program is that the problem solved by the expert system generally has no algorithmic solution, and often it is necessary to make conclusions based on incomplete, inaccurate or uncertain information. The general expert system consists of five parts: database, knowledge base, inference engine, interpreter and knowledge acquisition, which structure is shown in Figure 10-9.

Figure 10-9: Structural diagram of expert system

1) Knowledge base

The knowledge base is used to access and manage the acquired expertise and experience, which can be used by inference engine with the functions of knowledge storage, retrieval, editing, addition, deletion, modification and expansion.

2) Database

It is used to store control information, intermediate hypothesis and intermediate results used in system reasoning.

3) Inference engine

It can be used for reasoning by knowledge and solving special problems, which has the functions of heuristic reasoning, algorithmic reasoning, forward, backward or bidirectional reasoning, serial or parallel reasoning and so on.

4) Interpreter

The interpreter is used as the “man-machine” interface between expert system and user, its function is to explain the behavior of the system to user, including:

(4.1) Consulting Understanding: Understanding the user’s queries, transforming the user’s input questions and related facts, data and conditions into information acceptable to the inference engine.

(4.2) Explanation of conclusions: The conclusion or answer of reasoning is output to the user, and the reasoning process is explained according to the user’s needs, and the reliability of the conclusion is estimated.

5) Knowledge acquirer

Knowledge acquisition is the “interface” between expert systems and experts. The knowledge in the knowledge base is generally obtained through the “manual transplant” method, the “interface” is the knowledge engineer (the designer of the expert system), the knowledge is acquired by means of “topic interview” and “speaking record analysis”, then enter the knowledge base. In order to improve the efficiency of knowledge engineers’ access to expert knowledge, the “knowledge acquisition aids” can be used to assist experts in organizing knowledge or assisting in the expansion and modification of databases. In recent years, methods such as machine learning, machine recognition, and semi-automation have been acquired to acquire knowledge.

## Knowledge processing of expert systems

### Artificial intelligence and expert system

In the simulation of human brain research, it was originally intended to start with young children, with the development of the brain to simulate the human brain, but found that such simulation is too difficult, and turned to the thinking process of experts in the field of research, because experts in the field can explain clearly the knowledge and logic. With the advent of expert system tool software, expert systems have been developed in many fields, the most successful of which is the expert system of chess. The main purpose of artificial intelligence is to simulate the function of the human brain, but at present people’s thinking process on the human brain is not very clear, so the concept of artificial intelligence cannot be very clear. Many studies of artificial intelligence are limited to the derivation of formal logic. Anything beyond the scope of formal logic is considered to be an unsolvable problem. The artificial intelligence that is now understood mainly refers to the process of performing logical reasoning with a computer.

### Knowledge representation

Knowledge representation is the formalization of knowledge, which is to study the feasible, effective and universal principles and methods of expressing knowledge by machine. At present, the commonly used knowledge representation methods are: production rules, semantic network method, frame representation, and or graph method, process representation, feature representation, blackboard structure, Petri network method, neural network, etc. The best effect is the production rule, the other representation methods are not used alone, most of them are based on production rules to increase and expand semantics, framework and programming knowledge.

The production rule uses “if…” Then…” Statement (If… (Then). “If” can be a condition or multiple conditions; “then” can also be a conclusion or multiple conclusions. Also known as forward reasoning, there are several cases:

1. One-to-one: If (1), then (a).

2. One-to-many: If (1), then (a), (b),… (n).

3. Many-to-one: If (1), (2), …, (m); then (a).

4. Many-to-many: If (1), (2), …, (m); then (a), (b),…,(n).

If…, the then statement is a statement from a known condition, inferring the result, and conversely, the condition from the result is called backward-style reasoning. There are also four situations, one-on-one, one-to-many, many-to-one, many-to-many:

1. One-to-one: Conclusion (a); Need(1).

2. One-to-many: Conclusion (a); Need(1), (2),…,(m).

3. Many-to-one: Conclusion (a), (b),…,(n);Need (1).

4. Many-to-many: Conclusion (a), (b),…,(n);Need (1),(2),…,(m).

It can be seen that both the forward reasoning and the reverse reasoning of the production rules are the processing methods in the deterministic problem. For the problem of uncertainty, the production rule does not solve the problem and needs to be combined with other representation methods.

### Knowledge reasoning

Reasoning refers to the process of drawing conclusions from existing facts according to certain rules. The automatic reasoning in the expert system is knowledge reasoning, which is the main means of solving problems in the expert system.

Knowledge reasoning is closely related to knowledge representation, according to the characteristics of knowledge representation, knowledge reasoning methods can be divided into two types: graph search method and logical argument method.

. Graph search method

In the knowledge representation of the expert system, many basic and commonly used expressions have the form of “graphs” or can be transformed into the form of corresponding graphs, and can usually be expressed by or with graphs. For example, a state space map, an OR graph, a semantic grid graph, and an OR graph or a network graph transformed by a production rule or a frame representation method.

Based on the knowledge representation of the graph, the knowledge inference process of the problem solving is the route search process from the starting node corresponding to the initial state in the graph to the terminating node corresponding to the target state, that is, the search is effective from the initial state to the target，the optimal or most economical route, the corresponding knowledge reasoning method is the graph search method. For example, for a tree-like state space graph, called a “problem tree”, the basic graph search methods are: breadth-first search, depth-first search and so on.

. Logical argument method

When knowledge representation uses predicate logic or other formal logic methods, knowledge reasoning can also adopt logical argumentation methods. In this case, solving a problem corresponds to proving a theorem or several theorems, and the knowledge reasoning process of problem solving corresponds to the process of using the mathematical logic method to prove the theorem. The method of knowledge reasoning is the method of logical argumentation. For example, if a set of predicate logic expressions A is used to describe the relevant facts, conditions or conditions, and another set of predicate logic expressions B is used to describe the answer or conclusion of the question, then as long as the logic calculus is used to demonstrate that the theorem AB is true, it is argued that the correct answer or conclusion B can be derived from the facts, circumstances and conditions.

According to whether heuristic knowledge is used in the reasoning process of problem solving, knowledge reasoning methods can be divided into heuristic reasoning and non-heuristic reasoning.

. Heuristic reasoning

In the process of problem solving, using the heuristic knowledge related to the problem, that is, the strategy and skill of solving the problem, the practical experience or knowledge of the characteristics of the solution and the estimation of the law, so as to speed up the reasoning process and improve the search efficiency, the process of reasoning is called “heuristic reasoning.” For example, in the inference method of graph search, the depth-first search method improved by heuristic knowledge, such as the local preference search method, preferably the first search method, etc., only needs to search part of the state space, which can improve the search efficiency.

. Non-inspired reasoning

In the reasoning process of problem solving, no heuristic knowledge is used, and general reasoning is performed only according to general logic rules and control knowledge. This method lacks the pertinence of solving the problem, and needs to search the full state space without selecting the optimal search path, and most of the search efficiency is low, for example, the width-first search method is a complete algorithm, but its search efficiency is low.

According to the accuracy of conclusions in the reasoning process of problem solving, knowledge reasoning methods can be divided into two categories: precise reasoning and imprecise reasoning.

. **Exact reasoning ** Accurate reasoning means that in the expert system, the knowledge of a specific domain is expressed as a necessary causal relationship and logical relationship, and the conclusion of reasoning is affirmative. This reasoning is precise reasoning.

. Inaccurate reasoning In human knowledge, there is a considerable class of subjective judgments that are inaccurate and vague. The inference rules summarized by these knowledge are also often uncertain, based on this indeterminate inference rule, the reasoning is formed and the conclusion is called inexact reasoning. Commonly used methods of imprecise reasoning include probabilistic methods, credibility methods, fuzzy subset methods, and evidence theory methods.

According to the special and general relationship in the problem solving process, the knowledge reasoning method can be divided into deductive reasoning and inductive reasoning; according to the direction of reasoning in solving the reasoning process, the knowledge reasoning method can be divided into three categories: forward reasoning, reverse reasoning and forward and reverse mixed reasoning.

An example of a spatial classification expert system - land type classification

Spatial classification is the most commonly used function of GIS and remote sensing information systems, grouping spatial units into groups is the basic function of intelligent GIS. The traditional classification is based on binary logic, which is considered to be obvious, the basic spatial unit (vector or grid structure) belongs to and belongs to only one spatial category. However, in fact, the boundaries between spatial categories are usually fuzzy, gradual rather than abrupt, so the introduction of fuzzy logic in spatial classification will improve the accuracy of classification. In addition, spatial classification is also a psychological judgment process based on people’s knowledge and knowledge of spatial phenomena, it is necessary to develop an expert system with GIS.

Of course, structured classification algorithms (programmatic knowledge) can be used, but this method is often very mechanical and does not effectively communicate with the user about the classification. The classification method of the expert system is more flexible and intelligent, which is not an algorithm, but a rule about how the spatial classification is abstracted and how the spatial data is classified, it can be modified, deleted, and modified in the knowledge base without modifying any programs, increase the judgment of experts and non-experts, and classify knowledge and rules. Rule-based expert classification systems often have components that disseminate knowledge and education, the following is an example of a land type expert classification system based on remote sensing images.

The data uses 4-band LANDSAT MSS image data, and the classification used by the classification system is shown in Figure 10-10:

Figure 10-10: Land use classification

Because classification is a data-driven process, forward reasoning is adopted. Production rules are acquired from domain experts and stored in the knowledge base as shown in the table below.

Table 10-5: Classification rules for knowledge inventory storage

rule r1
If（x1<8.0000,12.0000）
and (x4<5.0000,10.0000)
then pretype1 is water
Certainty is 1
rule r2
If ( x3>=8.0000,12.0000)
and (x4>=5.0000,10.0000 )
then pretype1 is land
rule r3
If ( pretype1 is water )
and (x1>20.0000,24.0000）
and (x2>13.0000,16.0000)
and (x3>5.0000,10.0000)
then type is turbid
Certainty is 1
rule r4
If ( pretype1 is water)
and ( x1<=20.0000,24.0000)
or (x2<13.0000,16.0000 )
or (x3<=5.0000,10.0000 )
then type is clear
Certainty is 1
rule r5
If ( pretype1 is land )
and (x1<17.0000,25.0000）
and (x2<13.0000,30.0000)
and (x3>27.0000,50.0000)
and (x4>30.0000,65.0000)
then type is vegetation
Certainty is 1
rule r6
If ( pretype1 is land)
and ( x1>=17.0000,25.0000)
or (x2>=13.0000,30.0000 )
or (x3<=27.0000,50.0000 )
or (x4<=30.0000,65.0000 )
then pretype2 is non-vegetation
Certainty is 1
rule r7
If ( pretype2 is non-vegetation )
and (x1>27.0000,39.0000）
and (x2<26.0000,52.0000)
and (x3>26.0000,49.0000)
and (x4>21.0000,41.0000)
then type is barren
Certainty is 1
rule r8
If ( pretype2 is non-vegetation)
and ( x1<20.0000,30.0000)
and (x2<20.0000,30.0000)
and (x3>20.0000,35.0000)
and (x4>15.0000,25.0000)
then type is urban_or_other
Certainty is 1


According to the expert’s experience, a band value cannot be used arbitrarily as the boundary of classification, to reflect the gradual change of spectral reflection, a fuzzy logic method is used to represent the inference rule. Taking the rule r1 as an example, when dividing the waters, not only a value 5 of the band 3 (x3) and a value 8 of the band 4 (x4) are used as the classification basis, but the method of using the fuzzy set allows the gradation feature. The fuzzy set representation is shown in Figure 10-11.

Figure 10-11: Fuzzy sets

Since the expert is very certain about the classification rules, the certainty factor is 1. If the level of certainty is different, the deterministic factor can take values in the range [0, 1].

The results of the classification are displayed by the GIS. When the classification results are accurate, the system automatically displays the classification results. When there is an error in the classification result, the mixed pixels are simultaneously identified and displayed, and the fuzzy boundary caused by the gradient of the land type can also be displayed, the width of the fuzzy boundary is controlled by different thresholds in the place where the land type is mixed.