mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-06 10:32:39 +02:00
plotting fix
This commit is contained in:
parent
328e0124c7
commit
c302e515e2
5 changed files with 6 additions and 7 deletions
|
|
@ -148,7 +148,7 @@ class GP(Model):
|
||||||
|
|
||||||
return Ysim
|
return Ysim
|
||||||
|
|
||||||
def posterior_samples(self,X,size=10, full_cov=True, Y_metadata=None):
|
def posterior_samples(self, X, size=10, full_cov=False, Y_metadata=None):
|
||||||
"""
|
"""
|
||||||
Samples the posterior GP at the points X.
|
Samples the posterior GP at the points X.
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ class GP(Model):
|
||||||
:returns: Ysim: set of simulations, a Numpy array (N x samples).
|
:returns: Ysim: set of simulations, a Numpy array (N x samples).
|
||||||
"""
|
"""
|
||||||
Ysim = self.posterior_samples_f(X, size, full_cov=full_cov)
|
Ysim = self.posterior_samples_f(X, size, full_cov=full_cov)
|
||||||
Ysim = self.likelihood.noise_model.samples(Ysim, Y_metadata)
|
Ysim = self.likelihood.samples(Ysim, Y_metadata)
|
||||||
|
|
||||||
return Ysim
|
return Ysim
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class Gaussian(Likelihood):
|
||||||
return self.variance + sigma**2
|
return self.variance + sigma**2
|
||||||
|
|
||||||
def predictive_quantiles(self, mu, var, quantiles, Y_metadata):
|
def predictive_quantiles(self, mu, var, quantiles, Y_metadata):
|
||||||
return [stats.norm.ppf(q)*np.sqrt(var) + mu for q in quantiles]
|
return [stats.norm.ppf(q/100.)*np.sqrt(var) + mu for q in quantiles]
|
||||||
|
|
||||||
def pdf_link(self, link_f, y, extra_data=None):
|
def pdf_link(self, link_f, y, extra_data=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@ class Likelihood(Parameterized):
|
||||||
|
|
||||||
return [np.percentile(ss_y ,q, axis=1)[:,None] for q in quantiles]
|
return [np.percentile(ss_y ,q, axis=1)[:,None] for q in quantiles]
|
||||||
|
|
||||||
def samples(self, gp):
|
def samples(self, gp, Y_metadata=None):
|
||||||
"""
|
"""
|
||||||
Returns a set of samples of observations based on a given value of the latent variable.
|
Returns a set of samples of observations based on a given value of the latent variable.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ class StudentT(Likelihood):
|
||||||
def conditional_variance(self, gp):
|
def conditional_variance(self, gp):
|
||||||
return self.deg_free/(self.deg_free - 2.)
|
return self.deg_free/(self.deg_free - 2.)
|
||||||
|
|
||||||
def samples(self, gp):
|
def samples(self, gp, Y_metadata=None):
|
||||||
"""
|
"""
|
||||||
Returns a set of samples of observations based on a given value of the latent variable.
|
Returns a set of samples of observations based on a given value of the latent variable.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,7 @@ def plot_fit(model, plot_limits=None, which_data_rows='all',
|
||||||
upper = m + 2*np.sqrt(v)
|
upper = m + 2*np.sqrt(v)
|
||||||
else:
|
else:
|
||||||
m, v = model.predict(Xgrid, full_cov=False, Y_metadata=Y_metadata)
|
m, v = model.predict(Xgrid, full_cov=False, Y_metadata=Y_metadata)
|
||||||
|
lower, upper = model.predict_quantiles(Xgrid, Y_metadata=Y_metadata)
|
||||||
lower, upper = model.predict_quantiles(Xgrid, Y_metadata=Y_metadata)
|
|
||||||
|
|
||||||
|
|
||||||
for d in which_data_ycols:
|
for d in which_data_ycols:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue