Docsity

Probability & Uncertainty in AI: USF CS Dept. Course - Prof. Christopher H. Brooks, Study notes of Computer Science

Partial preview of the text

Download Probability & Uncertainty in AI: USF CS Dept. Course - Prof. Christopher H. Brooks and more Study notes Computer Science in PDF only on Docsity!

Artificial Intelligence Programming^ Probability

Chris BrooksDepartment of Computer ScienceUniversity of San Francisco

Department of Computer Science — University of San Francisco – p. 1/

19-2:^ Uncertainty^ •^ In many interesting agent environments,

uncertainty^

plays a

central role. • Actions may have nondeterministic effects.^ ◦^ Shooting an arrow at a target, retrieving a web page, moving • Agents may not know the true state of the world.^ ◦^ Incomplete sensors, dynamic environment • Relations between facts may not be deterministic.^ ◦^ Sometimes it rains when it’s cloudy.^ ◦^ Sometimes I play tennis when it’s humid. • Rational agents will need to deal with uncertainty.

Department of Computer Science — University of San Francisco – p. 2/

19-4:^ Weaknesses with logic^ •^ Qualifying all possible outcomes.^ ◦^ “If I leave now, I’ll be on time, unless there’s an earthquake,or I run out of gas, or there’s an accident ...”^ •^ We may not know all possible outcomes.^ ◦^ “If a patient has a toothache, she may have a cavity, or mayhave gum disease, or maybe something else we don’t knowabout.”^ •^ We have no way to talk about the likelihood of events.^ ◦^ “It’s possible that I’ll get hit by lightning today.”

Department of Computer Science — University of San Francisco – p. 4/

19-5:^ Qualitative vs. Quantitative^ •^ Logic gives us a

qualitative^ approach to uncertainty. ◦^ We can say that one event is more common than another, orthat something is a possibility. ◦^ Useful in cases where we don’t have statistics, or we wantto reason more abstractly. • Probability allows us to reason

quantitatively ◦^ We assign concrete values to the chance of an eventoccurring and derive new concrete values based onobservations.

Department of Computer Science — University of San Francisco – p. 5/

19-7:^ Basic Probability^ •^ A probability signifies a

belief^ that a proposition is true. ◦^ P(BartStudied) = 0.01 ◦^ P(Hungry(Homer)) = 0.99 • The proposition itself is true or false - we just don’t know which. • This is different than saying the sentence is partially true. ◦^ “Bart is short” - this is

sort of^ true, since “short” is a vague term. • An agent’s^ belief state

is a representation of the probability of the value of each proposition of interest.

Department of Computer Science — University of San Francisco – p. 7/

19-8:^ Random Values^ •^ A random variable is a variable or proposition whose value isunknown.^ •^ It has a domain of values that it can take on.^ •^ These variables can be:^ ◦^ Boolean (true, false) - Hungry(Homer), isRaining^ ◦^ Discrete - values taken from a countable domain.^ •^ Temperature: <hot, cool, mild>, Outlook: <sunny,overcast, rain>^ ◦^ Continuous - values can be drawn from an interval such as[0,1]^ •^ Velocity, time, position^ •^ Most of our focus will be on the discrete case.

Department of Computer Science — University of San Francisco – p. 8/

19-10:^ Axioms of Probability^ •^ All probabilities are between 0 and 1.

0 ≤^ P^ (a)^ ≤^

-^ Propositions that are necessarily true have probability 1. •^ Propositions that are unsatisfiable have probability 0. •^ The probability of

(A^ ∨^ B)^ is^ P

(A) +^ P^ (B)^

−^ P^ (A^ ∧^ B) Department of Computer Science — University of San Francisco – p. 10/

19-11:^ Prior Probability^ •^ The^ prior probability

of a proposition is its probability of taking on a value^ in the absence of any other information

◦^ P(Rain) = 0.1, P(Overcast) = 0.4, P(Sunny) = 0.5 • We can also list the probabilities of combinations of variables ◦^ P^ (Rain^ ∧^ Humid

) = 0.^1 , P^ (Rain^

∧ ¬Humid) = 0

