Download presentation
Presentation is loading. Please wait.
Published byEmil Wright Modified over 9 years ago
1
Knowledge Representation & Reasoning Lecture #4 UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005 (Based on slides by Lise Getoor and Alvaro Cardenas (UMD) (in turn based on slides by Nir Friedman (Hebrew U)))
2
Today and Next Class 1.Probabilistic graphical models 2.Treewidth methods: 1.Variable elimination 2.Clique tree algorithm 3. Applications du jour: Sensor Networks
3
Probabilistic Representation of Knowledge Knowledge that is deterministic –If there is rain, there are clouds: Clouds v Rain Knowledge that includes uncertainty –If there are clouds, there is a chance for rain Probabilistic knowledge –If there are clouds, the rain has probability 0.3 Pr(Rain=True | Clouds=True)=0.3 How do we write probabilistic knowledge?
4
How to Represent Probabilistic Knowledge? A probability distribution is a function from measurable sets of events to [0,1] Pr : Pow( ) [0,1] –Example: domain = {T,F} x {T,F} Random variables: Rain, Clouds If the domain is discrete, Pr specifies probabilities for all 2 | | sets But, it is enough to represent only | | values: Pr(a 1 a 2 )=Pr(a 1 )+Pr(a 2 )-Pr(a 1 a 2 ) This is not good enough if =2 #rv’s (rv’s=Random Variables) and #rv’s is large
5
Example: How Many RV’s?
6
Independent Random Variables Two variables X and Y are independent if –P(X = x|Y = y) = P(X = x) for all values x,y –That is, learning the values of Y does not change prediction of X If X and Y are independent then –P(X,Y) = P(X|Y)P(Y) = P(X)P(Y) In general, if X 1,…,X p are independent, then P(X 1,…,X p )= P(X 1 )...P(X p ) –Requires O(n) parameters
7
Conditional Independence Unfortunately, most of random variables of interest are not independent of each other A more suitable notion is that of conditional independence Two variables X and Y are conditionally independent given Z if –P(X = x|Y = y,Z=z) = P(X = x|Z=z) for all values x,y,z –That is, learning the values of Y does not change prediction of X once we know the value of Z –notation: I ( X, Y | Z )
8
Modeling assumptions: Ancestors can effect descendants' genotype only by passing genetic materials through intermediate generations Example: Family trees Noisy stochastic process: Example: Pedigree A node represents an individual’s genotype Homer Bart Marge LisaMaggie
9
Markov Assumption We now make this independence assumption more precise for directed acyclic graphs (DAGs) Each random variable X, is independent of its non- descendents, given its parents Pa(X) Formally, I (X, NonDesc(X) | Pa(X)) Descendent Ancestor Parent Non-descendent X Y1Y1 Y2Y2
10
Markov Assumption Example In this example: –I ( E, B ) –I ( B, {E, R} ) –I ( R, {A, B, C} | E ) –I ( A, R | B,E ) –I ( C, {B, E, R} | A) Earthquake Radio Burglary Alarm Call
11
I-Maps A DAG G is an I-Map of a distribution P if all Markov assumptions implied by G are satisfied by P (Assuming G and P both use the same set of random variables) Examples: XYXY
12
Factorization Given that G is an I-Map of P, can we simplify the representation of P? Example: Since I(X,Y), we have that P(X|Y) = P(X) Applying the chain rule P(X,Y) = P(X|Y) P(Y) = P(X) P(Y) Thus, we have a simpler representation of P(X,Y) XY
13
Factorization Theorem From assumption: Thm: if G is an I-Map of P, then Proof: By chain rule: wlog. X 1,…,X p is an ordering consistent with G Since G is an I-Map, I (X i, NonDesc(X i )| Pa(X i )) We conclude, P(X i | X 1,…,X i-1 ) = P(X i | Pa(X i ) ) Hence,
14
Factorization Example P(C,A,R,E,B) = P(B)P(E|B)P(R|E,B)P(A|R,B,E)P(C|A,R,B,E) Earthquake Radio Burglary Alarm Call versus P(C,A,R,E,B) = P(B) P(E) P(R|E) P(A|B,E) P(C|A)
15
Consequences We can write P in terms of “local” conditional probabilities If G is sparse, – that is, |Pa(X i )| < k, each conditional probability can be specified compactly –e.g. for binary variables, these require O(2 k ) params. representation of P is compact –linear in number of variables
16
Summary We defined the following concepts The Markov Independences of a DAG G –I (X i, NonDesc(X i ) | Pa i ) G is an I-Map of a distribution P –If P satisfies the Markov independencies implied by G We proved the factorization theorem if G is an I-Map of P, then
17
Let Markov(G) be the set of Markov Independencies implied by G The factorization theorem shows G is an I-Map of P We can also show the opposite: Thm: G is an I-Map of P Conditional Independencies
18
Proof (Outline) Example: X Y Z
19
Implied Independencies Does a graph G imply additional independencies as a consequence of Markov(G)? We can define a logic of independence statements Some axioms: –I( X ; Y | Z ) I( Y; X | Z ) –I( X ; Y 1, Y 2 | Z ) I( X; Y 1 | Z )
20
d-separation A procedure d-sep(X; Y | Z, G) that given a DAG G, and sets X, Y, and Z returns either yes or no Goal: d-sep(X; Y | Z, G) = yes iff I(X;Y|Z) follows from Markov(G)
21
Paths Intuition: dependency must “flow” along paths in the graph A path is a sequence of neighboring variables Examples: R E A B C A E R Earthquake Radio Burglary Alarm Call
22
Paths We want to know when a path is –active -- creates dependency between end nodes –blocked -- cannot create dependency end nodes We want to classify situations in which paths are active.
23
Blocked Unblocked E R A E R A Path Blockage Three cases: –Common cause – Blocked Active
24
Blocked Unblocked E C A E C A Path Blockage Three cases: –Common cause –Intermediate cause – Blocked Active
25
Blocked Unblocked E B A C E B A C E B A C Path Blockage Three cases: –Common cause –Intermediate cause –Common Effect Blocked Active
26
Path Blockage -- General Case A path is active, given evidence Z, if Whenever we have the configuration B or one of its descendents are in Z No other nodes in the path are in Z A path is blocked, given evidence Z, if it is not active. A C B
27
A –d-sep(R,B)? Example E B C R
28
–d-sep(R,B) = yes –d-sep(R,B|A)? Example E B A C R
29
–d-sep(R,B) = yes –d-sep(R,B|A) = no –d-sep(R,B|E,A)? Example E B A C R
30
d-Separation X is d-separated from Y, given Z, if all paths from a node in X to a node in Y are blocked, given Z. Checking d-separation can be done efficiently (linear time in number of edges) –Bottom-up phase: Mark all nodes whose descendents are in Z –X to Y phase: Traverse (BFS) all edges on paths from X to Y and check if they are blocked
31
Soundness Thm: If –G is an I-Map of P –d-sep( X; Y | Z, G ) = yes then –P satisfies I( X; Y | Z ) Informally: Any independence reported by d- separation is satisfied by underlying distribution
32
Completeness Thm: If d-sep( X; Y | Z, G ) = no then there is a distribution P such that –G is an I-Map of P –P does not satisfy I( X; Y | Z ) Informally: Any independence not reported by d- separation might be violated by the underlying distribution We cannot determine this by examining the graph structure alone
33
Summary: Structure We explored DAGs as a representation of conditional independencies: –Markov independencies of a DAG –Tight correspondence between Markov(G) and the factorization defined by G –d-separation, a sound & complete procedure for computing the consequences of the independencies –Notion of minimal I-Map –P-Maps This theory is the basis for defining Bayesian networks
34
Inference We now have compact representations of probability distributions: –Bayesian Networks –Markov Networks Network describes a unique probability distribution P How do we answer queries about P ? We use inference as a name for the process of computing answers to such queries
35
Today 1.Probabilistic graphical models 2.Treewidth methods: 1.Variable elimination 2.Clique tree algorithm 3. Applications du jour: Sensor Networks
36
Queries: Likelihood There are many types of queries we might ask. Most of these involve evidence –An evidence e is an assignment of values to a set E variables in the domain –Without loss of generality E = { X k+1, …, X n } Simplest query: compute probability of evidence This is often referred to as computing the likelihood of the evidence
37
Queries: A posteriori belief Often we are interested in the conditional probability of a variable given the evidence This is the a posteriori belief in X, given evidence e A related task is computing the term P(X, e) –i.e., the likelihood of e and X = x for values of X
38
A posteriori belief This query is useful in many cases: Prediction: what is the probability of an outcome given the starting condition –Target is a descendent of the evidence Diagnosis: what is the probability of disease/fault given symptoms –Target is an ancestor of the evidence the direction between variables does not restrict the directions of the queries
39
Queries: MAP In this query we want to find the maximum a posteriori assignment for some variable of interest (say X 1,…,X l ) That is, x 1,…,x l maximize the probability P(x 1,…,x l | e) Note that this is equivalent to maximizing P(x 1,…,x l, e)
40
Queries: MAP We can use MAP for: Classification –find most likely label, given the evidence Explanation –What is the most likely scenario, given the evidence
41
Complexity of Inference Thm: Computing P(X = x) in a Bayesian network is NP-hard Not surprising, since we can simulate Boolean gates.
42
Approaches to inference Exact inference –Inference in Simple Chains –Variable elimination –Clustering / join tree algorithms Approximate inference – later in semester –Stochastic simulation / sampling methods –Markov chain Monte Carlo methods –Mean field theory – your presentation
43
Variable Elimination General idea: Write query in the form Iteratively –Move all irrelevant terms outside of innermost sum –Perform innermost sum, getting a new term –Insert the new term into the product
44
Example Visit to Asia Smoking Lung Cancer Tuberculosis Abnormality in Chest Bronchitis X-Ray Dyspnea “Asia” network:
45
V S L T A B XD We want to compute P(d) Need to eliminate: v,s,x,t,l,a,b Initial factors “Brute force approach” Complexity is exponential in the size of the graph (number of variables) = T. N=number of states for each variable
46
V S L T A B XD We want to compute P(d) Need to eliminate: v,s,x,t,l,a,b Initial factors Eliminate: v Note: f v (t) = P(t) In general, result of elimination is not necessarily a probability term Compute:
47
V S L T A B XD We want to compute P(d) Need to eliminate: s,x,t,l,a,b Initial factors Eliminate: s Summing on s results in a factor with two arguments f s (b,l) In general, result of elimination may be a function of several variables Compute:
48
V S L T A B XD We want to compute P(d) Need to eliminate: x,t,l,a,b Initial factors Eliminate: x Note: f x (a) = 1 for all values of a !! Compute:
49
V S L T A B XD We want to compute P(d) Need to eliminate: t,l,a,b Initial factors Eliminate: t Compute:
50
V S L T A B XD We want to compute P(d) Need to eliminate: l,a,b Initial factors Eliminate: l Compute:
51
V S L T A B XD We want to compute P(d) Need to eliminate: b Initial factors Eliminate: a,b Compute:
52
V S L T A B XD Different elimination ordering: Need to eliminate: a,b,x,t,v,s,l Initial factors Intermediate factors: Complexity is exponential in the size of the factors!
53
Variable Elimination We now understand variable elimination as a sequence of rewriting operations Actual computation is done in elimination step Exactly the same computation procedure applies to Markov networks Computation depends on order of elimination
54
Markov Network (Undirected Graphical Models) A graph with hyper-edges (multi-vertex edges) Every hyper-edge e=(x 1 …x k ) has a potential function f e (x 1 …x k ) The probability distribution is
55
Complexity of variable elimination Suppose in one elimination step we compute This requires multiplications –For each value for x, y 1, …, y k, we do m multiplications additions –For each value of y 1, …, y k, we do |Val(X)| additions Complexity is exponential in number of variables in the intermediate factor
56
Undirected graph representation At each stage of the procedure, we have an algebraic term that we need to evaluate In general this term is of the form: where Z i are sets of variables We now plot a graph where there is undirected edge X--Y if X,Y are arguments of some factor –that is, if X,Y are in some Z i Note: this is the Markov network that describes the probability on the variables we did not eliminate yet
57
Chordal Graphs elimination ordering undirected chordal graph Graph: Maximal cliques are factors in elimination Factors in elimination are cliques in the graph Complexity is exponential in size of the largest clique in graph L T A B X V S D V S L T A B XD
58
Induced Width The size of the largest clique in the induced graph is thus an indicator for the complexity of variable elimination This quantity is called the induced width of a graph according to the specified ordering Finding a good ordering for a graph is equivalent to finding the minimal induced width of the graph
59
PolyTrees A polytree is a network where there is at most one path from one variable to another Thm: Inference in a polytree is linear in the representation size of the network –This assumes tabular CPT representation A C B D E FG H
60
Today 1.Probabilistic graphical models 2.Treewidth methods: 1.Variable elimination 2.Clique tree algorithm 3. Applications du jour: Sensor Networks
61
Junction Tree Why junction tree? –More efficient for some tasks than variable elimination –We can avoid cycles if we turn highly- interconnected subsets of the nodes into “supernodes” cluster Objective –Compute is a value of a variable and is evidence for a set of variable
62
Properties of Junction Tree An undirected tree Each node is a cluster (nonempty set) of variables Running intersection property: –Given two clusters and, all clusters on the path between and contain Separator sets (sepsets): –Intersection of the adjacent cluster ADEABD DEF ADDE Cluster ABD Sepset DE
63
Potentials Potentials: –Denoted by Marginalization –, the marginalization of into X Multiplication –, the multiplication of and
64
Properties of Junction Tree Belief potentials: –Map each instantiation of clusters or sepsets into a real number Constraints: –Consistency: for each cluster and neighboring sepset –The joint distribution
65
Properties of Junction Tree If a junction tree satisfies the properties, it follows that: –For each cluster (or sepset), –The probability distribution of any variable, using any cluster (or sepset) that contains
66
Building Junction Trees DAG Moral GraphTriangulated GraphJunction TreeIdentifying Cliques
67
Constructing the Moral Graph A B D C E G F H
68
Constructing The Moral Graph Add undirected edges to all co- parents which are not currently joined –Marrying parents A B D C E G F H
69
Constructing The Moral Graph Add undirected edges to all co- parents which are not currently joined –Marrying parents Drop the directions of the arcs A B D C E G F H
70
Triangulating An undirected graph is triangulated iff every cycle of length >3 contains an edge to connects two nonadjacent nodes A B D C E G F H
71
Identifying Cliques A clique is a subgraph of an undirected graph that is complete and maximal A B D C E G F H EGH ADEABD ACEDEF CEG
72
Junction Tree A junction tree is a subgraph of the clique graph that –is a tree –contains all the cliques –satisfies the running intersection property EGH ADEABD ACEDEF CEG ADE ABD ACE AD AE CEG CE DEF DE EGH EG
73
Principle of Inference DAG Junction Tree Inconsistent Junction Tree Initialization Consistent Junction Tree Propagation Marginalization
74
Example: Create Join Tree X1X2 Y1Y2 HMM with 2 time steps: Junction Tree: X1,X2 X1,Y1 X2,Y2 X1 X2
75
Example: Initialization Variable Associated Cluster Potential function X1X1,Y1 Y1X1,Y1 X2X1,X2 Y2X2,Y2 X1,X2 X1,Y1 X2,Y2 X1 X2
76
Example: Collect Evidence Choose arbitrary clique, e.g. X1,X2, where all potential functions will be collected. Call recursively neighboring cliques for messages: 1. Call X1,Y1. –1. Projection: –2. Absorption:
77
Example: Collect Evidence (cont.) 2. Call X2,Y2: –1. Projection: –2. Absorption: X1,X2 X1,Y1 X2,Y2 X1 X2
78
Example: Distribute Evidence Pass messages recursively to neighboring nodes Pass message from X1,X2 to X1,Y1: –1. Projection: –2. Absorption:
79
Example: Distribute Evidence (cont.) Pass message from X1,X2 to X2,Y2: –1. Projection: –2. Absorption: X1,X2 X1,Y1 X2,Y2 X1 X2
80
Example: Inference with evidence Assume we want to compute: P(X2|Y1=0,Y2=1) (state estimation) Assign likelihoods to the potential functions during initialization:
81
Example: Inference with evidence (cont.) Repeating the same steps as in the previous case, we obtain:
82
Next Time Inference with Propositional Logic Later in the semester: (a) Approximate Probabilistic Inference via sampling: Gibbs, Priority, MCMC (b) Approximate Probabilistic Inference using a close, simpler distribution
83
THE END
84
Example: Naïve Bayesian Model A common model in early diagnosis: –Symptoms are conditionally independent given the disease (or fault) Thus, if –X 1,…,X p denote whether the symptoms exhibited by the patient (headache, high- fever, etc.) and –H denotes the hypothesis about the patients health then, P(X 1,…,X p,H) = P(H)P(X 1 |H)…P(X p |H), This naïve Bayesian model allows compact representation –It does embody strong independence assumptions
85
Elimination on Trees Formally, for any tree, there is an elimination ordering with induced width = 1 Thm Inference on trees is linear in number of variables
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.