# Copyright (c) 2016, Vladimir Feinberg
# Licensed under the BSD 3-clause license (see LICENSE)
"""
The identity kernel (no covariance).
"""
from .stationary_kern import StationaryKern
from ..util.docs import inherit_doc
[docs]@inherit_doc
class Identity(StationaryKern):
"""
This class defines identity kernel :math:`k`.
.. math::
k(r) = 1_{r=0}
:param name:
:param active_dims: see :class:`runlmc.kern.stationary_kern.StationaryKern`
for details.
"""
def __init__(self, name='id', active_dims=None):
super().__init__(name=name, active_dims=active_dims)
[docs] def from_dist(self, dists):
return (dists == 0.0).astype(float)
[docs] def to_gpy(self):
raise NotImplementedError('requires manual impl')
[docs] def kernel_gradient(self, dists):
return []
[docs] def update_gradient(self, grad):
pass