33 #ifndef __MLPACK_METHODS_RANN_RA_SEARCH_HPP
34 #define __MLPACK_METHODS_RANN_RA_SEARCH_HPP
67 template<
typename SortPolicy = NearestNeighborSort,
69 typename TreeType = tree::BinarySpaceTree<bound::HRectBound<2, false>,
70 RAQueryStat<SortPolicy> > >
96 const typename TreeType::Mat&
querySet,
97 const bool naive =
false,
99 const MetricType
metric = MetricType());
123 RASearch(
const typename TreeType::Mat& referenceSet,
124 const bool naive =
false,
126 const MetricType
metric = MetricType());
159 const typename TreeType::Mat& referenceSet,
160 const typename TreeType::Mat& querySet,
162 const MetricType
metric = MetricType());
192 const typename TreeType::Mat& referenceSet,
194 const MetricType
metric = MetricType());
238 void Search(
const size_t k,
239 arma::Mat<size_t>& resultingNeighbors,
240 arma::mat& distances,
241 const double tau = 5,
242 const double alpha = 0.95,
243 const bool sampleAtLeaves =
false,
244 const bool firstLeafExact =
false,
245 const size_t singleSampleLimit = 20);
308 #include "ra_search_impl.hpp"
const arma::mat & querySet
Query dataset (may not be given).
void ResetQueryTree()
This function recursively resets the RAQueryStat of the queryTree to set 'bound' to WorstDistance and...
MetricType metric
Instantiation of kernel.
std::string ToString() const
LMetric< 2, false > SquaredEuclideanDistance
void ResetRAQueryStat(TreeType *treeNode)
bool hasQuerySet
Indicates if a separate query set was passed.
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
RASearch(const typename TreeType::Mat &referenceSet, const typename TreeType::Mat &querySet, const bool naive=false, const bool singleMode=false, const MetricType metric=MetricType())
Initialize the RASearch object, passing both a query and reference dataset.
const arma::mat & referenceSet
Reference dataset.
arma::mat queryCopy
Copy of query dataset (if we need it, because tree building modifies it).
TreeType * referenceTree
Pointer to the root of the reference tree.
size_t numberOfPrunes
Total number of pruned nodes during the neighbor search.
std::vector< size_t > oldFromNewReferences
Permutations of reference points during tree building.
TreeType * queryTree
Pointer to the root of the query tree (might not exist).
arma::mat referenceCopy
Copy of reference dataset (if we need it, because tree building modifies it).
~RASearch()
Delete the RASearch object.
std::vector< size_t > oldFromNewQueries
Permutations of query points during tree building.
bool treeOwner
If true, this object created the trees and is responsible for them.
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
bool naive
Indicates if naive random sampling on the set is being used.
bool singleMode
Indicates if single-tree search is being used (opposed to dual-tree).
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.