chapter 4: inference techniques reasoning inference forward chaining backward chaining 1

Post on 21-Jan-2016

268 Views

Category:

Documents

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Chapter 4: Inference Techniques

ReasoningInferenceForward Chaining Backward Chaining

2

Introduction

• How does the inference engine work?

Modus Ponens

• => (implies) (X => Y)

______X____ :. Y

– If it rains, then the streets will be wet. – It is raining. – Infer the conclusion: The streets will be wet.

3

Review:

4

The Conditional and Its Variants

مخالف

معكوس

قلب

معكوس

Review:

Modus tollens

(X => Y)____ ~Y _____

:. ~ X– If it rains, then the streets will be wet. – The streets are not wet. – Infer the conclusion: It is not raining.

• NOTE: Avoid mistakes – If it rains, then the streets will be wet. – The streets are not wet. – cannot conclude that it is raining.

5

Review:

6

Syllogism

• chain implications to deduce a conclusion (X => Y) __ (Y => Z)__ :. (X => Z)

6

Review:

Resolution

(X v Y) (~Y v Z) :. (X v Z)

•basis for the inference mechanism in the Prolog language and some theorem provers

7

Review:

8

Reasoning(استدالل)

• The process of working with knowledge, facts, and problem solving strategies to draw conclusions

9

Reasoning Methods

• Deductive Reasoning (استدالل استنباطي)• Inductive Reasoning (استدالل استقرايي)• Abductive Reasoning (استدالل انتزاعي)• Analogical Reasoning (استدالل قياسي)• Common-Sense Reasoning (استدالل عقل سليم)• Non-monotonic Reasoning (استدالل غيريكنواخت)

10

Deductive Reasoning ( استدالل(استنباطي

• Reasoning where conclusions must follow from premises

• General to specific• Application: Generating conclusions

Implication: if every body standing in the rain, then he will get wet.Axiom: I am standing in the rainConclusion: I will get wet

11

Inductive Reasoning ( استدالل(استقرايي

inference is from the specific case to the general

Application: Generating rules

Premise: Monkeys in the pittsburgh zoo eat bananasPremise: Monkeys in the cleveland zoo eat bananasConclusion: In general , all monkeys eat banana

12

Abductive Reasoning ( استدالل(انتزاعي

• Reasoning back from a true conclusion to the premises that may have caused the condition

Implication: Ground is wet if it is rainingAxiom: Ground is wetConclusion: It is raining (?)

A plausible reasoning might be “it’s raining”

13

Analogical Reasoning ( استدالل(قياسي

• inferring conclusions based on similarities with other situations ANN

Tiger Frame :Specialization of : AnimalsNumber of legs : 4Eats : meatLives : India and Southeast AsiaColor : tawny with stripes

If we state that a lion is like a tiger, we would naturally assume that they share many of the features

14

Common-Sense Reasoning (استدالل عقل سليم)

• A combination of all based on our experience– it’s complicated

• Also named Heuristic reasoning• It’s valuable in applications that required quick

solution

A loose fan belt usually causes a strong noise A mechanic might have found this common-sense knowledge from his experience

15

Non-monotonic Reasoning ( استدالل غير(يكنواخت

• New evidence may invalidate previous knowledge

• Truth maintenance System– Keep a record of what cause a fact to be asserted

If the wind blows, then the cradle will rock

If it’s windy, then the cradle is rock; but, after the wind is gone, we would expect the cradle to stop rocking.

Reasoning Methods (summary)

deduction sound ◆ conclusions must follow from their premises

induction unsound ◆ inference from specific cases (examples) to the general

abduction unsound ◆ reasoning from a true conclusion to premises that may have caused the

conclusion

analogy unsound◆ a conclusion is drawn based on similarities to another situation

common-sense (heuristics) unsound ◆ rules of thumb, based on experience

non-monotonic unsound◆ new evidence may invalidate previous knowledge

16

17

Inference(استنتاج)

• The process used in an expert system of deriving new information from known information.

• Reasoning has a general meaning, even it is used for the human case; but inference is used for machine, i.e. AI & ES.

18

Some Rules of Inference

(Modus Ponens)

19

Some Rules of Inference (continued)

20

Features of Propositional LogicReview:

Artificial Intelligence: A modern approach, Norving & russel

21

Quiz

با استفاده از قوانين منطق گزاره ای نشان دهيد، •روابط زير صحيح هستند:

• (A^B=>C)معادل با ((A=>C)V(B=>C))

23

Forward and Backward Chaining

• Chain: a group of multiple inferences that connect a problem with its solution

• Search process: • Forward chaining: if the premise matches the situation, then

the process attempts to assert the conclusion

• Backward chaining: if the current goal is to determine the correct conclusion, then the process attempts to determine whether the premise clauses (facts) match the situation

24

Froward Chaining Inference process

25

Forward Chaining

• given a set of basic facts, we try to derive a conclusion from these facts

• example: What can we conclude about Clyde?IF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant (Clyde)

modus ponens: IF p THEN qp

q

Unification (pattern matching): find compatible values for variables

26

IF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant( x ) THEN mammal( x )

unification:find compatible values for variables

Forward Chaining Example

27

Forward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant(Clyde) THEN mammal(Clyde)

unification:find compatible values for variables

28

Forward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant(Clyde) THEN mammal(Clyde)

IF mammal( x ) THEN animal( x )

unification:find compatible values for variables

29

Forward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant(Clyde) THEN mammal(Clyde)

IF mammal(Clyde) THEN animal(Clyde)

unification:find compatible values for variables

30

Forward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant(Clyde) THEN mammal(Clyde)

IF mammal(Clyde) THEN animal(Clyde)

animal(Clyde)

unification:find compatible values for variables

31

Forward Chaining

32

Conflict Resolution

• Strategy used for choosing a rule-firing sequence when more than one rule can fire

• Steps of the conflict resolution strategies:1. Recognize. Find the rules that can fire (making the conflict set)

2. Resolve, If more than one rule can fire, choose one rule to fire according to some strategy.

3. Act. Fire the rule and add its conclusion to the working memory.

33

Conflict Resolution Strategies

First rule that matches contents of working memory.1. Highest priority rule.2. Most specific rule, (more # of premises)3. Rule that refers to the element most recently added to

the working memory.4. Don't fire a rule that has already fired (preventing loop,

used in the most strategies). 5. Fire all rules with separate line of reasoning (parallel).

34

Backward Chaining

• try to find supportive evidence (i.e. facts) for a hypothesis• example: Is there evidence that Clyde is an animal?

IF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant (Clyde)

modus ponens: IF p THEN qp

q

Unification (pattern matching): find compatible values for variables

35

Backward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

IF mammal( x ) THEN animal( x )

animal(Clyde)

unification:find compatible values for variables

?

36

Backward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

IF mammal(Clyde) THEN animal(Clyde)

animal(Clyde)

unification:find compatible values for variables

?

37

Backward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

IF elephant( x ) THEN mammal( x )

IF mammal(Clyde) THEN animal(Clyde)

animal(Clyde)

unification:find compatible values for variables

?

?

38

Backward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

IF elephant(Clyde) THEN mammal(Clyde)

IF mammal(Clyde) THEN animal(Clyde)

animal(Clyde)

unification:find compatible values for variables

?

?

39

Backward Chaining ExampleIF elephant(x) THEN mammal(x)

IF mammal(x) THEN animal(x)

elephant(Clyde)

modus ponens:IF p THEN qp

q

elephant (Clyde)

IF elephant(Clyde) THEN mammal(Clyde)

IF mammal(Clyde) THEN animal(Clyde)

animal(Clyde)

unification:find compatible values for variables

40

Backward Chaining

41

Forward-Chaining

42

Backward-Chaining

43

Forward Chaining v.s. Backward Chaining

Forward Chaining Backward Chainingplanning, monitoring, control diagnosis

data-driven goal-driven (hypothesis)

bottom-up processing top-down processing

find possible conclusions supported by given facts

find facts that support a given hypothesis

similar to breadth-first search

similar to depth-first search

CLIPS PROLOG

46

Family Example: Facts

47

Family Example: Rules

48

PROLOG Sample Inference

49

PROLOG Sample Inference

50

Mini Projects 1Chapter 4 (Inference Engine)

• Due date: 94/1/20

top related