changeset 491:180d125dc7e2

made logistic_regression classes compatible with stacker
author Olivier Breuleux <breuleuo@iro.umontreal.ca>
date Tue, 28 Oct 2008 11:39:27 -0400
parents 2c4738e5e4b2
children 6dfdcee64e9b
files algorithms/logistic_regression.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/algorithms/logistic_regression.py	Tue Oct 28 00:23:53 2008 -0400
+++ b/algorithms/logistic_regression.py	Tue Oct 28 11:39:27 2008 -0400
@@ -18,7 +18,7 @@
             self.lr = 0.01
             self.__hide__ = ['params']
 
-    def __init__(self, x=None, targ=None, w=None, b=None, lr=None):
+    def __init__(self, x=None, targ=None, w=None, b=None, lr=None, regularize=False):
         super(Module_Nclass, self).__init__() #boilerplate
 
         self.x = x if x is not None else T.matrix()
@@ -36,6 +36,7 @@
 
         self.y = y
         self.sum_xent = sum_xent
+        self.cost = sum_xent
 
         #define the apply method
         self.pred = T.argmax(T.dot(self.x, self.w) + self.b, axis=1)
@@ -57,7 +58,7 @@
             self.lr = 0.01
             self.__hide__ = ['params']
 
-    def __init__(self, x=None, targ=None, w=None, b=None, lr=None):
+    def __init__(self, x=None, targ=None, w=None, b=None, lr=None, regularize=False):
         super(Module, self).__init__() #boilerplate
 
         self.x = x if x is not None else T.matrix()
@@ -76,6 +77,7 @@
         self.y = y
         self.xent = xent
         self.sum_xent = sum_xent
+        self.cost = sum_xent
 
         #define the apply method
         self.pred = (T.dot(self.x, self.w) + self.b) > 0.0