Wednesday, October 21, 2009

Rule – Based Expert System

A rule-based expert system is an expert system which works as a production system in which rules encode expert knowledge. Most expert systems are rule-based.

Data-driven Rule-based Expert Systems

Use Forward Chaining:

Given a certain set of facts in WM, use the rules to generate new facts until the desired goal is reached.

To forward chain the inference engine must:

1. Match the condition patterns of rules against facts in working memory.

2. If there is more than one rule that could be used (that could "fire"), select which one to apply (this is called conflict resolution)

3. Apply the rule, maybe causing new facts to be added to working memory

4. Halt when some useful (or goal) conclusion is added to WM (or until all possible conclusions have been drawn.)

Goal-driven Rule-based Expert Systems

Use Backward Chaining:

Work backwards from a hypothesised goal, attempting to prove it by linking the goal to the initial facts.

To backward chain from a goal in WM the inference engine must:

1. Select rules with conclusions matching the goal.

2. Replace the goal by the rule's premises. These become sub-goals.

3. Work backwards till all sub-goals are known to be true -

either they are facts (in WM)

or the user provides the information.

Example

A production system IDENTIFIER, which identifies animals.

R1 IF the animal has hair
THEN it is a mammal

R2 IF the animal gives milk
THEN it is a mammal

R3 IF the animal has feathers
THEN it is a bird

R4 IF the animal flies
the animal lays eggs
THEN it is a bird

R5 IF the animal is a mammal
the animal eats meat
THEN it is a carnivore

R6 IF the animal is a mammal
the animal has pointed teeth
the animal has claws
the animal's eyes point forward
THEN it is a carnivore

R7 IF the animal is a mammal
the animal has hooves
THEN it is an ungulate

R8 IF the animal is a mammal
the animal chews cud
THEN it is an ungulate AND
it is even-toed

R9 IF the animal is a carnivore
the animal has a tawny colour
the animal has dark spots
THEN it is a cheetah

R10 IF the animal is a carnivore
the animal has a tawny colour
the animal has black stripes
THEN it is a tiger

R11 IF the animal is an ungulate
the animal has long legs
the animal has a long neck
THEN it is a giraffe

R12 IF the animal is an ungulate
the animal has a white colour
the animal has black stripes
THEN it is a zebra

R13 IF the animal is a bird
the animal does not fly
the animal has long legs
the animal has a long neck
the animal is black and white
THEN it is an ostrich

R14 IF the animal is a bird
the animal does not fly
the animal swims
the animal is black and white
THEN it is a penguin

R15 IF the animal is a bird
the animal is a good flier
THEN it is an albatross

PROBLEM:

Given these facts in working memory initially:

the animal gives milk
the animal chews its cud
the animal has long legs
the animal has a long neck

Establish by forward chaining that the animal is a giraffe.

Given the facts that:

the animal has hair
the animal has claws
the animal has pointed teeth
the animal's eyes point forward
the animal has a tawny colour
the animal has dark spots

Establish by backward chaining that the animal is a cheetah.

[HINT: start with R9, first subgoal : the animal is a carnivore etc.]

Goal-driven search is suggested if:

A goal or hypothesis is given in the problem statement or can be easily formulated
(theorem-proving, diagnosis hypothesis testing).

There are a large number of rules that match the facts, producing a large number of conclusions - choosing a goal prunes the search space.

Problem data are not given (or easily available) but must be acquired as necessary (e.g. medical tests).

Data-driven search is suggested if:

All or most of the data is given in the problem statement (interpretation problems)

Large number of potential goals but few achievable in a particular problem instance.

It is difficult to formulate a goal or hypothesis.

No comments:

Post a Comment