[R] Nearest Neighbors
Petr Savicky
savicky at cs.cas.cz
Sun Jul 29 20:44:27 CEST 2012
On Tue, Jul 24, 2012 at 09:26:49AM -0700, olemissrebs1123 wrote:
> I was wondering if there is a way in R to find k nearest neighbors of various
> orders, say order 2, 3, or 4. In otherwords neighbors of neighbors of
> neighbors. You get the idea. I know that I can use knearneigh(matrix.data,
> k) but this only gives me the k nearest neighbors and not of a particular
> order.
Hi.
If i understand correctly, then this may be achieved by several iterations.
In the first iteration, the nearest neighbours are found. The next iteration
starts from them a finds their nearest neighbours. These are neighbours of
order 2. A general iteration finds neighbours of order n by looking for neighbours
of the points found in the previous step, which are the neighours of order n-1.
Hope this helps.
Petr Savicky.
More information about the R-help
mailing list