view algorithms/sgd.py @ 479:fbfd3932fd00

typo
author James Bergstra <bergstrj@iro.umontreal.ca>
date Mon, 27 Oct 2008 17:28:48 -0400
parents 8ff412852d66
children
line wrap: on
line source


from theano.compile import module
from theano import tensor as T

class StochasticGradientDescent(module.FancyModule):
    def __init__(self, params, gparams, lr=None):
        super(StochasticGradientDescent, self).__init__()

        self.lr = lr if lr is not None else module.Member(T.dscalar())
        self.params = params
        self.gparams = gparams

        self.updates = dict((p, p - self.lr * g) for p, g in zip(self.params, self.gparams))