changeset 804:5e3b7dd6f96a

load mecanism no Tie model from Tie model for DAA_input_groups
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Tue, 28 Jul 2009 11:50:07 -0400
parents 86b007959ceb
children c61d775f4f95
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Jul 28 10:07:01 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Jul 28 11:50:07 2009 -0400
@@ -55,6 +55,8 @@
 def PCAinit(data,nhid):
     pass
 
+#-----------------------------------------------------------------
+
 # Initialize containers:
 class CreateContainer:
     pass
@@ -776,10 +778,18 @@
             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)/coefdec[i]
+                        if 'wauxdec%s_%s.ft'%(i,j) in os.listdir(save_dir):
+                            inst.daaig[i].wauxdec[j] = load_mat('wauxdec%s_%s.ft'%(i,j),save_dir)/coefdec[i]
+                        else:
+                            print "WARNING: no decoding 'wauxdec%s_%s.ft' file use 'wauxenc%s_%s.ft' instead"%(i,j,i,j)
+                            inst.daaig[i].wauxdec[j] = numpy.transpose(load_mat('wauxenc%s_%s.ft'%(i,j),save_dir)/coefdec[i])
                 
                 if self.daaig[i].input is not None:
-                    inst.daaig[i].wdec = load_mat('wdec%s.ft'%(i),save_dir)/coefdec[i]
+                    if 'wdec%s.ft'%(i) in os.listdir(save_dir):
+                        inst.daaig[i].wdec = load_mat('wdec%s.ft'%(i),save_dir)/coefdec[i]
+                    else:
+                        print "WARNING: no decoding 'wdec%s.ft' file use 'wenc%s.ft' instead"%(i,i)
+                        inst.daaig[i].wdec = numpy.transpose(load_mat('wenc%s.ft'%(i),save_dir)/coefdec[i])
         i=i+1
         if Sup_layer is None:
             inst.daaig[i].w = load_mat('wenc%s.ft'%(i),save_dir)