Mercurial > pylearn
comparison algorithms/sgd.py @ 477:8ff412852d66
added sgd
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Fri, 24 Oct 2008 13:28:00 -0400 |
parents | |
children | fbfd3932fd00 |
comparison
equal
deleted
inserted
replaced
475:11e0357f06f4 | 477:8ff412852d66 |
---|---|
1 | |
2 from theano.compile import module | |
3 | |
4 class StochasticGradientDescent(module.FancyModule): | |
5 def __init__(self, params, gparams, lr=None): | |
6 super(StochasticGradientDescent, self).__init__() | |
7 | |
8 self.lr = lr if lr is not None else module.Member(T.dscalar()) | |
9 self.params = params | |
10 self.gparams = gparams | |
11 | |
12 self.updates = dict((p, p - self.lr * g) for p, g in zip(self.params, self.gparams)) | |
13 |