changeset 857:bd7d540db70d

sum change to mean for logistic regression cost over mini-batches for LogReg2
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Mon, 09 Nov 2009 16:12:09 -0500
parents 0cfbaf0c598d
children 3a68b6936303 fafe796ad5ff
files pylearn/algorithms/logistic_regression.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/logistic_regression.py	Mon Nov 09 15:57:00 2009 -0500
+++ b/pylearn/algorithms/logistic_regression.py	Mon Nov 09 16:12:09 2009 -0500
@@ -245,12 +245,12 @@
 
         output = nnet.sigmoid(T.dot(self.x, self.w) + self.b)
         xent = -self.targ * T.log(output) - (1.0 - self.targ) * T.log(1.0 - output)
-        sum_xent = T.sum(xent)
+        mean_xent = T.mean(xent)
 
         self.output = output
         self.xent = xent
-        self.sum_xent = sum_xent
-        self.cost = sum_xent
+        self.mean_xent = mean_xent
+        self.cost = mean_xent
 
         #define the apply method
         self.pred = (T.dot(self.input, self.w) + self.b) > 0.0
@@ -258,8 +258,8 @@
 
         #if this module has any internal parameters, define an update function for them
         if self.params:
-            gparams = T.grad(sum_xent, self.params)
-            self.update = module.Method([self.input, self.targ], sum_xent,
+            gparams = T.grad(mean_xent, self.params)
+            self.update = module.Method([self.input, self.targ], mean_xent,
                                         updates = dict((p, p - self.lr * g) for p, g in zip(self.params, gparams)))