changeset 801:0772b76c806d

redifinition of saturation monitoring instance methods DAA_inputs_groups
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Thu, 23 Jul 2009 12:25:47 -0400
parents 49ba5d622c3a
children a18b87ca33e6
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Jul 21 17:22:20 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Thu Jul 23 12:25:47 2009 -0400
@@ -756,7 +756,7 @@
     def _instance_load(self,inst,save_dir='',coef = None, Sup_layer = None):
         
         if coef is None:
-            coef = [1]*self.depth
+            coef = [1.]*self.depth
             
         for i in range(self.depth):
             inst.daaig[i].benc = load_mat('benc%s.ft'%(i), save_dir)/coef[i]
@@ -764,19 +764,19 @@
             if self.daaig[i].auxinput is not None:
                 for j in range(len(inst.daaig[i].wauxenc)):
                     inst.daaig[i].wauxenc[j] = load_mat('wauxenc%s_%s.ft'%(i,j),save_dir)/coef[i]
-                    inst.daaig[i].bauxdec[j] = load_mat('bauxdec%s_%s.ft'%(i,j),save_dir)/coef[i]
+                    inst.daaig[i].bauxdec[j] = load_mat('bauxdec%s_%s.ft'%(i,j),save_dir)
             
             if self.daaig[i].input is not None:
                 inst.daaig[i].wenc = load_mat('wenc%s.ft'%(i),save_dir)/coef[i]
-                inst.daaig[i].bdec = load_mat('bdec%s.ft'%(i),save_dir)/coef[i]
+                inst.daaig[i].bdec = load_mat('bdec%s.ft'%(i),save_dir)
             
             if not self.daaig[i].tie_weights:
                 if self.daaig[i].auxinput is not None:
                     for j in range(len(inst.daaig[i].wauxdec)):
-                        inst.daaig[i].wauxdec[j] = load_mat('wauxdec%s_%s.ft'%(i,j),save_dir)/coef[i]
+                        inst.daaig[i].wauxdec[j] = load_mat('wauxdec%s_%s.ft'%(i,j),save_dir)
                 
                 if self.daaig[i].input is not None:
-                    inst.daaig[i].wdec = load_mat('wdec%s.ft'%(i),save_dir)/coef[i]
+                    inst.daaig[i].wdec = load_mat('wdec%s.ft'%(i),save_dir)
         i=i+1
         if Sup_layer is None:
             inst.daaig[i].w = load_mat('wenc%s.ft'%(i),save_dir)
@@ -785,8 +785,11 @@
             inst.daaig[i].w = load_mat('wenc%s.ft'%(Sup_layer),save_dir)
             inst.daaig[i].b = load_mat('benc%s.ft'%(Sup_layer),save_dir)
     
-    def _instance_checksaturation(self,inst,layer,inputs):
-        return numpy.mean(numpy.median(abs(inst.representation[layer](*inputs)),1))
+    def _instance_hidsaturation(self,inst,layer,inputs):
+        return numpy.mean(numpy.median(abs(inst.activation[layer](*inputs)),1))
+    
+    def _instance_recsaturation(self,inst,layer,inputs):
+        return numpy.mean(numpy.median(abs(inst.recactivation[layer](*inputs)),1))
     
     def _instance_noiseseed(self,inst,seed):
         scannoise.R.rand.seed(seed)
@@ -817,5 +820,3 @@
                         cost[layer] = inst.globalupdate[i](*data)
         if printcost:
             print cost
-    
-