mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
added identity warp function and change np.argmin to np.nanargmin in optimize_restarts
This commit is contained in:
parent
2426580d4d
commit
7fd8c9c556
2 changed files with 23 additions and 1 deletions
|
|
@ -104,7 +104,7 @@ class Model(Parameterized):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
if len(self.optimization_runs):
|
if len(self.optimization_runs):
|
||||||
i = np.argmin([o.f_opt for o in self.optimization_runs])
|
i = np.nanargmin([o.f_opt for o in self.optimization_runs])
|
||||||
self.optimizer_array = self.optimization_runs[i].x_opt
|
self.optimizer_array = self.optimization_runs[i].x_opt
|
||||||
else:
|
else:
|
||||||
self.optimizer_array = initial_parameters
|
self.optimizer_array = initial_parameters
|
||||||
|
|
|
||||||
|
|
@ -293,3 +293,25 @@ class TanhWarpingFunction_d(WarpingFunction):
|
||||||
names = sum([['warp_tanh_%s_t%i' % (variables[n],q) for n in range(3)] for q in range(self.n_terms)],[])
|
names = sum([['warp_tanh_%s_t%i' % (variables[n],q) for n in range(3)] for q in range(self.n_terms)],[])
|
||||||
names.append('warp_tanh_d')
|
names.append('warp_tanh_d')
|
||||||
return names
|
return names
|
||||||
|
|
||||||
|
|
||||||
|
class IdentityFunction(WarpingFunction):
|
||||||
|
"""
|
||||||
|
Identity warping function. This is for testing and sanity check purposes
|
||||||
|
and should not be used in practice.
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self.num_parameters = 0
|
||||||
|
super(IdentityFunction, self).__init__(name='identity')
|
||||||
|
|
||||||
|
def f(self, y):
|
||||||
|
return y
|
||||||
|
|
||||||
|
def fgrad_y(self, y):
|
||||||
|
return 1.0
|
||||||
|
|
||||||
|
def fgrad_y_psi(self,y):
|
||||||
|
return 1.0
|
||||||
|
|
||||||
|
def f_inv(self,z):
|
||||||
|
return z
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue