Models for Inexact Reasoning Overview of Rule Based Systems y - - PowerPoint PPT Presentation

models for inexact reasoning overview of rule based
SMART_READER_LITE
LIVE PREVIEW

Models for Inexact Reasoning Overview of Rule Based Systems y - - PowerPoint PPT Presentation

Models for Inexact Reasoning Overview of Rule Based Systems y Miguel Garca Remesal Department of Artificial Intelligence mgremesal@fi.upm.es Rules and Productions Rules and Productions Production synonym for rule


slide-1
SLIDE 1

Models for Inexact Reasoning Overview of Rule‐Based Systems y

Miguel García Remesal Department of Artificial Intelligence mgremesal@fi.upm.es

slide-2
SLIDE 2

Rules and ‘Productions’ Rules and Productions

  • ‘Production’ – synonym for rule
  • English regular verbs

l b ( ) b ‘ d’ – regular_verb + (past) verb + ‘ed’

  • Pig‐Latin productions

– consonant string → string + consonant + ‘ay’ – vowel + string → string + ay

slide-3
SLIDE 3

Work through this production system to decode the result

l

  • z → l

u → p p → h lw → llo q → r v → w r → e

  • uqzv → ??
slide-4
SLIDE 4

Rules Rules

  • Form

– IF antecedent THEN conclusion – IF condition THEN action – IF antecedent THEN goal

  • Interpreters

– Backward chaining Backward chaining

  • Trigger on conclusion/goal

– Forward chaining

  • Trigger on antecedent/condition
slide-5
SLIDE 5

Forward and Backward Chaining Forward and Backward Chaining

  • Rules

– r1: IF may_rain THEN should_take_umbrella – r2: IF cloudy THEN may_rain

  • Questions

– “Should I take an umbrella?” – “What should I do if it is cloudy?”

H did h i ?

  • How did you answer the questions?

– Which part of the rule did you look for? (‘match’)

slide-6
SLIDE 6

B k d Ch i i Backward Chaining

  • Rules

– R1: IF may_rain THEN should_take_umbrella – R2: IF cloudy THEN may_rain

  • “Should I take an umbrella?”

– “Do the rules indicate I should take an umbrella?

  • Is there a rule about “taking umbrellas”?

– R1: goal: should_take_umbrella

H I th t l?

  • How can I prove that goal?

– What has to be true for r1 to hold? » may_rain is the antecedent of r1

  • Can I prove that it may rain?
  • Can I prove that it may_rain?

– R2: goal: may_rain

  • How can I prove that goal2

What has to be true for r2 to hold – What has to be true for r2 to hold » cloudy is the antecedent of r2

  • How can I prove ‘cloudy’?
slide-7
SLIDE 7

Backward Chaining

Goal 1 → Goal 2 _ _ Goal 2 → Goal 3

soning

Goa _ → Goa _3 Goal 3 → Goal 4

rules ion of reas

_ _ Goal 4 → Goal 5

Direct

_ _ Question

slide-8
SLIDE 8

B k d Ch i i Backward Chaining

  • Rules

– R1: IF may_rain THEN should_take_umbrella – R2: IF cloudy THEN may_rain – R3: IF may_be_intense_sun THEN should_take_umbrella – R4: IF summer AND in_tropics THEN may_be_intense_sun _ p y_ _ _

  • “Should I take an umbrella?”

– “Do the rules indicate I should take an umbrella?

  • Is there are rule about “taking umbrellas”?

Is there are rule about taking umbrellas ?

– R1: goal: should_take_umbrella

  • What is antecedent for r1?

– R1:antecedent may rain R1:antecedent may_rain

  • Can I prove that it may_rain?

– R2: goal: may_rain

  • How can I prove may rain

How can I prove may_rain

– R2:antecedent: cloudy

  • BUT NOT CLOUDY!
slide-9
SLIDE 9

B k d Ch i i B kt ki Backward Chaining: Backtracking

  • Rules

– R1: IF may rain THEN should take umbrella y_ _ _ – R2: IF cloudy THEN may_rain – R3: IF may_be_intense_sun THEN should_take_umbrella – R4: IF summer AND in tropics THEN may be intense sun R4: IF summer AND in_tropics THEN may_be_intense_sun

“Sh ld I t k b ll ?”

  • “Should I take an umbrella?”
  • Are there any other rules about umbrellas?

R3 l h ld t k b ll – R3: goal: should_take_umbrella

  • What is antecedent of R3?

– R3:antecedent: summer AND in tropics R3:antecedent: summer AND in tropics

slide-10
SLIDE 10

Backwards Chaining with Backtracking

