# nearest neighbor

#### jenya56

##### New Member
I am trying to understand some paper. In there author has the sample of 140 observations with respective x and y for coordinates. He then proceeds with calculating the distance to the nearest neighbor. As the result he gets 140 distances (from which he calculates cdf). I am just not sure how he did. First of all, from what little I know of this algorithm, you need training data. Second, I am not sure how he got only 140 distances. Any suggestions? Perhaps, could somebody explain with little example. Thanks!!!

#### AtlasFrysmith

##### New Member
I'm not too familiar with nearest neighbor methods but it makes sense to me that you would only get n distances from n points; each point has either exactly one nearest neighbor or else several that share the same distance. I'd expect you'd need the other distances during the calculation but if the result is just a mapping from each point to the nearest neighbor and the distance, you'd get 140.