Introduction
In this part, we will introduce Bayesian networks, which are probabilistic graphical models that represent a set of variables and their conditional dependencies via a directed acyclic graph (DAG). Bayesian networks are powerful tools for modeling complex systems and reasoning under uncertainty. We will discuss some fundamental theory and their applications.
Graphical Models
Intuition (Graphical Models)
Graphical models are a powerful framework to represent and learn structured probability models.
The main idea behind graphical models is that they capture a way in which a joint distribution can be factorized into product of factors, each depending only on a subset of variables. They are generally useful for, visualizing the structure of a probabilistic model, encoding structural information (i.e., dependencies) about involved random variables, and provide structure in computations, i.e., provide graph-based algorithms for computations, inference, and prediction.
There are three main types of graphical models,
-
Bayesian Networks (or Bayes nets) which are DAGs 1Directed Acyclic Graphs (DAGs) are graphs with directed edges and no cycles.. They represent a set of random variables and their conditional dependence structure.
-
Markov Random Fields which are undirected graphs. They represent a set of random variables and their Markov structure (i.e., conditional independence structure).
-
Factor Graphs. Which are more convenient for the purposes of inference and learning.
Bayesian Networks
Definition 1 (Bayesian Networks)
In a Bayesian network, we have two types of elements.
-
Nodes represents the random variables and more specifically, an empty node is an unobserved variable, while a shaded node is an observed variable.
-
Edges represents the relationships between the random variables.
Further, the bayesian netowrk encodes a factorization of a join distribution.
Assume we have random variables with join probability distribution , we know by the chain rule of probability that,
To build a Bayesian network we need,
-
Introduce a node for each and associate the node with .
-
For each , draw a directed edge to node from nodes corresponding to RVs on which the distribution is conditioned.
-
Edge from node to node , parent of , child of .
Example 1 (Bayesian Network Example)
Consider the network in Figure 1, the corresponding joint distribution is given by,
Definition 2 (Bayesian Networks (Continued))
A Bayesian network is a directed acyclic graph (DAG) whose nodes represents random variables with an associated joint distribution that factorizes as,
where denotes the set of parents of node in the graph.
Note
Note that accounts for statistical dependence of with all the preceding variables according to selected order. The corresponding Bayesian network encodes,
Example 2 (Bayesian Polynomial Regression)
Consider the joint distribution condtioned on input data and model parameters,
Causal Relationships
Intuition (Causal Relationships)
Bayesian networks are especially useful for modeling causal relationships between variables.
If we can identify causal relationships among random variables, this must mean there is a natural order on variables, i.e., random variables that appear later caused by a subset of preceding variables.
Causing random variables for random variable are included in . Which means conditioning on , is independent of all other preceding variables.
Intuition (Ancestral Sampling)
However, we usually have a problem when dealing with causal relationships, i.e., obtaining marginals is not a trivial task.
But we can approximate exact distribution by an empirical one built from samples and perfect task for Bayesian networks.
Algorithm (Ancestral Sampling)
Assume,
i.e., ordered variables , with no arrow from any node to any lower numbered node.
-
Draw sample for from .
-
Draw sample for from .
-
-
Draw sample for from .
Thus, we have obtained a sample from the joint distribution.
To sample from a marginal distribution we,
-
Take sampled values for required nodes and ignore those remaining ones.
-
: sample from , retain and and discard .
Definition 3 (Conditional Independence)
We know from classical probability theory that two random variables and are conditionally independent given a third random variable if,
When dealing with graphical models, we denote conditional independence as,
This can also be written as,
Intuition (Types of Connections)
Observe Figure 3, in the case of a tail-to-tail connection,
i.e., and are independent if node in between is observed.
In the case of a head-to-tail connection,
i.e., and are independent if node in between is observed.
In the case of a head-to-head connection,
i.e., and are independent if node in between and any of its descendants are not observed.
-Separation
Intuition (d-Separation)
This leads to asking a more general question. Are and conditionally independent given ? (see Figure 4)
Or, in more general, isa given subset of variables independent of another set conditioned on a third subset ? () Thus, the goal is to determine independencies directly from the directed acyclic graph.
We can define the concept of -separation as. If all paths from any node in to any node in given the nodes in are blocked, then .
Or more formally as.
Let be a directed graph and , , and disjoint sets of nodes. Then, if all paths from any node in to any node in given the nodes in are blocked, and are said to be -separated by and .
A path between and is blocked if the path includes either,
-
A head-to-tail or tail-to-tail node which is in , or,
-
A head-to-head node, and neither the node nor any of its descendants in .
So, to answer our question to Figure 4.
Path from to are not blocked by , since a tail-to-tail node and is unobserved.
Path not blocked by , as a head-to-head node with an observed descendant.
Thus, does not hold from the DAG.
Are and conditionally independent given ?
Path from to are blocked by , since a tail-to-tail node and is observed. Path blocked by , as a head-to-head node and neither the node nor any of its descendants are observed.
Hence, holds from the DAG.
Note (Markov Blanket)
In a directed graphical model, a node is conditionally independent of all other nodes given its parents, children and co-parnets.
The Markov blanket of node is the minimal set of nodes that isolates from the rest of the graph.
Note (Structured Learning)
What if the Bayesian network is not known? (i.e., we do not know the structure of the graph)
Bayesian networks can be learned from data without a pre-specified structure.
-
Different algorithms can be employed to learn network structure by analyzing the data and inferring most likely graph structure that best fits observed dependencies.
-
Once structure and parameters are learned, the Bayesian network can be used for prediction.