Skip to content

Commit

Permalink
add additional docstring info about coincident points
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwolf committed Dec 10, 2021
1 parent f52e6a7 commit fd0929f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion libpysal/weights/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,20 @@ class KNN(W):
Notes
-----
Ties between neighbors of equal distance are arbitrarily broken.
Ties between neighbors of equal distance are arbitrarily broken.
Further, if many points occupy the same spatial location (i.e. observations are
coincident), then you may need to increase k for those observations to
acquire neighbors at different spatial locations. For example, if five
points are coincident, then their four nearest neighbors will all
occupy the same spatial location; only the fifth nearest neighbor will
result in those coincident points becoming connected to the graph as a
whole.
Solutions to this problem include jittering the points (by adding
a small random value to each observation's location) or by adding
higher-k neighbors only to the coincident points, using the
weights.w_sets.w_union() function.
See Also
--------
Expand Down

0 comments on commit fd0929f

Please sign in to comment.