Mercurial > pylearn
comparison algorithms/stacker.py @ 498:2be795cc5c3a
More documentation + todo
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Tue, 28 Oct 2008 12:25:15 -0400 |
parents | bb6bdd3b7ff3 |
children | c7ce66b4e8f4 |
comparison
equal
deleted
inserted
replaced
497:a272f4cbf004 | 498:2be795cc5c3a |
---|---|
4 import sys | 4 import sys |
5 import numpy as N | 5 import numpy as N |
6 | 6 |
7 class Stacker(T.RModule): | 7 class Stacker(T.RModule): |
8 """ | 8 """ |
9 @note: Assumes some names in the layers: input, cost, lr, and update | |
9 @todo: Maybe compile functions on demand, rather than immediately. | 10 @todo: Maybe compile functions on demand, rather than immediately. |
10 """ | 11 """ |
11 | 12 |
12 def __init__(self, submodules, input = None, regularize = False): | 13 def __init__(self, submodules, input = None, regularize = False): |
13 super(Stacker, self).__init__() | 14 super(Stacker, self).__init__() |
44 # this layer's cost | 45 # this layer's cost |
45 dict((param, param - layer.lr * T.grad(layer.cost, param)) | 46 dict((param, param - layer.lr * T.grad(layer.cost, param)) |
46 for param in to_update), | 47 for param in to_update), |
47 list(all_kits))) | 48 list(all_kits))) |
48 | 49 |
50 # @todo: Add diagnostics | |
51 # self.diagnose_from_input = Method([self.input], self.layers[0].diagnose.outputs + self.layers[1].diagnose.outputs ... | |
52 | |
49 self.local_update = local_update | 53 self.local_update = local_update |
50 self.global_update = global_update | 54 self.global_update = global_update |
51 self.update = self.global_update[-1] | 55 self.update = self.global_update[-1] |
52 self.compute = theano.Method(self.input, self.output) | 56 self.compute = theano.Method(self.input, self.output) |
53 ll = self.layers[-1] | 57 ll = self.layers[-1] |