[mlpack] How to keep object when searching neighbors?

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


> 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?

Thanks for providing such details!

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

> On Thu, Jan 16, 2014 at 10:36:49AM +0800, Li Dong wrote:
>>> You can use the RangeSearch class to find all the neighbors of a tracer
>>> in a specified radius.
>> 
>> RangeSearch is exactly what I want.
>> 
>>> Or am I misunderstanding?  Are you trying to find the Tracer neighbors
>>> of the MeshCell points or the MeshCell neighbors of the Tracer points?
>> 
>> MeshCells is the reference dataset, and Tracer is the query point.
> 
> 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);
>  }
> }}}
> 
> -- 
> Ryan Curtin    | "I don't really come from outer space."
> ryan at ratml.org |   - L.J. Washington





More information about the mlpack mailing list