mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-13 14:03:20 +02:00
plotting behaviour adapted for BGPLVM
This commit is contained in:
parent
cadf822292
commit
2b0858b697
2 changed files with 9 additions and 7 deletions
|
|
@ -218,7 +218,7 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
|
|||
return means, covars
|
||||
|
||||
|
||||
def plot_X_1d(self, ax=None, fignum=None, colors=None):
|
||||
def plot_X_1d(self, fignum=None, ax=None, colors=None):
|
||||
"""
|
||||
Plot latent space X in 1D:
|
||||
|
||||
|
|
@ -230,7 +230,8 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
|
|||
colors of different latent space dimensions Q
|
||||
"""
|
||||
import pylab
|
||||
fig = pylab.figure(num=fignum, figsize=(8, min(12, (2 * self.X.shape[1]))))
|
||||
if ax is None:
|
||||
fig = pylab.figure(num=fignum, figsize=(8, min(12, (2 * self.X.shape[1]))))
|
||||
if colors is None:
|
||||
colors = pylab.gca()._get_lines.color_cycle
|
||||
pylab.clf()
|
||||
|
|
@ -241,8 +242,10 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
|
|||
for i in range(self.X.shape[1]):
|
||||
if ax is None:
|
||||
ax = fig.add_subplot(self.X.shape[1], 1, i + 1)
|
||||
else:
|
||||
elif isinstance(ax, (tuple, list)):
|
||||
ax = ax[i]
|
||||
else:
|
||||
raise ValueError("Need one ax per latent dimnesion Q")
|
||||
ax.plot(self.X, c='k', alpha=.3)
|
||||
plots.extend(ax.plot(x, self.X.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
|
||||
ax.fill_between(x,
|
||||
|
|
|
|||
|
|
@ -257,16 +257,15 @@ class MRD(model):
|
|||
return Z
|
||||
|
||||
def _handle_plotting(self, fignum, ax, plotf):
|
||||
if ax is None:
|
||||
fig = pylab.figure(num=fignum)
|
||||
ax = fig.add_subplot(111)
|
||||
if ax is None:
|
||||
fig = pylab.figure(num=fignum, figsize=(4 * len(self.bgplvms), 3))
|
||||
for i, g in enumerate(self.bgplvms):
|
||||
if ax is None:
|
||||
ax = fig.add_subplot(1, len(self.bgplvms), i + 1)
|
||||
else:
|
||||
elif isinstance(ax, (tuple, list)):
|
||||
ax = ax[i]
|
||||
else:
|
||||
raise ValueError("Need one ax per latent dimension Q")
|
||||
plotf(i, g, ax)
|
||||
pylab.draw()
|
||||
if ax is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue