33 #ifndef __MLPACK_METHODS_RANN_RA_SEARCH_HPP
34 #define __MLPACK_METHODS_RANN_RA_SEARCH_HPP
56 template<
typename SortPolicy>
76 template<
typename TreeType>
78 bound(SortPolicy::WorstDistance()),
113 template<
typename SortPolicy = NearestNeighborSort,
116 RAQueryStat<SortPolicy> > >
142 const typename TreeType::Mat&
querySet,
143 const bool naive =
false,
145 const size_t leafSize = 20,
146 const MetricType
metric = MetricType());
170 RASearch(
const typename TreeType::Mat& referenceSet,
171 const bool naive =
false,
173 const size_t leafSize = 20,
174 const MetricType
metric = MetricType());
207 const typename TreeType::Mat& referenceSet,
208 const typename TreeType::Mat& querySet,
210 const MetricType
metric = MetricType());
240 const typename TreeType::Mat& referenceSet,
242 const MetricType
metric = MetricType());
286 void Search(
const size_t k,
287 arma::Mat<size_t>& resultingNeighbors,
288 arma::mat& distances,
289 const double tau = 5,
290 const double alpha = 0.95,
291 const bool sampleAtLeaves =
false,
292 const bool firstLeafExact =
false,
293 const size_t singleSampleLimit = 20);
353 #include "ra_search_impl.hpp"
size_t numSamplesMade
The minimum number of samples made by any query in this node.
arma::mat referenceCopy
Copy of reference dataset (if we need it, because tree building modifies it).
double Bound() const
Get the bound.
~RASearch()
Delete the RASearch object.
Extra data for each node in the tree.
bool ownReferenceTree
Indicates if we should free the reference tree at deletion time.
void ResetRAQueryStat(TreeType *treeNode)
bool naive
Indicates if naive random sampling on the set is being used.
LMetric< 2, false > SquaredEuclideanDistance
TreeType * referenceTree
Pointer to the root of the reference tree.
size_t numberOfPrunes
Total number of pruned nodes during the neighbor search.
A binary space partitioning tree, such as a KD-tree or a ball tree.
const arma::mat & querySet
Query dataset (may not be given).
TreeType * queryTree
Pointer to the root of the query tree (might not exist).
std::vector< size_t > oldFromNewQueries
Permutations of query points during tree building.
const arma::mat & referenceSet
Reference dataset.
size_t NumSamplesMade() const
Get the number of samples made.
void Search(const size_t k, arma::Mat< size_t > &resultingNeighbors, arma::mat &distances, const double tau=5, const double alpha=0.95, const bool sampleAtLeaves=false, const bool firstLeafExact=false, const size_t singleSampleLimit=20)
Compute the rank approximate nearest neighbors and store the output in the given matrices.
bool ownQueryTree
Indicates if we should free the query tree at deletion time.
void ResetQueryTree()
This function recursively resets the RAQueryStat of the queryTree to set 'bound' to WorstDistance and...
MetricType metric
Instantiation of kernel.
arma::mat queryCopy
Copy of query dataset (if we need it, because tree building modifies it).
double & Bound()
Modify the bound.
std::vector< size_t > oldFromNewReferences
Permutations of reference points during tree building.
RASearch(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())
Initialize the RASearch object, passing both a query and reference dataset.
RAQueryStat(const TreeType &)
Initialization for a node.
bool singleMode
Indicates if single-tree search is being used (opposed to dual-tree).
see subsection cli_alt_reg_tut Alternate DET regularization The usual regularized error f $R_ alpha(t)\f $of a node\f $t\f $is given by
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
size_t & NumSamplesMade()
Modify the number of samples made.
double bound
The bound on the node's neighbor distances.
RAQueryStat()
Initialize the statistic with the worst possible distance according to our sorting policy...