mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 13:32:39 +02:00
unit_tests corrected
This commit is contained in:
parent
bae714f72c
commit
7396e5ad21
2 changed files with 8 additions and 6 deletions
|
|
@ -19,8 +19,6 @@ class link_function(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class identity(link_function):
|
class identity(link_function):
|
||||||
def transf(self,mu):
|
def transf(self,mu):
|
||||||
return mu
|
return mu
|
||||||
|
|
@ -53,6 +51,10 @@ class log_ex_1(link_function):
|
||||||
return np.log(np.log(np.exp(f)+1))
|
return np.log(np.log(np.exp(f)+1))
|
||||||
|
|
||||||
class probit(link_function):
|
class probit(link_function):
|
||||||
pass
|
|
||||||
|
|
||||||
|
def inv_transf(self,f):
|
||||||
|
return std_norm_cdf(f)
|
||||||
|
|
||||||
|
def log_inv_transf(self,f):
|
||||||
|
return np.log(std_norm_cdf(f))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ class GradientTests(unittest.TestCase):
|
||||||
X = np.hstack([np.random.normal(5,2,N/2),np.random.normal(10,2,N/2)])[:,None]
|
X = np.hstack([np.random.normal(5,2,N/2),np.random.normal(10,2,N/2)])[:,None]
|
||||||
Y = np.hstack([np.ones(N/2),np.zeros(N/2)])[:,None]
|
Y = np.hstack([np.ones(N/2),np.zeros(N/2)])[:,None]
|
||||||
kernel = GPy.kern.rbf(1)
|
kernel = GPy.kern.rbf(1)
|
||||||
distribution = GPy.likelihoods.likelihood_functions.probit()
|
distribution = GPy.likelihoods.likelihood_functions.binomial()
|
||||||
likelihood = GPy.likelihoods.EP(Y, distribution)
|
likelihood = GPy.likelihoods.EP(Y, distribution)
|
||||||
m = GPy.core.GP(X, likelihood, kernel)
|
m = GPy.core.GP(X, likelihood, kernel)
|
||||||
m.ensure_default_constraints()
|
m.ensure_default_constraints()
|
||||||
|
|
@ -183,7 +183,7 @@ class GradientTests(unittest.TestCase):
|
||||||
Y = np.hstack([np.ones(N/2),np.zeros(N/2)])[:,None]
|
Y = np.hstack([np.ones(N/2),np.zeros(N/2)])[:,None]
|
||||||
Z = np.linspace(0,15,4)[:,None]
|
Z = np.linspace(0,15,4)[:,None]
|
||||||
kernel = GPy.kern.rbf(1)
|
kernel = GPy.kern.rbf(1)
|
||||||
distribution = GPy.likelihoods.likelihood_functions.probit()
|
distribution = GPy.likelihoods.likelihood_functions.binomial()
|
||||||
likelihood = GPy.likelihoods.EP(Y, distribution)
|
likelihood = GPy.likelihoods.EP(Y, distribution)
|
||||||
m = GPy.core.sparse_GP(X, likelihood, kernel,Z)
|
m = GPy.core.sparse_GP(X, likelihood, kernel,Z)
|
||||||
m.ensure_default_constraints()
|
m.ensure_default_constraints()
|
||||||
|
|
@ -196,7 +196,7 @@ class GradientTests(unittest.TestCase):
|
||||||
X = np.hstack([np.random.rand(N/2)+1,np.random.rand(N/2)-1])[:,None]
|
X = np.hstack([np.random.rand(N/2)+1,np.random.rand(N/2)-1])[:,None]
|
||||||
k = GPy.kern.rbf(1) + GPy.kern.white(1)
|
k = GPy.kern.rbf(1) + GPy.kern.white(1)
|
||||||
Y = np.hstack([np.ones(N/2),-np.ones(N/2)])[:,None]
|
Y = np.hstack([np.ones(N/2),-np.ones(N/2)])[:,None]
|
||||||
likelihood = GPy.inference.likelihoods.probit(Y)
|
likelihood = GPy.inference.likelihoods.binomial(Y)
|
||||||
m = GPy.models.generalized_FITC(X,likelihood,k,inducing=4)
|
m = GPy.models.generalized_FITC(X,likelihood,k,inducing=4)
|
||||||
m.constrain_positive('(var|len)')
|
m.constrain_positive('(var|len)')
|
||||||
m.approximate_likelihood()
|
m.approximate_likelihood()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue