mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 05:46:24 +02:00
Still working on rasmussen, link function needs vectorizing I think
This commit is contained in:
parent
afa5b1f956
commit
0312f319ad
3 changed files with 154 additions and 54 deletions
|
|
@ -36,7 +36,10 @@ class student_t(likelihood_function):
|
|||
:returns: float(likelihood evaluated for this point)
|
||||
|
||||
"""
|
||||
y = np.squeeze(y)
|
||||
f = np.squeeze(f)
|
||||
assert y.shape == f.shape
|
||||
|
||||
e = y - f
|
||||
objective = (gammaln((self.v + 1) * 0.5)
|
||||
- gammaln(self.v * 0.5)
|
||||
|
|
@ -44,6 +47,7 @@ class student_t(likelihood_function):
|
|||
- (self.v + 1) * 0.5
|
||||
* np.log(1 + ((e**2 / self.sigma**2) / self.v))
|
||||
)
|
||||
print (e**2).shape
|
||||
return np.sum(objective)
|
||||
|
||||
def link_grad(self, y, f):
|
||||
|
|
@ -57,10 +61,12 @@ class student_t(likelihood_function):
|
|||
:returns: gradient of likelihood evaluated at points
|
||||
|
||||
"""
|
||||
y = np.squeeze(y)
|
||||
f = np.squeeze(f)
|
||||
assert y.shape == f.shape
|
||||
e = y - f
|
||||
grad = ((self.v + 1) * e) / (self.v * (self.sigma**2) + (e**2))
|
||||
return grad
|
||||
return np.squeeze(grad)
|
||||
|
||||
def link_hess(self, y, f):
|
||||
"""
|
||||
|
|
@ -75,11 +81,12 @@ class student_t(likelihood_function):
|
|||
:f: latent variables f
|
||||
:returns: array which is diagonal of covariance matrix (second derivative of likelihood evaluated at points)
|
||||
"""
|
||||
y = np.squeeze(y)
|
||||
f = np.squeeze(f)
|
||||
assert y.shape == f.shape
|
||||
e = y - f
|
||||
#hess = ((self.v + 1) * e) / ((((self.sigma**2) * self.v) + e**2)**2)
|
||||
hess = ((self.v + 1)*(e**2 - self.v*(self.sigma**2))) / ((((self.sigma**2)*self.v) + e**2)**2)
|
||||
return hess
|
||||
return np.squeeze(hess)
|
||||
|
||||
def predictive_values(self, mu, var):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue