pygeoda.kernel_knn_weights

pygeoda.kernel_knn_weights(geoda_obj, k, kernel, **kwargs)[source]

K-NN Kernel Spatial Weights Create a kernel weights by specifying k-nearest neighbors and a kernel method

Parameters
  • geoda_obj (geoda) – An instance of geoda class.

  • k (int) – a positive integer number for k-nearest neighbors

  • kernel (str) – A string value, which has to be one of {‘triangular’, ‘uniform’, ‘epanechnikov’, ‘quartic’, ‘gaussian’}

  • Adaptive_bandwidth (bool, optional) – True(default) or False: True - use adaptive bandwidth calculated using distance of k-nearest neithbors, False - use max distance of all observation to their k-nearest neighbors

  • use_kernel_diagonals (bool, optional) – A bool flag indicates whether or not the lower order neighbors should be included in the weights structure. Defaults to False.

  • is_inverse (bool, optional) – A bool flag indicates whether or not to apply inverse on distance value. Defaults to False.

  • power (float, optional) – The power (or exponent) of a number indicates how many times to use the number in a multiplication.

  • is_arc (bool, optional) – A bool flag indicates if compute arc distance or Euclidean distance. Defaults to False (Euclidean distance)

  • is_mile (bool, optional) – A bool flag indicates if the distance unit is mile or km. Defaults to True (mile).

Returns

An instance of Weight class

Return type

Weight