Mercurial > pylearn
changeset 520:82bafb80ba65
merge
author | Joseph Turian <turian@iro.umontreal.ca> |
---|---|
date | Fri, 14 Nov 2008 02:09:23 -0500 |
parents | b267a8000f92 (diff) 4aa7f74ea93f (current diff) |
children | 2bef0768bc27 |
files | |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/algorithms/logistic_regression.py Wed Nov 12 12:36:09 2008 -0500 +++ b/algorithms/logistic_regression.py Fri Nov 14 02:09:23 2008 -0500 @@ -8,7 +8,7 @@ import numpy as N class LogRegInstanceType(module.FancyModuleInstance): - def initialize(self, n_in, n_out=1, rng=N.random, seed=None): + def initialize(self, n_in, n_out, lr, seed): #self.component is the LogisticRegressionTemplate instance that built this guy. """ @todo: Remove seed. Used only to keep Stacker happy. @@ -16,7 +16,7 @@ self.w = N.zeros((n_in, n_out)) self.b = N.zeros(n_out) - self.lr = 0.01 + self.lr = lr self.__hide__ = ['params'] self.input_dimension = n_in self.output_dimension = n_out @@ -27,12 +27,12 @@ def __init__(self, x=None, targ=None, w=None, b=None, lr=None, regularize=False): super(Module_Nclass, self).__init__() #boilerplate - self.x = x if x is not None else T.matrix('input') - self.targ = targ if targ is not None else T.lvector() + self.x = module.Member(x) if x is not None else T.matrix('input') + self.targ = module.Member(targ) if targ is not None else T.lvector() - self.w = w if w is not None else module.Member(T.dmatrix()) - self.b = b if b is not None else module.Member(T.dvector()) - self.lr = lr if lr is not None else module.Member(T.dscalar()) + self.w = module.Member(w) if w is not None else module.Member(T.dmatrix()) + self.b = module.Member(b) if b is not None else module.Member(T.dvector()) + self.lr = module.Member(lr) if lr is not None else module.Member(T.dscalar()) self.params = [p for p in [self.w, self.b] if p.owner is None] @@ -77,12 +77,12 @@ def __init__(self, input=None, targ=None, w=None, b=None, lr=None, regularize=False): super(Module, self).__init__() #boilerplate - self.input = input if input is not None else T.matrix('input') - self.targ = targ if targ is not None else T.lcol() + self.input = module.Member(input) if input is not None else T.matrix('input') + self.targ = module.Member(targ) if targ is not None else T.lcol() - self.w = w if w is not None else module.Member(T.dmatrix()) - self.b = b if b is not None else module.Member(T.dvector()) - self.lr = lr if lr is not None else module.Member(T.dscalar()) + self.w = module.Member(w) if w is not None else module.Member(T.dmatrix()) + self.b = module.Member(b) if b is not None else module.Member(T.dvector()) + self.lr = module.Member(lr) if lr is not None else module.Member(T.dscalar()) self.params = [p for p in [self.w, self.b] if p.owner is None]