Representations for KBS: Uncertainty

Download Report

Transcript Representations for KBS: Uncertainty

Representations for KBS: Uncertainty & Decision Support

6.871 - Knowledge Based Systems Tuesday March 20, 2006 Howard Shrobe Randall Davis 6.871, 2004 -Uncertainty , Page 1

Outline

• The Other Problem with Mycin • Brief review of history of uncertainty in AI • Bayes Theorem • Some tractable Bayesian situations • Bayes Nets • Decision Theory and Rational Choice

6.871, 2004 -Uncertainty , Page 2

The Other Problem with Mycin

• In an earlier class we argued that Mycin used an extremely impoverished language for stating facts and rules (A-O-V triples) • Here we argue that it’s notion of uncertainty was broken: – In mycin the certainty factor for OR is Max • CF (OR A B) = (Max (Cf A) (Cf B)) • Consider – Rule-1 IF A then C, certainty factor 1 – Rule-2 If B then C, certainty factor 1 – This is logically the same as: – If (Or A B) then C, certainty factor 1

6.871, 2004 -Uncertainty , Page 3

More Problems

• If CF(A) = .8 and CF(B) = .3

– Then CF (C ) = .8 + .3 * (1 - .8) = .8 + .06 = .86

– CF (OR A B) = (Max .8 .3) = .8 and CF(C ) = .8

• IF A -> B, A -> C, B ->D, C->D there will also be a mistake: (why?) B A D C

6.871, 2004 -Uncertainty , Page 4

History of Uncertainty Representations

• Probability tried and Rejected – too many numbers • Focus on Logical, qualitative – reasoning by cases – non-monotonic reasoning • Numerical Approaches retried – Certainty factors – Dempster-Schafer – Fuzzy • Bayes Networks

6.871, 2004 -Uncertainty , Page 5

Understanding Bayes Theorem

Positive: .95

Has it and Tests for it 10 • .95 = 9.5

Test?

Has Cancer?

Yes: 010 No: 990 Has it and Doesn’t Test for it Doesn’t Have it But Tests for it 990 • .05 = 49.5

Test?

Number that test positive = 9.5 + 49.5 = 59 Doesn’t Have it and doesn’t Test for it If you test positive your probability of having Cancer is 9.5 / 59 = 16.1 %

6.871, 2004 -Uncertainty , Page 6

Reviewing Bayes Theorem

Symptom S

Diseases D

i

such that P

(

D

i

)  1 U Conditional Probability of S given D D S D P(S)  P(S & D)  P(S & D) P(S)  P(D)P(S | D)  P(D)P(S | D) P(S) P(D i  | S)  P(D j )  j  P(S | D j ) P(S | D i )  P(S) P(D i )

P

(

S

|

D

) 

P

(

S

&

D

)

P

(

D

)

P

(

D

|

S

) 

P

(

S

&

D

)

P

(

S

)

P

(

D

|

S

) 

P

(

S

|

D

)

P

(

D

)

P

(

S

)

6.871, 2004 -Uncertainty , Page 7

Independence & Conditional Independence

• Independence: P(A) • P(B) = P(A&B) – A varies the same within B as it does in the universe • Conditional Independence within C: P(A|C) • P(B|C) = P(A&B|C) – When we restrict attention to C, A and B are independent

6.871, 2004 -Uncertainty , Page 8

Examples

A D C B A and B are Independent A and B are conditionally Dependent, given C A’ B A’ and B are Dependent A’ and B are Conditionally Independent, given C.

6.871, 2004 -Uncertainty , Page 9

“IDIOT” BAYES Model

S1 D SK • Single Disease • Conditionally Independent Symptoms: – P(S1,S2|D) = P(S1|D) * P(S2|D) • N Symptoms means N probabilities • Without conditional independence need joint probabilities 2^N

6.871, 2004 -Uncertainty , Page 10

Using Multiple Pieces of Evidence

E1 H P(H|E1,E2) = P(E1,E2|H) · P(H) P(E1,E2) E2 If you assume "conditional independence" between the evidence then this takes on a nice multiplicative form.

Conditional Independence is the notion that the various pieces of evidence are statistically independent of one another, given that the hypothesis obtains, i.e. the hypothesis "separates" the different pieces of evidence: P(E1,E2|H) = P(E1|H) · P(E2|H) P(~E1,~E2|H) = P(~E1|H) · P(~E2|H) Without conditional independence you need to build up a very large database of joint probabilities and joint conditional probabilities.

6.871, 2004 -Uncertainty , Page 11

Sequential Bayesian Inference

• Consider symptoms one by one – Prior Probabilities P(Di) – Observe Symptom Sj – Updates Priors using Bayes Rule:

P

(

D i

) 

P

(

S j

|

D i

) 

P

(

D i

)

P

(

S j

) – Repeat for Other Symptoms using the resulting Posterior as the new Prior • If symptoms are conditionally independent, same as doing it all at once • Allows choice of what symptom to observe (test to perform) next in terms of cost/benefit.

6.871, 2004 -Uncertainty , Page 12

Bipartite Graphs

