mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 04:22:38 +02:00
making clipping adjustable
This commit is contained in:
parent
f6ffbf88d9
commit
c97359c7af
1 changed files with 4 additions and 3 deletions
|
|
@ -39,8 +39,9 @@ class logexp(transformation):
|
||||||
return '(+ve)'
|
return '(+ve)'
|
||||||
|
|
||||||
class logexp_clipped(transformation):
|
class logexp_clipped(transformation):
|
||||||
def __init__(self):
|
def __init__(self, lower=1e-12):
|
||||||
self.domain = 'positive'
|
self.domain = 'positive'
|
||||||
|
self.lower = lower
|
||||||
def f(self, x):
|
def f(self, x):
|
||||||
f = np.log(1. + np.exp(x))
|
f = np.log(1. + np.exp(x))
|
||||||
return f
|
return f
|
||||||
|
|
@ -49,13 +50,13 @@ class logexp_clipped(transformation):
|
||||||
def gradfactor(self, f):
|
def gradfactor(self, f):
|
||||||
ef = np.exp(f)
|
ef = np.exp(f)
|
||||||
gf = (ef - 1.) / ef
|
gf = (ef - 1.) / ef
|
||||||
return np.where(f < 1e-6, 0, gf)
|
return np.where(f < self.lower, 0, gf)
|
||||||
def initialize(self,f):
|
def initialize(self,f):
|
||||||
if np.any(f<0.):
|
if np.any(f<0.):
|
||||||
print "Warning: changing parameters to satisfy constraints"
|
print "Warning: changing parameters to satisfy constraints"
|
||||||
return np.abs(f)
|
return np.abs(f)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '(+ve)'
|
return '(+ve_c)'
|
||||||
|
|
||||||
class exponent(transformation):
|
class exponent(transformation):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue