mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-03 16:52:39 +02:00
fix: samples tests and plotting, multioutput
This commit is contained in:
parent
270b90857c
commit
8446da628b
45 changed files with 15 additions and 17 deletions
|
|
@ -208,10 +208,10 @@ def _plot_samples(self, canvas, helper_data, helper_prediction, projection,
|
|||
if len(free_dims)==1:
|
||||
# 1D plotting:
|
||||
update_not_existing_kwargs(kwargs, pl().defaults.samples_1d) # @UndefinedVariable
|
||||
plots = [pl().plot(canvas, Xgrid[:, free_dims], samples[:, s], label=label if s==0 else None, **kwargs) for s in range(samples.shape[-1])]
|
||||
plots = [pl().plot(canvas, Xgrid[:, free_dims], samples[:, :, s], label=label if s==0 else None, **kwargs) for s in range(samples.shape[-1])]
|
||||
elif len(free_dims)==2 and projection=='3d':
|
||||
update_not_existing_kwargs(kwargs, pl().defaults.samples_3d) # @UndefinedVariable
|
||||
plots = [pl().surface(canvas, x, y, samples[:, s].reshape(resolution, resolution), **kwargs) for s in range(samples.shape[-1])]
|
||||
plots = [pl().surface(canvas, x, y, samples[:, :, s].reshape(resolution, resolution), **kwargs) for s in range(samples.shape[-1])]
|
||||
else:
|
||||
pass # Nothing to plot!
|
||||
return dict(gpmean=plots)
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ def helper_predict_with_model(self, Xgrid, plot_raw, apply_link, percentiles, wh
|
|||
else: percentiles = []
|
||||
|
||||
if samples > 0:
|
||||
fsamples = self.posterior_samples(Xgrid, full_cov=True, size=samples, **predict_kw)
|
||||
fsamples = fsamples[which_data_ycols] if fsamples.ndim == 3 else fsamples
|
||||
fsamples = self.posterior_samples(Xgrid, size=samples, **predict_kw)
|
||||
fsamples = fsamples[:, which_data_ycols, :]
|
||||
else:
|
||||
fsamples = None
|
||||
|
||||
|
|
@ -95,12 +95,9 @@ def helper_predict_with_model(self, Xgrid, plot_raw, apply_link, percentiles, wh
|
|||
retmu[:, [i]] = self.likelihood.gp_link.transf(mu[:, [i]])
|
||||
for perc in percs:
|
||||
perc[:, [i]] = self.likelihood.gp_link.transf(perc[:, [i]])
|
||||
if fsamples is not None and fsamples.ndim == 3:
|
||||
if fsamples is not None:
|
||||
for s in range(fsamples.shape[-1]):
|
||||
fsamples[i, :, s] = self.likelihood.gp_link.transf(fsamples[i, :, s])
|
||||
elif fsamples is not None:
|
||||
for s in range(fsamples.shape[-1]):
|
||||
fsamples[:, s] = self.likelihood.gp_link.transf(fsamples[:, s])
|
||||
fsamples[:, i, s] = self.likelihood.gp_link.transf(fsamples[:, i, s])
|
||||
return retmu, percs, fsamples
|
||||
|
||||
def helper_for_plot_data(self, X, plot_limits, visible_dims, fixed_inputs, resolution):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue