Kernel Weights

Kernel Weights applies kernel function to determine the distance decay in the derived continuous weights kernel. The kernel weights are defined as a function K(z) of the ratio between the distance dij from i to j, and the bandwidth hi, with z=dij/hi. The kernel functions include {triangular , uniform, quadratic , epanechnikov, quartic, gaussian}.

  • Uniform, K(z)=1/2 for |z|<1,

  • Triangular, K(z)=(1−|z|) for |z|<1,

  • Quadratic or Epanechnikov, K(z)=(3/4)(1−z^2) for |z|<1,

  • Quartic, K(z)=(15/16)(1−z^2)^2 for |z|<1|z|<1, and

  • Gaussian. K(z) = (2π)^{1/2}exp(-z^2/2)

For more information, please read: https://geodacenter.github.io/workbook/4c_distance_functions/lab4c.html#kernel-weights

There are two types of fixed bandwidths for kernel weights. One is the max-min distance used earlier (the largest of the nearest-neighbor distances): kernel_weights(). The other is the maximum distance for a given specification of k-nearest neighbors: kernel_knn_weights().

1. getKernelWeights()

function getKernelWeights(
    String mapUid,
    Number distBand, 
    String kernel,
    Number power, 
    Boolean isInverse,
    Boolean isArc,
    Boolean isMile,
    Boolean useKernelDiagonals)

Arguments

Return

2. getKernelKnnWeights()

With knn set to a given value, the maximum distance between the selected k-nearest neighbors' pairs is used as a "fixed" bandwidth. However, a drawback of fixed bandwidth kernel weights is that the number of non-zero weights can vary considerably, especially when the density of the point locations is not uniform throughout space. The argument adaptive_bandwidth is provided to allow adaptive bandwidth in knn kernel weights: instead of a fixed distance bandwidth, the distance to the k-th nearest neighbor is used in the kernel function for each observation.

API

function getKernelKnnWeights(
    String map_uid, 
    integer k, 
    String kernel,
    Boolean adaptive_bandwidth,
    Number power, 
    Boolean is_inverse,
    Boolean is_arc,
    Boolean is_mile,
    Boolean use_kernel_diagonals)

Arguments

Return

Try it yourself in the playground (jsgeoda + deck.gl):

Last updated