Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify constructors of dual-tree algorithms #289

Closed
rcurtin opened this issue Dec 29, 2014 · 3 comments
Closed

unify constructors of dual-tree algorithms #289

rcurtin opened this issue Dec 29, 2014 · 3 comments
Assignees
Milestone

Comments

@rcurtin
Copy link
Member

rcurtin commented Dec 29, 2014

Reported by rcurtin on 7 May 43624460 22:08 UTC
Right now, the NeighborSearch constructor, the RangeSearch constructor, and the RASearch constructor each take the 'leafSize' parameter, which is specific to kd-trees. In addition, the actual constructor implementation is specific to kd-trees in that it hangs onto mappings for the tree when indices are reordered.

So, we must unify tree constructors so that we only need to pass the dataset they are being built on, but also we need some kind of compile-time tree trait that tells us if the tree will mix the ordering of the dataset.

Then, we can have two overloads of constructors to build the trees, and we can use that compile-time constant later to determine if we need to unmap.

@rcurtin rcurtin self-assigned this Dec 29, 2014
@rcurtin rcurtin added this to the mlpack 1.0.9 milestone Dec 29, 2014
@rcurtin rcurtin closed this as completed Dec 29, 2014
@rcurtin
Copy link
Member Author

rcurtin commented Dec 30, 2014

Commented by saheb on 13 Aug 44100804 10:23 UTC
Hi I have made the changes and attached the patch file above as I don't have commit rights as of now, its compiled properly. Check it out :)
I will soon discuss about traits and map/unmap for the same.

@rcurtin
Copy link
Member Author

rcurtin commented Dec 30, 2014

Commented by rcurtin on 3 Dec 44100867 09:54 UTC
Is this tested so that the following code will work?

arma::mat randomData;
randomData.randu(10, 10000);

NeighborSearch<CoverTree<> > ns(randomData);

arma::mat distances;
arma::Mat<size_t> neighbors;
ns.Search(5, neighbors, distances);

@rcurtin
Copy link
Member Author

rcurtin commented Dec 30, 2014

Commented by rcurtin on 29 Mar 44516391 05:58 UTC
Ok, after a large amount of patches and commits, each of the existing five dual-tree algorithms (NeighborSearch, RangeSearch, RASearch, DualTreeBoruvka, and FastMKS) now have constructors that do not have any parameters that depend on the type of tree. So the code snippet in the previous comment works, for each type of dual-tree algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant