hoangduit / accord

Automatically exported from code.google.com/p/accord
0 stars 0 forks source link

Index information in KD structure #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First off, a big big thanks to those working on this wonderful project...

I have a request! (and maybe you can educate me if this doesn't make sense)

Let's say I have constructed a kd tree structure out of a 2D array (N points 
each w/ values describing the position in three dimensions).  I then query for 
k nearest neighbors and get the k results.  Obviously the k results came from 
some position in the original 2D array describing the N points. Does the kd 
tree structure support easy access to these indices?

I haven't found any obvious support for this...  I would find this indexing 
information very useful for pairing the nearest neighbor results with data such 
as color, normals, or intensity that are external to the kd tree structure but 
tied to points in the structure that I am searching.

Thanks for comments or help!

S

Original issue reported on code.google.com by scrouc...@gmail.com on 11 Feb 2014 at 6:10

GoogleCodeExporter commented 9 years ago
Follow up:

As a temporary work around, I have written in a 4th dimension with the index 
data I am interested in.  This can be done such that it is very unlikely to 
affect search results - writing in as a small number.  I guess taking this data 
along for the ride will affect speeds somewhat but much less so than having to 
take the NN search results and then brute force search the entire list of input 
points for a pairing just to find the index (this is what is being avoided in 
the first place).  It would just be nice if the index rode along through the 
structure as a sort of meta data that was there for the taking.  Exploring the 
tree in the debugger shows plenty of other stuff is around!

Thanks again for help or comments.

Original comment by scrouc...@gmail.com on 11 Feb 2014 at 11:21

GoogleCodeExporter commented 9 years ago
Hi there! Actually it should be possible to store other kind of information in 
the nodes of the KDTree. When you create a KDTree using KDTree.Create(), you 
can give a list of values that should be passed alongside the vector positions 
in the nodes. 

http://accord-framework.net/docs/html/M_Accord_MachineLearning_Structures_KDTree
_FromData__1_2.htm

Hope it helps! (By the way, we can also use the forums to discuss about it!)

Original comment by cesarso...@gmail.com on 12 Feb 2014 at 9:17

GoogleCodeExporter commented 9 years ago
Yes a huge help! Thanks for the push in the right direction.

Best Regards,

s

Original comment by scrouc...@gmail.com on 12 Feb 2014 at 3:12