glearn.kernels.Exponential#

class glearn.kernels.Exponential#

Exponential kernel.

The kernel object is used as input argument to the instants of glearn.Covariance class.

Note

For the methods of this class, see the base class glearn.kernels.Kernel.

Notes

The exponential kernel is defined as

\[k(x) = e^{-x}.\]

The first derivative of the kernel is

\[\frac{\mathrm{d} k(x)}{\mathrm{d}x} = -k(x),\]

and its second derivative is

\[\frac{\mathrm{d} k(x)}{\mathrm{d}x} = k(x).\]

Examples

Create Kernel Object:

>>> 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, derivative=1)
-0.6065306597126334

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

>>> # Plot kernel and its first and second derivative
>>> kernel.plot()
../_images/kernel_exponential.png

Where to Use Kernel Object:

Use the kernel object to define a covariance object:

>>> # Generate a set of sample points
>>> from glearn.sample_data import generate_points
>>> points = generate_points(num_points=50)

>>> # Create covariance object of the points with the above kernel
>>> from glearn import covariance
>>> cov = glearn.Covariance(points, kernel=kernel)