From 4be40da23a3086b004de75da1652c4f633bb715c Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 11 Nov 2013 14:23:10 +0000 Subject: [PATCH 1/2] Changes in plot function: sampling vs numerical approximation --- GPy/core/gp_base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPy/core/gp_base.py b/GPy/core/gp_base.py index b6e4ebc0..cb968520 100644 --- a/GPy/core/gp_base.py +++ b/GPy/core/gp_base.py @@ -173,7 +173,8 @@ class GPBase(Model): upper = m + 2*np.sqrt(v) Y = self.likelihood.Y else: - m, v, lower, upper = self.predict(Xgrid, which_parts=which_parts) + m, v, lower, upper = self.predict(Xgrid, which_parts=which_parts,sampling=False) #Compute the exact mean + m_, v_, lower, upper = self.predict(Xgrid, which_parts=which_parts,sampling=True,num_samples=15000) #Apporximate the percentiles Y = self.likelihood.data for d in which_data_ycols: gpplot(Xnew, m[:, d], lower[:, d], upper[:, d], axes=ax, edgecol=linecol, fillcol=fillcol) @@ -210,7 +211,7 @@ class GPBase(Model): m, _ = self._raw_predict(Xgrid, which_parts=which_parts) Y = self.likelihood.Y else: - m, _, _, _ = self.predict(Xgrid, which_parts=which_parts,num_samples=100) #FIXME we need a balance between accuracy and speed to define num_samples + m, _, _, _ = self.predict(Xgrid, which_parts=which_parts,sampling=False) Y = self.likelihood.data for d in which_data_ycols: m_d = m[:,d].reshape(resolution, resolution).T From 7184cee6afb4a8d1a1909e45f7814348b024e4d2 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 11 Nov 2013 14:23:55 +0000 Subject: [PATCH 2/2] Added **likelihood_params to predictive_values --- GPy/likelihoods/gaussian.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/likelihoods/gaussian.py b/GPy/likelihoods/gaussian.py index 85c028b4..c12d8e6d 100644 --- a/GPy/likelihoods/gaussian.py +++ b/GPy/likelihoods/gaussian.py @@ -69,7 +69,7 @@ class Gaussian(likelihood): self.covariance_matrix = np.eye(self.N) * x self._variance = x - def predictive_values(self, mu, var, full_cov): + def predictive_values(self, mu, var, full_cov, **likelihood_args): """ Un-normalize the prediction and add the likelihood variance, then return the 5%, 95% interval """