提交 ea44df9c authored 作者: Frederic Bastien's avatar Frederic Bastien

added seed option to module. This allow to compare differenc version of the module.

上级 fa6bd29f
...@@ -12,11 +12,12 @@ import numpy as N ...@@ -12,11 +12,12 @@ import numpy as N
class LogisticRegressionN(module.FancyModule): class LogisticRegressionN(module.FancyModule):
class InstanceType(module.FancyModuleInstance): class InstanceType(module.FancyModuleInstance):
def initialize(self, n_in, n_out): def initialize(self, n_in, n_out, seed = None):
#self.component is the LogisticRegressionTemplate instance that built this guy. #self.component is the LogisticRegressionTemplate instance that built this guy.
rng = N.random.RandomState(seed)
self.w = N.random.randn(n_in, n_out) self.w = rng.randn(n_in, n_out)
self.b = N.random.randn(n_out) self.b = rng.randn(n_out)
self.lr = 0.01 self.lr = 0.01
self.__hide__ = ['params'] self.__hide__ = ['params']
...@@ -48,11 +49,13 @@ class LogisticRegressionN(module.FancyModule): ...@@ -48,11 +49,13 @@ class LogisticRegressionN(module.FancyModule):
class LogisticRegression2(module.FancyModule): class LogisticRegression2(module.FancyModule):
class InstanceType(module.FancyModuleInstance): class InstanceType(module.FancyModuleInstance):
def initialize(self, n_in): def initialize(self, n_in, seed = 1827):
#self.component is the LogisticRegressionTemplate instance that built this guy. #self.component is the LogisticRegressionTemplate instance that built this guy.
self.w = N.random.randn(n_in,1) rng = N.random.RandomState(seed)
self.b = N.random.randn(1)
self.w = rng.randn(n_in, 1)
self.b = rng.randn(1)
self.lr = 0.01 self.lr = 0.01
self.__hide__ = ['params'] self.__hide__ = ['params']
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论