pygeoda.knn_weights

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

K-Nearest Neighbors-based Spatial Weights Create a k-nearest neighbors based spatial weights

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

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

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

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

  • 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