Options

# k nearest neighbor - example set of nearest neighbors

danjeharry
Member Posts:

**20**Contributor II
Hey all,

If I wanted to run a k-nearest neighbor algorithm on my dataset and get say the 500 nearest points for a single data point, is there a way to get rapidminer to return the 500 points that comprise the nearest neighbors?

Thanks

If I wanted to run a k-nearest neighbor algorithm on my dataset and get say the 500 nearest points for a single data point, is there a way to get rapidminer to return the 500 points that comprise the nearest neighbors?

Thanks

0

## Answers

14Contributor IIPut the point in question to the center of it and create a new attribute that holds the distance from the origin of your new coordinate system. Then cut on that distance. Or sort the output with respect to that distance. The feasibility of this workaround however critically depends on the dimensionality of your problem. It'll really suck to implement that for high dimension (meaning >= well let's say 5 or 6 ...)

Tim