Fadli (Bahasa Inggris)
Fadli (Bahasa Inggris)
Fadli (Bahasa Inggris)
By:
Fadli Lutfillah Hawari (10116253)
1. Background
We show how to use “complementary priors” to eliminate the explaining away
effects that make inference difficult in densely connected belief nets that have many
hidden layers. Using complementary priors, we derive a fast, greedy algorithm that can
learn deep, directed belief network one layer at a time, provided the top two layers form
an undirected associative memory. The fast, greedy algorithm is used to initialize a
slower learning procedurethat fine-tunes the weights using a contrastive version of the
wake-sleep algorithm.
After fine-tuning, a network with three hidden layers forms a very good
generative model of the joint distribution of handwritten didigt images and their labels.
This generative model gives better digit classification than the best discriminative
learning algorithms. The low-dimensional manifolds on which the digits lie are modeled
by long raviens in the free-energy landscape of the top level associative memory, and it is
easy to explore these raviens by using the directed connections to display what
associative memory has mind.
1 Introduction
Learning is difficult in densely connected, directed belief nets that have many hidden layers
because it is difficult to infer the conditional distribution of the hidden activities when given a
data vector. Variational methods use simple approximations to the true conditional distribution,
but the approximations may be poor, especially at the deepest hidden layer, where
thepriorassumesindependence.Also,variationallearningstillrequiresall of the parameters to be
learned together and this makes the learning time scale poorly as the number of parameters
increases. We describe a model in which the top two hidden layers form an undirected
associative memory (see Figure 1) and the remaining hidden layers
form a directed acyclic graph that converts the representations in the associative memory
into observable variables such as the pixels of an image. This hybrid model has some attractive
features:
There is a fast, greedy learning algorithm that can find a fairly good set of parameters
quickly, even in deep networks with millions of parameters and many hidden layers.
The learning algorithm is unsupervised but can be applied to labeled data by learning a
model that generates both the label and the data.
There is a fine-tuning algorithm that learns an excellent generative model that
outperforms discriminative methods on the MNIST database of hand-written digits.
The generative model makes it easy to interpret the distributed representations in the
deep hidden layers.
The inference required for forming a percept is both fast and accurate.
The learning algorithm is local. Adjustments to a synapse strength depend on only the
states of the presynaptic and postsynaptic neuron.
The communication is simple. Neurons need only to communicate their stochastic binary
states.
Section 2 introduces the idea of a “complementary” prior that exactly cancels the
“explaining away” phenomenon that makes inference difficult in directed models. An example of
a directed belief network with complementary priors is presented.
Section 3 shows the equivalence between restricted Boltzmann machines and infinite
directed networks with tied weights.
Section 4 introduces a fast, greedy learning algorithm for constructing multi layer directed
networks one layer at a time. Using a variational bound, it shows that as each new layer is added,
the overall generative model improves. The greedy algorithm bears some resemblance to
boosting in its repeated use of the same “weak” learner, but instead of reweighting each data
vector to ensure that the next step learns something new, it rerepresents it. The “weak” learner
that is used to construct deep directed nets is itself an undirected graphical model.
Section 5 shows how the weights produced by the fast, greedy algorithm can be fine-tuned
using the “up-down” algorithm. This is a contrastive version of the wake-sleep algorithm
(Hinton, Dayan, Frey, & Neal, 1995) that does not suffer from the “mode-averaging” problems
that can cause the wake-sleep algorithm to learn poor recognition weights.
Section 6 shows the pattern recognition performance of a network with three hidden layers
and about 1.7 million weights on the MNIST set of hand written digits. When no knowledge of
geometry is provided and there is no special preprocessing, the generalization performance of the
network is 1.25% errors on the 10,000-digit official test set. This beats the 1.5% achieved by the
best back propagation nets when they are not handcrafted for this particular application. It is also
slightly better than the 1.4% errors reported by Decoste and Schoelkopf (2002) for support
vector machine son the same task.
Finally, section 7 shows what happens in the mind of the network when it is running without
being constrained by visual input. The network has a full generative model, so it is easy to look
into its mind we simply generate an image from its high-level representations. Throughout the
letter, we consider nets composed of stochastic binary variables, but the ideas can be generalized
to other models in which the log probability of a variable is an additive function of the states of
its directly connected neighbors (see appendix A for details).
Figure 2: A simple logistic belief net containing two independent, rare causes
thatbecomehighlyanticorrelatedwhenweobservethehousejumping.Thebias of −10 on the
earthquake node means that in the absence of any observation, this node is e10 times more likely
to be off than on. If the earthquake node is on and the truck node is off, the jump node has a total
input of 0, which means that it has an even chance of being on. This is a much better explanation
of the observation that the house jumped than the odds of e−20, which apply if neither of the
hidden causes is active. But it is wasteful to turn on both hidden causes to explain the
observation because the probability of both happening is e−10 ×e−10 =e−20. When the
earthquake node is turned on, it “explains away” the evidence for the truck node.
2 Complementary Priors
p(si =1)=
1 1+exp−bi −j sjwij
, (2.1)
where bi is the bias of unit i. If a logistic belief net has only one hidden layer, the prior
distribution over the hidden variables is factorial because their binary states are chosen
independently when the model is used to
generatedata.Thenonindependenceintheposteriordistributioniscreated by the likelihood term
coming from the data. Perhaps we could eliminate explaining away in the first hidden layer by
using extra hidden layers to
createa“complementary”priorthathasexactlytheoppositecorrelationsto those in the likelihood
term. Then, when the likelihood term is multiplied by the prior, we will get a posterior that is
exactly factorial. It is not at all obvious that complementary priors exist, but Figure 3 shows a
simple exampleofaninfinitelogisticbeliefnetwithtiedweightsinwhichthepriors are complementary
at every hidden layer(see appendix A for a more general treatment of the conditions under which
complementary priors exist). The us eoftied weights to construct complementary priors may
seem like a more trick for making directed model sequivalenttoun directedones.Asweshall see,
however, it leads to a novel and very efficient learning algorithm that works by progressively
untying the weights in each layer from the weights in higher layers.
2.1 An Infinite Directed Model with Tied Weights. We can generate data from the infinite
directed net in Figure 3 by starting with a random configuration at an infinitely deep hidden
layer1 and then performing a top-down “ancestral” pass in which the binary state of each
variable in a layerischosenfromtheBernoullidistributiondeterminedbythetop-down input coming
from its active parents in the layer above. In this respect, it is just like any other directed acyclic
belief net. Unlike other directed nets, however, we can sample from the true poster or
distribution overall of the hidden layers by starting with a data vector on the visible units and
then using the transposed weight matrices to infer the factorial distributions over each hidden
layer in turn. At each hidden layer, we sample from the factorial posterior before computing the
factorial posterior for the layer above.
Figure3: An infinite logistic belief net with tied weights. The down ward arrows represent
the generative model. The upward arrows are not part of the model. They represent the
parameters that are used to infer samples from the posterior distribution at each hidden layer of
the net when a data vector is clamped on V0. Because the complementary prior at each layer
ensures that the posterior distribution really is factorial. Since we can sample from the true
posterior, we can compute the derivatives of the log probability of the data. Let us start by
computing the derivative for a generative weight, w00 ij, from a unit j in layer H0 to unit i in
layer V0 (see Figure 3). In a logistic belief net, the maximum likelihood learning rule for a single
data vector, v0, is
reconstructed from the sampled hidden states. Computing the posterior distribution over the
second hidden layer, V1, from the sampled binary states in the first hidden layer, H0, is exactly
the same process as reconstructing the data, so v1 i is a sample from a Bernoulli random variable
with probability ˆ v0 i . The learning rule can therefore be written as ∂ log p(v0) ∂w00 ij
=
h0 jv0 i −v1
i +
v1 ih0 j −h1
j +
It may not be immediately obvious that the infinite directed net in Figure 3 is equivalent to a
restricted Boltzmann machine (RBM). An RBM has a single layer of hidden units that are not
connected to each other and have undirected, symmetrical connections to a layer of visible units.
To generate data from an RBM, we can start with a random state in one of the layers and then
perform alternating Gibbs sampling. All of the units in one layer are updated in parallel given the
current states of the units in the other layer, and this is repeated until the system is sampling from
its equilibrium distribution. Notice that this is exactly the same process as generating data from
the infinite belief net with tied weights. To perform maximum likelihood learning in an RBM,
we can use the difference between two correlations. For each weight, wij, between a visible unit i
and a hidden unit, j, we measure the
correlation
v0 i h0 jwhen a data vector is clamped on the visible units and the hidden states are sampled
from their conditional distribution, which is factorial. Then, using alternating Gibbs sampling,
we run the Markov chain shown in Figure 4 until it reaches its
stationarydistributionandmeasurethecorrelation
v0 i h0
j−
v∞ i h∞ j . (3.1)
>< 00 ji hv
j
i
t = infinity
>< ∞∞ ji hv
Figure 4: This depicts a Markov chain that uses alternating Gibbs sampling. In one full step of
Gibbs sampling, the hidden units in the top layer are all
updatedinparallelbyapplyingequation2.1totheinputsreceivedfromthethe current states of the
visible units in the bottom layer; then the visible units are all updated in parallel given the current
hidden states. The chain is initialized by setting the binary states of the visible units to be the
same as a data vector. The correlations in the activities of a visible and a hidden unit are
measured after the first update of the hidden units and again at the end of the chain. The
difference of these two correlations provides the learning signal for updating the weight on the
connection.
This learning rule is the same as the maximum likelihood learning rule for the infinite logistic
belief net with tied weights, and each step of Gibbs sampling corresponds to computing the exact
posterior distribution in a layer of the infinite logistic belief net.
MaximizingthelogprobabilityofthedataisexactlythesameasminimizingtheKullback-
Leiblerdivergence, KL(P0||P∞ θ ),betweenthedistribution ofthedata,
P0,andtheequilibriumdistributiondefinedbythemodel, P∞ θ .
Incontrastivedivergencelearning(Hinton,2002),weruntheMarkovchain
foronlynfullstepsbeforemeasuringthesecondcorrelation.3 Thisisequivalent to ignoring the
derivatives that come from the higher layers of the
infinitenet.Thesumofalltheseignoredderivativesisthederivativeofthe log probability of the
posterior distribution in layer Vn, which is also the derivative of the Kullback-Leibler divergence
between the posterior distribution in layer Vn, Pn θ , and the equilibrium distribution defined by
the model. So contrastive divergence learning minimizes the difference of two Kullback-Leibler
divergences: KLP0 P∞ θ −KLPn θ P∞ θ
. (3.2)
Ignoringsamplingnoise,thisdifferenceisnevernegativebecauseGibbs sampling is used to produce
Pn θ from P0, and Gibbs sampling always reducestheKullback-
Leiblerdivergencewiththeequilibriumdistribution.It
Anefficientwaytolearnacomplicatedmodelistocombineasetofsimpler
modelsthatarelearnedsequentially.Toforceeachmodelinthesequenceto learn something different
from the previous models, the data are modified
insomewayaftereachmodelhasbeenlearned.Inboosting(Freund,1995), each model in the sequence
is trained on reweighted data that emphasize the cases that the preceding models got wrong. In
one version of principal componentsanalysis,thevarianceinamodeleddirectionisremoved,thus
forcingthenextmodeleddirectiontolieintheorthogonalsubspace(Sanger, 1989).In projectionpursuit
(Friedman&Stuetzle,1981),thedataaretransformedbynonlinearlydistortingonedirectioninthedatasp
acetoremove all nongaussianity in that direction. The idea behind our greedy algorithm is to
allow each model in the sequence to receive a different representation of the data. The model
performs a nonlinear transformation on its input vectors and produces as output the vectors that
will be used as input for the next model in the sequence. Figure 5 shows a multilayer generative
model in which the top two layers interact via undirected connections and all of the other
connections
Figure 5: A hybrid network. The top two layers have undirected connections and form an
associative memory. The layers below have directed, top-down
generativeconnectionsthatcanbeusedtomapastateoftheassociativememory
toanimage.Therearealsodirected,bottom-uprecognitionconnectionsthatare used to infer a factorial
representation in one layer from the binary activities in the layer below. In the greedy initial
learning, the recognition connections are tied to the generative connections.
1. Learn W0 assuming all the weight matrices are tied. 2. Freeze W0 and commit ourselves to
using WT 0 to infer factorial approximateposteriordistributionsoverthestatesofthevariablesinthe
firsthiddenlayer,evenifsubsequentchangesinhigher-levelweights mean that this inference method
is no longer correct. 3. Keeping all the higher-weight matrices tied to each other, but untied from
W0, learn an RBM model of the higher-level “data” that was produced by using WT 0 to
transform the original data. If this greedy algorithm changes the higher-level weight matrices, it
is guaranteed to improve the generative model. As shown in Neal and
Hinton(1998),thenegativelogprobabilityofasingledatavector,v0,under the multilayer generative
model is bounded by a variational free energy, which is the expected energy under the
approximating distribution, Q(h0|v0), minus the entropy of that distribution. For a directed
model, the “energy” of the configuration v0,h0 is given by E(v0,h0)=−[log p(h0)+log p(v0|h0)],
(4.1) so the bound is log p(v0) ≥ allh0 Q(h0|v0)[log p(h0)+log p(v0|h0)] − allh0
Q(h0|v0)logQ(h0|v0), (4.2)
So maximizing the bound with respect to the weights in the higher layers is exactly equivalent to
maximizing the log probability of a data set in which h0 occurs with probability Q(h0|v0). If the
bound becomes tighter, it
the values of the variables in the layer below. A variant of the wake-sleep algorithm described in
Hinton et al. (1995) can then be used to allow the higher-levelweightstoinfluencethelower-
levelones.Inthe“up-pass,”the recognition weights are used in a bottom-up pass that stochastically
picks a state for every hidden variable. The generative weights on the directed
connectionsarethenadjustedusingthemaximumlikelihoodlearningrule in equation 2.2.5 The
weights on the undirected connections at the top level are learned as before by fitting the top-
level RBM to the posterior distribution of the penultimate layer. The “down-pass” starts with a
state of the top-level associative memoryandusesthetop-
downgenerativeconnectionstostochasticallyactivate each lower layer in turn. During the down-
pass, the top-level undirected
connectionsandthegenerativedirectedconnectionsarenotchanged.Only the bottom-up recognition
weights are modified. This is equivalent to the sleep phase of the wake-sleep algorithm if the
associative memory is allowed to settle to its equilibrium distribution before initiating the
downpass. But if the associative memory is initialized by an up-pass and then only allowed to
run for a few iterations of alternating Gibbs sampling beforeinitiatingthedown-
pass,thisisa“contrastive”formofthewake-sleep algorithm that eliminates the need to sample from
the equilibrium distribution of the associative memory. The contrastive form also fixes several
other problems of the sleep phase. It ensures that the recognition weights
arebeinglearnedforrepresentationsthatresemblethoseusedforrealdata, and it also helps to eliminate
the problem of mode averaging. If, given a
particulardatavector,thecurrentrecognitionweightsalwayspickaparticularmodeatthelevelaboveandi
gnoreotherverydifferentmodesthatare equallygoodatgeneratingthedata,thelearninginthedown-
passwillnot trytoalterthoserecognitionweightstorecoveranyoftheothermodesasit would if the sleep
phase used a pure ancestral pass. A pure ancestral pass would have to start by using prolonged
Gibbs sampling to get an equilibrium sample from the top-level associative memory. By using a
top-level associative memory, we also eliminate a problem in the wake phase: independent top-
level units seem to be required to allow an ancestral pass, but
theymeanthatthevariationalapproximationisverypoorforthetoplayer of weights. Appendix B
specifies the details of the up-down algorithm using MATLAB-style pseudocode for the network
shown in Figure 1. For simplicity, there is no penalty on the weights, no momentum, and the
same learning rate for all parameters. Also, the training data are reduced to a single case.
5 Becauseweightsarenolongertiedtotheweightsabovethem, ˆ v0 i mustbecomputed
usingthestatesofthevariablesinthelayerabovei andthegenerativeweightsfromthese variables to i.
1540 G. Hinton, S. Osindero, and Y.-W. Teh
6.1 Training the Network. The MNIST database of handwritten digits contains 60,000 training
images and 10,000 test images. Results for many
differentpatternrecognitiontechniquesarealreadypublishedforthispubliclyavailabledatabase,soitisi
dealforevaluatingnewpatternrecognition methods. For the basic version of the MNIST learning
task, no knowledge of geometry is provided, and there is no special preprocessing or
enhancement of the training set, so an unknown but fixed random permutation of the pixels
would not affect the learning algorithm. For this “permutationinvariant” version of the task, the
generalization performance of our network was 1.25% errors on the official test set. The network
shown in Figure 1 was trained on 44,000 of the training images that were divided into 440
balanced mini-batches, each containing 10 examples of each digit class.6 The weights were
updated after each mini-batch.
Intheinitialphaseoftraining,thegreedyalgorithmdescribedinsection4 was used to train each layer
of weights separately, starting at the bottom. Each layer was trained for 30 sweeps through the
training set (called “epochs”). During training, the units in the “visible” layer of each RBM had
real-valued activities between 0 and 1. These were the normalized pixel intensities when learning
the bottom layer of weights. For training higherlayersofweights,thereal-
valuedactivitiesofthevisibleunitsinthe
RBMweretheactivationprobabilitiesofthehiddenunitsinthelower-level RBM. The hidden layer of
each RBM used stochastic binary values when
thatRBMwasbeingtrained.Thegreedytrainingtookafewhoursperlayer in MATLAB on a 3 GHz
Xeon processor, and when it was done, the error rate on the test set was 2.49% (see below for
details of how the network is tested).
Whentrainingthetoplayerofweights(theonesintheassociativememory), the labels were provided as
part of the input. The labels were represented by turning on one unit in a “softmax” group of 10
units. When the activities in this group were reconstructed from the activities in the layer above,
exactly one unit was allowed to be active, and the probability of picking unit i was given by
pi =
exp(xi) j exp(xj)
, (6.1)
where xi is the total input received by unit i. Curiously, the learning rules
areunaffectedbythecompetitionbetweenunitsinasoftmaxgroup,sothe
6 Preliminary experiments with 16×16 images of handwritten digits from the USPS
databaseshowedthatagoodwaytomodelthejointdistributionofdigitimagesandtheir labels was to use
an architecture of this type, but for 16×16 images, only three-fifths as many units were used in
each hidden layer.
synapses do not need to know which unit is competing with which other unit. The competition
affects the probability of a unit turning on, but it is only this probability that affects the learning.
Afterthegreedylayer-by-layertraining,thenetworkwastrained,witha
differentlearningrateandweightdecay,for300epochsusingtheup-down
algorithmdescribedinsection5.Thelearningrate,momentum,andweight decay7
werechosenbytrainingthenetworkseveraltimesandobservingits performance on a separate
validation set of 10,000 images that were taken from the remainder of the full training set. For
the first 100 epochs of the up-down algorithm, the up-pass was followed by three full iterations
of alternating Gibbs sampling in the associative memory before performing thedown-
pass.Forthesecond100epochs,6iterationswereperformed,and
forthelast100epochs,10iterationswereperformed.Eachtimethenumber of iterations of Gibbs
sampling was raised, the error on the validation set decreased noticeably. The network that
performed best on the validation set was tested and had an error rate of 1.39%. This network was
then trained on all 60,000 training images8 until its error rate on the full training set was as low
as itsfinalerror ratehadbeenon theinitialtrainingsetof 44,000images.This took a further 59 epochs,
making the total learning time about a week. The finalnetworkhadanerror rateof1.25%.9
Theerrorsmadebythenetwork are shown in Figure 6. The 49 cases that the network gets correct
but for which the second-best probability is within 0.3 of the best probability are shown in Figure
7. The error rate of 1.25% compares very favorably with the error rates
achievedbyfeedforwardneuralnetworksthathaveoneortwohiddenlayers and are trained to optimize
discrimination using the backpropagation algorithm (see Table 1). When the detailed
connectivity of these networks is not handcrafted for this particular task, the best reported error
rate for stochastic online learning with a separate squared error on each of the 10 output units is
2.95%. These error rates can be reduced to 1.53% in a net
withonehiddenlayerof800unitsbyusingsmallinitialweights,aseparate cross-entropy error function
on each output unit, and very gentle learning
7 No attempt was made to use different learning rates or weight decays for different
layers,andthelearningrateandmomentumwerealwayssetquiteconservativelytoavoid
oscillations.Itishighlylikelythatthelearningspeedcouldbeconsiderablyimprovedby
amorecarefulchoiceoflearningparameters,thoughitispossiblethatthiswouldleadto worse solutions.
8 The training set has unequal numbers of each class, so images were assigned randomly to each
of the 600 mini-batches. 9 To check that further learning would not have significantly improved
the error rate, the network was then left running with a very small learning rate and with the test
error beingdisplayedaftereveryepoch.Aftersixweeks,thetesterrorwasfluctuatingbetween 1.12%
and 1.31% and was 1.18% for the epoch on which number of training errors was smallest.
1542 G. Hinton, S. Osindero, and Y.-W. Teh
Figure 7: All 49 cases in which the network guessed right but had a second
guesswhoseprobabilitywaswithin0.3oftheprobabilityofthebestguess.The true classes are arranged
in standard scan order.
neuralnetworksfrom1.5%to0.95%.Thereisnoobviousreasonwhyweight
sharingandsubsamplingcannotbeusedtoreducetheerrorrateofthegenerative model, and we are
currently investigating this approach. Further
improvementscanalwaysbeachievedbyaveragingtheopinionsofmultiple networks, but this
technique is available to all methods. Substantial reductions in the error rate can be achieved by
supplementingthedatasetwithslightlytransformedversionsofthetrainingdata.Usingone-andtwo-
pixeltranslations,DecosteandSchoelkopf(2002)achieve 0.56%. Using local elastic deformations
in a convolutional neural network, Simard, Steinkraus, and Platt (2003) achieve 0.4%, which is
slightly better than the 0.63% achieved by the best hand-coded recognition algorithm (Belongie,
Malik, & Puzicha, 2002). We have not yet explored the use of distorted data for learning
generative models because many types of distortion need to be investigated, and the fine-tuning
algorithm is currently too slow.
6.2 Testing the Network. One way to test the network is to use a stochasticup-
passfromtheimagetofixthebinarystatesofthe500unitsin
thelowerlayeroftheassociativememory.Withthesestatesfixed,thelabel units are given initial real-
valued activities of 0.1, and a few iterations of alternating Gibbs sampling are then used to
activate the correct label unit. This method of testing gives error rates that are almost 1% higher
than the rates reported above.
1544 G. Hinton, S. Osindero, and Y.-W. Teh
1.25
1.4
1.51
1.53
2.95
2.8
3.1
4.0
4.4
Unpermuted images; extra Backprop: cross-entropy and 0.4 data from elastic early-
stoppingconvolutionalneuralnet deformations Unpermuted de-skewed Virtual SVM: degree 9
polynomial 0.56 images; extra data from 2 kernel pixel translations Unpermuted images Shape-
context features: hand-coded matching 0.63 Unpermuted images; extra Backprop in LeNet5:
convolutional 0.8 data from affine neural net transformations Unpermuted images Backprop in
LeNet5: convolutional neural net 0.95
A better method is to first fix the binary states of the 500 units in the lower layer of the
associative memory and to then turn on each of the label units in turn and compute the exact free
energy of the resulting 510-component binary vector. Almost all the computation required is
independent of which label unit is turned on (Teh & Hinton, 2001), and this
methodcomputestheexactconditionalequilibriumdistributionoverlabels instead of approximating
it by Gibbs sampling, which is what the previous method is doing. This method gives error rates
that are about 0.5% higher than the ones quoted because of the stochastic decisions made in
theup-pass.Wecanremovethisnoiseintwoways.Thesimpleristomake the up-pass deterministic by
using probabilities of activation in place of
Figure8:
Eachrowshows10samplesfromthegenerativemodelwithaparticularlabelclampedon.Thetop-
levelassociativememoryisrunfor1000iterations of alternating Gibbs sampling between samples.
stochastic binary states. The second is to repeat the stochastic up-pass 20 times and average
either the label probabilities or the label log probabilities over the 20 repetitions before picking
the best one. The two types
ofaveragegivealmostidenticalresults,andtheseresultsarealsoverysimilartousingasingledeterministi
cup-pass,whichwasthemethodusedfor the reported results.
Figure 9: Each row shows 10 samples from the generative model with a particular label clamped
on. The top-level associative memory is initialized by an up-
passfromarandombinaryimageinwhicheachpixelisonwithaprobability of 0.5. The first column
shows the results of a down-pass from this initial highlevel state. Subsequent columns are
produced by 20 iterations of alternating Gibbs sampling in the associative memory.
in mind. This use of the word mind is not intended to be metaphorical. We believe that a mental
state is the state of a hypothetical, external world in which a high-level internal representation
would constitute veridical perception. That hypothetical world is what the figure shows.
8 Conclusion
We have shown that it is possible to learn a deep, densely connected belief network one layer at
a time. The obvious way to do this is to assume that the higher layers do not exist when learning
the lower layers, but this is not compatible with the use of simple factorial approximations to
replace the intractable posterior distribution. For these approximations to work well, we need the
true posterior to be as close to factorial as possible. So instead of ignoring the higher layers, we
assume that they exist but have tied weights that are constrained to implement a complementary
prior that makes the true posterior exactly factorial. This is equivalent to
havinganundirectedmodelthatcanbelearnedefficientlyusingcontrastive divergence. It can also be
viewed as constrained variational learning because a penalty term—the divergence between the
approximate and true
posteriors—has been replaced by the constraint that the prior must make the variational
approximation exact. Aftereachlayerhasbeenlearned,itsweightsareuntiedfromtheweights
inhigherlayers.Asthesehigher-levelweightschange,thepriorsforlower layers cease to be
complementary, so the true posterior distributions in lower layers are no longer factorial, and the
use of the transpose of the generative weights for inference is no longer correct. Nevertheless, we
can use a variational bound to show that adapting the higher-level weights improves the overall
generative model. To demonstrate the power of our fast, greedy learning algorithm, we used it to
initialize the weights for a much slower fine-tuning algorithm
thatlearnsanexcellentgenerativemodelofdigitimagesandtheirlabels.It
isnotclearthatthisisthebestwaytousethefast,greedyalgorithm.Itmight bebettertoomitthefine-
tuningandusethespeedofthegreedyalgorithm to learn an ensemble of larger, deeper networks or a
much larger training set. The network in Figure 1 has about as many parameters as 0.002 cubic
millimeters of mouse cortex (Horace Barlow, personal communication, 1999), and several
hundred networks of this complexity could fit within a single voxel of a high-resolution fMRI
scan. This suggests that much bigger networks may be required to compete with human shape
recognition abilities. Ourcurrentgenerativemodelislimitedinmanyways(Lee&Mumford,
2003).Itisdesignedforimagesinwhichnonbinaryvaluescanbetreatedas
probabilities(whichisnotthecasefornaturalimages);itsuseoftop-down feedback during perception
is limited to the associative memory in the top two layers; it does not have a systematic way of
dealing with perceptual invariances;itassumesthatsegmentationhasalreadybeenperformed;and it
does not learn to sequentially attend to the most informative parts of
objectswhendiscriminationisdifficult.Itdoes,however,illustratesomeof the major advantages of
generative models as compared to discriminative ones:
Generative models can learn low-level features without requiring feedback from the label, and
they can learn many more parameters than discriminative models without overfitting. In
discriminative learning, each training case constrains the parameters only by as many bits of
information as are required to specify the label. For a generative model, each training case
constrains the parameters by the number of bits required to specify the input. It is easy to see
what the network has learned by generating from its model. It is possible to interpret the
nonlinear, distributed representations in the deep hidden layers by generating images from them.
The superior classification performance of discriminative learning methods holds only for
domains in which it is not possible to learn a good generative model. This set of domains is
being eroded by Moore’s law.
P(x|y)=
1 (y)
exp j
j(x, yj)+β(x)
=exp j
, (A.1)
where is the normalization term. For this assertion to hold, we
need to assume positivity of distributions: that both P(y) > 0 andP(x|y) > 0 for
everyvalueofyandx.Thecorrespondingfamilyofcomplementarypriors then assumes the form
P(y)=
1C
αj(yj)
, (A.2)
where C is a constant to ensure normalization. This combination of functional forms leads to the
following expression for the joint,
P(x,y)=
1C
exp j
j(x, yj)+β(x)+j
αj(yj)
. (A.3)
To prove our assertion, we need to show that every likelihood function of form equation A.1
admits a complementary prior and vice versa. First, it can be directly verified that equation A.2 is
a complementary prior for the likelihood functions of equation A.1. To show the converse, let us
assume that P(y) is a complementary prior for some likelihood function
P(x|y).Noticethatthefactorialformoftheposteriorsimplymeansthatthe
joint distribution P(x,y)= P(y)P(x|y) satisfies the following set of conditional independencies: yj
⊥⊥ yk |x for every j =k. This set of conditional independencies corresponds exactly to the
relations satisfied by an undirected graphical model having edges between every hidden and
observed variable and among all observed variables. By the Hammersley-Clifford theorem and
using our positivity assumption, the joint distribution must be of the form of equation A.3, and
the forms for the likelihood function equation A.1 and prior equation A.2 follow from this.
A.2 ComplementarityforInfiniteStacks. Wenowconsiderasubsetof
modelsoftheforminequationA.3forwhichthelikelihoodalsofactorizes. This means that we now
have two sets of conditional independencies: P(x|y)=
i P(xi|y) (A.4) P(y|x)=
j P(yj|x). (A.5)
P(x,y)=
1Z
exp i,j
i,j(xi, yj)+i
γi(xi)+j
αj(yj)
, (A.6)
while the likelihood functions take on the form P(x|y)=exp i,j i,j(xi, yj)+ i
γi(xi)−log (y)
. (A.7)
Although it is not immediately obvious, the marginal distribution over the observables, x, in
equation A.6 can also be expressed as an infinite directed model in which the parameters defining
the conditional distributions between layers are tied together.
Anintuitivewayofvalidatingthisassertionisasfollows.Consideroneof
themethodsbywhichwemightdrawsamplesfromthemarginaldistribution
P(x)impliedbyequationA.6.Startingfromanarbitraryconfiguration of y, we would iteratively
perform Gibbs sampling using, in alternation, the distributions given in equations A.4 and A.5. If
we run this Markov chain for long enough, then, under the mild assumption that the chain
mixes properly, we will eventually obtain unbiased samples from the joint distribution given in
equation A.6. Now let us imagine that we unroll this sequence of Gibbs updates in
space,suchthatweconsidereachparallelupdateofthevariablestoconstitutestatesofaseparatelayerinag
raph.Thisunrolledsequenceofstateshas a purely directed structure (with conditional distributions
taking the form of equations A.4 and A.5 and in alternation). By equivalence to the Gibbs
sampling scheme, after many layers in such an unrolled graph, adjacent pairs of layers will have
a joint distribution as given in equation A.6. We can formalize the above intuition for unrolling
the graph as follows. Thebasicideaistounrollthegraph“upwards”(i.e.,movingawayfromthe
data),sothatwecanputawell-defineddistributionovertheinfinitestackof
variables.Thenweverifysomesimplemarginalandconditionalproperties
ofthejointdistributionandthusdemonstratetherequiredpropertiesofthe graph in the “downwards”
direction. Let x=x(0),y=y(0),x(1),y(1),x(2),y(2),...be a sequence (stack) of variables, the first two
of which are identified as our original observed and hidden variable. Define the functions
f(x
,y
)=
1Z
exp i,j
i,j(x
i, y
i)+i
γi(x
i)+j
αj(y
j)
(A.8)
fx(x
)=y
f(x
,y
) (A.9)
fy(y
)=x
f(x
,y
) (A.10)
gx(x
|y
)= f(x
,y
)/fy(y
) (A.11) gy(y
|x
)= f(x
,y
)/fx(x
), (A.12)
and define a joint distribution over our sequence of variables as follows: P(x(0),y(0))=
fx(0),y(0) (A.13)
P(x(i)|y(i−1))=gxx(i)|y(i−1) i =1,2,... (A.14)
P(y(i)|x(i))=gyy(i)|x(i) . i =1,2,... (A.15) We verify by induction that
the distribution has the following marginal distributions: P(x(i))=
fxx(i) i =0,1,2,... (A.16) P(y(i))=
fyy(i) i =0,1,2,... (A.17)
fx(i),y(i−1) fyy(i−1)
\% UP-DOWN ALGORITHM \% \% the data and all biases are row vectors. \% the generative
model is: lab <--> top <--> pen --> hid --> vis \% the number of units in layer foo is numfoo \%
weight matrices have names fromlayer tolayer \% "rec" is for recognition biases and "gen" is for
generative \% biases. \% for simplicity, the same learning rate, r, is used everywhere.
Acknowledgments
We thank Peter Dayan, Zoubin Ghahramani, Yann Le Cun, Andriy Mnih, Radford Neal, Terry
Sejnowski, and Max Welling for helpful discussions and the referees for greatly improving the
manuscript. The research was supported by NSERC, the Gatsby Charitable Foundation, CFI, and
OIT. G.E.H. is a fellow of the Canadian Institute for Advanced Research and holds a Canada
Research Chair in machine learning.
Bibliography
Belongie, S., Malik, J., & Puzicha, J. (2002). Shape matching and object
recognition using shape contexts. IEEE Transactions on Pattern Analysis
and Machine Intelligence, 24(4), 509–522. Carreira-Perpinan, M. A., &
Hinton, G. E. (2005). On contrastive divergence learning. In R. G.
Cowell & Z. Ghahramani (Eds.), Artificial Intelligence and Statistics,
2005. (pp. 33–41). Fort Lauderdale, FL: Society for Artificial
Intelligence and Statistics. Decoste, D., & Schoelkopf, B. (2002).
Training invariant support vector machines, Machine Learning, 46, 161–
190. Freund, Y. (1995). Boosting a weak learning algorithm by majority.
Information and Computation, 12(2), 256–285.
Friedman,J.,&Stuetzle,W.(1981).Projectionpursuitregression.Journalofth
eAmerican Statistical Association, 76, 817–823. Hinton, G. E. (2002).
Training products of experts by minimizing contrastive divergence,
Neural Computation, 14(8), 1711–1800. Hinton, G. E., Dayan, P., Frey,
B. J., & Neal, R. (1995). The wake-sleep algorithm for self-organizing
neural networks. Science, 268, 1158–1161. LeCun, Y., Bottou, L., &
Haffner, P. (1998). Gradient-based learning applied to document
recognition. Proceedings of the IEEE, 86(11), 2278–2324.
Lee,T.S.,&Mumford,D.(2003).HierarchicalBayesianinferenceinthevisual
cortex. Journal of the Optical Society of America, A, 20, 1434–1448.
Marks, T. K., & Movellan, J. R. (2001). Diffusion networks, product of
experts, and factor analysis. In T. W. Lee, T.-P. Jung, S. Makeig, & T. J.
Sejnowski (Eds.), Proc. Int. Conf. on Independent Component Analysis
(pp. 481–485). San Diego. Mayraz, G., & Hinton, G. E. (2001).