mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-27 14:25:16 +02:00
[Merge] merge devel
This commit is contained in:
commit
c793ca77a9
116 changed files with 1134 additions and 636 deletions
|
|
@ -420,4 +420,4 @@ def _plot(self, canvas, plots, helper_data, helper_prediction, levels, plot_indu
|
|||
|
||||
if helper_prediction[2] is not None:
|
||||
plots.update(_plot_samples(self, canvas, helper_data, helper_prediction, projection, "Samples"))
|
||||
return plots
|
||||
return plots
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ from .. import Tango
|
|||
from .plot_util import update_not_existing_kwargs, helper_for_plot_data
|
||||
from ...kern.src.kern import Kern, CombinationKernel
|
||||
|
||||
def plot_ARD(kernel, filtering=None, legend=False, **kwargs):
|
||||
def plot_ARD(kernel, filtering=None, legend=False, canvas=None, **kwargs):
|
||||
"""
|
||||
If an ARD kernel is present, plot a bar representation using matplotlib
|
||||
|
||||
|
|
@ -62,7 +62,11 @@ def plot_ARD(kernel, filtering=None, legend=False, **kwargs):
|
|||
|
||||
bars = []
|
||||
kwargs = update_not_existing_kwargs(kwargs, pl().defaults.ard)
|
||||
canvas, kwargs = pl().new_canvas(xlim=(-.5, kernel._effective_input_dim-.5), xlabel='input dimension', ylabel='sensitivity', **kwargs)
|
||||
|
||||
|
||||
if canvas is None:
|
||||
canvas, kwargs = pl().new_canvas(xlim=(-.5, kernel._effective_input_dim-.5), xlabel='input dimension', ylabel='sensitivity', **kwargs)
|
||||
|
||||
for i in range(ard_params.shape[0]):
|
||||
if parts[i].name in filtering:
|
||||
c = Tango.nextMedium()
|
||||
|
|
@ -96,7 +100,7 @@ def plot_covariance(kernel, x=None, label=None,
|
|||
"""
|
||||
X = np.ones((2, kernel._effective_input_dim)) * [[-3], [3]]
|
||||
_, free_dims, Xgrid, xx, yy, _, _, resolution = helper_for_plot_data(kernel, X, plot_limits, visible_dims, None, resolution)
|
||||
|
||||
|
||||
from numbers import Number
|
||||
if x is None:
|
||||
from ...kern.src.stationary import Stationary
|
||||
|
|
@ -104,7 +108,7 @@ def plot_covariance(kernel, x=None, label=None,
|
|||
elif isinstance(x, Number):
|
||||
x = np.ones((1, kernel._effective_input_dim))*x
|
||||
K = kernel.K(Xgrid, x)
|
||||
|
||||
|
||||
if projection == '3d':
|
||||
xlabel = 'X[:,0]'
|
||||
ylabel = 'X[:,1]'
|
||||
|
|
@ -136,4 +140,4 @@ def plot_covariance(kernel, x=None, label=None,
|
|||
return pl().add_to_canvas(canvas, plots)
|
||||
|
||||
else:
|
||||
raise NotImplementedError("Cannot plot a kernel with more than two input dimensions")
|
||||
raise NotImplementedError("Cannot plot a kernel with more than two input dimensions")
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ def _plot_magnification(self, canvas, which_indices, Xgrid,
|
|||
def plot_function(x):
|
||||
Xtest_full = np.zeros((x.shape[0], Xgrid.shape[1]))
|
||||
Xtest_full[:, which_indices] = x
|
||||
|
||||
mf = self.predict_magnification(Xtest_full, kern=kern, mean=mean, covariance=covariance)
|
||||
return mf.reshape(resolution, resolution).T
|
||||
imshow_kwargs = update_not_existing_kwargs(imshow_kwargs, pl().defaults.magnification)
|
||||
|
|
@ -215,7 +216,12 @@ def _plot_latent(self, canvas, which_indices, Xgrid,
|
|||
def plot_function(x):
|
||||
Xtest_full = np.zeros((x.shape[0], Xgrid.shape[1]))
|
||||
Xtest_full[:, which_indices] = x
|
||||
mf = np.log(self.predict(Xtest_full, kern=kern)[1])
|
||||
mf = self.predict(Xtest_full, kern=kern)[1]
|
||||
if mf.shape[1]==self.output_dim:
|
||||
mf = mf.sum(-1)
|
||||
else:
|
||||
mf *= self.output_dim
|
||||
mf = np.log(mf)
|
||||
return mf.reshape(resolution, resolution).T
|
||||
|
||||
imshow_kwargs = update_not_existing_kwargs(imshow_kwargs, pl().defaults.latent)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue