mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-28 22:36:24 +02:00
added demo for uncollapsed GP
This commit is contained in:
parent
3c708b3bd6
commit
28edb59e8b
1 changed files with 32 additions and 0 deletions
32
GPy/examples/uncollapsed_GP_demo.py
Normal file
32
GPy/examples/uncollapsed_GP_demo.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||
|
||||
|
||||
import numpy as np
|
||||
"""
|
||||
Sparse Gaussian Processes regression with an RBF kernel,
|
||||
using the uncollapsed sparse GP (where the distribution of the
|
||||
inducing points is explicitley represented)
|
||||
"""
|
||||
import pylab as pb
|
||||
import numpy as np
|
||||
import GPy
|
||||
np.random.seed(2)
|
||||
pb.ion()
|
||||
N = 500
|
||||
M = 20
|
||||
|
||||
# sample inputs and outputs
|
||||
X = np.random.uniform(-3.,3.,(N,1))
|
||||
Y = np.sin(X)+np.random.randn(N,1)*0.05
|
||||
|
||||
kernel = GPy.kern.rbf(1) + GPy.kern.white(1)
|
||||
|
||||
# create simple GP model
|
||||
m = GPy.models.uncollapsed_sparse_GP(X, Y, kernel=kernel, M=M)#, X_uncertainty=np.zeros_like(X)+0.01)
|
||||
|
||||
# contrain all parameters to be positive
|
||||
m.ensure_default_constraints()
|
||||
m.checkgrad()
|
||||
# optimize and plot
|
||||
m.plot()
|
||||
Loading…
Add table
Add a link
Reference in a new issue