Docsity

Data Analysis Graphical Models, Lecture Slide - Engineering, Slides of Advanced Data Analysis

Toggle sidebar
bg1
Lecture 21, Graphical Models
36-402, Advanced Data Analysis
7 April 2011
Contents
1 Conditional Independence and Factor Models 2
2 Directed Acyclic Graph (DAG) Models 4
2.1 Conditional Independence and the Markov Property . . . . . . . 5
3 Examples of DAG Models and Their Uses 6
3.1 MissingVariables........................... 9
4 Further Reading 10
A Non-DAG Graphical Models: Undirected Graphs and Directed
Graphs with Cycles 11
A.1 UndirectedGraphs.......................... 11
A.2 Directed but Cyclic Graphs . . . . . . . . . . . . . . . . . . . . . 13
B Rudimentary Graph Theory 15
We have spent a lot of time looking at ways of figuring out how one variable
(or set of variables) depends on another variable (or set of variables) — this
is the core idea in regression and in conditional density estimation. We have
also looked at how to estimate the joint distribution of variables, both with
kernel density estimation and with models like factor and mixture models. The
later two show an example of how to get the joint distribution by combining a
conditional distribution (observables given factors; mixture components) with a
marginal distribution (Gaussian distribution of factors; the component weights).
When dealing with complex sets of dependent variables, it would be nice to
have a general way of composing conditional distributions together to get joint
distributions, and especially nice if this gave us a way of reasoning about what
we could ignore, of seeing which variables are irrelevant to which other variables.
This is what graphical models let us do.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Data Analysis Graphical Models, Lecture Slide - Engineering and more Slides Advanced Data Analysis in PDF only on Docsity!

Lecture 21, Graphical Models

36-402, Advanced Data Analysis

7 April 2011

Contents

1 Conditional Independence and Factor Models 2

2 Directed Acyclic Graph (DAG) Models 4 2.1 Conditional Independence and the Markov Property....... 5

3 Examples of DAG Models and Their Uses 6 3.1 Missing Variables........................... 9

4 Further Reading 10

A Non-DAG Graphical Models: Undirected Graphs and Directed Graphs with Cycles 11 A.1 Undirected Graphs.......................... 11 A.2 Directed but Cyclic Graphs..................... 13

B Rudimentary Graph Theory 15 We have spent a lot of time looking at ways of figuring out how one variable (or set of variables) depends on another variable (or set of variables) — this is the core idea in regression and in conditional density estimation. We have also looked at how to estimate the joint distribution of variables, both with kernel density estimation and with models like factor and mixture models. The later two show an example of how to get the joint distribution by combining a conditional distribution (observables given factors; mixture components) with a marginal distribution (Gaussian distribution of factors; the component weights). When dealing with complex sets of dependent variables, it would be nice to have a general way of composing conditional distributions together to get joint distributions, and especially nice if this gave us a way of reasoning about what we could ignore, of seeing which variables are irrelevant to which other variables. This is what graphical models let us do.

F

X1 X2 X

F

X

Figure 1: Illustration of a typical model with two latent factors (F 1 and F 2 , in circles) and four observables (X 1 through X 4 ).

1 Conditional Independence and Factor Models

The easiest way into this may be to start with the diagrams we drew for factor analysis. There, we had observables and we had factors, and each observable depended on, or loaded on, some of the factors. We drew a diagram where we had nodes, standing for the variables, and arrows running from the factors to the observables which depended on them. In the factor model, all the observables were conditionally independent of each other, given all the factors:

p(X 1 , X 2 ,... Xp|F 1 , F 2 ,... Fq ) =

∏^ p

i=

p(Xi|F 1 ,... Fq ) (1)

But in fact observables are also independent of the factors they do not load on, so this is still too complicated. Let’s write loads(i) for the set of factors on which the observable Xi loads. Then

p(X 1 , X 2 ,... Xp|F 1 , F 2 ,... Fq ) =

∏^ p

i=

p(Xi|Floads(i)) (2)

Consider Figure 1. The conditional distribution of observables given factors is

p(X 1 , X 2 , X 3 , X 4 |F 1 , F 2 ) = p(X 1 |F 1 , F 2 )p(X 2 |F 1 , F 2 )p(X 3 |F 1 )p(X 4 |F 2) (3)

X 1 loads on F 1 and F 2 , so it is independent of everything else, given those two variables. X 1 is unconditionally dependent on X 2 , because they load on

2 Directed Acyclic Graph (DAG) Models

