Presentation on theme: "Restricted Boltzmann Machines and Deep Belief Networks"— Presentation transcript:
1 Restricted Boltzmann Machines and Deep Belief Networks Presented by Matt LuciwUSING A VAST, VAST MAJORITY OF SLIDES ORIGINALLY FROM:Geoffrey Hinton, Sue Becker, Yann Le Cun, Yoshua Bengio, Frank Wood
2 MotivationsSupervised training of deep models (e.g. many-layered NNets) is difficult (optimization problem)Shallow models (SVMs, one-hidden-layer NNets, boosting, etc…) are unlikely candidates for learning high-level abstractions needed for AIUnsupervised learning could do “local-learning” (each module tries its best to model what it sees)Inference (+ learning) is intractable in directed graphical models with many hidden variablesCurrent unsupervised learning methods don’t easily extend to learn multiple levels of representation
3 Belief NetsA belief net is a directed acyclic graph composed of stochastic variables.Can observe some of the variables and we would like to solve two problems:The inference problem: Infer the states of the unobserved variables.The learning problem: Adjust the interactions between variables to make the network more likely to generate the observed data.stochastichidden causevisibleeffectUse nets composed of layers of stochastic binary variables with weighted connections. Later, we will generalize to other types of variable.
4 Stochastic binary neurons These have a state of 1 or 0 which is a stochastic function of the neuron’s bias, b, and the input it receives from other neurons.10.5
5 Stochastic unitsReplace the binary threshold units by binary stochastic units that make biased random decisions.The temperature controls the amount of noise.Decreasing all the energy gaps between configurations is equivalent to raising the noise level.temperature
6 The Energy of a joint configuration binary state of unit i in joint configuration v, hbias of unit iweight between units i and jEnergy with configuration v on the visible units and h on the hidden unitsindexes every non-identical pair of i and j once
7 Weights Energies Probabilities Each possible joint configuration of the visible and hidden units has an energyThe energy is determined by the weights and biases (as in a Hopfield net).The energy of a joint configuration of the visible and hidden units determines its probability:The probability of a configuration over the visible units is found by summing the probabilities of all the joint configurations that contain it.
8 Restricted Boltzmann Machines Restrict the connectivity to make learning easier.Only one layer of hidden units.Deal with more layers laterNo connections between hidden units.In an RBM, the hidden units are conditionally independent given the visible states.So can quickly get an unbiased sample from the posterior distribution when given a data-vector.This is a big advantage over directed belief netshiddenjivisible
9 Maximizing the training data log likelihood Standard PoE formWe want maximizing parametersDifferentiate w.r.t. to all parameters and perform gradient ascent to find optimal parameters.The derivation is nasty.Assuming d’s drawn independently from p()Over all training data.Frank Wood -
10 Equilibrium Is Hard to Achieve With:can now train our PoE model.But… there’s a problem:is computationally infeasible to obtain (esp. in an inner gradient ascent loop).Sampling Markov Chain must converge to target distribution. Often this takes a very long time!Frank Wood -
11 A very surprising factEverything that one weight needs to know about the other weights and the data in order to do maximum likelihood learning is contained in the difference of two correlations.Expected value of product of states at thermal equilibrium when the training vector is clamped on the visible unitsExpected value of product of states at thermal equilibrium when nothing is clampedDerivative of log probability of one training vector
12 The (theoretical) batch learning algorithm Positive phaseClamp a data vector on the visible units.Let the hidden units reach thermal equilibrium at a temperature of 1Sample for all pairs of unitsRepeat for all data vectors in the training set.Negative phaseDo not clamp any of the unitsLet the whole network reach thermal equilibrium at a temperature of 1 (where do we start?)Sample for all pairs of unitsRepeat many times to get good estimatesWeight updatesUpdate each weight by an amount proportional to the difference in in the two phases.
13 Solution: Contrastive Divergence! Now we don’t have to run the sampling Markov Chain to convergence, instead we can stop after 1 iteration (or perhaps a few iterations more typically)Why does this work?Attempts to minimize the ways that the model distorts the data.Frank Wood -
14 Contrastive Divergence Maximum likelihood gradient: pull down energy surface at the examples and pull it up everywhere else, with more emphasis where model puts more probability massContrastive divergence updates: pull down energy surface at the examples and pull it up in their neighborhood, with more emphasis where model puts more probability mass
15 Restricted Boltzmann Machines In an RBM, the hidden units are conditionally independent given the visible states. It only takes one step to reach thermal equilibrium when the visible units are clamped.Can quickly get the exact value of :hiddenjivisible
16 A picture of the Boltzmann machine learning algorithm for an RBM jjjja fantasyiiiit = t = t = t = infinityStart with a training vector on the visible units.Then alternate between updating all the hidden units in parallel and updating all the visible units in parallel.
17 Contrastive divergence learning: A quick way to learn an RBM jjStart with a training vector on the visible units.Update all the hidden units in parallelUpdate the all the visible units in parallel to get a “reconstruction”.Update the hidden units again.iit = t = 1datareconstructionThis is not following the gradient of the log likelihood. But it works well.When we consider infinite directed nets it will be easy to see why it works.
18 How to learn a set of features that are good for reconstructing images of the digit 2 50 binary feature neurons50 binary feature neuronsIncrement weights between an active pixel and an active featureDecrement weights between an active pixel and an active feature16 x 16 pixel image16 x 16 pixel imagedata (reality)reconstruction (better than reality)
19 Using an RBM to learn a model of a digit class Reconstructions by model trained on 2’sDataReconstructions by model trained on 3’s100 hidden units (features)jj256 visible units (pixels)iidatareconstruction
20 Each neuron grabs a different feature. The final 50 x 256 weightsEach neuron grabs a different feature.
21 How well can we reconstruct the digit images from the binary feature activations? Reconstruction from activated binary featuresReconstruction from activated binary featuresDataDataNew test images from the digit class that the model was trained onImages from an unfamiliar digit class (the network tries to see every image as a 2)
23 Explaining away (Judea Pearl) Even if two hidden causes are independent, they can become dependent when we observe an effect that they can both influence.If we learn that there was an earthquake it reduces the probability that the house jumped because of a truck.-10-10truck hits houseearthquakeposterior2020p(1,1)=.0001p(1,0)=.4999p(0,1)=.4999p(0,0)=.0001-20house jumps
24 Why multilayer learning is hard in a sigmoid belief net. To learn W, we need the posterior distribution in the first hidden layer.Problem 1: The posterior is typically intractable because of “explaining away”.Problem 2: The posterior depends on the prior created by higher layers as well as the likelihood.So to learn W, we need to know the weights in higher layers, even if we are only approximating the posterior. All the weights interact.Problem 3: We need to integrate over all possible configurations of the higher variables to get the prior for first hidden layer. Yuk!hidden variableshidden variablespriorhidden variableslikelihoodWdata
25 Solution: Complementary Priors There is a special type of multi-layer directed model in which it is easy to infer the posterior distribution over the hidden units because it has complementary priors.This special type of directed model is equivalent to an undirected model.At first, this equivalence just seems like a neat trickBut it leads to a very effective new learning algorithm that allows multilayer directed nets to be learned one layer at a time.The new learning algorithm resembles boosting with each layer being like a weak learner.
26 An example of a complementary prior etc.Infinite DAG with replicated weights.An ancestral pass of the DAG is exactly equivalent to letting a Restricted Boltzmann Machine settle to equilibrium.This infinite DAG defines the same distribution as an RBM.h2v2h1v1h0v0
27 Inference in a DAG with replicated weights etc.h2The variables in h0 are conditionally independent given v0.Inference is trivial. We just multiply v0 byThis is because the model above h0 implements a complementary prior.Inference in the DAG is exactly equivalent to letting a Restricted Boltzmann Machine settle to equilibrium starting at the data.v2h1v1h0v0
28 Divide and conquer multilayer learning Re-representing the data: Each time the base learner is called, it passes a transformed version of the data to the next learner.Can we learn a deep, dense DAG one layer at a time, starting at the bottom, and still guarantee that learning each layer improves the overall model of the training data?This seems very unlikely. Surely we need to know the weights in higher layers to learn lower layers?
29 Multilayer contrastive divergence Start by learning one hidden layer.Then re-present the data as the activities of the hidden units.The same learning algorithm can now be applied to the re-presented data.Can we prove that each step of this greedy learning improves the log probability of the data under the overall model?What is the overall model?
30 Learning a deep directed network etc.h2First learn with all the weights tiedThis is exactly equivalent to learning an RBMContrastive divergence learning is equivalent to ignoring the small derivatives contributed by the tied weights between deeper layers.v2h1v1h0h0v0v0
31 Then freeze the first layer of weights in both directions and learn the remaining weights (still tied together).This is equivalent to learning another RBM, using the aggregated posterior distribution of h0 as the data.etc.h2v2h1v1v1h0h0v0
32 A simplified version with all hidden layers the same size The RBM at the top can be viewed as shorthand for an infinite directed net.When learning W1 we can view the model in two quite different ways:The model is an RBM composed of the data layer and h1.The model is an infinite DAG with tied weights.After learning W1 we untie it from the other weight matrices.We then learn W2 which is still tied to all the matrices above it.h3h2h1data
33 Why greedy learning works Each time we learn a new layer, the inference at the layer below becomes incorrect, but the variational bound on the log prob of the data improves (only true in theory -ml).Since the bound starts as an equality, learning a new layer never decreases the log prob of the data, provided we start the learning from the tied weights that implement the complementary prior.Now that we have a guarantee we can loosen the restrictions and still feel confident.Allow layers to vary in size.Do not start the learning at each layer from the weights in the layer below.
34 Why the hidden configurations should be treated as data when learning the next layer of weights After learning the first layer of weights:If we freeze the generative weights that define the likelihood term and the recognition weights that define the distribution over hidden configurations, we get:Maximizing the RHS is equivalent to maximizing the log prob of “data” that occurs with probability
35 Fine-tuning with a contrastive version of the “wake-sleep” algorithm After learning many layers of features, we can fine-tune the features to improve generation.1. Do a stochastic bottom-up passAdjust the top-down weights to be good at reconstructing the feature activities in the layer below.Do a few iterations of sampling in the top level RBM-- Adjust the weights in the top-level RBM.Do a stochastic top-down passAdjust the bottom-up weights to be good at reconstructing the feature activities in the layer above.Not required! But helps the recognition rate (-ml).
36 A neural network model of digit recognition The top two layers form a restricted Boltzmann machine whose free energy landscape models the low dimensional manifolds of the digits.The valleys have names:2000 top-level units10 label units500 unitsThe model learns a joint density for labels and images. To perform recognition we can start with a neutral state of the label units and do one or two iterations of the top-level RBM.Or we can just compute the free energy of the RBM with each of the 10 labels500 units28 x 28 pixel image
37 Show the movie of the network generating digits (available at www. cs Show the movie of the network generating digits (available at
38 Limits of the Generative Model 1. Designed for images where non-binary values can be treated as probabilities.Top-down feedback only in the highest (associative) layer.No systematic way to deal with invariance.Assumes segmentation already performed and does not learn to attend to the most informative parts of objects.