[mlpack] How to keep object when searching neighbors?

Li Dong dongli at lasg.iap.ac.cn
Wed Jan 15 22:57:00 EST 2014


> The AllkNN object (which is a typedef for NeighborSearch) will build and
> internally hold the tree for the reference points, and because
> singleMode == true, it won't build the tree for the query points.  It is
> possible to make your own tree and pass that in, too, if that is what
> you prefer.


I found the following constructors with referenceTree:

RangeSearch (TreeType *referenceTree, const typename TreeType::Mat &referenceSet, const bool singleMode=false, const MetricTypemetric=MetricType())

RangeSearch (TreeType *referenceTree, TreeType *queryTree, const typename TreeType::Mat &referenceSet, const typename TreeType::Mat &querySet, const bool singleMode=false, const MetricTypemetric=MetricType())

It looks like I need to construct queryTree since the reference set and query set are not the same. I see no other place to pass trees. Correct me if I am wrong.

On 2014年1月16日, at 上午11:33, Ryan Curtin <gth671b at mail.gatech.edu> wrote:

> On Thu, Jan 16, 2014 at 11:28:53AM +0800, Li Dong wrote:
>>> Ok, in that case my idea will work; build a tree on MeshCell points,
>>> then use single-tree NeighborSearch during each iteration.  It'll look
>>> something like this...
>>> 
>>> {{{
>>> using namespace mlpack;
>>> 
>>> arma::mat meshPoints; // Constructed somehow
>>> arma::mat tracerPoints; // Constructed somehow
>>> 
>>> AllkNN allknn(meshPoints, tracerPoints, false /* not naive */, true /* single mode */);
>>> 
>>> while (stillRunning)
>>> {
>>>   // recalculate tracer points
>>>   ...
>>> 
>>>   arma::mat distances;
>>>   arma::Mat<size_t> neighbors;
>>>   allknn.Search(k, neighbors, distances);
>>> }
>>> }}}
>> 
>> Where do I build the tree for MeshCell points? Or MLPACK builds it for me when in single mode?
> 
> The AllkNN object (which is a typedef for NeighborSearch) will build and
> internally hold the tree for the reference points, and because
> singleMode == true, it won't build the tree for the query points.  It is
> possible to make your own tree and pass that in, too, if that is what
> you prefer.
> 
> -- 
> Ryan Curtin    | "So, it's just you 57 punks against KUNG FU JOE?"
> ryan at ratml.org |   - Kung Fu Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack/attachments/20140116/c460882a/attachment.html>


More information about the mlpack mailing list