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

This commit is contained in:
Max Zwiessele 2013-06-27 11:18:10 +01:00
commit 3b35d6d321
3 changed files with 16 additions and 2 deletions

View file

@ -187,7 +187,7 @@ class Parameterized(object):
def constrain_negative(self, regexp):
""" Set negative constraints. """
self.constrain(regexp, transformations.negative_exponent())
self.constrain(regexp, transformations.negative_logexp())
def constrain_positive(self, regexp):
""" Set positive constraints. """

View file

@ -36,6 +36,20 @@ class logexp(transformation):
def __str__(self):
return '(+ve)'
class negative_logexp(transformation):
domain = NEGATIVE
def f(self, x):
return -np.log(1. + np.exp(x))
def finv(self, f):
return np.log(np.exp(-f) - 1.)
def gradfactor(self, f):
ef = np.exp(-f)
return -(ef - 1.) / ef
def initialize(self, f):
return -np.abs(f)
def __str__(self):
return '(-ve)'
class logexp_clipped(transformation):
max_bound = 1e100
min_bound = 1e-10

View file

@ -227,7 +227,7 @@ def periodic_Matern52(input_dim, variance=1., lengthscale=None, period=2 * np.pi
:param n_freq: the number of frequencies considered for the periodic subspace
:type n_freq: int
"""
part = parts.periodic_Matern52part(input_dim, variance, lengthscale, period, n_freq, lower, upper)
part = parts.periodic_Matern52.PeriodicMatern52(input_dim, variance, lengthscale, period, n_freq, lower, upper)
return kern(input_dim, [part])
def prod(k1,k2,tensor=False):