Implementation of the k-nearest-neighbour algorithm. More...
|Calculate the euclidean distance of two n-dimensional points. |
|Find for point it's k nearest neighours in the iterable object points |
Implementation of the k-nearest-neighbour algorithm.
Find for point it's k nearest neighours in the iterable object points
|point||the reference points which near neighbours you want to find|
|points||iterable object of other points (distance to point is calculated for each point in this "set")|
|k||defines how many neighbours are found in the result list (if the length of the list is smaller than k a list of points is returned)|
|key||the distance function is not called on point and a point in points directly. The key function is called on point and the result is passed to the distance function|
|key2||similar to key but this function is applied to each point in the points "set". Default is None which means that key is used. The advantage of having to key functions is that we can apply different functions on point and all other points.|
|distance||a distance function that defines a float distance between two points. The distance function is applied to key(point) and key2(p) where p is a point form points. Default is euclidean_distance|
len(points) < kthe list has length