changeset 914:519e82748a55

logreg - added name parameter and autonaming of logreg shared variables
author James Bergstra <bergstrj@iro.umontreal.ca>
date Fri, 19 Mar 2010 17:54:45 -0400
parents 7edb78ba4c5b
children 5cb947647432
files pylearn/shared/layers/logreg.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/shared/layers/logreg.py	Thu Mar 18 15:39:32 2010 -0400
+++ b/pylearn/shared/layers/logreg.py	Fri Mar 19 17:54:45 2010 -0400
@@ -15,12 +15,14 @@
         update_locals(self, locals())
 
     @classmethod
-    def new(cls, input, n_in, n_out, dtype=None):
+    def new(cls, input, n_in, n_out, dtype=None, name=None):
         if dtype is None:
             dtype = input.dtype
+        if name is None:
+            name = cls.__name__
         cls._debug('allocating params w, b', n_in, n_out, dtype)
-        w = shared(numpy.zeros((n_in, n_out), dtype=dtype))
-        b = shared(numpy.zeros((n_out,), dtype=dtype))
+        w = shared(numpy.zeros((n_in, n_out), dtype=dtype), name='%s.w'%name)
+        b = shared(numpy.zeros((n_out,), dtype=dtype), name='%s.b'%name)
         return cls(input, w, b, params=[w,b])