mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-07 11:02:38 +02:00
[updates] merged update structure
This commit is contained in:
commit
bccd8e094a
36 changed files with 190 additions and 107 deletions
|
|
@ -10,11 +10,11 @@ class Hierarchical(Kernpart):
|
|||
A kernel part which can reopresent a hierarchy of indepencnce: a generalisation of independent_outputs
|
||||
|
||||
"""
|
||||
def __init__(self,parts):
|
||||
def __init__(self,parts,name='hierarchy'):
|
||||
self.levels = len(parts)
|
||||
self.input_dim = parts[0].input_dim + 1
|
||||
self.num_params = np.sum([k.num_params for k in parts])
|
||||
self.name = 'hierarchy'
|
||||
self.name = name
|
||||
self.parts = parts
|
||||
|
||||
self.param_starts = np.hstack((0,np.cumsum([k.num_params for k in self.parts[:-1]])))
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ class RBF(Stationary):
|
|||
_support_GPU = True
|
||||
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, active_dims=None, name='rbf', useGPU=False):
|
||||
super(RBF, self).__init__(input_dim, variance, lengthscale, ARD, active_dims, name, useGPU=useGPU)
|
||||
self.weave_options = {}
|
||||
self.group_spike_prob = False
|
||||
self.psicomp = PSICOMP_RBF()
|
||||
if self.useGPU:
|
||||
self.psicomp = PSICOMP_RBF_GPU()
|
||||
|
|
|
|||
|
|
@ -171,7 +171,8 @@ class Stationary(Kern):
|
|||
|
||||
#the lower memory way with a loop
|
||||
ret = np.empty(X.shape, dtype=np.float64)
|
||||
[np.sum(tmp*(X[:,q][:,None]-X2[:,q][None,:]), axis=1, out=ret[:,q]) for q in xrange(self.input_dim)]
|
||||
for q in xrange(self.input_dim):
|
||||
np.sum(tmp*(X[:,q][:,None]-X2[:,q][None,:]), axis=1, out=ret[:,q])
|
||||
ret /= self.lengthscale**2
|
||||
|
||||
return ret
|
||||
|
|
@ -309,6 +310,19 @@ class Matern52(Stationary):
|
|||
|
||||
|
||||
class ExpQuad(Stationary):
|
||||
"""
|
||||
The Exponentiated quadratic covariance function.
|
||||
|
||||
.. math::
|
||||
|
||||
k(r) = \sigma^2 (1 + \sqrt{5} r + \\frac53 r^2) \exp(- \sqrt{5} r)
|
||||
|
||||
notes::
|
||||
- Yes, this is exactly the same as the RBF covariance function, but the
|
||||
RBF implementation also has some features for doing variational kernels
|
||||
(the psi-statistics).
|
||||
|
||||
"""
|
||||
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, active_dims=None, name='ExpQuad'):
|
||||
super(ExpQuad, self).__init__(input_dim, variance, lengthscale, ARD, active_dims, name)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,10 @@
|
|||
|
||||
|
||||
import numpy as np
|
||||
from scipy import weave
|
||||
from kern import Kern
|
||||
from ...util.linalg import tdot
|
||||
from ...util.misc import param_to_array
|
||||
from ...core.parameterization import Param
|
||||
from ...core.parameterization.transformations import Logexp
|
||||
from ...util.caching import Cache_this
|
||||
from ...core.parameterization import variational
|
||||
from ...util.config import *
|
||||
|
||||
class TruncLinear(Kern):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue