From c272e7a38166d9e4560b4501236394025d4e5473 Mon Sep 17 00:00:00 2001 From: Xavier Audier Date: Thu, 26 Mar 2015 09:59:21 +0100 Subject: [PATCH] Allowing modification of learning rate for mu mu should be able to have a learning rate different from 1/sharing. --- pylearn2/models/dbm/layer.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pylearn2/models/dbm/layer.py b/pylearn2/models/dbm/layer.py index 99a69e5f3c..b636ff5987 100644 --- a/pylearn2/models/dbm/layer.py +++ b/pylearn2/models/dbm/layer.py @@ -2045,6 +2045,7 @@ class GaussianVisLayer(VisibleLayer): locations, ie mu should be a vector with one elem per channel bias_from_marginals : WRITEME beta_lr_scale : WRITEME + mu_lr_scale : WRITEME axes : tuple WRITEME """ @@ -2061,6 +2062,7 @@ def __init__(self, tie_mu = None, bias_from_marginals = None, beta_lr_scale = 'by_sharing', + mu_lr_scale = 'by_sharing', axes = ('b', 0, 1, 'c')): super(type(self), self).__init__() @@ -2164,12 +2166,17 @@ def get_lr_scalers(self): rval[self.beta] = self.beta_lr_scale assert self.tie_mu in [None, 'locations'] - if self.tie_mu == 'locations': - warn = True - assert self.nvis is None - rval[self.mu] = 1./num_loc - logger.warning("mu lr_scaler hardcoded to 1/sharing") - + if self.mu_lr_scale == 'by_sharing': + if self.tie_mu == 'locations': + assert self.nvis is None + warn = True + rval[self.mu] = 1. / num_loc + logger.warning("mu lr_scaler hardcoded to 1/sharing") + elif self.mu_lr_scale == None: + pass + else: + rval[self.mu] = self.mu_lr_scale + return rval @functools.wraps(Model._modify_updates)