# libpysal.kernels.kernel

libpysal.kernels.kernel(distances, bandwidth, kernel='gaussian', taper=True, decay=False)

  Evaluate a kernel function over a distance array.

  Parameters:
    distances `ndarray`

      Array of distances.

    bandwidth `python:float`

      Kernel bandwidth.

    kernel `python:str` or `python:callable()`, `optional`

      The kernel function to use. If a string, must be one of the predefined kernel names: ‘triangular’, ‘parabolic’, ‘gaussian’, ‘bisquare’, ‘cosine’, ‘boxcar’, ‘discrete’, ‘exponential’, ‘identity’. If callable, it should have the signature (distances, bandwidth). If None, the ‘identity’ kernel is used.

    taper bool (default: `python:True`)

      Set kernel = 0 for all distances exceeding the bandwith. To evaluate kernel beyond bandwith set taper=False.

    decay bool (default: `python:False`)

      whether to calculate the kernel using the decay formulation. In the decay form, a kernel measures the distance decay in similarity between observations. It varies from from maximal similarity (1) at a distance of zero to minimal similarity (0 or negative) at some very large (possibly infinite) distance. Otherwise, kernel functions are treated as proper volume-preserving probability distributions.

  Returns:
    `ndarray`

      Kernel function evaluated at distance values.