[mlpack] How to keep object when searching neighbors?
Ryan Curtin
gth671b at mail.gatech.edu
Wed Jan 15 22:33:38 EST 2014
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
More information about the mlpack
mailing list