chapter 7

38
Chapter 7 Expert Systems Part I King Saud University College of Computer and Information Sciences Information Technology Department IT422 - Intelligent systems

Upload: lyndon

Post on 10-Feb-2016

17 views

Category:

Documents


0 download

DESCRIPTION

King Saud University College of Computer and Information Sciences Information Technology Department IT422 - Intelligent systems. Chapter 7. Expert Systems Part I. What is an Expert System?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 7

Chapter 7

Expert SystemsPart I

King Saud UniversityCollege of Computer and Information Sciences Information Technology DepartmentIT422 - Intelligent systems

Page 2: Chapter 7

2

What is an Expert System?

An expert system is a computer system that emulates, or acts in all respects, with the decision-making capabilities of a human expert.

• Professor Edward Feigenbaum• Stanford University

Page 3: Chapter 7

3

Introduction

Two main approaches for problem solving using knowledge:

– Symbolic Approach

• Expert systems: Feed the system with knowledge. There is no

learning !!

– Sub-symbolic approaches

• Machine learning: the construction and study of systems that can

learn from data. Neural Networks learns from examples by

themselves.

Page 4: Chapter 7

Symbolic Approach

Page 5: Chapter 7

5

Expert system

• Expert system: a rule based program which encapsulates knowledge from

some domain, normally obtained from a human expert in that domain

• An expert system simulates a human expert in his/her field of expertise in

an attempt to solve a particular problem.

• Expert Systems do not replace experts, but they

– make their knowledge and experience more widely available

– permit non-experts to work better

• Expert System acts as a Consultant or Advisor

Page 6: Chapter 7

6

Expert SystemsObjective and Activities of an Expert System

• Objective of an expert system – To transfer expertise from an expert to a computer system and – Then on to other humans (non experts)

• Activities– Knowledge acquisition – Knowledge representation – Knowledge inferencing – Knowledge transfer to the user

• Knowledge is stored in a knowledge base

Page 7: Chapter 7

7

Architecture of an Expert System

Page 8: Chapter 7

8

Structure of an Expert System

Major Components

• Knowledge base (KB): repository of rules,

facts (productions)

• working memory: (if forward chaining used)

• inference engine: the deduction system

used to infer results from user input and KB

• user interface: interfaces with user

User Interface

Inference Engine

Knowledge Base

Page 9: Chapter 7

9

Structure of an Expert System

Knowledge base– The knowledge base contains the knowledge

necessary for understanding, formulating, and solving problems

– Two Basic Knowledge Base Elements• Facts• Production rules that direct the use of knowledge

– Production rules can be expressed in IF-THEN pseudocode format.

– Knowledge is the primary raw material of an Expert System

– Incorporated knowledge representation

User Interface

Inference Engine

Knowledge Base

Page 10: Chapter 7

10

Structure of an Expert System

Inference Engine

– The brain of the ES

– The control structure (rule interpreter)

– Provides methodology for reasoning

• Inference Engine performs inferences.

User Interface

Inference Engine

Knowledge Base

Page 11: Chapter 7

11

Structure of an Expert System

User Interface

– Mechanism by which user and system

communicate.

– Language processor for friendly,

problem-oriented communication

– Natural Language Processing, or menus

and graphics

User Interface

Inference Engine

Knowledge Base

Page 12: Chapter 7

12

Structure of an Expert SystemWorking Memory (Blackboard)

– Global database that

contains

• facts used by rules

• Intermediate results

– Records Intermediate Hypotheses and Decisions

1. Agenda2. Solution

User Interface

Inference Engine

Knowledge Base

Page 13: Chapter 7

13

Structure of an Expert System

Explanation Subsystem (Justifier) – Explains reasoning of expert

system to user by interactively answering questions:• Why?• How?• What?• (Where? When? Who?)

User Interface

Inference Engine

Knowledge Base

Page 14: Chapter 7

14

Developing Expert Systems

• The Human Element in Expert Systems– Expert– Knowledge Engineer– User– Others

Page 15: Chapter 7

15

Developing Expert Systems• Expert

– Has the special knowledge, judgment, experience and methods to give advice and solve problems

– Provides knowledge about task performance

Page 16: Chapter 7

16

Developing Expert Systems• Knowledge Engineer

– Helps the expert(s) structure the problem area by interpreting and integrating human answers to questions, drawing analogies, posing counterexamples, and bringing to light conceptual difficulties

– Usually also the System Builder

Page 17: Chapter 7

17

Developing Expert Systems

• User– Possible Classes of Users

• A non-expert client seeking direct advice (ES acts as a Consultant or Advisor)

• A student who wants to learn (Instructor)

• An ES builder improving or increasing the knowledge base (Partner)

• An expert (Colleague or Assistant)

– The Expert and the Knowledge Engineer Should Anticipate Users' Needs and Limitations When Designing ES

Page 18: Chapter 7

18

Knowledge base: production system

• Knowledge is represented using rules of the form:

– Rule: if Conditions then Conclusionsor– Rule: if Premises then Actionsor– Rule: if if-part then then-part

• A rule as described above is often referred to as a production rule.

Page 19: Chapter 7

19

Knowledge base: production system

Examples:

• if symptom1 and symptom2 and symptom3 then disease1

• if - the leaves are dry, brittle and discolouredthen - the plant has been attacked by red spider mite

• If – it is raining then – you should take an umbrella

• if - the customer closes the accountthen - delete the customer from the database

Page 20: Chapter 7

20

Inference engine: rule-based reasoning

• The essence of a rule-based reasoning system is that it goes through a

series of cycles.

• In each cycle, it attempts to pick an appropriate rule from its collection

of rules, depending on the present circumstances, and to use it.

• Because using a rule produces new information, it's possible for each

new cycle to take the reasoning process further than the cycle before.

