From c97359c7afc6598d6fe4fe1c35648d71bbea0024 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Fri, 10 May 2013 17:32:26 +0100 Subject: [PATCH] making clipping adjustable --- GPy/core/transformations.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GPy/core/transformations.py b/GPy/core/transformations.py index ff821851..2be3d19a 100644 --- a/GPy/core/transformations.py +++ b/GPy/core/transformations.py @@ -39,8 +39,9 @@ class logexp(transformation): return '(+ve)' class logexp_clipped(transformation): - def __init__(self): + def __init__(self, lower=1e-12): self.domain = 'positive' + self.lower = lower def f(self, x): f = np.log(1. + np.exp(x)) return f @@ -49,13 +50,13 @@ class logexp_clipped(transformation): def gradfactor(self, f): ef = np.exp(f) gf = (ef - 1.) / ef - return np.where(f < 1e-6, 0, gf) + return np.where(f < self.lower, 0, gf) def initialize(self,f): if np.any(f<0.): print "Warning: changing parameters to satisfy constraints" return np.abs(f) def __str__(self): - return '(+ve)' + return '(+ve_c)' class exponent(transformation): def __init__(self):