1 intelligent systems and control rule-based expert systems n introduction, or what is knowledge? n...

51
1 Intelligent Systems and Control Rule-based expert systems Introduction, or what is knowledge? Rules as a knowledge representation technique The main players in the development team Structure of a rule-based expert system Characteristics of an expert system

Upload: madeleine-goodman

Post on 18-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

n The human mental process is internal, and it is too complex to be represented as an algorithm. n However, most experts express knowledge in form of rules: IFthe ‘traffic light’ is green THENthe action is go IFthe ‘traffic light’ is red THENthe action is stop

TRANSCRIPT

Page 1: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

1

Intelligent Systems and ControlRule-based expert systems Introduction, or what is knowledge? Rules as a knowledge representation technique The main players in the development team Structure of a rule-based expert system Characteristics of an expert system Forward chaining and backward chaining Conflict resolution Summary

Page 2: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Introduction, or what is knowledge? Knowledge : theoretical or practical understanding

of a subject or a domain. sum of what is currently known, and apparently

knowledge is power. Domain expert: a person with deep knowledge (of

both facts and rules) and strong practical experience in a particular domain.

In general, an expert is a skilful person who can do things other people cannot.

The area of the domain may be limited.

Page 3: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

The human mental process is internal, and it is too complex to be represented as an algorithm.

However, most experts express knowledge in form of rules:

IF the ‘traffic light’ is greenTHEN the action is go

IF the ‘traffic light’ is redTHEN the action is stop

Page 4: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

How do you represent knowledge in AI? Commonly type of knowledge representation:

IF-THEN structure relates given information (facts) in IF part to some action in THEN part.

A rule provides some description of how to solve a problem.

Rules are relatively easy to create and understand. IF part: antecedent (premise or condition)

THEN part: consequent (conclusion or action).

Rules as a knowledge representation technique

Page 5: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

IF antecedentTHEN consequent

A rule can have multiple antecedents joined by the keywords AND (conjunction), OR (disjunction) or

both.

IF antecedent 1 IF antecedent 1

AND antecedent 2 OR antecedent 2 . . . . . .AND antecedent n OR antecedent nTHEN consequent THEN consequent

Page 6: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

The antecedent incorporates : an object (linguistic object) and its value linked by an operator.

The operator identifies the object and assigns value. Operators , e.g. is, are, is not, are not assign a

symbolic value to a linguistic object. Expert systems can also use mathematical operators

to define an object as numerical and assign it to the numerical value.

IF ‘age of the customer’ < 18AND ‘cash withdrawal’ > 1000THEN ‘signature of the parent’ is required

Page 7: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Rules can represent relations, recommendations, directives, strategies and heuristics:

RelationIF the ‘fuel tank’ is emptyTHENthe car is dead

RecommendationIF the season is autumnAND the sky is cloudyAND the forecast is drizzleTHENthe advice is ‘take an umbrella’

Directive (control)IF the car is deadAND the ‘fuel tank’ is emptyTHENthe action is ‘refuel the car’

Page 8: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

StrategyIF the car is deadTHENthe action is ‘check the fuel tank’;

step1 is complete

IF step1 is completeAND the ‘fuel tank’ is fullTHENthe action is ‘check the battery’;

step2 is complete Heuristic

IF the spill is liquidAND the ‘spill pH’ < 6AND the ‘spill smell’ is vinegarTHENthe ‘spill material’ is ‘acetic acid’

Page 9: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

The main players in the development team

Members of the expert system development team: domain expert knowledge engineer programmer project manager end-user The success of expert system entirely depends on

how well members work together.

Page 10: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

The main players in the development team

Expert System

End-user

Knowledge Engineer ProgrammerDomain Expert

Project Manager

Expert SystemDevelopment Team

Page 11: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

• Domain expert :knowledgeable/skilled person capable of solving problems in a domain (specific area).

• has greatest expertise in a given domain. This expertise is to be captured in the expert system.