.^1 , P^ (Overcast^ ∧

Humid) =

0.^2 , P^ (Overcast^

∧ ¬Humid) = 0

.^2 , P^ (Sunny^ ∧^ Humid

) =

0.^15 , P^ (Sunny^ ∧ ¬

Humid) = 0.^25

-^ This is called a

joint probability distribution

-^ For continuous variables, we can’t enumerate values •^ Instead, we use a parameterized function.^ ◦^ P^ (x) =

(^2) −z 1 − (^) √ (^2) edz 2 π (Normal distribution)

Department of Computer Science — University of San Francisco – p. 11/

19-13:^ Inference with Joint Probability Distributions^ •^ We can also use the joint probability distribution to determinethe^ marginal probability

of the dependent variable by summing all the ways the dependent variable can be true.^ ◦^ P^ (Rain) = 0

.^35

-^ What is the problem with using the joint probability distributionto do inference?

Department of Computer Science — University of San Francisco – p. 13/

19-14:^ Inference with Joint Probability Distributions^ •^ We can also use the joint probability distribution to determinethe^ marginal probability

of the dependent variable by summing all the ways the dependent variable can be true.^ ◦^ P^ (Rain) = 0

.^35

-^ What is the problem with using the joint probability distributionto do inference? •^ A problem with

n^ independent Boolean variables requires a table of size^

n 2

Department of Computer Science — University of San Francisco – p. 14/

19-16:^ Conditional Probability^ •^ Example:

P^ (Cloudy) = 0

.^3

-^ P^ (Rain) = 0

.^2

-^ P^ (cloudy^ ∧

rain) = 0.^15

-^ P^ (cloudy^ ∧ ¬

Rain) = 0.^1

-^ P^ (¬cloudy

∧^ Rain) = 0

.^1

-^ P^ (¬Cloudy

∧ ¬Rain) = 0

.^65

◦^ Initially,^ P^ (

Rain) = 0.^2. Once we see that it’s cloudy,(Rain P (Rain|Cloudy) =^ P^

∧Cloudy)^0 .=^ P (Cloudy)^

15 = 0.^50.^3 Department of Computer Science — University of San Francisco – p. 16/

19-17:^ Independence^ •^ In some cases, we can simplify matters by noticing that onevariable has no effect on another.^ •^ For example, what if we add a fourth variable

DayOf W eek

to

our Rain calculation? • Since the day of the week will not affect the probability of rain,we can assert

P^ (rain|Cloudy, M onday

P^ (rain|cloudy, T uesday

)...^ =^ P^ (rain

|cloudy)

-^ We say that

DayOf W eek

and^ Rain^ are independent.

-^ We can then split the larger joint probability distribution intoseparate subtables. •^ Independence will help us divide the domain into separatepieces.

Department of Computer Science — University of San Francisco – p. 17/

19-19:^ Bayes’ Theorem^ •^ we can generalize this to the case with more than two variables:^ ◦^ P^ (Y^ |

P^ (X| X, e) = Y,e)P^ (Y^ |e) P^ (X|e)

-^ We can then recursively solve for the conditional probabilitieson the right-hand side. •^ In practice, Bayes’ rule is useful for transforming the questionwe want to ask into one for which we have data.

Department of Computer Science — University of San Francisco – p. 19/

19-20:^ Bayes’ theorem example^ •^ Say we know:^ ◦^ Meningitis causes a stiff neck in 50% of patients.^ ◦^ P^ (stif f N eck

|M eningitis

) = 0.^5

◦^ Prior probability of meningitis is 1/50000. ◦^ P^ (meningitis

) = 0.^00002

◦^ Prior probability of a stiff neck is 1/20 ◦^ P^ (stif f N eck

) = 0.^05

-^ A patient comes to use with a stiff neck. What is the probabilityshe has meningitis? •^ P^ (meningitis

|stif f N eck) =

P^ (stif f N eck|meningitis

)P^ (meningitis) P (stif f N eck)^

0.^5 ×^0.^00002 = 0^0.^05

.^0002

Department of Computer Science — University of San Francisco – p. 20/