shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

k-d tree #1936

Closed iglesias closed 10 years ago

iglesias commented 10 years ago

This is an entrance task for the fundamental machine learning algorithms GSoC project http://www.shogun-toolbox.org/page/Events/gsoc2014_ideas#fundamental.

The road map for this task could roughly be as follows:

Please, do not wait to have everything above ready to issue your pull request. Roughly, each of the points above is worth its own pull request. The smaller a pull request is, the easier it is to get it merged. However, note also that they have to be fully compilable and add some functionality.

iglesias commented 10 years ago

Feel free to write your name below if you are working on this task! This way we avoid wasting manpower on the same algorithm.

dhruv13J commented 10 years ago

@iglesias: I'm attempting this :-)

punnu commented 10 years ago

@iglesias: already working on it :)

dhruv13J commented 10 years ago

@punnu: I've only just begun... If you already implemented the kdtree, I think i should move on to something else...

punnu commented 10 years ago

@dhruv13j: sorry for messaging lately.. i started working on it last night. So, if you are ahead of me, i can move to another task.

dhruv13J commented 10 years ago

@punnu: no problem! I've begun recently too... maybe we can decide based on the first PR ;-) ... I'm attempting this seriously for now...

vigsterkr commented 10 years ago

please note that before you start reinventing the wheel there are some libraries that extensively worked with this topic:

nanoflann is great because it's like eigen, i.e. header only based and from the statistics seems to be better than flann itself...

dhruv13J commented 10 years ago

@iglesias What are your suggestions about using nanoflann?

iglesias commented 10 years ago

Integrating nanoflann might be another possibility indeed. I am not familiarized with it at all so I will have a look, but feel free to go on your own and study whether we could integrate, bundle it, etc.

dhruv13J commented 10 years ago

@iglesias: Bundling is an option because it is a single header file, with a BSD licence. I will try this approach first.

dhruv13J commented 10 years ago

@iglesias @vigsterkr: Please take a look, I haven't made changes to KNN.h yet, because I'm still testing it. Here's the test program (based on KNN example under undocumented libshogun examples): https://gist.github.com/dhruv13J/9567939

arman-z commented 10 years ago

Hi, please take a look of my simple implementation of KD-tree from scratch. https://github.com/shogun-toolbox/shogun/pull/2095

arman-z commented 10 years ago

https://github.com/armanform/shogun/commit/41635990f69ede73a04d60b4da108ee1149714ef Hi, this is my KNN class with kd tree. Bruteforce integration with KNN.h and KNN.cpp

iglesias commented 10 years ago

@armanform, could you please update #2095 instead? Just get rid of the previous commits in that pull request and issue the one you have linked to in your previous comments.

arman-z commented 10 years ago

Ok, I've some problem to reverse commits, so I opened new pull request with only the last commit

2117

vigsterkr commented 10 years ago

@iglesias @mazumdarparijat this is done, or?

iglesias commented 10 years ago

I think this took eventually a different path since we have the kd-tree but it is not usable as the cover tree is from knn. Still, it is possible to do knn classification with the kd-tree using an instance of the tree directly. Is that right, @mazumdarparijat?

I didn't see any benchmark comparing cover tree and kd-tree.

vigsterkr commented 10 years ago

no the question was is kd-tree implemented in shogun?

vigsterkr commented 10 years ago

yes it is. fixed

mazumdarparijat commented 10 years ago

@iglesias We shall make it possible to access kd-tree/ball-tree from knn. I will have to look at the knn code. Once the integration is done, we can compare kd-tree and cover tree. I see that cover tree implementation is infused with the knn implementation. There is no separate class.

iglesias commented 10 years ago

The cover tree implementation is under lib. JLCoverTree is the class.

mazumdarparijat commented 10 years ago

ohk! I will look at this after Aug 5. Not as part of GSoC though! ;-)