[mlpack] How to keep object when searching neighbors?

Li Dong dongli at lasg.iap.ac.cn
Thu Jan 16 00:15:42 EST 2014


So the constructor should look like this?

RangeSearch (referenceTree, NULL, referenceSet, querySet, true)

where ‘querySet' is used as the query dataset?

It would be convenient that the reference dataset can be kept across the call of Search(…), and we can pass query dataset when calling Search(…).

On 2014年1月16日, at 下午12:19, Ryan Curtin <gth671b at mail.gatech.edu> wrote:

> On Thu, Jan 16, 2014 at 11:57:00AM +0800, Li Dong wrote:
>>> 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.
> 
> Why not use this constructor?
> 
> RangeSearch(const typename TreeType::Mat& referenceSet,
>            const typename TreeType::Mat& querySet,
>            const bool naive = false,
>            const bool singleMode = false,
>            const size_t leafSize = 20,
>            const MetricType metric = MetricType());
> 
> It will automatically build the trees for you, and if you specify
> singleMode = true, then the query tree wil not be built.
> 
> If you want to use the constructors where you manually pass trees, you
> can pass queryTree = NULL if singleMode = true.
> 
> -- 
> Ryan Curtin    | "What? Facts?"
> ryan at ratml.org |   - Joe Cairo

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


More information about the mlpack mailing list