We have a collection of variables, which to be generic I’ll write X 1 , X 2 ,... Xp. These may be discrete, continuous, or even vectors; it doesn’t matter. We represent these visually as nodes in a graph. There are arrows connecting some of these nodes. If an arrow runs from Xi to Xj , then Xi is a parent of Xj. This is, as the name “parent” suggests, an anti-symmetric relationship, i.e., Xj cannot also be the parent of Xi. This is why we use an arrow, and why the graph is directed^1. We write the set of all parents of Xj as parents(j); this generalizes the notion of the factors which an observable loads on to. The joint distribution “decomposes according to the graph”:

p(X 1 , X 2 ,... Xp) =

∏^ p

i=

p(Xi|Xparents(i)) (4)

If Xi has no parents, because it has no incoming arrows, take p(Xi|Xparents(i)) just to be the marginal distribution p(Xi). Such variables are called exogenous; the others, with parents, are endogenous. An unfortunate situation could arise where X 1 is the parent of X 2 , which is the parent of X 3 , which is the parent of X 1. Perhaps, under some circumstances, we could make sense of this and actually calculate with Eq. 4, but the general practice is to rule it out by assuming the graph is acyclic, i.e., that it has no cycles, i.e., that we cannot, by following a series of arrows in the graph, go from one node to other nodes and ultimately back to our starting point. Altogether we say that we have a directed acyclic graph, or DAG, which represents the direct dependencies between variables.^2 What good is this? The primary virtue is that if we are dealing with a DAG model, the graph tells us all the dependencies we need to know; those are the conditional distributions of variables on their parents, appearing in the product on the right hand side of Eq. 4. (This includes the distribution of the exogeneous variables.) This fact has two powerful sets of implications, for probabilistic reasoning and for statistical inference. Let’s take inference first, because it’s more obvious: all that we have to estimate are the conditional distributions p(Xi|Xparents(i)). We do not have to estimate the distribution of Xi given all of the other variables, unless of course they are all parents of Xi. Since estimating distributions, or even just regressions, conditional on many variables is hard, it is extremely helpful to be able to read off from the graph which variables we can ignore. Indeed, if the graph tells us that Xi is exogeneous, we don’t have to estimate it conditional on anything, we just have to estimate its marginal distribution.

(^1) See Appendix B for a brief review of the ideas and jargon of graph theory. (^2) See the appendix for remarks on undirected graphical models, and graphs with cycles.

X1 X2 X3 X

Figure 2: DAG for a discrete-time Markov process. At each time t, Xt is the child of Xt− 1 and the parent of Xt+1.

2.1 Conditional Independence and the Markov Property

The probabilistic implication of Eq. 4 is perhaps even more important, and that has to do with conditional independence. Pick any two variables Xi and Xj , where Xj is not a parent of Xi. Consider the distribution of Xi conditional on its parents and Xj. There are two possibilities. (i) Xj is not a descendant of Xi. Then we can see that Xi and Xj are conditionally independent. This is true no matter what the actual conditional distribution functions involved are; it’s just implied by the joint distribution respecting the graph. (ii) Alternatively, Xj is a descendant of Xi. Then in general they are not independent, even conditional on the parents of Xi. So the graph implies that certain conditional independence relations will hold, but that others in general will not hold. As you know from your probability courses, a sequence of random variables X 1 , X 2 , X 3 ,... forms a Markov process^3 when “the past is independent of the future given the present”: that is,

Xt+1 |= (Xt− 1 , Xt− 2 ,... X 1 )|Xt (5)

from which it follows that

(Xt+1, Xt+2, Xt+3,.. .) |= (Xt− 1 , Xt− 2 ,... X 1 )|Xt (6)

which is called the Markov property. DAG models have a similar property: if we take any collection of nodes I, it is independent of its non-descendants, given its parents: XI |= Xnon−descendants(I)|Xparents(I) (7)

This is the directed graph Markov property. The ordinary Markov property is in act a special case of this, when the graph looks like Figure 2^4.

(^3) After the Russian mathematician A. A. Markov, who introduced the theory of Markov processes in the course of a mathematical dispute with his arch-nemesis, to show that prob- ability and statistics could apply to dependent events, and hence that Christianity was not necessarily true (I am not making this up: Basharin et al., 2004). (^4) To see this, take the “future” nodes, indexed by t + 1 and up, as the set I. Their parent consists just of Xt, and all their non-descendants are the even earlier nodes at times t − 1, t − 2, etc.

Smoking

Yellow teeth Tar in lungs

Cancer

Asbestos

Figure 4: DAG model indicating (hypothetical) relationships between smoking, asbestos, cancer, and covariates.