Goal_1 → Goal_2 Goal_8 → Goal 7 Goal_2 → Goal_3 Goal 7 → Goal 6 _

soning

Goal_3 → Goal_4

rules fail

Goal_6 → Goal_4 _ _

ion of reas

Goal_4 → Goal_5

Direct

Question Question

slide-11
SLIDE 11

Backwards Chaining Systems Backwards Chaining Systems

MYCIN

  • MYCIN

– ‘The original expert system’

  • Diagnosis of acute infections (Meningitis, blood infections)

g ( g , )

– Still a good example of how it works

  • Also used

– uncertain reasoning uncertain reasoning – Explanation » ‘How’ did you prove that? » ‘Why’ are you asking me that? » Why are you asking me that?

  • Never used ‘for real’
  • PROLOG

– One of the two standard AI languages

  • A simple backwards chaining engine with backtracking

A simple backwards chaining engine with backtracking

slide-12
SLIDE 12

Backwards Chaining Engines usually written ‘backwards’

  • Goal ← Antecedent

Goal ← Antecedent

– Umbrella ← may_rain – may_rain ← cloudy

  • Prolog ‘Edinburgh’ notation

– umbrella :‐ may_rain. – may_rain :‐ cloudy. NB upper and lower case very important in Prolog

slide-13
SLIDE 13

Forward Chaining Forward Chaining

R l

  • Rules

– R1: IF may_rain THEN should_take_umbrella – R2: IF cloudy THEN may_rain

  • “What should I do if it is cloudy?”

– “What do the rules indicate I should do if it is cloudy?” What do the rules indicate I should do if it is cloudy?

  • Is there a rule that applies when it is cloudy?

– R2: antecedent: cloudy

  • What do I conclude from that antecedent ‘cloudy’
  • What do I conclude from that antecedent, cloudy

– R2: conclusion: may_rain

  • Is there a rule that applies when it may_rain?

– R1: antecedent: may_rain

  • What do I conclude from that antecedent: ‘may_rain’

– R1: conclusion: should_take_umbrella

slide-14
SLIDE 14

Forward chaining Forward chaining

‘Production Systems’ Production Systems

– Vocabulary used differently on west and east coast of US for many years

  • On east coast, ‘production systems’ means forward

, p y chaining

  • On west coast, ‘production systems’ just means rule

based systems

– Usually, and in this course, ‘Production System’ means ‘forward chaining’

slide-15
SLIDE 15

Forward Chaining Forward Chaining

Fact_1 Fact 1 → Fact 2 _ _ Fact 2 → Fact 3

Directi

act_ → act_3 Fact 3 → Fact 4

rules ion of reas

_ _ Fact 4 → Fact 5

soning

_ _ Action=Fact_5

slide-16
SLIDE 16

Production system interpreter Production system interpreter

  • Objectives:

– Fire rules as the facts come in to the knowledge base – Never fire a rule unless its conditions are satisfied – Fire every rule whose conditions are satisfied

  • Are these objectives consistent
  • Are these objectives consistent.

– Forward chaining rules sometimes called ‘demons’

  • From a system called “Pandemonium”
  • From a system called Pandemonium

– How can they be made consistent?

slide-17
SLIDE 17

Production System Strategy Production System Strategy

  • All rules tested at each cycle

All rules tested at each cycle

  • Only one rule fires at a time
slide-18
SLIDE 18

Production System Cycle Production System Cycle

1 Test all rules 2 Put all rules satisfied into the ‘conflict set’ 3 Choose one rule from the conflict set 3 Choose one rule from the conflict set 4 Fire the rule 5 Update the dynamic database 6 Repeat until goal reached or no more rules 6 Repeat until goal reached or no more rules satisfied

slide-19
SLIDE 19

ConflictResolution

k l d R1: IF sky=cloudy THEN expect=rain R2: IF expect=?X THEN weather=?X R3: IF sky=cloudy AND temperature=freezing R3: IF sky=cloudy AND temperature=freezing THEN expect=snow R4: IF weather=rain THEN termperature=above_freezing

What happens if ‘sky=cloudy’? What happens if sky cloudy ? What happens if ‘sky=cloudy and ‘temperature=freezing’?

slide-20
SLIDE 20

Possible Conflict Resolution Strategies Possible Conflict Resolution Strategies

  • Specificity
  • Priority

Priority

  • Lexical Ordering
  • Source file ordering
  • Explicit rules for conflict resolution

Explicit rules for conflict resolution

– a rule based system within a rule based system

slide-21
SLIDE 21

Basic Production System Architecture Basic Production System Architecture

Dynamic Memory y y

tickle execute

Rule Store Rule Execution Conflict Set

check satisfaction Select (resolve conflicts)