diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index ead4d0fc..cd893bac 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -2,5 +2,5 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) -from constructors import rbf, Matern32, Matern52, exponential, linear, white, bias, finite_dimensional, rbf_ARD, spline, Brownian, linear_ARD, rbf_sympy +from constructors import rbf, Matern32, Matern52, exponential, linear, white, bias, finite_dimensional, rbf_ARD, spline, Brownian, linear_ARD, rbf_sympy, sympykern from kern import kern diff --git a/GPy/kern/constructors.py b/GPy/kern/constructors.py index 7bbac967..0dd579cc 100644 --- a/GPy/kern/constructors.py +++ b/GPy/kern/constructors.py @@ -188,3 +188,9 @@ def rbf_sympy(D,variance=1., lengthscale=1.): dist = parse_expr(dist_string) f = rbf_variance*sp.exp(-dist/(2*rbf_lengthscale**2)) return kern(D,[spkern(D,f,np.array([variance,lengthscale]))]) + +def sympykern(D,k): + """ + A kernel from a symbolic sympy representation + """ + return kern(D,[spkern(D,k)]) diff --git a/GPy/models/uncollapsed_sparse_GP.py b/GPy/models/uncollapsed_sparse_GP.py index 3f645ab4..c345d1c5 100644 --- a/GPy/models/uncollapsed_sparse_GP.py +++ b/GPy/models/uncollapsed_sparse_GP.py @@ -140,5 +140,5 @@ class uncollapsed_sparse_GP(sparse_GP_regression): """ sparse_GP_regression.plot(self,*args,**kwargs) if self.Q==1: - pb.errorbar(self.Z[:,0],self.q_u_expectation[0][:,0],yerr=2*np.sqrt(np.diag(self.q_u_cov)),fmt=None,ecolor='b') + pb.errorbar(self.Z[:,0],self.q_u_expectation[0][:,0],yerr=2.*np.sqrt(np.diag(self.q_u_cov)),fmt=None,ecolor='b')