least in this model, as they are both exogenous^5. Conditional on whether some- one has cancer, however, smoking and asbestos will become dependent. To understand the logic of this, suppose (what is in fact true) that both how much someone smokes and how much they are exposed to asbestos raises the risk of cancer. Conditional on not having cancer, then, one was probably exposed to little of either tobacco smoke or asbestos. Conditional on both not having cancer and having been exposed to a high level of asbestos, one probably was exposed to an unusually low level of tobacco smoke. Vice versa, no cancer plus high levels of tobacco tend to imply especially little exposure to asbestos. We thus have created a negative association between smoking and asbestos by conditioning on cancer. Naively, a regression where we “controlled for” cancer would in fact tell us that exposure to asbestos keeps tar from building up in the lungs, prevents smoking, and whitens teeth. More generally, conditioning on a third variable can create dependence be- tween otherwise independent variables, when what we are conditioning on is a common descendant of the variables in question.^6 This conditional dependence is not some kind of finite-sample artifact or error — it really is there in the joint probability distribution. If all we care about is prediction, then it is perfectly legitimate to use it. In the world of Figure 4, it really is true that you can predict the color of someone’s teeth from whether they have cancer and how much asbestos they’ve been exposed to, so if that’s what you want to predict^7 , why not use that information? But if you want to do more than just make predictions without understanding, if you want to understand the structure ty- ing together these variables, if you want to do science, if you don’t want to go around telling yourself that asbestos whitens teeth, you really do need to know the graph.

(^5) If we had two variables which in some physical sense were exogenous but dependent on each other, we would represent them in a DAG model by either a single vector-valued random variable (which would get only one node), or as children of a latent unobserved variable, which was truly exogenous. (^6) Economists, psychologists, and other non-statisticians often repeat the advice that if you want to know the effect of X on Y , you should not condition on Z when Z is endogenous. This is bit of folklore is an incorrect relic of the days of ignorance, though it shows a sound indistinct groping towards a truth those people were unable to grasp. If we want to know whether asbestos is associated with tar in the lungs, conditioning on the yellowness of teeth is fine, even though that is an endogenous variable. (^7) Maybe you want to guess who’d be interested in buying whitening toothpaste.

4 Further Reading

The paper collection Jordan (1998) is actually extremely good, unlike most col- lections of edited papers; Jordan and Sejnowski (2001) is also useful. Lauritzen (1996) is thorough but more mathematically demanding. The books by Spirtes et al. (1993, 2001) and by Pearl (1988, 2000, 2009) are classics, especially for their treatment of causality, of which much more soon. Glymour (2001) dis- cusses applications to psychology. While I have presented DAG models as an outgrowth of factor analysis, their historical ancestry is actually closer to the “path analysis” models introduced by the great mathematical biologist Sewall Wright in the 1920s to analyze processes of development and genetics. These proved extremely influential in psychology. Loehlin (1992) is a decent textbook on them, but does not make enough contact with modern graphical methods developed in statistics and machine learning.

A Non-DAG Graphical Models: Undirected Graphs

and Directed Graphs with Cycles

A.1 Undirected Graphs

There is a lot of work on probability models which are based on undirected graphs, in which the relationship between random variables linked by edges is completely symmetric, unlike the case of DAGs^10. Since the relationship is symmetric, the preferred metaphor is not “parent and child”, but “neighbors”. The models are sometimes called Markov networks or Markov random fields, but since DAG models have a Markov property of their own, this is not a happy choice of name, and I’ll just call them “undirected graphical models”. The key Markov property for undirected graphical models is that any set of nodes I is independent of the rest of the graph given its neighbors:

XI |= Xnon−neighbors(I)|Xneighbors(I) (9)

This corresponds to a factorization of the joint distribution, but a more complex one than that of Eq. 4, because a symmetric neighbor-of relation gives us no way of ordering the variables, and conditioning the later ones on the earlier ones. The trick turns out to go as follows. First, as a bit of graph theory, a clique is a set of nodes which are all neighbors of each other, and which cannot be expanded without losing that property. We write the collection of all cliques in a graph G as cliques(G). Second, we introduce potential functions ψc which take clique configurations and return non-negative numbers. Third, we say that a joint distribution is a Gibbs distribution^11 when

p(X 1 , X 2 ,... Xp) ∝

c∈cliques(G)

ψc(Xi∈c) (10)

That is, the joint distribution is a product of factors, one factor for each clique. Frequently, one introduces what are called potential functions, Uc = log ψc, and then one has

p(X 1 , X 2 ,... Xp) ∝ e −

c∈cliques(G) Ui(Xi∈c)^ (11)

The key correspondence is what is sometimes called the Gibbs-Markov theorem: a distribution is a Gibbs distribution with respect to a graph G if, and only if, it obeys the Markov property with neighbors defined according to

(^10) I am told that this is more like the idea of causation in Buddhism, as something like “co-dependent origination”, than the asymmetric one which Europe and the Islamic world inherited from the Greeks (especially Aristotle), but you would really have to ask a philosopher about that. (^11) After the American physicist and chemist J. W. Gibbs, who introduced such distributions as part of statistical mechanics, the theory of the large-scale patterns produced by huge numbers of small-scale interactions.

Set point on thermostat Furnace

  • Interior temperature

Exterior temperature

Figure 5: Directed but cyclic graphical model of a feedback loop. Signs (+, − on arrows are “guides to the mind”. Cf. Figure 6.

A.2 Directed but Cyclic Graphs

Much less work has been done on directed graphs with cycles. It is very hard to give these a causal interpretation, in the fashion described in the next lecture. Feedback processes are of course very common in nature and technology, and one might think to represent these as cycles in a graph. A model of a thermostat, for instance, might have variables for the set-point temperature, the temperature outside, how much the furnace runs, and the actual temperature inside, with a cycle between the latter two (Figure 5). Thinking in this way is however simply sloppy. It always takes some time to traverse a feedback loop, and so the cycle really “unrolls” into an acyclic graph linking similar variables at different times (Figure 6). Sometimes^13 , it is clear that when people draw a diagram like Figure 5, the incoming arrows really refer to the change, or rate of change, of the variable in question, so it is merely a visual short-hand for something like Figure 6. Directed graphs with cycles are thus primarily useful when measurements are so slow or otherwise imprecise that feedback loops cannot be unrolled into the actual dynamical processes which implement them, and one is forced to hope that one can reason about equilibria instead^14. If you insist on dealing with cyclic directed graphical models, see Richardson (1996); Lacerda et al. (2008) and references therein.

(^13) As in Puccia and Levins (1985), and the LoopAnalyst package based on it (Dinno, 2009). (^14) Economists are fond of doing so, generally without providing any rationale, based in economic theory, for supposing that equilibrium is a good approximation.

Set point

on thermostat

Furnace

at time t

Furnace

at time t+

Interior

temperature

at time t+

Exterior

temperature

Interior

temperature

at time t

Figure 6: Directed, acyclic graph for the situation in Figure 5, taking into account the fact that it takes time to traverse a feedback loop. One should imagine this repeating to times t + 2, t + 3, etc., and extending backwards to times t − 1, t − 2, etc., as well. Notice that there are no longer any cycles.

A

B

C

D

E

Figure 7: Example for illustrating the concepts of graph theory.

References

Basharin, Gely P., Amy N. Langville and Valeriy A. Naumov (2004). “The Life and Work of A. A. Markov.” Linear Algebra and its Applica- tions, 386 : 3–26. URL http://decision.csl.uiuc.edu/~meyn/pages/ Markov-Work-and-life.pdf.

Dinno, Alexis (2009). LoopAnalyst: A collection of tools to conduct Levins’ Loop Analysis. URL http://CRAN.R-project.org/package=LoopAnalyst. R package version 1.2-2.

Glymour, Clark (2001). The Mind’s Arrows: Bayes Nets and Graphical Causal Models in Psychology. Cambridge, Massachusetts: MIT Press.

Griffeath, David (1976). “Introduction to Markov Random Fields.” In Denumer- able Markov Chains (John G. Kemeny and J. Laurie Snell and Anthony W. Knapp, eds.), pp. 425–457. Berlin: Springer-Verlag, 2nd edn.

Guttorp, Peter (1995). Stochastic Modeling of Scientific Data. London: Chap- man and Hall.

Guyon, Xavier (1995). Random Fields on a Network: Modeling, Statistics, and Applications. Berlin: Springer-Verlag.

Honerkamp, Josef (2002). Statistical Physics: An Advanced Approach with Ap- plications. Berlin: Springer-Verlag, 2nd edn. Translated by Thomas Filk.

Jordan, Michael I. (ed.) (1998). Learning in Graphical Models, Dordrecht. Kluwer Academic.

Jordan, Michael I. and Terrence J. Sejnowski (eds.) (2001). Graphical Mod- els: Foundations of Neural Computation, Computational Neuroscience, Cam- bridge, Massachusetts. MIT Press.

Kindermann, Ross and J. Laurie Snell (1980). Markov Random Fields and their Applications. Providence, Rhode Island: American Mathematical Society. URL http://www.ams.org/online_bks/conm1/.

Lacerda, Gustavo, Peter Spirtes, Joseph Ramsey and Patrik Hoyer (2008). “Dis- covering Cyclic Causal Models by Independent Components Analysis.” In Proceedings of the Proceedings of the Twenty-Fourth Conference Annual Con- ference on Uncertainty in Artificial Intelligence (UAI-08), pp. 366–374. Cor- vallis, Oregon: AUAI Press. URL http://uai.sis.pitt.edu/papers/08/ p366-lacerda.pdf.

Lauritzen, Steffen L. (1996). Graphical Models. New York: Oxford University Press.