probability calculations matt huenerfauth cse-391: artificial intelligence university of...

20
Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Upload: brandon-harvey

Post on 12-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Probability Calculations

Matt HuenerfauthCSE-391: Artificial Intelligence

University of PennsylvaniaApril 2005

Page 2: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Exams

• The makeup midterm exam will be on Friday at 3pm. If you’ve already talked with Dr. Palmer about this, then you should have received an e-mail about this.

• The final exam for CSE-391 will be on May 2, 2005, from 8:30am to 10:30am.

• We don’t yet know the room.

Page 3: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Probability Problems

Page 4: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Probability Calculations

• What do these notations mean?A

P( A )

P( A )

P( A B )

P( A B )

P( A | B )

H

P(H = h)

Boolean Random Variable

Unconditional Probability. The notation P(A) is a shortcut for P(A=true).

Probability of A or B: P(A) + P(B) – P(A B)

Probability of A given that we know B is true.

Non-Boolean Random Variable

Probability H has some value

Joint Probability. Probability of A and B together.

Page 5: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Axioms of Probability

0 P(A) 1

P(true) = 1

P(false) = 0

P( A B ) = P(A) + P(B) – P(A B)

1 out of 3

45.65%

0.98

Page 6: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Product Rule

P(A B) = P(A|B) P(B)

P(A|B) = P(A B)

P(B)

So, if we can find two of these values someplace (in a chart, from a word problem), then we can calculate the third one.

Page 7: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Using the Product Rule

• When there’s a fire, there’s a 99% chance that the alarm will go off. P( A | F )

• On any given day, the chance of a fire starting in your house is 1 in 5000. P( F )

• What’s the chance of there being a fire and your alarm going off tomorrow? P( A F ) = P( A | F ) * P( F )

Page 8: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Conditioning

• Sometimes we call the 2nd form of the product rule the “conditioning rule” because we can use it to calculate a conditional probability from a joint probability and an unconditional one.

P(A|B) = P(A B) P(B)

Page 9: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Word Problem

• Out of the 1 million words in some corpus, we know that 9100 of those words are “to” being used as a PREPOSITION.

P( PREP “to” )• Further, we know that 2.53% of all the words that appear

in the whole corpus are the word “to”.P( “to” )

• If we are told that some particular word in a sentence is “to” but we need to guess what part of speech it is, what is the probability the word is a PREPOSITION?

What is P( PREP | “to” ) ?Just calculate: P(PREP|“to”) = P(PREP“to”) /

P(“to”)

Page 10: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Marginalizing

What if we are told only joint probabilities about a variable H=h, is there a way to calculate an unconditional probability of H=h?

Yes, when we’re told the joint probabilities involving every single value of the other variable…

)(

)(V Domaind

d ) Vh P( H hHP

Page 11: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Word Problem

• We have an AI weather forecasting program.We tell it the following information about this weekend… We want it to tell us the chance of rain.

• Probability that there will be rain and lightening is 0.23.P( rain=true lightening=true ) = 0.23

• Probability that there will be rain and no lightening is 0.14.

P( rain=true lightening=false ) = 0.14

• What’s the probability that there will be rain? P(rain=true) ? Lightening is only ever true or false. P(rain=true) = 0.23 + 0.14 = 0.37

Page 12: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Marginalizing

)(

)(V Domaind

d ) Vh P( H hHP

Page 13: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Joint Probability Distribution Table

• How could we calculate P(A)? – Add up P(AB) and P(A¬B).

• Same for P(B).

• How about P(AB)?– Two options… – We can read P(AB) from

chart and find P(A) and P(B).P(AB)=P(A)+P(B)-P(AB)

– Or just add up the proper three cells of the table.

B ¬ B

A

0.35

0.02

¬ A

0.15

0.48

Each cell contains a ‘joint’probability of both occurring.

P(AB)

Page 14: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Chain Rule

• Is there a way to calculate a really big joint probability if we know lots of different conditional probabilities?

P(f1f2f3f4 … fn-1fn) = P(f1) * P(f2 | f1) * P(f3 | f1f2 ) *

P(f4 | f1f2f3) * . . . . . . P(fn |

f1f2f3f4...fn-1)

Page 15: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Chain Rule

P(f1f2f3f4 … fn-1fn) = P(f1) * P(f2 | f1) * P(f3 | f1f2 ) *

P(f4 | f1f2f3) * . . . . . . P(fn |

f1f2f3f4...fn-1)

• Is there a way to calculate a really big joint probability if we know lots of different conditional probabilities?

Page 16: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Word Problem

• If we have a white ball, the probability it is a baseball is 0.76.

P( baseball | white ball )• If we have a ball, the probability it is white is 0.35.

P(white | ball)• The probability we have a ball is 0.03.

P(ball)

• So, what’s the probability we have a white ball that is a baseball?P(white ball baseball) = 0.76 * 0.35 * 0.03

Page 17: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Bayes’ Rule

Bayes’ Theorem relates conditional probabilitydistributions:

P(h | e) = P(e | h) * P(h) P(e)

or with additional conditioning information:

P(h | e k) = P(e | h k) * P(h | k) P(e | k)

Page 18: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Word Problem

• The probability I think that my cup of coffee tastes good is 0.80.

P(G) = .80• I add Equal to my coffee 60% of the time.

P(E) = .60• I think when coffee has Equal in it, it tastes good

50% of the time.P(G|E) = .50

• If I sip my coffee, and it tastes good, what are the odds that it has Equal in it?

P(E|G) = P(G|E) * P(E) / P(G)

Page 19: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

Bayes’ Rule

Bayes’ Theorem relates conditional probabilitydistributions:

P(h | e) = P(e | h) * P(h) P(e)

or with additional conditioning information:

P(h | e k) = P(e | h k) * P(h | k) P(e | k)

Page 20: Probability Calculations Matt Huenerfauth CSE-391: Artificial Intelligence University of Pennsylvania April 2005

The Skills You Need

• Probability Calculations– Basic Definitions.– Axioms.– Notation.– Rules, Word Problems.– Interpreting Charts.– Working with Bayes’ Rule. – “Diagnosis” Problems.