mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 20:12:38 +02:00
Made sparse gp work again
This commit is contained in:
parent
5f119d0918
commit
afba8d5c5e
2 changed files with 12 additions and 8 deletions
|
|
@ -123,6 +123,8 @@ class BayesianGPLVMMiniBatch(SparseGPMiniBatch):
|
||||||
|
|
||||||
def _outer_init_full_values(self):
|
def _outer_init_full_values(self):
|
||||||
full_values = super(BayesianGPLVMMiniBatch, self)._outer_init_full_values()
|
full_values = super(BayesianGPLVMMiniBatch, self)._outer_init_full_values()
|
||||||
|
full_values['dL_dpsi0'] = np.zeros(self.X.shape[0])
|
||||||
|
full_values['dL_dpsi1'] = np.zeros((self.X.shape[0], self.Z.shape[0]))
|
||||||
return full_values
|
return full_values
|
||||||
|
|
||||||
def parameters_changed(self):
|
def parameters_changed(self):
|
||||||
|
|
|
||||||
|
|
@ -214,8 +214,8 @@ class SparseGPMiniBatch(SparseGP):
|
||||||
to initialize the gradients for the mean and the variance in order to
|
to initialize the gradients for the mean and the variance in order to
|
||||||
have the full gradient for indexing)
|
have the full gradient for indexing)
|
||||||
"""
|
"""
|
||||||
return {'dL_dpsi0': np.zeros(self.X.shape[0]),
|
return {'dL_dKdiag': np.zeros(self.X.shape[0]),
|
||||||
'dL_dpsi1': np.zeros((self.X.shape[0], self.Z.shape[0]))}
|
'dL_dKnm': np.zeros((self.X.shape[0], self.Z.shape[0]))}
|
||||||
|
|
||||||
def _outer_loop_for_missing_data(self):
|
def _outer_loop_for_missing_data(self):
|
||||||
Lm = None
|
Lm = None
|
||||||
|
|
@ -243,10 +243,8 @@ class SparseGPMiniBatch(SparseGP):
|
||||||
psi1 = self.kern.psi1(self.Z, self.X)
|
psi1 = self.kern.psi1(self.Z, self.X)
|
||||||
psi2 = self.kern.psi2(self.Z, self.X)
|
psi2 = self.kern.psi2(self.Z, self.X)
|
||||||
else:
|
else:
|
||||||
if psi0 is None:
|
psi0 = self.kern.Kdiag(self.X)
|
||||||
psi0 = kern.Kdiag(X)
|
psi1 = self.kern.K(self.X, self.Z)
|
||||||
if psi1 is None:
|
|
||||||
psi1 = kern.K(X, Z)
|
|
||||||
psi2 = None
|
psi2 = None
|
||||||
|
|
||||||
self.psi0 = psi0
|
self.psi0 = psi0
|
||||||
|
|
@ -261,8 +259,12 @@ class SparseGPMiniBatch(SparseGP):
|
||||||
|
|
||||||
psi0ni = psi0[ninan]
|
psi0ni = psi0[ninan]
|
||||||
psi1ni = psi1[ninan]
|
psi1ni = psi1[ninan]
|
||||||
|
if self.has_uncertain_inputs():
|
||||||
psi2ni = psi2[ninan]
|
psi2ni = psi2[ninan]
|
||||||
value_indices = dict(outputs=d, samples=ninan, dL_dpsi0=ninan, dL_dpsi1=ninan)
|
value_indices = dict(outputs=d, samples=ninan, dL_dpsi0=ninan, dL_dpsi1=ninan)
|
||||||
|
else:
|
||||||
|
psi2ni = None
|
||||||
|
value_indices = dict(outputs=d, samples=ninan, dL_dKdiag=ninan, dL_dKnm=ninan)
|
||||||
|
|
||||||
posterior, log_marginal_likelihood, grad_dict = self._inner_parameters_changed(
|
posterior, log_marginal_likelihood, grad_dict = self._inner_parameters_changed(
|
||||||
self.kern, self.X[ninan],
|
self.kern, self.X[ninan],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue