changeset 668:15a317a02f08

added sgd_minimizer back into sgd
author James Bergstra <bergstrj@iro.umontreal.ca>
date Mon, 30 Mar 2009 15:44:42 -0400
parents 719194960d18
children d17ebf9ac8c0
files pylearn/algorithms/sgd.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sgd.py	Mon Mar 30 12:26:01 2009 -0400
+++ b/pylearn/algorithms/sgd.py	Mon Mar 30 15:44:42 2009 -0400
@@ -38,3 +38,11 @@
     def _instance_initialize(self, obj):
         pass
 
+def sgd_minimizer(stepsize=None):
+    """Curry the stepsize argument to StochasticGradientDescent, providing standard minimizer interface
+    
+    :returns: standard minimizer constructor f(args, cost, params, gradient=None)
+    """
+    def f(args, cost, params, gradient=None):
+        return StochasticGradientDescent(args, cost, params, gradient, stepsize)
+    return f