Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

K-nearest neighbour C/C++ implementation

Where can I find an serial C/C++ implementation of the k-nearest neighbour algorithm?
Do you know of any library that has this?
I have found openCV but the implementation is already parallel.
I want to start from a serial implementation and parallelize it with pthreads openMP and MPI.

Thanks,
Alex

like image 554
alexsardan Avatar asked Nov 21 '12 07:11

alexsardan


Video Answer


2 Answers

How about ANN? http://www.cs.umd.edu/~mount/ANN/. I have once used the kdtree implementation, but there are other options.

Quoting from the website: "ANN is a library written in C++, which supports data structures and algorithms for both exact and approximate nearest neighbor searching in arbitrarily high dimensions."

like image 100
incrediblehulk Avatar answered Sep 20 '22 12:09

incrediblehulk


I wrote a C++ implementation for a KD-tree with nearest neighbor search. You can easily extend it for K-nearest neighbors by adding a priority queue.

Update: I added support for k-nearest neighbor search in N dimensions

like image 37
gvd Avatar answered Sep 17 '22 12:09

gvd