Skip to content

Commit 69c8ee9

Browse files
committed
Merge branch 'master' of git@github.com:lisa-lab/DeepLearningTutorials
2 parents f84b517 + e495a6c commit 69c8ee9

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

code/SdA.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ def __init__(self, n_visible= 784, n_hidden= 500, input= None):
207207
# Equation (3)
208208
self.z = T.nnet.sigmoid(T.dot(self.y, self.W_prime) + self.b_prime)
209209
# Equation (4)
210+
# note : we sum over the size of a datapoint; if we are using minibatches,
211+
# L will be a vector, with one entry per example in minibatch
210212
self.L = - T.sum( self.x*T.log(self.z) + (1-self.x)*T.log(1-self.z), axis=1 )
211213
# note : L is now a vector, where each element is the cross-entropy cost
212214
# of the reconstruction of the corresponding example of the
@@ -260,17 +262,13 @@ def __init__(self, input, n_ins, hidden_layers_sizes, n_outs):
260262
# input size is that of the previous layer
261263
# input is the output of the last layer inserted in our list
262264
# of layers `self.layers`
263-
print i
264-
print theano.pp(self.layers[-1].hidden_values)
265265
layer = dA( hidden_layers_sizes[i-1], \
266266
hidden_layers_sizes[i], \
267267
input = self.layers[-1].hidden_values )
268268
self.layers += [layer]
269269

270270

271271
self.n_layers = len(self.layers)
272-
print '------------------------------------------'
273-
print theano.pp(self.layers[-1].hidden_values)
274272
# now we need to use same weights and biases to define an MLP
275273
# We can simply use the `hidden_values` of the top layer, which
276274
# computes the input that we would normally feed to the logistic
@@ -302,7 +300,7 @@ def errors(self, y):
302300

303301

304302

305-
def sgd_optimization_mnist( learning_rate=0.1, pretraining_epochs = 10, \
303+
def sgd_optimization_mnist( learning_rate=0.1, pretraining_epochs = 15, \
306304
pretraining_lr = 0.1, training_epochs = 1000, dataset='mnist.pkl.gz'):
307305
"""
308306
Demonstrate stochastic gradient descent optimization for a multilayer
@@ -357,7 +355,7 @@ def shared_dataset(data_xy):
357355

358356
# construct the logistic regression class
359357
classifier = SdA( input=x, n_ins=28*28, \
360-
hidden_layers_sizes = [700, 700, 700], n_outs=10)
358+
hidden_layers_sizes = [1000, 1000, 1000], n_outs=10)
361359

362360
## Pre-train layer-wise
363361
for i in xrange(classifier.n_layers):
@@ -383,7 +381,7 @@ def shared_dataset(data_xy):
383381
# go through the training set
384382
for batch_index in xrange(n_train_batches):
385383
c = layer_update(batch_index)
386-
print 'Pre-training layer %i, epoch %d'%(i,epoch),c
384+
print 'Pre-training layer %i, epoch %d'%(i,epoch),c[0]
387385

388386

389387

@@ -458,10 +456,8 @@ def shared_dataset(data_xy):
458456
iter = epoch * n_train_batches + minibatch_index
459457

460458
if (iter+1) % validation_frequency == 0:
461-
print cost_ij
462459
cost_ij = []
463460
validation_losses = [validate_model(i) for i in xrange(n_valid_batches)]
464-
print validation_losses
465461
this_validation_loss = numpy.mean(validation_losses)
466462
print('epoch %i, minibatch %i/%i, validation error %f %%' % \
467463
(epoch, minibatch_index+1, n_train_batches, \

doc/SdA.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,7 @@ TODO
433433
References
434434
++++++++++
435435

436-
.. [Vincent08] Vincent, P., Larochelle H., Bengio Y. and Manzagol P.A.
437-
(2008). Extracting and Composing Robust Features with Denoising
438-
Autoencoders. ICML'08, pp. 1096 - 1103
436+
.. [Vincent08] Vincent, P., Larochelle H., Bengio Y. and Manzagol P.A.(2008).Extracting and Composing Robust Features with Denoising Autoencoders. ICML'08, pp. 1096 - 1103
439437

440-
.. [Bengio07] Bengio Y., Lamblin P., Popovici D. and Larochelle H.
441-
(2007). Greedy Layer-Wise Training of Deep Networks. NIPS'06, pp
442-
153-160
438+
.. [Bengio07] Bengio Y., Lamblin P., Popovici D. and Larochelle H.(2007). Greedy Layer-Wise Training of Deep Networks. NIPS'06, pp 153-160
443439

0 commit comments

Comments
 (0)