Mercurial > pylearn
comparison algorithms/logistic_regression.py @ 472:69c800af1370
changed weight initialization for logistic regression
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Thu, 23 Oct 2008 13:26:42 -0400 |
parents | bd937e845bbb |
children | 31acd42b2b0b |
comparison
equal
deleted
inserted
replaced
471:45b3eb429c15 | 472:69c800af1370 |
---|---|
8 import numpy as N | 8 import numpy as N |
9 | 9 |
10 | 10 |
11 class Module_Nclass(module.FancyModule): | 11 class Module_Nclass(module.FancyModule): |
12 class __instance_type__(module.FancyModuleInstance): | 12 class __instance_type__(module.FancyModuleInstance): |
13 def initialize(self, n_in, n_out, rng=N.random): | 13 def initialize(self, n_in, n_out): |
14 #self.component is the LogisticRegressionTemplate instance that built this guy. | 14 #self.component is the LogisticRegressionTemplate instance that built this guy. |
15 | 15 |
16 self.w = rng.randn(n_in, n_out) | 16 self.w = N.zeros((n_in, n_out)) |
17 self.b = rng.randn(n_out) | 17 self.b = N.zeros(n_out) |
18 self.lr = 0.01 | 18 self.lr = 0.01 |
19 self.__hide__ = ['params'] | 19 self.__hide__ = ['params'] |
20 | 20 |
21 def __init__(self, x=None, targ=None, w=None, b=None, lr=None): | 21 def __init__(self, x=None, targ=None, w=None, b=None, lr=None): |
22 super(Module_Nclass, self).__init__() #boilerplate | 22 super(Module_Nclass, self).__init__() #boilerplate |