38
Uncertainty Uncertain Knowledge • Probability Review • Bayes’ Theorem • Summary

Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Embed Size (px)

Citation preview

Page 1: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertainty

• Uncertain Knowledge• Probability Review• Bayes’ Theorem• Summary

Page 2: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertain Knowledge

In many situations we cannot assign a value oftrue or false to world statements.

ExampleSymptom(p,Toothache) Disease(p,Cavity)

To generalize:Symptom(p,Toothache) Disease(p,Cavity) V Disease(p,GumDisease) V …

Page 3: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertain Knowledge

Solution: Deal with degrees of belief.

We will use probability theory. Probability states a degree of belief based on evidence:

P(x) = 0.80 – based on evidence, 80% of the times in which the experiment is run, x occurs. It summarizes our uncertainty of what causes x.

Degree of truth – Fuzzy logic.

Page 4: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Utility Theory

Combine probability and decision theory

To make a decision (action) an agent needs tohave preferences between plans.

An agent should choose the action with highest expected utility averaged over

all possible outcomes.

Page 5: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertainty

• Uncertain Knowledge• Probability Review• Bayes’ Theorem• Summary

Page 6: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Random Variable

Definition: A variable that can take on several values, each value having a probability of occurrence.

There are two types of random variables:Discrete. Take on a countable number of values.Continuous. Take on a range of values.

Page 7: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Random Variable

Discrete Variables For every discrete variable X there will be a probability function P(x) = P(X = x).

Page 8: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Random Variable

Continuous Variables: For every continuous random variable X we will associate a probability density function f(x). It is the area under the density functions between two points that corresponds to the probability of the variable lying between the two values.

Prob(x1 < X <= x2) = ∫x1 f(x) dx x2

Page 9: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

The Sample Space

The space of all possible outcomes of a given process or situation is called the sample space S.

SS

red & smallred & smallblue & smallblue & small

red & largered & large blue & largeblue & large

Page 10: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

An Event

An event A is a subset of the sample space.

SS

red & smallred & small blue & smallblue & small

red & largered & large blue & largeblue & largeAA

Page 11: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Atomic Event

An atomic event is a single point in S.

Properties: Atomic events are mutually exclusive The set of all atomic events is exhaustive A proposition is the disjunction of the atomic events it covers.

Page 12: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

The Laws of Probability

The probability of the sample space S is 1, P(S) = 1The probability of any event A is such that 0 <= P(A) <= 1. Law of Addition

If A and B are mutually exclusive events, then the probability that either one of them will occur is the sum of the individual probabilities:

P(A or B) = P(A) + P(B)

Page 13: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

The Laws of Probability

If A and B are not mutually exclusive:

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

AA BB

Page 14: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Prior Probability

It is called the unconditional or prior probabilityof event A.

P(A) -- Reflects our original degree of belief of X.

Page 15: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Conditional Probabilities

Given that A and B are events in sample space S, and P(B) is different of 0, then the conditional probability of A given B is

P(A|B) = P(A and B) / P(B)

If A and B are independent then

P(A|B) = P(A)

Page 16: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

The Laws of Probability

Law of Multiplication

What is the probability that both A and B occur together?

P(A and B) = P(A) P(B|A) where P(B|A) is the probability of B conditioned on A.

Page 17: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

The Laws of Probability

If A and B are statistically independent:

P(B|A) = P(B) and then

P(A and B) = P(A) P(B)

Page 18: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Independence on Two Variables

P(A,B|C) = P(A|C) P(B|C)

If A and B are conditionally independent:

P(A|B,C) = P(A|C) and

P(B|A,C) = P(B|C)

Page 19: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

19

Exercises

Find the probability that the sum of the numbersFind the probability that the sum of the numberson two unbiased dice will be even by considering theon two unbiased dice will be even by considering theprobabilities that the individual dice will show an evenprobabilities that the individual dice will show an evennumber.number.

Page 20: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

20

Exercises

XX11 – first throw – first throw

XX22 – second throw – second throw

Page 21: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

21

Exercises

XX11 – first throw – first throw

XX22 – second throw – second throw

Pfinal = P(XPfinal = P(X11=1 & X=1 & X22=1) + P(X=1) + P(X11=1 & X=1 & X22=3) + P(X=3) + P(X11=1 & X=1 & X22=5) +=5) +

P(XP(X11=2 & X=2 & X22=2) + P(X=2) + P(X11=2 & X=2 & X22=4) + P(X=4) + P(X11=2 & X=2 & X22=6) +=6) +

P(XP(X11=3 & X=3 & X22=1) + P(X=1) + P(X11=3 & X=3 & X22=3) + P(X=3) + P(X11=3 & X=3 & X22=5) +=5) +

… … P(XP(X11=6 & X=6 & X22=2) + P(X=2) + P(X11=6 & X=6 & X22=4) + P(X=4) + P(X11=6 & X=6 & X22=6).=6).

PPfinalfinal = 18/36 = 1/2 = 18/36 = 1/2

Page 22: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

22

Exercises

Find the probabilities of throwing a sum of a) 3, b) 4Find the probabilities of throwing a sum of a) 3, b) 4with three unbiased dice.with three unbiased dice.

Page 23: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

23

Exercises

Find the probabilities of throwing a sum of a) 3, b) 4Find the probabilities of throwing a sum of a) 3, b) 4with three unbiased dice.with three unbiased dice.

X = sum of XX = sum of X11 and X and X22 and X and X33

P(X=3)?P(X=3)?

P(XP(X11=1 & X=1 & X22=1 & X=1 & X33=1) = 1/216=1) = 1/216

P(X=4)?P(X=4)?P(XP(X11=1 & X=1 & X22=1 & X=1 & X33=2) + P(X=2) + P(X11=1 & X=1 & X22=2 & X=2 & X33=1) + …=1) + …

P(X=4) = 3/216P(X=4) = 3/216

Page 24: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

24

Exercises

Three men meet by chance. What are the probabilities Three men meet by chance. What are the probabilities that a) none of them, b) two of them, c) all of themthat a) none of them, b) two of them, c) all of themhave the same birthday?have the same birthday?

Page 25: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

25

Exercises

None of them have the same birthdayNone of them have the same birthday

XX11 – birthday 1 – birthday 1stst person person

XX22 – birthday 2 – birthday 2ndnd person person

XX33 – birthday 3 – birthday 3rdrd person person

a)a) P(XP(X22 is different than X is different than X11 & X & X33 is different than X is different than X11 and X and X22))

PPfinalfinal = (364/365)(363/365) = (364/365)(363/365)

Page 26: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

26

Exercises

Two of them have the same birthdayTwo of them have the same birthday

P(XP(X11 = X = X22 and X and X33 is different than X is different than X11 and X and X22) +) +

P(XP(X11=X=X33 and X and X22 differs) + differs) +

P(XP(X22=X=X33 and X and X11 differs). differs).

P(XP(X11=X=X22 and X and X33 differs) = (1/365)(364/365) differs) = (1/365)(364/365)

PPfinalfinal = 3(1/365)(364/365) = 3(1/365)(364/365)

Page 27: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

27

Exercises

All of them have the same birthdayAll of them have the same birthday

P(XP(X11 = X = X22 = X = X33))

PPfinalfinal = (1/365)(1/365) = (1/365)(1/365)

Page 28: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Multivariate o Joint Distributions

P(x,y) = P( X = x and Y = y).

P’(x) = Prob( X = x) = ∑y P(x,y) It is called the marginal distribution of X The same can be done on Y to define the marginal distribution of Y, P”(y).

If X and Y are independent then P(x,y) = P’(x) P”(y)

Page 29: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Expectations: The Mean

Let X be a discrete random variable that takes the following values: x1, x2, x3, …, xn.

Let P(x1), P(x2), P(x3),…,P(xn) be their respective probabilities. Then the expected value of X, E(X), is defined as

E(X) = x1P(x1) + x2P(x2) + x3P(x3) + … + xnP(xn) E(X) = Σi xi P(xi)

Page 30: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

30

Exercises

Suppose that X is a random variable taking the valuesSuppose that X is a random variable taking the values{-1, 0, and 1} with equal probabilities and that Y = X{-1, 0, and 1} with equal probabilities and that Y = X22 . . Find the joint distribution and the marginal distributions Find the joint distribution and the marginal distributions of X and Y and also the conditional distributions of Xof X and Y and also the conditional distributions of Xgiven a) Y = 0 and b) Y = 1.given a) Y = 0 and b) Y = 1.

Page 31: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

31

Exercises

0 1/3 0

1/3 0 1/3YY

XX

1/31/3

2/32/3

1/3 1/3 1/31/3 1/3 1/3

-1 0 1-1 0 1

00

11

If Y = 0 then X= 0 with probability 1If Y = 0 then X= 0 with probability 1If Y = 1 then X is equally likely to be +1 or -1If Y = 1 then X is equally likely to be +1 or -1

Page 32: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertainty

• Uncertain Knowledge• Probability Review• Bayes’ Theorem• Summary

Page 33: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Bayes’ Theorem

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

The theorem:

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

Page 34: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

More General Bayes’ Theorem

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

Where e: background evidence.

Page 35: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Thomas Bayes

Born in London (1701). Studied logic and theology (Univ. of Edinburgh).Fellow of the Royal Society (year 1742).

Given white and black balls in an urn, what is the prob. of drawing one or the other?

Given one or more balls, what can be said about the number of balls in the urn?

Page 36: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Uncertainty

• Uncertain Knowledge• Probability Review• Bayes’ Theorem• Summary

Page 37: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Summary

• Uncertainty comes from ignorance on the true state of the world.

• Probabilities indicate our degree of belief on certain event.

• Concepts: random variable, prior probabilities, conditional probabilities, joint distributions, conditional independence, Bayes’ theorem.

Page 38: Uncertainty Uncertain Knowledge Probability Review Bayes’ Theorem Summary

Application: Predicting Stock Market

Bayesian Networks BNs have been exploited to predictthe behavior of the stock market. BNs can be constructed from daily stock returns over a certain amount of time.

Stocks can be analyzed from well-known repositories:e.g., S&P 500 index.