• Multiple Symptoms, multiple diseases • Diseases are probabilistically independent • Symptoms are conditionally independent • Symptoms probabilities depend only the diseases causing them • Symptoms with multiple causes require joint probabilities P(S2|D1,D2,D3) • Information explosion D1 D2 D3 S1 S2 S3 S4

6.871, 2004 -Uncertainty , Page 13

Noisy OR

A useful element in the modeling vocabulary Make the simplifying assumption that only 1 disease is present at a time: • Probability that all diseases cause the symptom is just the probability that at least 1 does • Therefore: Symptom is absent only if no disease caused it.

1 - P(S2|D1,D2,D3) = (1 - P(S2|D1)) * (1 - P(S2|D2)) * (1 - P(S2|D3)) • Use Causal Probabilities for the basic data • Reduces probability table size: if n diseases and k symptoms, from k2^n to nk

6.871, 2004 -Uncertainty , Page 14

Polytrees

• What if diseases cause or influence each other?

• Are there still well behaved versions?

• Yes, Polytrees: At most one path between any two nodes – Don’t have to worry about “double-counting” • Efficient Sequential updating is still possible D1 D2 S1 D3 S2 S3 S4 S5

6.871, 2004 -Uncertainty , Page 15

B

Bayes Nets

A C D E • Directed Acyclic Graphs • Absence of link --> conditional independence • P(X1,...,Xn) = Product P(Xi|{parents (Xi)}) • Specify joint probability tables over parents for each node Probability A,B,C,D,E all present: P(A,B,C,D,E) = P(A) * P(B|A) * P(C|A) * P(D|B,C) * P(E|C) Probability A,C,D present B,E absent: P(A,B,C,D,E) = P(A) * P(B|A) * P(C|A) * P(D|B,C) * P(E|C)

6.871, 2004 -Uncertainty , Page 16

Burglary

Example

Earthquake Alarm Radio Report Phone Call P(Call|Alarm) t f t .9

.1

f .01

.99

P(RadioReport|Earthquake) t f P(Alarm|B,E) t f t,t .8

.2

t,f .99

.01

f,t .6

.4

16 vs. 32 probabilites f,f .01

.99

t 1 0 f 0 1

6.871, 2004 -Uncertainty , Page 17

Computing with Partial Information

A B C D E • Probability that A present and E absent:

P

(

A

,

E

)  

B

,

C

,

D P

(

A

,

B

,

C

,

D

,

E

)  

B

,

C

,

D P

(

A

)

P

(

B

|

A

)

P

(

C

|

A

)

P

(

D

|

B

,

C

)

P

(

E

|

C

) 

P

(

A

) 

P

(

C

|

A

)

P

(

E

|

C

) 

P

(

B

|

A

) 

P

(

D

|

B

,

C

)

C B D

• Graph separators (e.g. C) correspond to factorizations • General problem of finding separators is NP-hard

P

(

A

|

E

) 

P

(

A

,

E

)

P

(

E

)

6.871, 2004 -Uncertainty , Page 18

Odds Likelihood Formulation

• Define Odds as

O

(

D

)  • Define Likelihood as:

P P

( (

D D L

(

S

|

D

)  ) ) 

P

(

D

) 1 

P

(

D

)

P

(

S

|

D

)

P

(

S

|

D

) Divide complementary instances of Bayes Rule:

P

(

D

|

S

) 

P

(

D

)

P

(

S

|

D

)

P

(

S

) Bayes Rule is Then:

P

(

D

|

S

) 

P

(

P

(

D

|

P

(

D

|

O

(

D

|

S

)

S

)

S

) 

P

(

D

)

P

(

S P

(

D

)

P

(

S

O

(

D

)

L

(

S

| | |

D

)

D

)

D

)

D

)

P P

( (

S S

) |

D

) In Logarithmic Form: Log Odds = Log Odd + Log Likelihood

6.871, 2004 -Uncertainty , Page 19

• Rules – If A, then C (x) – If B, then C (x) – If C, then D(x)

Certainty Factors

A B x z C D y Parallel Combination x+y -xy x,y>0 CF(C) = x+y +xy x,y<0

x

y

1  min(

x

,

y

) otherwise Series Combination CF(C) = z • max(0, CF(C))

6.871, 2004 -Uncertainty , Page 20

Issues with Certainty Factors

• Results obtained depend on order in which evidence is considered in some cases • Reasoning is often fairly insensitive to them. 20% variations yield no change in MYCIN • What do they mean? (in some cases the answer is:) Conditional Probability

P

(

C

|

A

) 

P

(

C

&

P

(

A

)

A

) Likelihood Certainty Factor 

x

 

P

(

C

|

P

(

C

|    1  1

A

)

A

)

6.871, 2004 -Uncertainty , Page 21

Decision Making

• So far, what we’ve considered is how to use evidence to evaluate a situation.

– In many cases, this is only the first part of the problem • What we want to do is to take actions to improve the situation • But which action should we take?

– The one which is most likely to leave us in the best condition • Decision Analysis helps us calculate which action that is

6.871, 2004 -Uncertainty , Page 22

A Decision Making Problem

There are two types of Urn U1 and U2 (80% are U1) U1 contains 4 Red balls and 6 Black balls U2 contains nine Red balls and one Black ball An urn is selected at random and you are to guess which type it is.

You have several courses of action: Refuse to play Guess it is of type 1 Guess it is of type 2 Sample a ball No Payoff no cost $40 Payoff if right, $20 penalty if wrong $100 Payoff if right, $5 penalty if wrong $8 payment for the right to sample

6.871, 2004 -Uncertainty , Page 23

Decision Flow Diagrams

Decision Fork $0.00

Refuse to Play -$8.00

Make an Observation No Observation a1 a2 R B Chance Fork (e1,R) a1 a2 a1 (e1,R, a1) (e1,B) a2 $40.00

-$20.00

-$5.00

$100.00

(e1,R, a1) $40.00

-$20.00

-$5.00

$100.00

$40.00

-$20.00

-$5.00

$100.00

6.871, 2004 -Uncertainty , Page 24

Expected Monetary Value

• Suppose there are several possible outcomes • Each has a monetary payoff or penalty • Each has a probability • The Expected Monetary Value is the sum of the products of the monetary payoffs times their corresponding probabilities.

.8

$40 .2

-$20 EMV = .8 · $40 + .2 · -$20 = $32 + (-$4) = $28 • EMV is a normative notion of what a person who has no other biases (risk aversion, e.g.) should be willing to accept in exchange for the situation facing him. In the picture above, you should be indifferent to the choice of taking $28 or playing the game.

• Most people have some extra biases and these can be incorporated in the form of a utility function applied to the calculated value.

• A rational person should choose that course of action which has the highest EMV.

6.871, 2004 -Uncertainty , Page 25

Averaging Out and Folding Back

• EMV of Decision Node is Max over all branches • EMV of Chance Node is Probability Weighted Sum over all branches $32.00

.8

$40.00

$28.00

$28.00

-$4.00

.2

-$20.00

$16.00

-$4.00

.8

-$5.00

$20.00

.2

$100.00

6.871, 2004 -Uncertainty , Page 26

The Effect of Observation

Bayes theorem is used to calculate probabilities at chance nodes following decision nodes that provide relevant evidence.

R B a1 a2 a1 a2 U1 U2 $40.00

-$20.00

-$5.00

$100.00

$40.00

-$20.00

-$5.00

$100.00

P(R) = P(R|U1) • P(U1) + P(R|U2) • P(U2) P(U1|R) = P(R|U1) • P(U1) / P(R)

6.871, 2004 -Uncertainty , Page 27

Calculating the Updated Probabilities

Initial Probabilities P(Outcome|State) Outcome Red Black .6

State U1 .4

U2 .9

.1

.8

.2

P(Outcome & State) State Outcome Red Black Joint & Marginal Probabilities U1 .8 • .4 = .32

.8 • .6 = .48

U2 .2 • .9 = .18

.2 • .1 = .02

Marginal Probability of Outcome .50

.50

Updated Probabilities P(State |Outcome) Outcome Red Black U1 State U2 .64

.96

.36

.04

6.871, 2004 -Uncertainty , Page 28

Illustrating Evaluation

R B 27.20

-$8.00

35.20

.5

R 16.40

B 18.80

.5

U1 .64

.96

U2 .36

.04

.5

.5

a1 +18.40

+25.60

.64

$40.00

a2 +32.80

37.60

-7.20

.36

-$20.00

-3.20

.64

-$5.00

+36.00

.36

$100.00

38.40

.96

$40.00

a1 a2 -.80

.04

-$20.00

-4.04

.96

-$5.00

-0.04

4.00

.04

$100.00

6.871, 2004 -Uncertainty , Page 29

Final Value of Decision Flow Diagram

(e1,R, a1)

$28.00

$0.00

Refuse to Play 27.20

-$8.00

Make an Observation No Observation $28.00

a1 a2 (e1,R) a1 a2 R B a1 (e1,R, a1) (e1,B) a2 $40.00

-$20.00

-$5.00

$100.00

$40.00

-$20.00

-$5.00

$100.00

$40.00

-$20.00

-$5.00

$100.00

6.871, 2004 -Uncertainty , Page 30

Maximum Entropy

.1

.2

.5

.2

Several Competing Hypotheses Each with a Probability rating.

• Suppose there are several tests you can make.

– Each test can change the probability of some (or all) of the hypotheses (using Bayes Theorem).

– Each outcome of the test has a probability.

– We’re only interested in gathering information at this point – Which test should you make? • Entropy = Sum -2 · P(i) · Log P(i) is a standard measure of Information.

• For each outcome of a test calculate the change in entropy.

– Weigh this by the probability of that outcome.

– Sum these to get an expected change of entropy for the test.

6.871, 2004 -Uncertainty , Page 31

Maximum Entropy (2)

• Chose that test which has the greatest expected change in entropy.

– This is equivalent to choosing the test which is most likely to provide the most information.

• Tests have different costs (sometimes quite drastic ones like life and death).

• Normalize the benefits by the costs and then make choice.

6.871, 2004 -Uncertainty , Page 32