mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-21 14:05:14 +02:00
Merge branch 'devel' of github.com:SheffieldML/GPy into devel
This commit is contained in:
commit
ab30ed7483
1 changed files with 12 additions and 4 deletions
|
|
@ -50,7 +50,9 @@ class logexp_clipped(transformation):
|
||||||
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 < 1e-6, 0, gf)
|
||||||
def initialize(self, f):
|
def initialize(self,f):
|
||||||
|
if np.any(f<0.):
|
||||||
|
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)'
|
||||||
|
|
@ -65,6 +67,8 @@ class exponent(transformation):
|
||||||
def gradfactor(self, f):
|
def gradfactor(self, f):
|
||||||
return f
|
return f
|
||||||
def initialize(self, f):
|
def initialize(self, f):
|
||||||
|
if np.any(f<0.):
|
||||||
|
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)'
|
||||||
|
|
@ -79,6 +83,8 @@ class negative_exponent(transformation):
|
||||||
def gradfactor(self, f):
|
def gradfactor(self, f):
|
||||||
return f
|
return f
|
||||||
def initialize(self, f):
|
def initialize(self, f):
|
||||||
|
if np.any(f>0.):
|
||||||
|
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)'
|
||||||
|
|
@ -108,9 +114,11 @@ class logistic(transformation):
|
||||||
def finv(self, f):
|
def finv(self, f):
|
||||||
return np.log(np.clip(f - self.lower, 1e-10, np.inf) / np.clip(self.upper - f, 1e-10, np.inf))
|
return np.log(np.clip(f - self.lower, 1e-10, np.inf) / np.clip(self.upper - f, 1e-10, np.inf))
|
||||||
def gradfactor(self, f):
|
def gradfactor(self, f):
|
||||||
return (f - self.lower) * (self.upper - f) / self.difference
|
return (f-self.lower)*(self.upper-f)/self.difference
|
||||||
def initialize(self, f):
|
def initialize(self,f):
|
||||||
return self.f(f * 0.)
|
if np.any(np.logical_or(f<self.lower,f>self.upper)):
|
||||||
|
print "Warning: changing parameters to satisfy constraints"
|
||||||
|
return np.where(np.logical_or(f<self.lower,f>self.upper),self.f(f*0.),f)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '({},{})'.format(self.lower, self.upper)
|
return '({},{})'.format(self.lower, self.upper)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue