14 #ifndef MLPACK_METHODS_RANN_RA_MODEL_HPP
15 #define MLPACK_METHODS_RANN_RA_MODEL_HPP
35 template<
typename SortPolicy>
69 template<
template<
typename TreeMetricType,
70 typename TreeStatType,
71 typename TreeMatType>
class TreeType>
78 RAType<tree::KDTree>* kdTreeRA;
80 RAType<tree::StandardCoverTree>* coverTreeRA;
82 RAType<tree::RTree>* rTreeRA;
84 RAType<tree::RStarTree>* rStarTreeRA;
86 RAType<tree::XTree>* xTreeRA;
88 RAType<tree::HilbertRTree>* hilbertRTreeRA;
90 RAType<tree::RPlusTree>* rPlusTreeRA;
92 RAType<tree::RPlusPlusTree>* rPlusPlusTreeRA;
94 RAType<tree::UBTree>* ubTreeRA;
96 RAType<tree::Octree>* octreeRA;
109 template<
typename Archive>
110 void Serialize(Archive& ar,
const unsigned int );
113 const arma::mat&
Dataset()
const;
131 double Alpha()
const;
168 const size_t leafSize,
170 const bool singleMode);
174 void Search(arma::mat&& querySet,
176 arma::Mat<size_t>& neighbors,
177 arma::mat& distances);
183 void Search(
const size_t k,
184 arma::Mat<size_t>& neighbors,
185 arma::mat& distances);
194 #include "ra_model_impl.hpp"
bool SampleAtLeaves() const
Get whether or not sampling is done at the leaves.
size_t SingleSampleLimit() const
Get the limit on the size of a node that can be approximated.
void BuildModel(arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
Build the reference tree.
size_t LeafSize() const
Get the leaf size (only relevant when the kd-tree is used).
RAModel(TreeTypes treeType=TreeTypes::KD_TREE, bool randomBasis=false)
Initialize the RAModel with the given type and whether or not a random basis should be used...
bool FirstLeafExact() const
Get whether or not we traverse to the first leaf without approximation.
bool Naive() const
Get whether or not naive search is being used.
double Alpha() const
Get the desired success probability.
const arma::mat & Dataset() const
Expose the dataset.
void Search(arma::mat &&querySet, const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances)
Perform rank-approximate neighbor search, taking ownership of the query set.
std::string TreeName() const
Get the name of the tree type.
bool SingleMode() const
Get whether or not single-tree search is being used.
~RAModel()
Clean memory, if necessary.
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
TreeTypes
The list of tree types we can use with RASearch.
double Tau() const
Get the rank-approximation in percentile of the data.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType param...
bool RandomBasis() const
Get whether or not a random basis is being used.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
TreeTypes TreeType() const
Get the type of tree being used.