fatf.utils.kernels.exponential_kernel

fatf.utils.kernels.exponential_kernel(distances, width=1)[source]

Applies an exponential kernel to an array of distances.

New in version 0.0.2.

The exponential kernel is computed as:

\[\mathcal{K}(\mathbf{d}) = \sqrt{exp\left(-\frac{\mathbf{d}^2}{w^2}\right)}\]

where \(\mathbf{d}\) is the array with distances and \(w\) is the kernel width.

Parameters
distancesnumpy.ndarray

A 1-dimensional, numerical numpy array with distances.

widthnumber, optional (default=1)

Width of the exponential kernel, which has to be a positive number. If a value is not provided, the default value of 1 is used.

Returns
kernelised_distancesnumpy.ndarray

A 1-dimensional numpy array containing distances transformed with an exponential kernel of width width.

Raises
IncorrectShapeError

The distances array is not a 1-dimensional numpy array.

TypeError

The distances array is a structured numpy array or it is not a purely numerical array. The width of the kernel is not a number.

ValueError

The width of the kernel is not a positive (greater than 0) number.