changeset 808:316817114b15

small changes for quadratic and global update DAA input groups
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Tue, 11 Aug 2009 18:37:22 -0400
parents 96d5114b7a8e
children a66bef83e1fd
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Mon Aug 10 19:12:11 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Aug 11 18:37:22 2009 -0400
@@ -9,6 +9,7 @@
         scanmaskenc,scanmaskdec, FillMissing, mask_gradient
 
 from pylearn.algorithms.logistic_regression import LogRegN
+import pylearn.algorithms.cost
 
 from pylearn.io import filetensor
 import os
@@ -613,7 +614,7 @@
             if self.regularize:
                 self.regularizationenccost[i] = self.regularizationenccost[i-1]+self.daaig[i-1].regularizationenc if i else 0
                 self.localcost[i] += self.daaig[i].regularization
-                self.globalcost[i] += self.regularizationenccost[i]
+                self.globalcost[i] += self.regularizationenccost[i] + self.daaig[i].regularization
                 if self.totalupdatebool:
                     self.totalcost[i] += self.daaig[i].regularization
             
@@ -866,12 +867,12 @@
                     for i in range(self.depth):
                         if typeup == 'local':
                             cost[i] = inst.localupdate[i](*data[i])
-                        if typeup == 'global':
+                        else:
                             cost[i] = inst.globalupdate[i](*data[i])
                 else:
                     if typeup == 'local':
                         cost[layer] = inst.localupdate[layer](*data)
-                    if typeup == 'global':
+                    else:
                         cost[layer] = inst.globalupdate[layer](*data)
         if printcost:
             print cost