Finds the K nearest neighbors of the query object.
Finds the K nearest neighbors of the query object. The naive implementation here searches through all the the objects in the RDD to get the KNN. The nearness of the objects here is decided on the basis of the distance between their centers.
: RDD[T] RDD of T (T<:Shape3D)
: (T<:Shape3D) Object to which the KNN are to be found
: (Int) Number of nearest neighbors requested
: (Boolean) If True, returns only distinct objects. Default is false.
(List[T]) List of the KNN T<:Shape3D.
More efficient implementation of the KNN query above.
More efficient implementation of the KNN query above. First we seek the partitions in which the query object belongs and we will look for the knn only in those partitions. After this if the limit k is not satisfied, we keep looking similarly in the neighbors of the containing partitions.
: RDD[T] RDD of T (T<:Shape3D)
: (T<:Shape3D) Object to which the KNN are to be found
: (Int) Number of nearest neighbors requested
(List[T]) List of the KNN T<:Shape3D.