mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 04:22:38 +02:00
dimensionality reduction merge
This commit is contained in:
commit
7f63849dd2
9 changed files with 28 additions and 87 deletions
|
|
@ -24,7 +24,7 @@ def BGPLVM(seed=default_seed):
|
|||
Y = np.random.multivariate_normal(np.zeros(N), K, Q).T
|
||||
lik = Gaussian(Y, normalize=True)
|
||||
|
||||
k = GPy.kern.rbf(Q, ARD=True) + GPy.kern.bias(Q) + GPy.kern.white(Q)
|
||||
k = GPy.kern.rbf_inv(Q, ARD=True) + GPy.kern.bias(Q) + GPy.kern.white(Q)
|
||||
# k = GPy.kern.rbf(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
|
||||
# k = GPy.kern.rbf(Q, ARD = False) + GPy.kern.white(Q, 0.00001)
|
||||
|
||||
|
|
@ -145,6 +145,7 @@ def BGPLVM_oil(optimize=True, N=200, Q=10, num_inducing=15, max_iters=150, plot=
|
|||
|
||||
# create simple GP model
|
||||
kernel = GPy.kern.rbf_inv(Q, ARD=True) + GPy.kern.bias(Q, np.exp(-2)) + GPy.kern.white(Q, np.exp(-2))
|
||||
|
||||
Y = data['X'][:N]
|
||||
Yn = Y - Y.mean(0)
|
||||
Yn /= Yn.std(0)
|
||||
|
|
@ -375,11 +376,12 @@ def stick():
|
|||
def stick_bgplvm(model=None):
|
||||
data = GPy.util.datasets.stick()
|
||||
Q = 6
|
||||
kernel = GPy.kern.rbf(Q, ARD=True) + GPy.kern.bias(Q, np.exp(-2)) + GPy.kern.white(Q, np.exp(-2))
|
||||
m = BayesianGPLVM(data['Y'], Q, init="PCA", num_inducing=20, kernel=kernel)
|
||||
kernel = GPy.kern.rbf_inv(Q, ARD=True) + GPy.kern.bias(Q, np.exp(-2)) + GPy.kern.white(Q, np.exp(-2))
|
||||
m = BayesianGPLVM(data['Y'], Q, init="PCA", num_inducing=35,kernel=kernel)
|
||||
# optimize
|
||||
m.ensure_default_constraints()
|
||||
m.optimize(messages=1, max_f_eval=3000, xtol=1e-300, ftol=1e-300)
|
||||
m.constrain_bounded('.*rbf_inv',1e-5, 100)
|
||||
m.optimize(messages=1, max_iters=3000,xtol=1e-300,ftol=1e-300)
|
||||
m._set_params(m._get_params())
|
||||
plt.clf, (latent_axes, sense_axes) = plt.subplots(1, 2)
|
||||
plt.sca(latent_axes)
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ def toy_ARD(optim_iters=1000, kernel_type='linear', N=300, D=4):
|
|||
X4 = np.log(np.sort(np.random.rand(N,1),0))
|
||||
X = np.hstack((X1, X2, X3, X4))
|
||||
|
||||
Y1 = np.asarray(2*X[:,0]+3).T
|
||||
Y2 = np.asarray(4*(X[:,2]-1.5*X[:,0])).T
|
||||
Y1 = np.asmatrix(2*X[:,0]+3).T
|
||||
Y2 = np.asmatrix(4*(X[:,2]-1.5*X[:,0])).T
|
||||
Y = np.hstack((Y1, Y2))
|
||||
|
||||
Y = np.dot(Y, np.random.rand(2,D));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue