def exponential(x, y, sigma=1):
"""Compute an exponential kernel.
The exponential kernel is closely related to the Gaussian kernel, with
only the square of the norm left out. It is also a radial basis function
kernel:
K(x, y) = exp(-||x - y|| / 2?^2)
where `x` and `y` are vectors in the input space (i.e., vectors of
features computed from training or test samples), ``||x - y||` is the
Euclidean norm, and the adjustable parameter `sigma` is used to adjust
the kernel 'bandwidth'. It is important to note that the observations made
about the `sigma` parameter for the Gaussian kernel also apply to the
Exponential and Laplacian kernels.
See Also
--------
gaussian
"""
return exp(-(dist.euclidean(x, y) / 2*sigma**2))
评论列表
文章目录