made svigp depend on GP instead of gp_base

This commit is contained in:
James Hensman 2014-01-24 10:16:57 +00:00
parent d2e0b0eefd
commit 6701741c94
2 changed files with 8 additions and 8 deletions

View file

@ -68,7 +68,7 @@ class SparseGP(GP):
self.psi1 = self.kern.K(self.X, self.Z)
self.psi2 = None
self.posterior = self.inference_method.inference(??)
#self.posterior = self.inference_method.inference(??)
super(SparseGP, self).parameters_changed()

View file

@ -4,12 +4,12 @@
import numpy as np
import pylab as pb
from ..util.linalg import pdinv, mdot, tdot, dpotrs, dtrtrs, jitchol, backsub_both_sides
from gp_base import GPBase
from gp import GP
import time
import sys
class SVIGP(GPBase):
class SVIGP(GP):
"""
Stochastic Variational inference in a Gaussian Process
@ -22,7 +22,7 @@ class SVIGP(GPBase):
Additional kwargs are used as for a sparse GP. They include:
:param q_u: canonical parameters of the distribution squasehd into a 1D array
:param q_u: canonical parameters of the distribution sqehd into a 1D array
:type q_u: np.ndarray
:param M: Number of inducing points (optional, default 10. Ignored if Z is not None)
:type M: int
@ -44,7 +44,7 @@ class SVIGP(GPBase):
def __init__(self, X, likelihood, kernel, Z, q_u=None, batchsize=10, X_variance=None):
GPBase.__init__(self, X, likelihood, kernel, normalize_X=False)
GP.__init__(self, X, likelihood, kernel, normalize_X=False)
self.batchsize=batchsize
self.Y = self.likelihood.Y.copy()
self.Z = Z
@ -92,7 +92,7 @@ class SVIGP(GPBase):
def getstate(self):
steplength_params = [self.hbar_t, self.tau_t, self.gbar_t, self.gbar_t1, self.gbar_t2, self.hbar_tp, self.tau_tp, self.gbar_tp, self.adapt_param_steplength, self.adapt_vb_steplength, self.vb_steplength, self.param_steplength]
return GPBase.getstate(self) + \
return GP.getstate(self) + \
[self.get_vb_param(),
self.Z,
self.num_inducing,
@ -139,7 +139,7 @@ class SVIGP(GPBase):
self.num_inducing = state.pop()
self.Z = state.pop()
vb_param = state.pop()
GPBase.setstate(self, state)
GP.setstate(self, state)
self.set_vb_param(vb_param)
def _compute_kernel_matrices(self):
@ -489,7 +489,7 @@ class SVIGP(GPBase):
#horrible hack here:
data = self.likelihood.data.copy()
self.likelihood.data = self.Y
GPBase.plot(self, ax=ax, **kwargs)
GP.plot(self, ax=ax, **kwargs)
self.likelihood.data = data
Zu = self.Z * self._Xscale + self._Xoffset