mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
an assortment of fixes
This commit is contained in:
parent
7040b26f41
commit
56a4bc4e21
5 changed files with 13 additions and 19 deletions
|
|
@ -5,7 +5,6 @@ import numpy as np
|
|||
from matplotlib import pyplot as plt
|
||||
|
||||
import GPy
|
||||
from GPy.util.datasets import swiss_roll_generated
|
||||
from GPy.core.transformations import logexp
|
||||
from GPy.models.bayesian_gplvm import BayesianGPLVM
|
||||
|
||||
|
|
@ -64,7 +63,7 @@ def GPLVM_oil_100(optimize=True):
|
|||
return m
|
||||
|
||||
def swiss_roll(optimize=True, N=1000, M=15, Q=4, sigma=.2, plot=False):
|
||||
from GPy.util.datasets import swiss_roll
|
||||
from GPy.util.datasets import swiss_roll_generated
|
||||
from GPy.core.transformations import logexp_clipped
|
||||
|
||||
data = swiss_roll_generated(N=N, sigma=sigma)
|
||||
|
|
@ -109,10 +108,10 @@ def swiss_roll(optimize=True, N=1000, M=15, Q=4, sigma=.2, plot=False):
|
|||
m.data_colors = c
|
||||
m.data_t = t
|
||||
|
||||
m.constrain('variance|length', logexp_clipped())
|
||||
m['lengthscale'] = 1. # X.var(0).max() / X.var(0)
|
||||
m['noise'] = Y.var() / 100.
|
||||
m.ensure_default_constraints()
|
||||
m['rbf_lengthscale'] = 1. # X.var(0).max() / X.var(0)
|
||||
m['noise_variance'] = Y.var() / 100.
|
||||
m['bias_variance'] = 0.05
|
||||
|
||||
if optimize:
|
||||
m.optimize('scg', messages=1)
|
||||
|
|
|
|||
|
|
@ -159,13 +159,13 @@ def coregionalisation_sparse(optim_iters=100):
|
|||
k = k1.prod(k2,tensor=True) + GPy.kern.white(2,0.001)
|
||||
|
||||
m = GPy.models.SparseGPRegression(X,Y,kernel=k,Z=Z)
|
||||
m.scale_factor = 10000.
|
||||
m.constrain_fixed('.*rbf_var',1.)
|
||||
#m.constrain_positive('kappa')
|
||||
m.constrain_fixed('iip')
|
||||
m.constrain_bounded('noise_variance',1e-3,1e-1)
|
||||
m.ensure_default_constraints()
|
||||
m.optimize_restarts(5, robust=True, messages=1, max_f_eval=optim_iters)
|
||||
|
||||
#plotting:
|
||||
pb.figure()
|
||||
Xtest1 = np.hstack((np.linspace(0,9,100)[:,None],np.zeros((100,1))))
|
||||
Xtest2 = np.hstack((np.linspace(0,9,100)[:,None],np.ones((100,1))))
|
||||
|
|
@ -300,7 +300,6 @@ def sparse_GP_regression_2D(N = 400, M = 50, optim_iters=100):
|
|||
m.checkgrad()
|
||||
|
||||
# optimize and plot
|
||||
pb.figure()
|
||||
m.optimize('tnc', messages = 1, max_f_eval=optim_iters)
|
||||
m.plot()
|
||||
print(m)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue