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" TreeTypes TreeType() const
Get the type of tree being used.
void BuildModel(arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
Build the reference tree.
bool RandomBasis() const
Get whether or not a random basis is being used.
Linear algebra utility functions, generally performed on matrices or vectors.
const arma::mat & Dataset() const
Expose the dataset.
double Tau() const
Get the rank-approximation in percentile of the data.
size_t SingleSampleLimit() const
Get the limit on the size of a node that can be approximated.
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.
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.
~RAModel()
Clean memory, if necessary.
bool SingleMode() const
Get whether or not single-tree search is being used.
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
size_t LeafSize() const
Get the leaf size (only relevant when the kd-tree is used).
TreeTypes
The list of tree types we can use with RASearch.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
bool SampleAtLeaves() const
Get whether or not sampling is done at the leaves.
std::string TreeName() const
Get the name of the tree type.
bool Naive() const
Get whether or not naive search is being used.
The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType param...
double Alpha() const
Get the desired success probability.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.