Deep Learning - University of Houston

advertisement
Deep Belief Nets and Restricted Boltzmann Machines
Erte Pan
Wireless Eng. Group
Advisor: Dr. Han
Department of Electrical and Computer Engineering
University of Houston, Houston, TX.
Graphical Model
 Generative model: graphical model captures the causal process
by which the observed data was generated, so it is also called
generative model.
hidden
 Undirected graphical model:
j
 links have no directional significance
 inference(infer the states of unobserved variables) is easy
 learning(adjust weights between variables to make the network
more likely to generate the observed data) and generating
processes are tricky
 Directed graphical model:
i
visible
hidden
j
 links have a particular directionality indicated by arrows
 inference is difficult
 learning and generating processes are simple
i
visible
Boltzmann Machine Model
 Boltzmann Machine:
 one input layer and one hidden layer
 typically binary states for every unit
 stochastic (vs. deterministic)
 recurrent (vs. feed-forward)
 generative model (vs. discriminative): estimate the
distribution of observations(say p(image)), while
traditional discriminative networks only estimate the
labels(say p(label|image))
Boltzmann Machine
 defined Energy of the network and Probability of a
unit’s state(scalar T is referred to as the “temperature”):
E ( s )    ai si   s j wi, j si
i
i j
m
1
P ( s j  1) 
1 e
(
E j
T
)
  (( s j   w i , j s i ) / T )
i 1
Restricted Boltzmann Machine Model

Restricted Boltzmann Machine:
 a bipartite graph: no intralayer connections, feedforward
 RBM does not have T factor, the rest are the same as
BM
 one important feature of RBM is that the visible units
and hidden units are conditionally independent, which
will lead to a beautiful result later on:
m
P (v | h) 

P (vi | h )
i 1
n
P (h | v) 

j 1
P (h j | v)
Restricted Boltzmann Machine
Stochastic Search
 Why BM?
 Different optimization criteria in traditional networks and RBM for
optimization purpose:
 Traditional: Error criterion. BP method strictly goes along the gradient
descent direction. Any direction that enlarge error is NOT acceptable. Easy to
get stuck in local minima.
 BM: associate the network with “Energy”. Simulated Annealing enables the
energy to grow under certain probability.
Simulated Annealing
 Simulated Annealing for BM:
1. Create initial solution S (global states of the network)
Initialize temperature T>>1
2. Repeat until T =T-lower-bound
 Repeat until thermal equilibrium is reached at
the current T
• Generate a random transition from S to S’
This term allows “thermal
• Let E = E(S’)  E(S)
disturbance” which facilitate
finding global minimum
• if E < 0 then S = S’
• else if exp[E/T] > rand(0,1) then S = S’
 Reduce temperature T according to the
cooling schedule
3. Return S
Restricted Boltzmann Machine
 Two characters to define a Restricted Boltzmann Machine:
 states of all the units: obtained through probability distribution.
 weights of the network: obtained through training(Contrastive Divergence).
 As mentioned before, the objective of RBM is to estimate the distribution of input data.
And this goal is fully determined by the weights, given the input.
 Energy defined for the RBM:
E (v , h )    ai vi   b j h j  
i
j
i
h w
j
v
i, j i
j
 Distribution of visible layer of the RBM(Boltzmann
Distribution):
1
P (v ) 
Z

h
e
 E ( v ,h )
Restricted Boltzmann Machine
 Z is the partition function defined as the sum of e  E ( v , h ) over all possible
configurations of {v,h}
m
 Probability that unit i is on(binary state 1): P ( h j  1 | v )   ( b j 
the logistic/sigmoid function
w
i 1
v ) σ(.) is
i, j i
Restricted Boltzmann Machine
 Training for RBM: Maximum Likelihood learning
 the probability over a vector x with parameter W(weights) is:
p ( x;W ) 
1
e
 E ( x ;W )
Z (W )
Z (W ) 

x
e
 E ( x ;W )
 Given i.i.d. samples   {x n } nN 1 , The objective is to maximize the
average log-likelihood:
L(W;  ) 
1
N
N
 log
p(x n ; W)  log p ( x ; W )
n 1
0
  E ( x;W )
 the <.>0 denotes an average w.r.t. the data distribution p ( x )  1
0
N
 the gradient is then computed as:
 L(W;  )
W

 E(x;W)
W

0
 E(x;W)
W
 the <.>∞ denotes an average w.r.t. the model distribution

0
 log Z (W )

N
n 1
 ( x  xn )
Restricted Boltzmann Machine
 Then the update of weights, W, can be computed as:
W
(  1 )
W
( )

 L (W ;  )
W
W
( )
 the <.>0 term can be computed using the input samples
 the <.>∞ term can be solved by MCMC but very slow and suffering from large
variance of estimated gradient
 Solution: Contrastive Divergence
 maximizing the log probability of the data is the same as minimizing the KL
divergence,
( p0 ( x)
KL ( p 0 || p  )   p 0 ( x ) log
p ( x;W )
x
 define CD to be: CD n  KL ( p 0 || p  )  KL ( p n || p  ) where n is the small
number that we run the MC
 use CDn multiplied by learning rate as the update of the weights
 Note: this update direction is NOT the gradient of ANY function, yet it is
successful in application…
Restricted Boltzmann Machine
 In RBM, the previous equations then become(for calculating a particular
weight between two units):  log p ( v )
 w ij
 v i h j  data   v i h j  model
 w ij   (  v i h j  data   v i h j  model )
 these two equations are obtained by substituting the energy function into
the learning rule.

Summarized algorithm for training RBM:
1)
take a training sample v, compute the probabilities of the hidden units and sample a hidden
activation vector h from this probability distribution.
2)
compute the expectation of vh and call this the positive gradient. (clamped phase, or positive
phase)
3)
From h , sample a reconstruction v’ of the visible units, then resample the hidden activations h’
from this.
4) Compute the expectation of v’h’ and call this the negative gradient.(free phase, or negative phase)
5) Let the weight update Wij to be the positive gradient minus the negative gradient, times some
learning rate.
General Deep Belief Nets
 Problem with DBNs:
Since DBNs are directed graph model, given input data, the
posterior of hidden units is intractable due to the “explaining
away” effect.
 Solution: Complementary Priors to ensure the posterior of
hidden units are under the independent constraints.
-10
truck hits house
-10
earthquake
General Deep Belief Nets
20
-20
20
house
jumps
Explaining Away Effect
posterior
p(1,1)=.0001
p(1,0)=.4999
p(0,1)=.4999
p(0,0)=.0001
Explaining Away Effect
etc.
 Brief summary for explaining away effect:
W
Given the observations, the posterior of associated hidden
variables are actually NOT independent(the probability
that one hidden variable is on or off influences the states
of others), even though the hidden variables are assumed
to be independent in their priors.
h2
W
v2
 The reason is that we have non-independence in the
likelihood term:
W
 Add extra hidden layers to create CP that has opposite
correlations with the likelihood term, so (when likelihood
is multiplied by the prior), posterior will become factorial
T
h1
Posterior(non-indep) = prior(indep.) * likelihood (nonindep.)
 Eliminate Explaining Away by Complementary Priors
T
W
+ +
+
+
v1
W
h0
W
v0
T
Complementary Priors
 Definition of Complementary Priors:
 Consider observations x and hidden variables y, for a given likelihood
function P(x|y), the priors of y, P(y) is called the complementary priors of
P(x|y), provided that P(x,y)=P(x|y) P(y) leads to the posteriors P(y|x) that
exactly factorises.
 Infinite directed model with tied weights & Complementary Priors & Gibbs
sampling:
P (v | h)   P ( v | h )
m
i
i 1
 Recall that the RBMs have the property
n
P (h | v) 

P (h j | v)
j 1
 The definition of energy function of RBM makes it proper model that has two
sets of conditional independencies(complementary priors for both v and h)
 Since we need to estimate the distribution of data, P(v), we can perform
Gibbs sampling alternatively from P(v,h) for infinite times. This procedure is
analogous to unroll the single RBM into infinite directed stacks of RBMs with
tied weights(due to “complementary priors”) where each RBM takes input
from the hidden layer of the lower level RBM.
DBNs based on RBMs
 DBNs based on stacks of RBMs:
The top two hidden layers form an
undirected associative
memory(regarded as a shorthand for
infinite stacks) and the remained
hidden layers form a directed acyclic
graph.
h3
RBM
W3
h2
W2
RBM
h1
 The red arrows are NOT part of the
generative model. They are just for
inference purpose
W1
data
RBM
Training Deep Belief Nets
 Previous discussion gives an intuition of training stacks of RBMs one layer at
a time.
 This greedy learning algorithm is proved to be efficient in the sense of
expected variance by Hinton.
 First, learn all the weights tied.
Learn as a single
RBM
Training Deep Belief Nets
 Then freeze bottom layer and
relearn all the other layers.
Learn as a single
RBM
 Then freeze bottom two layers
and relearn all the other layers.
Learn as a single
RBM
Fine-tuning Deep Belief Nets
 Each time we learn a new layer, the inference at the lower layers will
become incorrect, but the variational bound on the log probability of the
data improves, proved by Hinton.
 Since the inference at lower layers becomes incorrect, Hinton uses a finetuning procedure to adjust the weights, called wake-sleep algorithm.
 Wake-sleep algorithm:
 wake phase: do a down-top pass, sample
T
h using the recognition weight W based
on input v for each RBM, and then adjust
the generative weight by the RBM learning
rule.
 sleep phase: do a top-down pass, start by
a random state of h at the top layer and
generate v. Then the recognition weights
are modified.
h3
RBM
W3
h2
W2
RBM
h1
W1
data
RBM
Deep Belief Nets
 Analogs for wake-sleep algorithm:
 wake phase: if the reality is different with the imagination, then modify the
generative weights to make what is imagined as close as the reality.
 sleep phase: if the illusions produced by the concepts learned during wake
phase are different with the concepts, then modify the recognition weight to
make the illusions as close as the concepts.
 Questions on DBNs:
 training vector vs. training set(Patch Training)
 How to perform unsupervised classification?
Performances from DBNs
 A: 2-D coded representation of hand-written database MNIST by PCA
 B: 2-D coded representation of MNIST by DBNs
Results produced by Hinton etc.
Performances from DBNs
 A: 2-D coded representation of documents retrieval data by LSA
 B: 2-D coded representation of the same data by DBNs
B
A
Results produced by Hinton etc.
Convolutional DBNs
 Limitations of DBNs:
 unable to process high dimensional data(DBNs transform 2D images into vectors
and then input them into the networks, thus certain spatial information is lost)
 even if using vectors as the input instead, DBNs are unable to be scaled up
properly for real image sizes. They are only suitable for small images
 directly extending the DBNs to fit the high dimensional data suffers from
inefficient computation(millions of weights to estimate)
 Advantages of CDBNs:
 feature detectors are shared through all locations in an image, therefore they
form the convolution kernels and reduce computation
 max-pooling: shrink the representation to be translation-invariant and reduce
computation
Architecture of CDBNs
 Energy term and Probability are
defined similarly to RBM:
P (v, h ) 
1
e
 E ( v ,h )
Z
K
E (v, h )   
NH
NW
 hW
k
ij
k
rs
v i  r 1, j  s 1
k 1 i , j 1 r , s 1
K
  bk
k 1
Nv
NH
h
k
ij
i , j 1
 c  v ij
i , j 1
 All units are 2D binary images,
within one unit of detection layer,
the weights/convolutional kernels
are shared, leading to the
convolution operation :
N
K
N
K
v
H
~k
k
E ( v , h )    h  (W  v )   bk  hij  c  v ij
k
k 1
k 1
i , j 1
i , j 1
CDBNs
 Training of CDBNs is done by optimizing the networks’ energy via sparsity
regularization(imposed by max-pooling):
E (v, h )   
ij
subject
to
K
h
ij
h
k
ij
K
~k
 (W  v ) ij   b k
k
k 1
k 1
Nv
NH
h
k
ij
i , j 1
 c  v ij
i , j 1
 1,  k , 
( i , j ) B 
 This yields a similar updating strategy for the weights and biases as the
Contrastive Divergence.
 The sparse constraints also give rise to a simple inference of the network:
k
P (h  1 | v) 
k
ij
exp( I ( hij ))
1 
P ( p  0 | v ) 
k
( i ', j ' ) B 
1
k
where
exp( I ( hi ' j ' ))
1 
k
( i ', j ' ) B 
exp( I ( hi ' j ' ))
~k
k
I ( hij )  b k  (W  v ) ij
Performance of CDBNs
 Hierarchical representations of Caltech-101 object classification database by
CDBNs. Top: first layer CDBN output. Bottom: second layer CDBN output.
Results produced by Andrew Y. Ng etc.
References
 Review:

Learning deep architectures for AI, Y. Bengio 2009
 Foundations:

A fast learning algorithm for deep belief nets, Hinton 2006

Reducing the dimensionality of data with neural networks, Hinton 2006

A practical guide to training restricted Boltzmann machines, Hinton 2010

On contrastive divergence learning, Hinton, 2005

On the convergence property of contrastive divergence, Tieleman, 2010

Training products of experts by minimizing contrastive divergence, Hinton, 2002

Learning multiple layers of representation, Hinton, 2007
 Applications:

Sparse deep belief net model for visual area V2, H. Lee 2008

Convolutional deep belief network for scalable unsupervised learning of hierarchical
representations, H. Lee 2009

Unsupervised learning of invariant feature hierarchies with applications to object
recognition, Y. LeCun 2007
Download