changeset 551:7de7fa19fb9b

added WEIRD_STUFF flag to sgd. Relates to theano ticket 238
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 27 Nov 2008 23:27:14 -0500
parents b52c1a8811a6
children 4afb07de33ee
files pylearn/algorithms/sgd.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sgd.py	Thu Nov 27 23:16:52 2008 -0500
+++ b/pylearn/algorithms/sgd.py	Thu Nov 27 23:27:14 2008 -0500
@@ -6,6 +6,8 @@
 
 from .minimizer import minimizer_factory
 
+WEIRD_STUFF = True
+
 class StochasticGradientDescent(module.FancyModule):
     """Fixed stepsize gradient descent"""
     def __init__(self, args, cost, params, gradients=None, stepsize=None):
@@ -22,7 +24,8 @@
         elif isinstance(stepsize, T.TensorResult):
             self.stepsize = stepsize
         else:
-            if 1: #TODO: why is this necessary? why does the else clause not work?
+            if WEIRD_STUFF:
+                #TODO: why is this necessary? why does the else clause not work?
                 self.stepsize = module.Member(T.dscalar())
                 self.stepsize_init = stepsize
             else:
@@ -43,7 +46,7 @@
                 args, cost,
                 updates=self.updates)
     def _instance_initialize(self, obj):
-        if 1:
+        if WEIRD_STUFF:
             obj.stepsize = self.stepsize_init
         else:
             pass