mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 04:22:38 +02:00
added logexp_clipped transformation
This commit is contained in:
parent
5b2035a390
commit
ff863612eb
1 changed files with 61 additions and 30 deletions
|
|
@ -38,6 +38,23 @@ class logexp(transformation):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '(+ve)'
|
return '(+ve)'
|
||||||
|
|
||||||
|
class logexp_clipped(transformation):
|
||||||
|
def __init__(self):
|
||||||
|
self.domain = 'positive'
|
||||||
|
def f(self, x):
|
||||||
|
f = np.log(1. + np.exp(x))
|
||||||
|
return f
|
||||||
|
def finv(self, f):
|
||||||
|
return np.log(np.exp(f) - 1.)
|
||||||
|
def gradfactor(self, f):
|
||||||
|
ef = np.exp(f)
|
||||||
|
gf = (ef - 1.) / ef
|
||||||
|
return np.where(f < 1e-6, 0, gf)
|
||||||
|
def initialize(self, f):
|
||||||
|
return np.abs(f)
|
||||||
|
def __str__(self):
|
||||||
|
return '(+ve)'
|
||||||
|
|
||||||
class exponent(transformation):
|
class exponent(transformation):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.domain = 'positive'
|
self.domain = 'positive'
|
||||||
|
|
@ -66,6 +83,20 @@ class negative_exponent(transformation):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '(-ve)'
|
return '(-ve)'
|
||||||
|
|
||||||
|
class square(transformation):
|
||||||
|
def __init__(self):
|
||||||
|
self.domain = 'positive'
|
||||||
|
def f(self, x):
|
||||||
|
return x ** 2
|
||||||
|
def finv(self, x):
|
||||||
|
return np.sqrt(x)
|
||||||
|
def gradfactor(self, f):
|
||||||
|
return 2 * np.sqrt(f)
|
||||||
|
def initialize(self, f):
|
||||||
|
return np.abs(f)
|
||||||
|
def __str__(self):
|
||||||
|
return '(+sq)'
|
||||||
|
|
||||||
class logistic(transformation):
|
class logistic(transformation):
|
||||||
def __init__(self, lower, upper):
|
def __init__(self, lower, upper):
|
||||||
self.domain = 'bounded'
|
self.domain = 'bounded'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue