mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 22:06:22 +02:00
Working with OU kernel
This commit is contained in:
parent
c8da9602ec
commit
0c2bae53f7
2 changed files with 22 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ from _src.rbf import RBF
|
||||||
from _src.linear import Linear, LinearFull
|
from _src.linear import Linear, LinearFull
|
||||||
from _src.static import Bias, White
|
from _src.static import Bias, White
|
||||||
from _src.brownian import Brownian
|
from _src.brownian import Brownian
|
||||||
from _src.stationary import Exponential, Matern32, Matern52, ExpQuad, RatQuad, Cosine
|
from _src.stationary import Exponential, OU, Matern32, Matern52, ExpQuad, RatQuad, Cosine
|
||||||
from _src.mlp import MLP
|
from _src.mlp import MLP
|
||||||
from _src.periodic import PeriodicExponential, PeriodicMatern32, PeriodicMatern52
|
from _src.periodic import PeriodicExponential, PeriodicMatern32, PeriodicMatern52
|
||||||
from _src.independent_outputs import IndependentOutputs, Hierarchical
|
from _src.independent_outputs import IndependentOutputs, Hierarchical
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,27 @@ class Exponential(Stationary):
|
||||||
def dK_dr(self, r):
|
def dK_dr(self, r):
|
||||||
return -0.5*self.K_of_r(r)
|
return -0.5*self.K_of_r(r)
|
||||||
|
|
||||||
|
|
||||||
|
class OU(Stationary):
|
||||||
|
"""
|
||||||
|
OU kernel:
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
|
||||||
|
k(r) = \\sigma^2 \exp(- r) \\ \\ \\ \\ \\text{ where } r = \sqrt{\sum_{i=1}^input_dim \\frac{(x_i-y_i)^2}{\ell_i^2} }
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, active_dims=None, name='OU'):
|
||||||
|
super(OU, self).__init__(input_dim, variance, lengthscale, ARD, active_dims, name)
|
||||||
|
|
||||||
|
def K_of_r(self, r):
|
||||||
|
return self.variance * np.exp(-r)
|
||||||
|
|
||||||
|
def dK_dr(self,r):
|
||||||
|
return -1.*self.variance*np.exp(-r)
|
||||||
|
|
||||||
|
|
||||||
class Matern32(Stationary):
|
class Matern32(Stationary):
|
||||||
"""
|
"""
|
||||||
Matern 3/2 kernel:
|
Matern 3/2 kernel:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue