mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-05 17:52:39 +02:00
Merge branch 'params' of github.com:SheffieldML/GPy into params
This commit is contained in:
commit
2c7a620ce7
3 changed files with 9 additions and 4 deletions
|
|
@ -86,6 +86,9 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parentable
|
|||
if self._gradient_ is None:
|
||||
self._gradient_ = numpy.zeros(self._realshape_)
|
||||
return self._gradient_
|
||||
@gradient.setter
|
||||
def gradient(self, val):
|
||||
self.gradient[:] = val
|
||||
|
||||
#===========================================================================
|
||||
# Pickling operations
|
||||
|
|
|
|||
|
|
@ -81,13 +81,16 @@ class Posterior(object):
|
|||
def covariance(self):
|
||||
if self._covariance is None:
|
||||
#LiK, _ = dtrtrs(self.woodbury_chol, self._K, lower=1)
|
||||
self._covariance = self._K - self._K.dot(self.woodbury_inv).dot(self._K)
|
||||
self._covariance = np.tensordot(np.dot(np.atleast_3d(self.woodbury_inv).T, self._K), self._K, [1,0]).T
|
||||
#self._covariance = self._K - self._K.dot(self.woodbury_inv).dot(self._K)
|
||||
return self._covariance
|
||||
|
||||
@property
|
||||
def precision(self):
|
||||
if self._precision is None:
|
||||
self._precision, _, _, _ = pdinv(self.covariance)
|
||||
self._precision = np.zeros(np.atleast_3d(self.covariance).shape) # if one covariance per dimension
|
||||
for p in xrange(self.covariance.shape[-1]):
|
||||
self._precision[:,:,p] = pdinv(self.covariance[:,:,p])[0]
|
||||
return self._precision
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
|
||||
import numpy as np
|
||||
import scipy as sp
|
||||
import pylab as plt
|
||||
|
||||
class WarpingFunction(object):
|
||||
"""
|
||||
|
|
@ -39,6 +37,7 @@ class WarpingFunction(object):
|
|||
def plot(self, psi, xmin, xmax):
|
||||
y = np.arange(xmin, xmax, 0.01)
|
||||
f_y = self.f(y, psi)
|
||||
from matplotlib import pyplot as plt
|
||||
plt.figure()
|
||||
plt.plot(y, f_y)
|
||||
plt.xlabel('y')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue