mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 11:32:39 +02:00
added a constructor for a generic sympy kernel
This commit is contained in:
parent
304947d6cd
commit
e29dc1c9dd
3 changed files with 8 additions and 2 deletions
|
|
@ -2,5 +2,5 @@
|
||||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
# 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
|
from kern import kern
|
||||||
|
|
|
||||||
|
|
@ -188,3 +188,9 @@ def rbf_sympy(D,variance=1., lengthscale=1.):
|
||||||
dist = parse_expr(dist_string)
|
dist = parse_expr(dist_string)
|
||||||
f = rbf_variance*sp.exp(-dist/(2*rbf_lengthscale**2))
|
f = rbf_variance*sp.exp(-dist/(2*rbf_lengthscale**2))
|
||||||
return kern(D,[spkern(D,f,np.array([variance,lengthscale]))])
|
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)])
|
||||||
|
|
|
||||||
|
|
@ -140,5 +140,5 @@ class uncollapsed_sparse_GP(sparse_GP_regression):
|
||||||
"""
|
"""
|
||||||
sparse_GP_regression.plot(self,*args,**kwargs)
|
sparse_GP_regression.plot(self,*args,**kwargs)
|
||||||
if self.Q==1:
|
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')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue