changeset 778:a985baadf74d

Merge
author Foo Bar <barfoo@iro.umontreal.ca>
date Sat, 13 Jun 2009 22:02:13 -0400
parents ba055d419bcf (diff) 72ce8288a283 (current diff)
children 2c159439c47c
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Thu Jun 11 15:44:32 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Sat Jun 13 22:02:13 2009 -0400
@@ -558,7 +558,7 @@
                 self.totalupdate[i] = theano.Method(self.inputs[i],self.totalcost[i],total_grads)
             #
             if self.debugmethod:
-                self.representation[i] = theano.Method(self.inputs[i],self.daaig[i].clean.hidden)
+                self.representation[i] = theano.Method(self.inputs[i],self.daaig[i].clean.hidden_activation)
                 self.reconstruction[i] = theano.Method(self.inputs[i],self.daaig[i].clean.rec)
                 self.validate[i] =theano.Method(self.inputs[i], [self.daaig[i].clean.cost, self.daaig[i].clean.rec])
                 self.noisyinputs[i] =theano.Method(self.inputs[i], noisyout)
@@ -640,8 +640,13 @@
         for i in range(self.depth):
             print '\tLayer = ', i+1
             inst.daaig[i].initialize(reg_coef = reg_coef, noise_level = noise_level,\
-                    noise_level_group = noise_level_group, seed = seed, alloc = alloc)
+                    noise_level_group = noise_level_group, seed = seed + i, alloc = alloc)
         print '\tLayer supervised'
         inst.daaig[-1].initialize()
+        if alloc:
+            inst.daaig[-1].R = numpy.random.RandomState(seed+self.depth)
+            # init the logreg weights
+            inst.daaig[-1].w = inst.daaig[-1].R.uniform(size=inst.daaig[-1].w.shape,\
+                                low = -1/numpy.sqrt(inst.daaig[-2].n_hid), high = 1/numpy.sqrt(inst.daaig[-2].n_hid))
         inst.daaig[-1].l1 = 0
         inst.daaig[-1].l2 = reg_coef #only l2 norm for regularisation to be consitent with the unsup regularisation