• Expert communicates knowledge, participates in expert system development.

• Domain expert is the most important player in expert system development team.

Page 12: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

The knowledge engineer: designs, builds and tests testing an expert system: interviews domain expert to find out how a

particular problem is solved. establishes what reasoning methods expert uses to

handle facts and rules and decides how to represent them in the expert system.

chooses some development software or an expert system shell, or looks at programming languages for encoding the knowledge.

tests, revising and integrates the expert system into the workplace.

Page 13: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Expert System

End-user

Knowledge Engineer ProgrammerDomain Expert

Project Manager

Expert SystemDevelopment Team

Page 14: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Programmer: Writes the actual programming, describing domain

knowledge in terms that a computer can understand. Has skills in conventional programming symbolic programming in such AI languages as

LISP, Prolog some experience in the application of different

types of expert system shells are useful.

Page 15: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Project manager: leader of the expert system development team, responsible for keeping the project on track.

makes sure that all deliverables and milestones are met, interacts with expert, knowledge engineer, programmer and end-user.

end-user: a person who uses expert system when it is developed.

user interface of the expert system is also vital for the project’s success; end-user’s contribution here can be crucial.

Page 16: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Production system model: foundation of the modern rule-based expert systems.

The production model is based on the idea that humans solve problems by applying their knowledge (expressed as production rules) to a given problem.

The production rules are stored in the long-term memory

Problem-specific information or facts in the short-term memory.

Structure of a rule-based expert system

Page 17: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Production system model

Conclusion

REASONING

Long-term Memory

Production Rule

Short-term Memory

Fact

Page 18: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Basic structure of a rule-based expert system

Inference Engine

Knowledge Base

Rule: IF-THEN

Database

Fact

Explanation Facilities

User Interface

User

Page 19: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

knowledge base: contains domain knowledge useful for problem solving. In a rule-based expert system, the knowledge is represented as a set of rules.

Each if-then rule specifies a relation, recommendation, directive, strategy or heuristic

When condition (if) part of a rule is satisfied, rule is said to fire and the action part is executed

Database includes a set of facts used to match against the IF (condition) parts of rules stored in the knowledge base (e.g. customer information)

Page 20: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Inference engine: carries out reasoning to reach a solution. It links rules in knowledge base with facts in database.

Explanation facilities: how a particular conclusion is reached and why a specific fact is needed.

User interface: means of communication between a user seeking a solution to problem and an expert system.

Page 21: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Complete structure of a rule-based expert system

User

ExternalDatabase External Program

Inference Engine

Knowledge Base

Rule: IF-THEN

Database

Fact

Explanation Facilities

User Interface DeveloperInterface

Expert System

Expert

Knowledge Engineer

Page 22: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Expert system (ES) is built to perform at a human expert level in a narrow, specialised domain.

The most important characteristic of ES is high-quality performance.

The speed of reaching a solution is very important. Even the most accurate decision or diagnosis may not be useful if it is too late to apply, e.g. in an emergency.

Characteristics of an expert system

Page 23: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

ES apply heuristics to guide the reasoning and reduce search area for a solution.

A unique feature of an expert system is its explanation capability.

Expert systems employ symbolic reasoning when solving a problem. Symbols are used to represent different types of knowledge such as facts, concepts and rules.

Page 24: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Can expert systems make mistakes? Even a brilliant human expert can make mistakes.

Therefore ES built to perform at a human expert level also should be allowed to make mistakes.

But we still trust experts, even we recognise that their judgements are sometimes wrong. Likewise, at least in most cases, we can rely on solutions provided by expert systems, but mistakes are possible and we should be aware of this.

Page 25: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

In ES, knowledge is separated from its processing ( knowledge base and the inference engine are split up).

A conventional program is a mixture of knowledge and the control structure to process this knowledge. This leads to difficulties in understanding and reviewing the program code, as any change to the code affects both the knowledge and its processing.

