diff --git a/GPy/examples/BGPLVM_demo.py b/GPy/examples/BGPLVM_demo.py new file mode 100644 index 00000000..08e994f8 --- /dev/null +++ b/GPy/examples/BGPLVM_demo.py @@ -0,0 +1,33 @@ +# Copyright (c) 2012, GPy authors (see AUTHORS.txt). +# Licensed under the BSD 3-clause license (see LICENSE.txt) + +import numpy as np +import pylab as pb +import GPy +np.random.seed(123344) + +N = 10 +M = 3 +Q = 2 +D = 3 +#generate GPLVM-like data +X = np.random.rand(N, Q) +k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001) +K = k.K(X) +Y = np.random.multivariate_normal(np.zeros(N),K,D).T + +k = GPy.kern.rbf(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001) +# k = GPy.kern.rbf_ARD(Q) + GPy.kern.white(Q, 0.00001) +m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M) +m.constrain_positive('(rbf|bias|noise|white|S)') +# m.constrain_fixed('S', 1) + +# pb.figure() +# m.plot() +# pb.title('PCA initialisation') +# pb.figure() +# m.optimize(messages = 1) +# m.plot() +# pb.title('After optimisation') +m.randomize() +m.checkgrad(verbose = 1)