mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 13:32:39 +02:00
logistic seems working but more tests are needed
This commit is contained in:
parent
4dc6f0ec6c
commit
91e625a9bd
2 changed files with 5 additions and 3 deletions
|
|
@ -316,10 +316,12 @@ class MiscTests(unittest.TestCase):
|
|||
X = (2 * np.pi) * np.random.random(151) - np.pi
|
||||
Y = np.sin(X) + np.random.normal(0,0.2,151)
|
||||
Y = np.array([np.power(abs(y),float(1)/3) * (1,-1)[y<0] for y in Y])
|
||||
Y = np.abs(Y)
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
warp_k = GPy.kern.RBF(1)
|
||||
warp_f = GPy.util.warping_functions.TanhFunction(n_terms=2)
|
||||
#warp_f = GPy.util.warping_functions.TanhFunction(n_terms=2)
|
||||
warp_f = GPy.util.warping_functions.LogisticFunction(n_terms=2)
|
||||
warp_m = GPy.models.WarpedGP(X[:, None], Y[:, None], kernel=warp_k, warping_function=warp_f)
|
||||
|
||||
m = GPy.models.GPRegression(X[:, None], Y[:, None])
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ class LogisticFunction(WarpingFunction):
|
|||
return grad, logistic_term, logistic_grad
|
||||
return grad
|
||||
|
||||
def fgrad_y_psi(self, y, psi):
|
||||
def fgrad_y_psi(self, y, return_covar_chain=False):
|
||||
"""
|
||||
gradient of f w.r.t to y and psi
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ class LogisticFunction(WarpingFunction):
|
|||
for i in xrange(self.n_terms):
|
||||
a, b, c = mpsi[i]
|
||||
gradients[:, :, i, 0] = b * l_grad[i].T
|
||||
b2l_term = b - (2 * l_term[i])
|
||||
b2l_term = b - (2 * l_term[i].T)
|
||||
al_grad = a * l_grad[i].T
|
||||
#gradients[:, :, i, 1] = a * (d[i] - 2.0 * s[i] * r[i] * (1.0/np.cosh(s[i])) ** 2).T
|
||||
gradients[:, :, i, 1] = (1 + ((y + c) * b2l_term)) * al_grad
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue