spark-knn icon indicating copy to clipboard operation
spark-knn copied to clipboard

Searching K nearest neighbors for each test sample in training set

Open isablle31 opened this issue 7 years ago • 1 comments
trafficstars

Is there a way to extract the K nearest neighbors from Training samples from the KNN model in the Scala version?

isablle31 avatar Oct 04 '18 19:10 isablle31

Yes. You simply run transform again on the training data to get the K neighbors for every point in the dataset. https://github.com/saurfang/spark-knn/blob/master/spark-knn-core/src/test/scala/org/apache/spark/ml/knn/KNNSuite.scala#L31

saurfang avatar Oct 05 '18 03:10 saurfang