mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
baysian gplvm and example changes
This commit is contained in:
parent
f8c3cd669d
commit
992a35b614
2 changed files with 100 additions and 88 deletions
|
|
@ -13,7 +13,6 @@ import priors
|
|||
from ..util.linalg import jitchol
|
||||
from ..inference import optimization
|
||||
from .. import likelihoods
|
||||
import re
|
||||
|
||||
class model(parameterised):
|
||||
def __init__(self):
|
||||
|
|
@ -215,7 +214,7 @@ class model(parameterised):
|
|||
for s in positive_strings:
|
||||
for i in self.grep_param_names(s):
|
||||
if not (i in currently_constrained):
|
||||
to_make_positive.append(re.escape(param_names[i]))
|
||||
to_make_positive.append(param_names[i])
|
||||
if warn:
|
||||
print "Warning! constraining %s postive"%name
|
||||
if len(to_make_positive):
|
||||
|
|
|
|||
|
|
@ -161,13 +161,26 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
|
|||
ax.plot(self.Z[:, input_1], self.Z[:, input_2], '^w')
|
||||
return ax
|
||||
|
||||
def plot_X_1d(self, fig_num="MRD X 1d", axes=None, colors=None):
|
||||
import pylab
|
||||
def plot_X_1d(self, fig=None, axes=None, fig_num="MRD X 1d", colors=None):
|
||||
"""
|
||||
Plot latent space X in 1D:
|
||||
|
||||
fig = pylab.figure(num=fig_num, figsize=(min(8, (3 * len(self.bgplvms))), min(12, (2 * self.X.shape[1]))))
|
||||
-if fig is given, create Q subplots in fig and plot in these
|
||||
-if axes is given plot Q 1D latent space plots of X into each `axis`
|
||||
-if neither fig nor axes is given create a figure with fig_num and plot in there
|
||||
|
||||
colors:
|
||||
|
||||
colors of different latent space dimensions Q
|
||||
"""
|
||||
import pylab
|
||||
if fig is None and axes is None:
|
||||
fig = pylab.figure(num=fig_num, figsize=(8, min(12, (2 * self.X.shape[1]))))
|
||||
if colors is None:
|
||||
colors = pylab.gca()._get_lines.color_cycle
|
||||
pylab.clf()
|
||||
else:
|
||||
colors = iter(colors)
|
||||
plots = []
|
||||
for i in range(self.X.shape[1]):
|
||||
if axes is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue