CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg...

22
CS520: Steinberg 1 Lecture 16 CS 520: Introduction CS 520: Introduction to to Artificial Artificial Intelligence Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty

Transcript of CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg...

Page 1: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg1Lecture 16

CS 520: Introduction to CS 520: Introduction to Artificial IntelligenceArtificial Intelligence

Prof. Louis Steinberg

Lecture 16: Uncertainty

Page 2: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg2Lecture 16

Start goal

Review: Building PlansReview: Building Plans• Progression

– Choose first step, what state does that result in?– Plan from that state to goal

• Means-Ends– Choose an operator that reduces start-goal difference– Plan from start to preconditions of operator– Plan from result of operator to goal

• Regression– Choose last step, what conditions needs to be true before it to – ensure goal met after it?– Plan from start to those conditions

Start goalop plan

Start goalopplan

op plan2plan1

Page 3: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg3Lecture 16

Sources of UncertaintySources of Uncertainty• Incomplete knowledge of the world state

– Which room is the wumpus in?• Uncertainty in operator effects

– Command: turn 90 degrees right– Result: robot turns 89.35 degrees right

• Theoretical vs practical uncertainty– We have no way to know, v.s.– It would cost too much to know

– Human time– Computer time

Page 4: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg4Lecture 16

Modeling UncertaintyModeling Uncertainty• Degree of belief

– Historical interest: approximations of probability

• Fuzzy logic– Oriented towards linguistic imprecision

– It is hot vs it is warm vs it is sweltering

• Probability

Page 5: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg5Lecture 16

Acting under uncertaintyActing under uncertainty• Probability: methods for representing and

reasoning about uncertainty of knowledge• Utility theory: a way to represent and

reason about the desirability of different outcomes

• Decision theory: A way to combine probability and utility to decide what to do.

Page 6: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg6Lecture 16

ProbabilityProbability• Bag with 10 marbles: 3 red, 7 blue

– Reach in, take one, put it back– Repeat lots of times.– What fraction red? About .3– P(red) = .3

Page 7: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg7Lecture 16

Probability DistributionProbability Distribution• The probability for each value of a random

variableif color = (red, blue)

P(color) = (.3, .7)

Page 8: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg8Lecture 16

Conditional ProbabilityConditional Probability• Marbles are red or blue, striped or solid• Take marble, look at it, put it back• Ignore non-red• What fraction are striped?

P(striped | red) = 1/3

• P(red | striped) = 1/4

Page 9: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg9Lecture 16

Conditional ProbabilityConditional Probability• P(A | B) = P(A B) / P(B)

.1 P(red striped)

.4 P(striped)

.1/.4 = 1/4 = P(red | striped)

.1 P(red striped)

.3 P(red)

.1/.3 = 1/3 = P(striped | red)• Equivalently: P(A^B) = P(A | B) * P(B)

Page 10: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg10Lecture 16

Basic PropertiesBasic Properties• 0 ≤ P(A) ≤ 1• P(true) = 1

P(red blue green) = 1

• P(false) = 0

P(black) = 0

Page 11: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg11Lecture 16

Basic PropertiesBasic Properties

• P(A B) = P(A) + P(B) - P(A B)

.3 P(red)

+ .4 P(striped)

- .1 P(red striped)

P(red striped) = .6

Counted twice

So subtract once

Page 12: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg12Lecture 16

Example ProofsExample Proofs• Prove P(true | A) = 1• Proof:

P(true | A) = P(true^A)/P(A) = P(A)/P(A) = 1

• Prove: P(B|A)+P(¬B|A)= 1• Proof:

P(B|A)+P(¬B|A) = P(B v ¬B |A) + P(B ^ ¬B|A)

= P(true | A) + P(false | A) = 1 + 0

Page 13: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg13Lecture 16

Example ProofExample Proof• Prove:

P(A) = P(A | B)*P(B) + P(A|¬B)*P(¬B)

• Proof:P(B|A)+P(¬B|A)=P(B v ¬B |A)=P(true | A) = 1

P(B|A)+P(¬B|A)=

P(A|B)*P(B)/P(A) + P(A|¬B)*P(¬B)/P(A) =

(P(A | B)*P(B) + P(A|¬B)*P(¬B)) / P(A)

Page 14: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg14Lecture 16

Example Use: Mine SweeperExample Use: Mine Sweeper• Grid of cells, some have mines• Probe a cell:

– If has a mine, lose– Else tells number of neighboring mines

• Variables:– M(x, y): boolean: mine– C(x, y): neighbor mine count– N: total mines

Page 15: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg15Lecture 16

Mine SweeperMine SweeperP(M(1, 1)) =

# ways of choosing 2 of 5

# ways of choosing 3 of 6

= 5! /(2!3!)

6! /(3!3!)

= 10/20 = .5

?

N = 3 == 2

Page 16: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg16Lecture 16

Mine SweeperMine SweeperP( C(1,2)=2 ^ ~M(1,2) ) =

choose(2, 3) * choose(1,2)

choose (3, 6)

= 3*2/20 = .3N = 3 == 2

2

Page 17: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg17Lecture 16

Mine SweeperMine SweeperP( C(1,2)=2 ^ ~M(1,2) ^ M(1,1) )=

choose(1, 2) * choose(1,2)

choose (3, 6)

= 2 * 2 / 20 = .2N = 3 == 2

2

Page 18: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg18Lecture 16

Mine SweeperMine SweeperP( C(1,2)=2 ^ ~M(1,2) | M(1,1) )=

P( C(1,2)=2 ^ ~M(1,2) ^ M(1,1) )

P( M(1,1) )

= .2/.5 = 2/5

N = 3 == 2

2

Page 19: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg19Lecture 16

Mine SweeperMine SweeperP( M(1,1) | C(1,2)=2 ^ ~M(1,2) )=

P( C(1,2)=2 ^ ~M(1,2) | M(1,1) )

* P( M(1,1) )

/ P(C(1,2)=2 ^ ~M(1,2) )

= 2/5 * 1/2 / 3/10

= 2/3?

N = 3 == 2

2

Page 20: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg20Lecture 16

Mine SweeperMine Sweeper• Known:

P(M(1, 1) v M(2, 1)) =1P(M(1, 1) ^ M(2, 1)) = 0P(M(1, 1)) = P(M(2, 1))

• Conclude:1 = P(M(1, 1)) + P(M(2, 1)) - 0P(M(1, 1)) = P(M(2, 1)) = .5

1 1

A B

Mine Sweeper

Page 21: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg21Lecture 16

Joint ProbabilityJoint Probability• The state of a single situation / domain

may be represented by a set of random variables.

Page 22: CS520: Steinberg 1 Lecture 16 CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 16: Uncertainty.

CS520: Steinberg22Lecture 16

Example of JointExample of JointProbability DistributionProbability Distribution

2

C

D

B

MinesLeft = 1

A

Mine Sweeper

A B C D Probability

F F F F 0

F F F T 1/2

F F T F 1/2

F F T T 0

F T F F 0

F T F T 0

F T T F 0

F T T T 0

T F F F 0

T F F T 0

T F T F 0

T F T T 0

T T F F 0

T T F T 0

T T T F 0

T T T T 0