def stick_bgplvm(model=None, optimize=True, verbose=True, plot=True):
from GPy.models import BayesianGPLVM<EOL>from matplotlib import pyplot as plt<EOL>import numpy as np<EOL>import GPy<EOL>import pods<EOL>data = pods.datasets.osu_run1()<EOL>Q = <NUM_LIT:6><EOL>kernel = GPy.kern.RBF(Q, lengthscale=np.repeat(<NUM_LIT>, Q), ARD=True)<EOL>m = BayesianGPLVM(data['<STR_LIT:Y>'], Q, init="<STR_LIT>", num_inducing=<NUM_LIT:20>, kernel=kernel)<EOL>m.data = data<EOL>m.likelihood.variance = <NUM_LIT><EOL>try:<EOL><INDENT>if optimize: m.optimize('<STR_LIT>', messages=verbose, max_iters=<NUM_LIT>, bfgs_factor=<NUM_LIT:10>)<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>if plot:<EOL><INDENT>fig, (latent_axes, sense_axes) = plt.subplots(<NUM_LIT:1>, <NUM_LIT:2>)<EOL>plt.sca(latent_axes)<EOL>m.plot_latent(ax=latent_axes)<EOL>y = m.Y[:<NUM_LIT:1>, :].copy()<EOL>data_show = GPy.plotting.matplot_dep.visualize.stick_show(y, connect=data['<STR_LIT>'])<EOL>dim_select = GPy.plotting.matplot_dep.visualize.lvm_dimselect(m.X.mean[:<NUM_LIT:1>, :].copy(), m, data_show, latent_axes=latent_axes, sense_axes=sense_axes)<EOL>fig.canvas.draw()<EOL>input('<STR_LIT>')<EOL><DEDENT>return m<EOL>
Interactive visualisation of the Stick Man data from Ohio State University with the Bayesian GPLVM.