Introduction To Uncertainity
Introduction To Uncertainity
P(a|b) = 0.8
P(b) = 1/30000
P(a)= .02
From a standard deck of playing cards, a single card is drawn. The
probability that the card is king is 4/52, then calculate posterior
probability P(King|Face), which means the drawn face card is a king
card
=P(D|A){P(A|B,E)*P(B,E)+P(A|¬B,E)*P(¬B,E)+(P(A|B,¬E)*P(B,¬E)+
P(A|¬B,¬E)*P(¬B,¬E)}+ P(D|¬A){P(¬A|B,E)*P(B,E)+P(¬A|
¬B,E)*P(¬B,E)+P(¬A|B,¬E)*P(B,¬E)+ P(¬A|¬B,¬E)*P(¬B,¬E)}
=P(D|A){P(A|B,E)*P(B)P(E)+P(A|¬B,E)*P(¬B)P(E)+(P(A|
B,¬E)*P(B)P(¬E)+ P(A|¬B,¬E)*P(¬B)P(¬E)}+ P(D|¬A){P(¬A|
B,E)*P(B)P(E)+P(¬A|¬B,E)*P(¬B)P(E)+P(¬A|B,¬E)*P(B)P(¬E)
+ P(¬A|¬B,¬E)*P(¬B)P(¬E)}
Example: Alarm Network
B P(B) E P(E)
+b 0.001
B E +e 0.002
-b 0.999 -e 0.998
A J P(J|A)
A A M P(M|A)
B E A P(A|B,E)
+a +j 0.9 +a +m 0.7
+b +e +a 0.95
+a -j 0.1 +a -m 0.3
+b +e -a 0.05
-a +j 0.05 J M -a +m 0.01
+b -e +a 0.94
-a -j 0.95 -a -m 0.99
+b -e -a 0.06
-b +e +a 0.29
-b +e -a 0.71
-b -e +a 0.001
-b -e -a 0.999
Example: Alarm Network
B P(B) E P(E)
+b 0.001
B E +e 0.002
-b 0.999 -e 0.998
A J P(J|A)
A A M P(M|A)
B E A P(A|B,E)
+a +j 0.9 +a +m 0.7
+b +e +a 0.95
+a -j 0.1 +a -m 0.3
+b +e -a 0.05
-a +j 0.05 J M -a +m 0.01
+b -e +a 0.94
-a -j 0.95 -a -m 0.99
+b -e -a 0.06
-b +e +a 0.29
-b +e -a 0.71
-b -e +a 0.001
-b -e -a 0.999
Example: Alarm Network
B P(B) E P(E)
+b 0.001
B E +e 0.002
-b 0.999 -e 0.998
A J P(J|A)
A A M P(M|A)
B E A P(A|B,E)
+a +j 0.9 +a +m 0.7
+b +e +a 0.95
+a -j 0.1 +a -m 0.3
+b +e -a 0.05
-a +j 0.05 J M -a +m 0.01
+b -e +a 0.94
-a -j 0.95 -a -m 0.99
+b -e -a 0.06
-b +e +a 0.29
-b +e -a 0.71
-b -e +a 0.001
-b -e -a 0.999
Inference
• Inference: calculating some useful Examples:
quantity from a joint probability Posterior probability
distribution
Step 1: Select the Step 2: Sum out H to get joint Step 3: Normalize
entries consistent of Query and evidence
with the evidence
Inference by Enumeration
• A method to calculate the probability of a specific event or variable given
evidence in the network.
• It's based on systematically considering all possible combinations of values
for the variables in the network that are not observed (i.e., not provided as
evidence) and summing or multiplying probabilities accordingly.
1.Identify the Query: Determine the variable/s you want to make inferences about.
2.Identify Evidence: Identify any evidence or observed values in the network.
3.Initialize: Start with the joint probability distribution of all variables in the network.
4.Enumeration: Enumerate over all possible values of the remaining variables, and for
each combination of values
1. Multiply the probabilities associated with observed evidence
2. Sum or multiply probabilities for unobserved variables according to the network structure and
conditional probability tables
5.Normalize: After enumerating over all possible combinations of values, normalize
the probabilities to ensure they sum to 1.
|W |T |P(T|W)|
Inference by Enumeration
|W | P(W) |
|----------|------| |---------|---------|--------|
| Sunny | 0.7 | | Sunny | Light | 0.9 |
| Rainy | 0.3 | | Sunny | Heavy | 0.1 |
Weather (W) --> Traffic (T) --> Late for work (L) | Rainy | Light | 0.3 |
| Rainy | Heavy | 0.7 |
Infer the probability of being late for work (L) given that it's rainy (W = rainy)
1.Identify the Query: P(L|W = rainy). |T
T) |
|L | P(L|
J M
B E A P(A|B,E)
• Family of conditionals: T W P
P(X |Y) hot sun 0.8
• Multiple conditionals hot rain 0.2
• Entries P(x | y) for all x, y cold sun 0.4
• Sums to |Y| cold rain 0.6
Factor Zoo III
• Specified family: P( y | X )
• Entries P(y | x) for fixed y,
but for all x
• Sums need not to 1
T W P
hot rain 0.2
cold rain 0.6
Factor Zoo Summary
In general, when we write P(Y1 … YN | X1 … XM)
It is a “factor,” a multi-dimensional array
+t +l 0.3
+t -l 0.7
-t +l 0.1
-t -l 0.9
Inference by Enumeration: Procedural
Outline
• Track objects called factors
• Initial factors are local CPTs (one per node)
• Example: Join on R
R
+r 0.1 +r +t 0.8 +r +t 0.08
-r 0.9 +r -t 0.2 +r -t 0.02 R,T
-r +t 0.1 -r +t 0.09
T -r -t 0.9 -r -t 0.81
+r 0.1
R -r 0.9 Join R
+r +t 0.08
Join T
R, T, L
+r -t 0.02
T +r +t 0.8 -r +t 0.09
+r -t 0.2 -r -t 0.81 R, T
-r +t 0.1 +r +t +l 0.024
-r -t 0.9 +r +t -l 0.056
L
L +r -t +l 0.002
+r -t -l 0.018
+t +l 0.3 +t +l 0.3 -r +t +l 0.027
+t -l 0.7 +t -l 0.7 -r +t -l 0.063
-t +l 0.1 -t +l 0.1 -r -t +l 0.081
-t -l 0.9 -t -l 0.9 -r -t -l 0.729
Operation 2: Eliminate
• Second basic operation: marginalization
• Take a factor and sum out a variable
• Shrinks a factor to a smaller one
• A projection operation
• Example:
+r +t 0.08
+r -t 0.02 +t 0.17
-r +t 0.09 -t 0.83
-r -t 0.81
Multiple Elimination
R, T, L T, L L
+r +t +l 0.024
+r +t -l 0.056 Sum Sum
+r -t +l 0.002 out R out T
+r -t -l 0.018 +t +l 0.051
-r +t +l 0.027 +t -l 0.119 +l 0.134
-r +t -l 0.063 -t +l 0.083 -l 0.886
-r -t +l 0.081 -t -l 0.747
-r -t -l 0.729
Marginalizing
Join R
Early! (aka VE) Sum out T
Sum out R Join T
+r +t 0.08
+r 0.1 +r -t 0.02
-r 0.9 +t 0.17
-r +t 0.09
-t 0.83
-r -t 0.81
R R, T T T, L L
+r +t 0.8
+r -t 0.2
-r +t 0.1
T -r -t 0.9 L
L +t +l 0.051
+t -l 0.119 +l 0.134
-t +l 0.083 -l 0.866
L +t +l 0.3 +t +l 0.3 -t -l 0.747
+t +l 0.3
+t -l 0.7 +t -l 0.7
+t -l 0.7
-t +l 0.1 -t +l 0.1
-t +l 0.1
-t -l 0.9 -t -l 0.9
-t -l 0.9
Evidence
• If evidence, start with factors that select that evidence
• No evidence uses these initial factors:
Normalize
+r +l 0.026 +l 0.26
+r -l 0.074 -l 0.74
• That ’s it!
Traffic Domain
R
L
Join on r Join on r
Join on t Eliminate r
Eliminate r Join on t
Eliminate t Eliminate t
Example
Choose A
Example
Choose E
Finish with B
Normalize
Same Example in Equations
use x*(y+z) = xy + xz
use x*(y+z) = xy + xz
• The elimination ordering can greatly affect the size of the largest factor.
• E.g., previous slide’s example 2n vs. 2
• Does there always exist an ordering that only results in small factors?
• No!
Worst Case Complexity?
• CSP:
• If we can answer P(z) equal to zero or not, we answered whether the 3-SAT problem has a solution.