spacenet.pcf.helpers.polynomial_kernel#

spacenet.pcf.helpers.polynomial_kernel(x, n=2, delta_r=1)#

Computes the polynomial kernel function for a given distance or array of distances. The polynomial kernel is defined as:

\[\kappa_{\Delta r, n}(x) = \max\left(0, \frac{n+1}{2n \Delta r} \left(1 - \left(\frac{x}{\Delta r}\right)^n\right)\right)\]
Parameters:
xfloat or numpy.ndarray

The distance(s) at which to evaluate the kernel function.

nint, optional

The exponent parameter for the polynomial kernel. Default is 2.

delta_rfloat, optional

The bandwidth parameter for the kernel function. Default is 1.

Returns:
kernel_valuesfloat or numpy.ndarray

The value(s) of the polynomial kernel function at the given distance(s).