mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
Exception fixes for Python 3 compat
This commit is contained in:
parent
c4fb58176d
commit
7c6ff2982f
6 changed files with 9 additions and 9 deletions
|
|
@ -29,7 +29,7 @@ class DTC(LatentFunctionInference):
|
||||||
#make sure the noise is not hetero
|
#make sure the noise is not hetero
|
||||||
beta = 1./likelihood.gaussian_variance(Y_metadata)
|
beta = 1./likelihood.gaussian_variance(Y_metadata)
|
||||||
if beta.size > 1:
|
if beta.size > 1:
|
||||||
raise NotImplementedError, "no hetero noise with this implementation of DTC"
|
raise NotImplementedError("no hetero noise with this implementation of DTC")
|
||||||
|
|
||||||
Kmm = kern.K(Z)
|
Kmm = kern.K(Z)
|
||||||
Knn = kern.Kdiag(X)
|
Knn = kern.Kdiag(X)
|
||||||
|
|
@ -97,7 +97,7 @@ class vDTC(object):
|
||||||
#make sure the noise is not hetero
|
#make sure the noise is not hetero
|
||||||
beta = 1./likelihood.gaussian_variance(Y_metadata)
|
beta = 1./likelihood.gaussian_variance(Y_metadata)
|
||||||
if beta.size > 1:
|
if beta.size > 1:
|
||||||
raise NotImplementedError, "no hetero noise with this implementation of DTC"
|
raise NotImplementedError("no hetero noise with this implementation of DTC")
|
||||||
|
|
||||||
Kmm = kern.K(Z)
|
Kmm = kern.K(Z)
|
||||||
Knn = kern.Kdiag(X)
|
Knn = kern.Kdiag(X)
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ def _compute_dL_dR(likelihood, het_noise, uncertain_inputs, LB, _LBi_Lmi_psi1Vf,
|
||||||
dL_dR = None
|
dL_dR = None
|
||||||
elif het_noise:
|
elif het_noise:
|
||||||
if uncertain_inputs:
|
if uncertain_inputs:
|
||||||
raise NotImplementedError, "heteroscedatic derivates with uncertain inputs not implemented"
|
raise NotImplementedError("heteroscedatic derivates with uncertain inputs not implemented")
|
||||||
else:
|
else:
|
||||||
#from ...util.linalg import chol_inv
|
#from ...util.linalg import chol_inv
|
||||||
#LBi = chol_inv(LB)
|
#LBi = chol_inv(LB)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class FITC(LatentFunctionInference):
|
||||||
#make sure the noise is not hetero
|
#make sure the noise is not hetero
|
||||||
sigma_n = likelihood.gaussian_variance(Y_metadata)
|
sigma_n = likelihood.gaussian_variance(Y_metadata)
|
||||||
if sigma_n.size >1:
|
if sigma_n.size >1:
|
||||||
raise NotImplementedError, "no hetero noise with this implementation of FITC"
|
raise NotImplementedError("no hetero noise with this implementation of FITC")
|
||||||
|
|
||||||
Kmm = kern.K(Z)
|
Kmm = kern.K(Z)
|
||||||
Knn = kern.Kdiag(X)
|
Knn = kern.Kdiag(X)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class Posterior(object):
|
||||||
or ((mean is not None) and (cov is not None)):
|
or ((mean is not None) and (cov is not None)):
|
||||||
pass # we have sufficient to compute the posterior
|
pass # we have sufficient to compute the posterior
|
||||||
else:
|
else:
|
||||||
raise ValueError, "insufficient information to compute the posterior"
|
raise ValueError("insufficient information to compute the posterior")
|
||||||
|
|
||||||
self._K_chol = K_chol
|
self._K_chol = K_chol
|
||||||
self._K = K
|
self._K = K
|
||||||
|
|
@ -134,13 +134,13 @@ class Posterior(object):
|
||||||
#self._woodbury_chol = jitchol(W)
|
#self._woodbury_chol = jitchol(W)
|
||||||
#try computing woodbury chol from cov
|
#try computing woodbury chol from cov
|
||||||
elif self._covariance is not None:
|
elif self._covariance is not None:
|
||||||
raise NotImplementedError, "TODO: check code here"
|
raise NotImplementedError("TODO: check code here")
|
||||||
B = self._K - self._covariance
|
B = self._K - self._covariance
|
||||||
tmp, _ = dpotrs(self.K_chol, B)
|
tmp, _ = dpotrs(self.K_chol, B)
|
||||||
self._woodbury_inv, _ = dpotrs(self.K_chol, tmp.T)
|
self._woodbury_inv, _ = dpotrs(self.K_chol, tmp.T)
|
||||||
_, _, self._woodbury_chol, _ = pdinv(self._woodbury_inv)
|
_, _, self._woodbury_chol, _ = pdinv(self._woodbury_inv)
|
||||||
else:
|
else:
|
||||||
raise ValueError, "insufficient information to compute posterior"
|
raise ValueError("insufficient information to compute posterior")
|
||||||
return self._woodbury_chol
|
return self._woodbury_chol
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ def _compute_dL_dR(likelihood, het_noise, uncertain_inputs, LB, _LBi_Lmi_psi1Vf,
|
||||||
dL_dR = None
|
dL_dR = None
|
||||||
elif het_noise:
|
elif het_noise:
|
||||||
if uncertain_inputs:
|
if uncertain_inputs:
|
||||||
raise NotImplementedError, "heteroscedatic derivates with uncertain inputs not implemented"
|
raise NotImplementedError("heteroscedatic derivates with uncertain inputs not implemented")
|
||||||
else:
|
else:
|
||||||
#from ...util.linalg import chol_inv
|
#from ...util.linalg import chol_inv
|
||||||
#LBi = chol_inv(LB)
|
#LBi = chol_inv(LB)
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class Optimizer():
|
||||||
self.time = str(end - start)
|
self.time = str(end - start)
|
||||||
|
|
||||||
def opt(self, f_fp=None, f=None, fp=None):
|
def opt(self, f_fp=None, f=None, fp=None):
|
||||||
raise NotImplementedError, "this needs to be implemented to use the optimizer class"
|
raise NotImplementedError("this needs to be implemented to use the optimizer class")
|
||||||
|
|
||||||
def plot(self):
|
def plot(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue