0% found this document useful (0 votes)
15 views30 pages

Part5.3 Knowledge-Based Systems

Uploaded by

murimironny3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views30 pages

Part5.3 Knowledge-Based Systems

Uploaded by

murimironny3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 30

Part 5.

3 Knowledge-based Systems:
Rule-based Knowledge Systems
Knowledge-based Systems
(Expert Systems)

Semester: August 2021.

• ||Fredrick Michael Ogore||[email protected]||Cell-No:0717105568||

1
Rule-based systems:
 Overview:
 Deductive versus Reactive rule-systems
 “Zookeeper”: a deductive rule-system
 “Bagger”: a reactive rule-system
 Procedures for inference in Rule-systems
 Explanation facilities

2
Deductive Rule-
Systems:
Consist of rules of the form:

If Condition_1 Then Conclusion_1


and Condition_2 and Conclusion_2
… …
and Condition_n and Conclusion_m

Winston’s notation:

Know Deduced
facts facts

AND gate 3
Basics for Deduction
Systems:
true true
assertions facts
false
The working memory = a collection of assertions

Can be either facts or hypothesis:


In FORWARD chaining, we usually start from facts and add
assertions that are new facts:

Know Deduced
facts facts

In BACKWARD chaining, we usually start from hypothesis and add


assertions that are new hypothesis.

New
Hypothesis
hypothesis
4
ZOOKEEPER:
Winston’s simplification of MYCIN.
Robby robot attempts to identify animals in the ZOO.

Z1 If ?x has hair
Then ?x is a mammal

Z2 If ?x gives milk
Then ?x is a mammal

Z3 If ?x has feathers
Then ?x is a bird

Z4 If ?x flies and ?x lays eggs


Then ?x is a bird

Z5 If ?x is a mammal and ?x eats meat


Then ?x is a carnivore
5
ZOOKEEPER (cont.):
Z6 If ?x is a mammal and ?x has pointed teeth
and ?x has claws and ?x has forward-pointed eyes
Then ?x is a carnivore

Z7 If ?x is a mammal and ?x has hoofs


Then ?x is an ungulate

Z8 If ?x is a mammal and ?x chews cud


Then ?x is an ungulate

Z9 If ?x is a carnivore and ?x has tawny color


and ?x has dark spots
Then ?x is a cheetah

Z10 If ?x is a carnivore and ?x has tawny color


and ?x has black stripes
Then ?x is a tiger 6
ZOOKEEPER (cont.2):
Z11 If ?x is an ungulate and ?x has long legs
and ?x has long neck and ?x has dark spots
Then ?x is a giraffe

Z12 If ?x is an ungulate and ?x has white color


and ?x has black stripes
Then ?x is a zebra

Z13 If ?x is an bird and ?x does not fly


and ?x has long legs and ?x has long neck
Then ?x is an ostrich

Z14 If ?x is an bird and ?x does not fly


and ?x swims and ?x is black and white
Then ?x is a penguin
7
Forward chaining in
Working
Zookeeper:
Stretch has hair. Stretch has a long neck.
memory Stretch chews cud. Stretch has dark spots.
Stretch has long legs.

Is a mammal
First rule fires
Has
hair
Z1

Second rule fires


Chews cud Is an ungulate
Z8

Has long legs Third rule fires


Has a long neck Is a giraffe
Z11
Has dark spots
8
Backward chaining in
Knowledge Zookeeper
Swifty has forward-pointing eyes.
Swifty has pointed teeth.
Swifty has claws.
Swifty has dark spots.
base
Swifty has tawny color. Swifty has hair.

Working memory Swifty is a cheetah.

Has forward-pointing eyes


Third rule
Has claws Is a carnivore
Z6
Has pointed teeth

Fourth rule
Has hair Is a mammal
Z1
Second rule tried
Eats meat Is a carnivore
Z5
First rule used
Has a tawny color
Z9
Has dark spots Is a cheetah
9
Old backward/forward
choice:
 Mostly: the branching factor argument.
 Winston terminology: “fan out”, “fan in”

 Also:
 Are you able to gather more facts?
 If not: just forward chain to see what you can
get as conclusions
 If you are only interested in a specific question:
 Is it a carnivore?
– Backward better

10
Example: Mycin
- Diagnoses Bacterial Infections of the blood.
How to choose antibiotic treatment, without knowing
exactly which organism?

- Preferably: don’t prescribe a broad-spectrum drug

- Narrow down to more specific, using information


concerning:
patient symptoms, general condition,
quick lab-tests, ...

- Questions and advises physician.

11
Excerpt of sample
session:
> Male or female?
Male.
> Age?
55.
> Have you obtained positive cultures indicating general type?
Yes.
> What type of infection is it?
Primary bacteremia.
> When did symptoms first appear?
May 5.
> From where was the positive culture taken?
From the blood.
>…
12
Mycin (cont.)
 About 500 If-Then rules .
 Can recognize about 100 causes of infections.

 Example rule:
If ?x ’s type is primary bacteremia
the suspected entry point of ?x is the gastrointestinal tract
the site of the culture of ?x is one of the sterile sites
Then there is evidence that ?x is bacteroides

 Uses: backward chaining.


… and certainty factors.

13
Query-the-user facility:
 Where do the questions come from? > Age?
55.
 The query-the-user rule:
 Any system includes a rule of the type
If query-the-user( ?x )
Then ?x
 Here ?x could be any predicate
 If we want to establish ?x and there is no information on ?x in the
rule-base, ask the user about ?x

If age_patient(?x) No “age_patient(..)” query-the-user(


?x > 50
age_patient(?x))
Then ... in rule-base

14
Reactive Rule-Systems:
Consist of rules of the form:

If Condition_1 Then Action_1


and Condition_2 and Action_2
… …
and Condition_n and Action_m

No more relation to logical statements !

15
BAGGER:
Winston’s simplification of XCON.
Robby robot attempts to help bagging in a supermarket.

It considers 4 steps in the procedure:


1. ”check order” :see if something is missing
2. ”bag the large items” and put big bottles in first
3. “bag medium items” and put frozen things in
freezer bags
4. “bag small items” : put wherever there is room

Use a
database
of objects

16
Bagger’s Working
Memory:
 Current step is “Check order”

 Current bag is Bag_1(empty)

 Not bagged are bread, glop, granola (2),


ice cream, patato chips
+ the database of objects

17
Bagger rules:
B1 If step is “check order”
and patato chips are in not bagged
and Pepsi is NOT in not bagged
Then suggest to add Pepsi to not bagged

Assume suggestion is accepted and Pepsi added in not bagged.

B2 If step is “check order” Delete


Then discontinue step “check order”
And start step “bag large items”
Add

Note: whenever B1 is triggered, B2 is triggered as well !


Need: CONFLICT RESOLUTION
18
Conflict Resolution:
A rule in a rule-based system is triggered if
the precondition of the rule is satisfied
A rule is said to fire if its
then-part is executed

In a deductive system, every triggered rule fires.

In a reactive system, we need a “conflict resolution strategy”


to determine which rule may fire.

Assume for now that we use textual order here.

19
Bagger (cont.):
 Current step is “bag the large items” Working memory
 Current bag is Bag_1(empty)
 Not bagged are bread, glop, granola (2),
ice cream, patato chips, Pepsi

B3 If step is “bag the large items”


and a large item is in not bagged
and a large bottle is in not bagged
add
and current bag has < 6 large items
Then put large bottle in current bag delete

B4 If step is “bag the large items”


and a large item is in not bagged
add
and current bag has < 6 large items
Then put large item in current bag delete

B5 If step is “bag the large items”


and a large item is in not bagged add
Then start a fresh bag delete
20
Possible conflict
resolution strategies:
Specificity ordering:
highest priority rule has superset of conditions
Textual rule ordering (see
Bagger)
Data ordering
give a priority number to each possible aspect
Size ordering
highest priority rule has largest list of conditions
Context limiting
put rules into groups: activate/deactivate the
groups

21
Example: XCON
- System for Configuration of Computer Systems.
How to set up all components of a big main frame
computer system.

- Includes processors, memory, terminals, discs,


peripheral controllers, etc.
- All components must be arranged sensibly with
appropriate input/output buses.
- Must deal with hundreds of possible options: how
to configure?

22
XCON (cont.)
 About 10000 If-Then rules .
 Can deal with about 200 components of VAX
 Example rules:
systems.
If context is doing layout and assigning power supply
an sbi module has been put in a cabinet
the position the sbi module occupies is known
there is space available for a power supply
there is no available power supply
the voltage and frequency of components is known
Then add an appropriate power supply

Similar to the Pepsi rule in bagger

If context is doing layout and assigning power supply


an sbi module has been put in a cabinet
the position the sbi module occupies is known
there is space available for a power supply
there is an available power supply
Then put the power supply in the cabinet in the available space
23
Explicit procedures for
Back/Forward reasoning:
 Depth-first search Even for forward
reasoning!
 Database operation (Join - Projection -
Selection) for Forward Reasoning
 Tuple-at-a-time database operations:
the Rete algorithm
Ref: Winston for details.

24
Mixing Forward and
Backward Reasoning:
Many commercial systems promote their ability to provide
both forward and backward reasoning (together) on the
same set of rules.

Is this useful? Or even reasonable??

- Forward reasoning starts from facts and produces new


fact.
Why would one want to start backward reasoning:
Why would one want to start backward reasoning:
from hypothesis building new hypothesis from a fact??

- Backward reasoning starts from hypothesis and builds


new hypothesis.
These are not facts and cannot be used to derive new
fact from them in a forward reasoning !!

25
One way to combine
forward and backward:
 Assume that by forward reasoning we derived:
 the facts a, b and d.

 If there is a rule:
If a and b and c and d
Then e
then it may be a good idea to switch to backward reasoning to try to prove c (and
thus conclude e)

 BUT: VERY hard to control this and completeness becomes VERY obscure.

26
Explanation facilities:
Expert Systems are supposed to provide explanations to
convince the user that their proposed conclusions are
reasonable.

 Typical user questions:


 How did you arrive to the conclusion that … .
 Why did you show that … .
 Technique:
 Keep a trace of all inferences done:

If a and b and c and d


Then e
And record e <- a, b, c, d

27
All these systems
require FULL knowledge
of the world !
 What if information is Missing?
 Information is Unclear?
 Information is Vague?
 Information is Contradicting?
 Information Only probabilistically available?

 Requires a study in Uncertainty, Fuzziness, ….

28
Q& A
Thank you.

You might also like