Академический Документы
Профессиональный Документы
Культура Документы
CS 6300
Artificial Intelligence
Spring 2018
Tucker Hermans
thermans@cs.utah.edu
Many slides courtesy of
Pieter Abbeel and Dan Klein 1
Tucker Hermans
Today
Ø Probability
Ø Random Variables
Ø Joint and Marginal Distributions
Ø Conditional Distribution
Ø Inference by Enumeration
Ø Product Rule, Chain Rule, Bayes’ Rule
Ø Independence
Ø Statistics
Ø Expected value
2
Tucker Hermans
3
Tucker Hermans
Random Variables
4
Tucker Hermans
Uncertainty
Ø General situation:
Ø Observed variables (evidence):
Agent knows certain things about the
state of the world (e.g., sensor
readings or symptoms)
Ø Unobserved variables:
Agent needs to reason about other
aspects (e.g., where an object is or
what disease is present)
Ø Model:
Agent knows something about how the
known variables relate to the unknown
variables
a 5
Tucker Hermans
Probability Distribution
• A probability distribution is an assignment of weights
to outcomes
• Example: traffic on freeway?
• Random variable: T = whether there’s traffic
• Outcomes: T in {none, light, heavy}
• Distribution: P(T=none) = 0.25, P(T=light) = 0.55, P(T=heavy) =
0.20
• Some laws of probability:
• Probabilities are always non-negative
• Probabilities over all possible outcomes sum to one
• As we get more evidence, probabilities may change:
• P(T=heavy) = 0.20, P(T=heavy | Hour=8am) = 0.60
6
Tucker Hermans
Probability Distributions
Ø A distribution is a TABLE of probabilities of values
T P W P
hot 0.5 sun 0.6
cold 0.5 rain 0.4
∀xP(x) ≥ 0 ∑ P(x) = 1
x∈X
7
Tucker Hermans
Joint Distributions
Ø A joint distribution over a set of random variables:
specifies a real number for each assignment (or outcome):
T W P
hot sun 0.4
Ø Size of distribution if n variables with
domain sizes d? hot rain 0.1
cold sun 0.2
Ø Must obey: cold rain 0.3
Probabilistic Models
Ø A probabilistic model is a joint distribution
over a set of random variables Constraint over T,W
T W P
Ø CSPs:
Ø Variables with domains hot sun T
Ø Constraints: state whether hot rain F
assignments are possible
Ø Ideally: only certain variables directly cold sun F
interact cold rain T
9
Tucker Hermans
Events
Ø An event is a set E of outcomes
T W P
hot sun 0.4
hot rain 0.1
Ø From a joint distribution, we can
calculate the probability of any event cold sun 0.2
cold rain 0.3
Ø Probability that it’s hot AND sunny?
10
Tucker Hermans
Quiz: Events
§ P(+x, +y) ?
X Y P
+x +y 0.2
+x -y 0.3
§ P(+x) ?
-x +y 0.4
-x -y 0.1
§ P(-y OR +x) ?
11
Tucker Hermans
Marginal Distributions
Ø Marginal distributions are sub-tables which eliminate variables
Ø Marginalization (summing out): Combine collapsed rows by
adding
T P
hot 0.5
T W P
cold 0.5
hot sun 0.4
hot rain 0.1
cold sun 0.2 W P
cold rain 0.3 sun 0.6
rain 0.4
12
Tucker Hermans
X P
+x
X Y P
-x
+x +y 0.2
+x -y 0.3
-x +y 0.4 Y P
-x -y 0.1 +y
-y
13
Tucker Hermans
Conditional Probabilities
Ø Conditional or posterior probabilities:
Ø E.g., P(cavity | toothache) = 0.8
Ø Given that toothache is all I know…
Ø If we know more:
Ø P(cavity | toothache, catch) = 0.9
Ø P(cavity | toothache, cavity) = 1
Ø Note: the less specific belief remains valid after more evidence arrives, but
is not always useful
Example Problems
Ø Suppose a murder occurs in a town of population
10,000 (10,001 before the murder). A suspect is
brought in and DNA tested. The probability that
there is a DNA match given that a person is innocent
is 1/100,000; the probability of a match on a guilty
person is 1. What is the probability he is guilty
given a DNA match?
15
Tucker Hermans
Conditional Probabilities
Ø A simple relation between joint and conditional probabilities
Ø In fact, this is taken as the definition of a conditional probability
T W P
hot sun 0.4
hot rain 0.1
cold sun 0.2
cold rain 0.3
17
Tucker Hermans
X Y P
+x +y 0.2
+x -y 0.3
§ P(-x | +y) ?
-x +y 0.4
-x -y 0.1
§ P(-y | +x) ?
18
Tucker Hermans
Conditional Distributions
Ø Conditional distributions are probability distributions over
some variables given fixed values of others
W P T W P
sun 0.8 hot sun 0.4
rain 0.2 hot rain 0.1
cold sun 0.2
cold rain 0.3
W P
sun 0.4
rain 0.6
19
Tucker Hermans
Normalization Trick
Ø A trick to get a whole conditional distribution at once:
Ø Select the joint probabilities matching the evidence
Ø Normalize the selection (make it sum to one)
T W P
hot sun 0.4 T P T P
hot rain 0.1 hot 0.1 hot 0.25
cold sun 0.2 Select cold 0.3 Normalize
cold 0.75
cold rain 0.3
Ø Why does this work? Because sum of selection is
P(evidence)! (P(r) here)
20
Tucker Hermans
§ P(X | Y=-y) ?
NORMALIZE
X Y P the selection
SELECT the joint (make it sum to
+x +y 0.2 probabilities one)
+x -y 0.3 matching the
evidence
-x +y 0.4
-x -y 0.1
21
Tucker Hermans
Probabilistic Inference:
Inference by Enumeration
Ø P(sun)? S T W P
summer hot sun 0.30
summer hot rain 0.05
Ø P(sun | winter)? summer cold sun 0.10
summer cold rain 0.05
winter hot sun 0.10
winter hot rain 0.05
Ø P(sun | winter, hot)? winter cold sun 0.15
winter cold rain 0.20
23
Tucker Hermans
Inference by Enumeration
Ø P(sun)?
S T W P
0.30+0.10+0.10+0.15= 0.65 summer hot sun 0.30
summer hot rain 0.05
Ø P(sun | winter)?
summer cold sun 0.10
P ( sun , winter )
P ( sun winter )= summer cold rain 0.05
P (winter )
winter hot sun 0.10
winter hot rain 0.05
winter cold sun 0.15
winter cold rain 0.20
Ø P(sun | winter, hot)?
24
Tucker Hermans
Inference by Enumeration
Ø General case:
Ø Evidence variables:
Ø Query variables:
Ø Hidden variables:
All variables
Ø We want:
Ø Obvious problems: 25
Ø Worst-case time complexity O(dn)
Ø Space complexity O(dn) to store the joint distribution 25
Tucker Hermans
Ø Example:
D W P D W P
W P wet sun 0.1 wet sun 0.08
sun 0.8 dry sun 0.9 dry sun 0.72
wet rain 0.7 wet rain 0.14
rain 0.2
dry rain 0.3 dry rain 0.06
27
Tucker Hermans
28
Tucker Hermans
Bayes’ Rule
Ø Two ways to factor a joint distribution over two variables:
That’s my rule!
Ø Dividing, we get:
29
Tucker Hermans
Ø Example:
Ø m is meningitis, s is stiff neck
Example
givens
30
Tucker Hermans
§ Given:
R P D W P
sun 0.8 wet sun 0.1
31
Tucker Hermans
Ghostbusters Revisited
32
Tucker Hermans
Independence
Ø Two variables are independent in a joint distribution if:
P( X ,Y )= P( X )P(Y )
x , y : P( x , y)= P(x) P(y)
Ø Says the joint distribution factors into a product of two simpler distributions
Ø Usually variable aren’t independent!
Ø Equivalent definition of independence:
x , y : P( x y)= P( x)
Ø We write: x y
Example: Independence?
Ø Arbitrary joint
distributions can be
poorly modeled by T P W P
independent factors warm 0.5 sun 0.6
cold 0.5 rain 0.4
T W P T S P
hot sun 0.4 warm sun 0.3
hot rain 0.1 warm rain 0.2
cold sun 0.2 cold sun 0.3
cold rain 0.3 cold rain 0.2
34
Tucker Hermans
Example: Independence
35
Tucker Hermans
Conditional Independence
Ø P(Toothache, Cavity, Catch)
Ø Equivalent statements:
Ø P(Toothache | Catch , Cavity) = P(Toothache | Cavity)
Ø P(Toothache, Catch | Cavity) = P(Toothache | Cavity) P(Catch | Cavity)
36
Tucker Hermans
Conditional Independence
37
Tucker Hermans
Trivial decomposition:
38
Tucker Hermans
Ø Givens:
Ø P(+g) = 0.5
Ø P(+t | +g) = 0.8
Ø P(+t | ¬g) = 0.4 P(T , B ,G)= P(G) P(T G) P(B G)
Ø P(+b | +t) = 0.4
Ø P(+b | ¬g) = 0.8
39
Tucker Hermans
Expectations
Ø The expected value of a function is its average output, weighted
by a given distribution over inputs
40
Tucker Hermans
Expectations
X P f
1 1/6 1
2 1/6 2
3 1/6 3
4 1/6 4
5 1/6 5
6 1/6 6 41
Tucker Hermans
42