This is rather like a human following a chain of ideas in order to come to

a conclusion.

Page 21: Chapter 7

21

Inference engine: Forward Chaining

• Forward Chaining is based on Modus Ponens inference rule:

(A, A B ) / B

• In other words, if A is true and we have A B then we can deduce that B is true

• In the context of Expert System, it is used as follows: – if A is in WM and we have a rule in KB of the form if A then

B then we can deduce B (add B to WM as new information)

Page 22: Chapter 7

22

Inference engine: Forward Chaining

Do until problem is solved or no antecedents matchCollect the rules whose antecedents are found in WM (create the Agenda).If more than one rule matches

use conflict resolution strategy to eliminate all but one Do actions indicated in by rule “fired”

• Agenda: a prioritized list of rules created by the inference engine, whose patterns are satisfied by facts or objects in working memory.

Page 23: Chapter 7

23

Inference engine: Forward Chaining

Cycles

MatchingRules filtering

Conflict Resolution

ExecutionApply the rule

Rules

Rule

Add Then-Part to WM

For Conflict Resolution we can use rule-order as an implied priority

Page 24: Chapter 7

24

Inference engine: Forward Chaining

Algorithm:

1. Match WM with KB to select production rules

2. Eliminate already applied rules

3. If many rules select one which has the smallest number

4. Apply selected rule by adding its conclusion to WM

5. If the problem is solved or no new information added then stop otherwise go to step 1

MatchingRules filtering

Conflict Resolution

ExecutionApply the rule

Rules

Rule

Add Then-Part to WM

Page 25: Chapter 7

25

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B

Inference Engine: Execute many cycles

Page 26: Chapter 7

26

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Page 27: Chapter 7

27

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 5, Rule 1, Rule 2 → add D

Page 28: Chapter 7

28

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D, G

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 5, Rule 1, Rule 2 → add DCycle 3: Rule 1, Rule 2, R 3, R 4, Rule 5 → add G

Page 29: Chapter 7

29

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D, G, F

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 5, Rule 1, Rule 2 → add DCycle 3: Rule 1, Rule 2, R3, R 4, Rule 5 → add GCycle 4: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add F

Page 30: Chapter 7

30

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D, G, F, E

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 5, Rule 1, Rule 2 → add DCycle 3: Rule 1, Rule 2, Rule 3, Rule 5 → add GCycle 4: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add FCycle 5: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add E

Page 31: Chapter 7

31

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D, G, F, E, Z

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 5, Rule 1, Rule 2 → add DCycle 3: Rule 1, Rule 2, Rule 3, Rule 5 → add GCycle 4: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add FCycle 5: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add ECycle 6: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add Z

Page 32: Chapter 7

32

Inference engine: Forward Chaining

Knowledge Base:Rule 1: If A and B and C then

DRule 2: if B and C then GRule 3: if B and D then FRule 4: if B and C and D then ERule 5: if A and B then CRule 6: if G and D then Z

Working Memory: A, B, C, D, G, F, E, Z

Inference Engine: Execute many cyclesCycle 1: Rule 5 → add C

Cycle 2: Rule 1, Rule 2, Rule 5 → add DCycle 3: Rule 1, Rule 2, Rule 3, Rule 5 → add GCycle 4: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add FCycle 5: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add ECycle 6: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → add Z Cycle 7: Rule 1, Rule 2, Rule 3, Rule 4, Rule 5, Rule 6 → no rule => STOP !!!

Page 33: Chapter 7

33

Inference engine: Backward Chaining

• Backward Chaining is also based on Modus Ponens inference rule;

• In the context of Expert System, it is used as follows:

• To prove a goal B which is not in the WM and if we have a rule in KB of the form if A then B then we just have to prove A (A is either present in WM or it exists as a rule with A as a conclusion)

Page 34: Chapter 7

34

Inference engine: Backward Chaining

• Consider the following KB and WM:

Knowledge Base:

Rule 1: If A and B and C then D

Rule 2: if B and C then G

Rule 3: if B and D then F

Rule 4: if B and C and D then E

Rule 5: if A and B then C

Rule 6: if G and D then Z

Working Memory: A, B

Inference Engine: Exploration of AND/OR Tree:

Suppose we have the goal: G

To prove G, one can use Rule 2

Proving G is equivalent of proving B and C

As B is present in the WM so it’s true

So remains the proof of C, one can use Rule 5

Proving C is equivalent of proving A and B

As A and B are present in WM (true), we can deduce that C is true

B and C are true then G is true

Page 35: Chapter 7

35

Expert System Shells• Shell = Inference Engine + User Interface

• ESS allow non programmers to build an expert system, by inserting facts and rules into a generic expert system architecture which is already built.

• Some ESSs– BABYLON– JESS– ES– CLIPS…..

Page 36: Chapter 7

36

Advantages of Expert Systems

• An expert system can operate constantly 24 hours per day.

• An expert system can exceed the performance of any human expert, as it can combine knowledge from a number of different experts.

Page 37: Chapter 7

37

Limitations of Expert Systems

• Not able to cope with unseen information.

• Not able to cope with noise.

• Not able to adapt to new environments.

• Not able to learn independently in a similar manner that humans learn. They need to be programmed in advance.

Page 38: Chapter 7

38

Conclusions

• Why use expert systems:

– commercial viability: whereas there may be only a few experts whose time is

expensive and rare, you can have many expert systems

– expert systems can be used anywhere, anytime

– expert systems can explain their line of reasoning

– commercially beneficial: the first commercial product of AI

• Weaknesses:

– expert systems are as sound as their KB; errors in rules mean errors in diagnoses

– automatic error correction, learning is difficult

– the extraction of knowledge from an expert, and encoding it into machine-inferable form is the

most difficult part of expert system implementation