glearn.kernels.Kernel.__call__#

Kernel.__call__()#

Evaluate the kernel function or its derivatives.

Parameters:
xfloat or array_like[float]

Input points to the kernel function.

derivativeint, default=0

The order of the derivative of the kernel function. Zero means no derivative.

Returns:
yfloat or numpy.array[float]

The value of the kernel function or its derivatives. The size of y is the same as the size of the input argument x.

Examples

>>> from glearn import kernels

>>> # Create an exponential kernel
>>> kernel = kernels.Exponential()

>>> # Evaluate kernel at the point x=0.5
>>> x = 0.5
>>> kernel(x)
0.6065306597126334

>>> # Evaluate first derivative of kernel at the point x=0.5
>>> kernel(x, derivarive=1)
-0.6065306597126334

>>> # Evaluate second derivative of kernel at the point x=0.5
>>> kernel(x, derivarive=2)
0.6065306597126334