mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 12:02:38 +02:00
demo for GP regressio with uncertain inputs
This commit is contained in:
parent
6d0a7afd4c
commit
207e12fd7f
1 changed files with 31 additions and 0 deletions
31
GPy/examples/uncertain_input_GP_regression_demo.py
Normal file
31
GPy/examples/uncertain_input_GP_regression_demo.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||
|
||||
|
||||
import pylab as pb
|
||||
import numpy as np
|
||||
import GPy
|
||||
pb.ion()
|
||||
pb.close('all')
|
||||
|
||||
|
||||
######################################
|
||||
## 1 dimensional example
|
||||
|
||||
# sample inputs and outputs
|
||||
S = np.ones((20,1))
|
||||
X = np.random.uniform(-3.,3.,(20,1))
|
||||
Y = np.sin(X)+np.random.randn(20,1)*0.05
|
||||
|
||||
k = GPy.kern.bias(1) + GPy.kern.white(1)
|
||||
|
||||
# create simple GP model
|
||||
m = GPy.models.uncertain_input_GP_regression(X,Y,S,kernel=k)
|
||||
|
||||
# contrain all parameters to be positive
|
||||
m.constrain_positive('(variance|prec)')
|
||||
|
||||
# optimize and plot
|
||||
m.optimize('tnc', max_f_eval = 1000, messages=1)
|
||||
m.plot()
|
||||
print(m)
|
||||
Loading…
Add table
Add a link
Reference in a new issue