mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
merge devel branch in
This commit is contained in:
commit
52c0be1848
21 changed files with 595 additions and 134 deletions
|
|
@ -38,6 +38,25 @@ class LatentFunctionInference(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
class InferenceMethodList(LatentFunctionInference, list):
|
||||
|
||||
def on_optimization_start(self):
|
||||
for inf in self:
|
||||
inf.on_optimization_start()
|
||||
|
||||
def on_optimization_end(self):
|
||||
for inf in self:
|
||||
inf.on_optimization_end()
|
||||
|
||||
def __getstate__(self):
|
||||
state = []
|
||||
for inf in self:
|
||||
state.append(inf)
|
||||
return state
|
||||
|
||||
def __setstate__(self, state):
|
||||
for inf in state:
|
||||
self.append(inf)
|
||||
|
||||
from exact_gaussian_inference import ExactGaussianInference
|
||||
from laplace import Laplace
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Posterior(object):
|
|||
"""
|
||||
if self._covariance is None:
|
||||
#LiK, _ = dtrtrs(self.woodbury_chol, self._K, lower=1)
|
||||
self._covariance = self._K - (np.tensordot(np.dot(np.atleast_3d(self.woodbury_inv).T, self._K), self._K, [1,0]).T).squeeze()
|
||||
self._covariance = (np.atleast_3d(self._K) - np.tensordot(np.dot(np.atleast_3d(self.woodbury_inv).T, self._K), self._K, [1,0]).T).squeeze()
|
||||
#self._covariance = self._K - self._K.dot(self.woodbury_inv).dot(self._K)
|
||||
return self._covariance
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,17 @@ class VarDTCMissingData(LatentFunctionInference):
|
|||
def set_limit(self, limit):
|
||||
self._Y.limit = limit
|
||||
|
||||
def __getstate__(self):
|
||||
# has to be overridden, as Cacher objects cannot be pickled.
|
||||
return self._Y.limit, self._inan
|
||||
|
||||
def __setstate__(self, state):
|
||||
# has to be overridden, as Cacher objects cannot be pickled.
|
||||
from ...util.caching import Cacher
|
||||
self.limit = state[0]
|
||||
self._inan = state[1]
|
||||
self._Y = Cacher(self._subarray_computations, self.limit)
|
||||
|
||||
def _subarray_computations(self, Y):
|
||||
if self._inan is None:
|
||||
inan = np.isnan(Y)
|
||||
|
|
@ -272,7 +283,11 @@ class VarDTCMissingData(LatentFunctionInference):
|
|||
else: beta = beta_all
|
||||
|
||||
VVT_factor = (beta*y)
|
||||
VVT_factor_all[v, ind].flat = VVT_factor.flat
|
||||
try:
|
||||
VVT_factor_all[v, ind].flat = VVT_factor.flat
|
||||
except ValueError:
|
||||
mult = np.ravel_multi_index((v.nonzero()[0][:,None],ind[None,:]), VVT_factor_all.shape)
|
||||
VVT_factor_all.flat[mult] = VVT_factor
|
||||
output_dim = y.shape[1]
|
||||
|
||||
psi0 = psi0_all[v]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue