PATTERN RECOGNITION �AND MACHINE LEARNING
CHAPTER 8: GRAPHICAL MODELS
Bayesian Networks
Directed Acyclic Graph (DAG)
Bayesian Networks
General Factorization
Bayesian Curve Fitting (1)
Polynomial
Bayesian Curve Fitting (2)
Plate
Bayesian Curve Fitting (3)
Input variables and explicit hyperparameters
Bayesian Curve Fitting —Learning
Condition on data
Bayesian Curve Fitting —Prediction
Predictive distribution:
where
Generative Models
Causal process for generating images
Discrete Variables (1)
General joint distribution: K 2 { 1 parameters
Independent joint distribution: 2(K { 1) parameters
Discrete Variables (2)
General joint distribution over M variables: �KM { 1 parameters
M -node Markov chain: K { 1 + (M { 1) K(K { 1) parameters
Discrete Variables: Bayesian Parameters (1)
Discrete Variables: Bayesian Parameters (2)
Shared prior
Parameterized Conditional Distributions
If are discrete,
K-state variables,
in general has O(K M) parameters.
The parameterized form
requires only M + 1 parameters
Linear-Gaussian Models
Directed Graph
Vector-valued Gaussian Nodes
Each node is Gaussian, the mean is a linear function of the parents.
Conditional Independence
a is independent of b given c
Equivalently
Notation
Conditional Independence: Example 1
Conditional Independence: Example 1
Conditional Independence: Example 2
Conditional Independence: Example 2
Conditional Independence: Example 3
Note: this is the opposite of Example 1, with c unobserved.
Conditional Independence: Example 3
Note: this is the opposite of Example 1, with c observed.
“Am I out of fuel?”
B = Battery (0=flat, 1=fully charged)
F = Fuel Tank (0=empty, 1=full)
G = Fuel Gauge Reading� (0=empty, 1=full)
and hence
“Am I out of fuel?”
Probability of an empty tank increased by observing G = 0.
“Am I out of fuel?”
Probability of an empty tank reduced by observing B = 0.
This referred to as “explaining away”.
D-separation
D-separation: Example
D-separation: I.I.D. Data
Directed Graphs as Distribution Filters
The Markov Blanket
Factors independent of xi cancel between numerator and denominator.
Markov Random Fields
Markov Blanket
Cliques and Maximal Cliques
Clique
Maximal Clique
Hammersley-Clifford theorem
1990
Joint Distribution
where is the potential over clique C and
is the normalization coefficient; note: M K-state variables → KM terms in Z.
Energies and the Boltzmann distribution
potential function is defined strictly positive
one of major limitation of undirected graph
Illustration: Image De-Noising (1)
Original Image
Noisy Image
Illustration: Image De-Noising (2)
Min
Max
x, y = {1, -1}
unknown original image
known noisy image
0
1.0
2.1
h can bias the model towards pixel values that have one particular sign in
preference to the other.
Illustration: Image De-Noising (3)
Noisy Image
Restored Image (ICM)
local optimum
Illustration: Image De-Noising (4)
Restored Image (Graph cuts)
Restored Image (ICM)
global optimum
Converting Directed to Undirected Graphs (1)
Converting Directed to Undirected Graphs (2)
Additional links
moralization
Directed vs. Undirected Graphs (1)
Directed vs. Undirected Graphs (2)
D-Map
I-Map
Distribution Independent Property
perfect Map
Inference in Graphical Models
MAP (maximum a posterior estimate)
marginal
Bayes' theorem
joint distribution
sum-product algorithm
max-sum algorithm
max-sum algorithm
Inference on a Chain
marginal
joint distribution
Inference on a Chain
Inference on a Chain
recursive notation
Inference on a Chain
message passing of Markov Chains
P43. summation of p(x1) to p(xn)
Inference on a Chain
To compute local marginals:
efficiently in time that is linear in the number of nodes
Trees
Undirected Tree
Directed Tree
Polytree
directed graph with
message passing for chains is called sum-product algorithm, which provides an efficient framework for exact inference in tree-structured graphs (not cycle)
directed polytree, conversion to an undirected graph results in loops
due to the moralization step, whereas conversion to a factor graph again results in a tree. Factor graph can keep tree-still conversion.
Factor Graphs (bipartite)
sum-product algorithm can be cast in a particularly simple
and general form if we first introduce a new graphical construction called a factor
graph (Frey, 1998; Kschischnang et al., 2001).
, Xs denotes a subset of the variables
Factor Graphs from Directed Graphs
fs(xs) are local conditional distributions
Factor Graphs from Undirected Graphs
local cycles in a directed/undirected graph due to links connecting parents of a node can be removed on conversion to a factor graph
by defining the appropriate factor function
1. create variable nodes corresponding to the nodes in the original undirected graph
2. create additional factor nodes corresponding to the maximal cliques xs
The Sum-Product Algorithm (1)
Objective:
Key idea: Distributive Law
ref p44, p56
unrelated variable can be move outside this summation
The Sum-Product Algorithm (2)
marginal distribution (Sum)
Distribution (Product)
ref p42
Xs denotes the set of all variables in the subtree connected to the variable node x via the factor node
F(x, Xs) presents the product of all the factors in the group associated with factor fs.
所有聯集fs相乘,就是distribution. p49
所有不屬於x的變數,可切分成跟fs關聯
整體clique連乘,可切分為neighbor clique連乘
The Sum-Product Algorithm (3)
交換product和sum
The Sum-Product Algorithm (4)
The Sum-Product Algorithm (5)
The Sum-Product Algorithm (6)
The Sum-Product Algorithm (7)
Initialization
The Sum-Product Algorithm (8)
To compute local marginals:
backward propagation because need calculating marginal for each node p(xi), max-sum algorithm need not
Sum-Product: Example (1)
unnormalized cliques
Sum-Product: Example (2)
Sum-Product: Example (3)
Sum-Product: Example (4)
The Max-Sum Algorithm (1)
Objective: an efficient algorithm for finding
In general, maximum marginals ≠ joint maximum.
joint maximum
The Max-Sum Algorithm (2)
Maximizing over a chain (max-product)
Max neighbor clique from leaf node and propagate
The Max-Sum Algorithm (3)
Generalizes to tree-structured factor graph
maximizing as close to the leaf nodes as possible
The Max-Sum Algorithm (4)
Max-Product → Max-Sum
For numerical reasons, use
Again, use distributive law
ref p67
unrelated variable can be move outside this summation
The Max-Sum Algorithm (5)
Initialization (leaf nodes)
Recursion
ref p65
The Max-Sum Algorithm (6)
Termination (root node)
Back-track, for all nodes i with l factor nodes to the root (l=0)
The Max-Sum Algorithm (7)
Example: Markov chain
From node n backtrack to all leaves with multiple path
The Junction Tree Algorithm
Not tree graph with loop
Loopy Belief Propagation
Not tree graph with loop