From 207e12fd7f93c9be19bf42b6d079b6c4e67da439 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Fri, 30 Nov 2012 15:49:47 +0000 Subject: [PATCH] demo for GP regressio with uncertain inputs --- .../uncertain_input_GP_regression_demo.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 GPy/examples/uncertain_input_GP_regression_demo.py diff --git a/GPy/examples/uncertain_input_GP_regression_demo.py b/GPy/examples/uncertain_input_GP_regression_demo.py new file mode 100644 index 00000000..3d2c51f0 --- /dev/null +++ b/GPy/examples/uncertain_input_GP_regression_demo.py @@ -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)