When an ES shell is used, a knowledge engineer simply enters rules in the knowledge base. Each new rule adds some new knowledge and makes the expert system smarter.

Page 26: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Comparison of expert systems with conventional systems and human experts

Page 27: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Comparison of expert systems with conventional systems and human experts (Continued)

Page 28: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Forward chaining and backward chaining

The matching of rule IF parts to the facts (rule firing) produces inference chains.

The inference chain indicates how an expert system applies the rules to reach a conclusion.

Page 29: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Inference engine cycles via a match-fire procedure

Knowledge Base

Database

Fact: A is x

Match Fire

Fact: B is y

Rule: IF A is x THEN is y

Page 30: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

An example of an inference chain

A X

B

E

Y

DZ

Page 31: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Forward chaining Forward chaining is data-driven reasoning. The reasoning starts from the known data and

proceeds forward with that data. Each time only topmost rule is executed. When

fired, the rule adds a new fact in the database. Any rule can be executed only once. The match-fire cycle stops when no further rules

can be fired..

Page 32: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Example• A = temperature > 35 oC• B = Window is closed• C = humidity is high• E = Oxygen is low

• X = AC is OFF• L = It is raining• Y = Condition is bad

Page 33: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Forward chaining

Match FireKnowledge Base

Database

A B C D E

X

Match FireKnowledge Base

Database

A B C D E

LX

Match FireKnowledge Base

Database

A C D E

YL

B

X

Match FireKnowledge Base

Database

A C D E

ZY

B

LX

Cycle 1 Cycle 2 Cycle 3

X & B & E YZY & D

LCL & M

A X

N

X & B & E YZY & D

LCL & M

A X

N

X & B & E YZY & D

LCL & M

A X

N

X & B & E YZY & D

LCL & M

A X

N

Page 34: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Forward chaining is a technique for gathering information and then inferring from it whatever can be inferred.

However, in forward chaining, many rules may be executed that have nothing to do with the established goal.

Therefore, if our goal is to infer only one particular fact, the forward chaining inference technique would not be efficient.

Page 35: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Backward chaining Backward chaining is the goal-driven reasoning. In backward chaining, ES has the goal (a

hypothetical solution) and inference engine attempts to find evidence to prove it.

First, knowledge base is searched to find rules that might have the desired solution.

Such rules must have the goal in their THEN (action) parts. If such a rule is found and its IF (condition) part matches data in the database, then the rule is fired and the goal is proved. However, this is rarely the case.

Page 36: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Backward chaining Thus inference engine puts aside rule it is working

with (the rule is said to stack) and sets up a new goal, a subgoal, to prove the IF part of this rule. Then the knowledge base is searched again for rules that can prove the subgoal.

The inference engine repeats the process of stacking the rules until no rules are found in the knowledge base to prove the current subgoal.

Page 37: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Example

• B = Window is closed• E = Fan is OFF• X = AC is ON• Y = Temp is medium• Z = Condition is good

Page 38: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Backward chaining

Match FireKnowledge Base

Database

A B C D E

X

Match FireKnowledge Base

Database

A C D E

YX

B

Sub-Goal: X Sub-Goal: Y

Knowledge Base

Database

A C D E

ZY

B

X

Match Fire

Goal: Z

Pass 2

Knowledge Base

Goal: Z

Knowledge Base

Sub-Goal: Y

Knowledge Base

Sub-Goal: X

Pass 1 Pass 3

Pass 5Pass 4 Pass 6

Database

A B C D E

Database

A B C D E

Database

B C D EA

YZ

?

X

?

X & B & E Y

LCL & M

A X

N

ZY & DX & B & E Y

ZY & D

LCL & M

A X

NLC

L & M N

X & B & E YZY & D

A X

X & B & E YZY & D

LCL & M

A X

N

X & B & E Y

LCL & M

A X

N

ZY & DX & B & E Y

ZY & D

LCL & M

A X

N

Page 39: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

If an expert first needs to gather some information and then tries to infer from it whatever can be inferred, choose the forward chaining inference engine.

However, if your expert begins with a hypothetical solution and then attempts to find facts to prove it, choose the backward chaining inference engine.

Choosing between forward and backward chaining

Page 40: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Rule 1:IF the ‘traffic light’ is greenTHEN the action is go

Rule 2:IF the ‘traffic light’ is redTHEN the action is stop

Rule 3:IF the ‘traffic light’ is redTHEN the action is go

Conflict resolution

Page 41: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Rule 2 and Rule 3, have same IF part. Thus both of them can fire when the condition part is satisfied. These rules represent a conflict set.

The inference engine must determine which rule to fire from such a set - this is called conflict resolution.

Page 42: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

In forward chaining, BOTH rules would be fired. Rule 2 is fired first as the topmost one, and as a result, its THEN part is executed and linguistic object action obtains value stop.

However, Rule 3 is also fired because the condition part of this rule matches the fact ‘traffic light’ is red, which is still in the database. As a consequence, object action takes new value go.

Page 43: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Methods used for conflict resolution Fire rule with highest priority. In simple

applications, place the rules in a priority order in the KB - works well for ES with around 100 rules.

Rule 1: Priority 100if Infection is Meningitis AND Patient is Child THEN Prescription Number_1Rule 2: Priority 90 if Infection is Meningitis AND Patient is Adult Then Prescription Number_2

Page 44: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

• Fire most specific rule - also known as longest matching strategy. assumes a specific rule processes more information than a general one.

Rule 1:IF season is FallAND sky is cloudyAND forecast is rain

THEN advice is Stay homeRule 2:IF season is Fall

THEN advice is take umbrella

Page 45: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Fire rule that uses data most recently entered in database - needs time tags attached to each fact in database.

In the conflict set, ES first fires rule whose antecedent uses data most recently added to database.

Rule 1:IF forecast is rain (entered 2:00 pm today)

THEN advice is take umbrellaRule 2:IF weather is wet (entered 3:12 pm today) THEN advice is stay home

Page 46: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Metaknowledge Metaknowledge: knowledge about knowledge.

Metaknowledge is knowledge about the use and control of domain knowledge in an ES.

In rule-based ES, metaknowledge is represented by metarules. A metarule determines a strategy for use of task-specific rules in the expert system.

Page 47: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Metarule 1:Rules supplied by experts have higher priorities than rules supplied by novices.

Metarule 2:Rules governing rescue of human lives have higher priorities than rules concerned with dealing with traffic jam.

Metarules

Page 48: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Natural knowledge representation. An expert usually explains his rules as: “In such-and-such situation, I do so-and-so”. These expressions can be represented quite naturally as IF-THEN production rules.

Uniform structure. Production rules have the uniform IF-THEN structure. Each rule is an independent piece of knowledge.

Advantages of rule-based expert systems

Page 49: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Separation of knowledge from its processing: effective separation of the KB from inference engine - possible to develop different applications using same ES shell.

Dealing with incomplete and uncertain knowledge. Most rule-based ES are capable of representing and reasoning with incomplete and uncertain knowledge.

Advantages of rule-based ES

Page 50: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Opaque relations between rulesindividual production rules are relatively simple and self-documented, their logical interactions within the large set of rules may be opaque. Rule-based systems make it difficult to observe how individual rules serve the overall strategy.

Ineffective search strategy: an exhaustive search through all the production rules during each cycle. Expert systems with a large set of rules (over 100 rules) can be slow, and thus large rule-based systems can be unsuitable for real-time applications.

Disadvantages of rule-based expert systems

Page 51: 1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The

Inability to learn - rule-based ES do not have an ability to learn from the experience.

Unlike a human expert, who knows when to “break the rules”, an expert system cannot automatically modify its knowledge base, or adjust existing rules or add new ones. The knowledge engineer is still responsible for revising and maintaining the system.

Disadvantages of rule-based expert systems