Merge branch 'devel' of github.com:SheffieldML/GPy into devel

This commit is contained in:
James Hensman 2013-05-20 11:27:02 +01:00
commit 14c073ba7e
7 changed files with 50 additions and 13 deletions

View file

@ -39,8 +39,8 @@ class logexp(transformation):
return '(+ve)'
class logexp_clipped(transformation):
max_bound = 1e300
min_bound = 1e-10
max_bound = 1e250
min_bound = 1e-9
log_max_bound = np.log(max_bound)
log_min_bound = np.log(min_bound)
def __init__(self, lower=1e-6):
@ -49,11 +49,13 @@ class logexp_clipped(transformation):
def f(self, x):
exp = np.exp(np.clip(x, self.log_min_bound, self.log_max_bound))
f = np.log(1. + exp)
if np.isnan(f).any():
import ipdb;ipdb.set_trace()
return f
def finv(self, f):
return np.log(np.exp(np.clip(f, self.min_bound, self.max_bound)) - 1.)
def gradfactor(self, f):
ef = np.exp(f)
ef = np.exp(f) # np.clip(f, self.min_bound, self.max_bound))
gf = (ef - 1.) / ef
return np.where(f < self.lower, 0, gf)
def initialize(self, f):