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>
137 template<
typename Archive>
138 void Serialize(Archive& ar,
const unsigned int );
141 const arma::mat&
Dataset()
const;
159 double Alpha()
const;
196 const size_t leafSize,
198 const bool singleMode);
202 void Search(arma::mat&& querySet,
204 arma::Mat<size_t>& neighbors,
205 arma::mat& distances);
211 void Search(
const size_t k,
212 arma::Mat<size_t>& neighbors,
213 arma::mat& distances);
222 #include "ra_model_impl.hpp" bool SampleAtLeaves() const
Get whether or not sampling is done at the leaves.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
double Tau() const
Get the rank-approximation in percentile of the data.
Linear algebra utility functions, generally performed on matrices or vectors.
RAType< tree::RPlusPlusTree > * rPlusPlusTreeRA
Non-NULL if the R++ tree is used.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
RAType< tree::RStarTree > * rStarTreeRA
Non-NULL if the R* tree is used.
RAType< tree::UBTree > * ubTreeRA
Non-NULL if the UB tree is used.
bool FirstLeafExact() const
Get whether or not we traverse to the first leaf without approximation.
void BuildModel(arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
Build the reference tree.
~RAModel()
Clean memory, if necessary.
bool Naive() const
Get whether or not naive search is being used.
std::string TreeName() const
Get the name of the tree type.
TreeTypes treeType
The type of tree being used.
bool RandomBasis() const
Get whether or not a random basis is being 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 SingleMode() const
Get whether or not single-tree search is being used.
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.
arma::mat q
The basis to project into.
size_t SingleSampleLimit() const
Get the limit on the size of a node that can be approximated.
RAType< tree::RTree > * rTreeRA
Non-NULL if the R tree is used.
RAType< tree::Octree > * octreeRA
Non-NULL if the octree is used.
const arma::mat & Dataset() const
Expose the dataset.
bool randomBasis
If true, randomly project into a new basis.
RAModel & operator=(const RAModel &other)
Copy the given RAModel.
TreeTypes TreeType() const
Get the type of tree being used.
size_t LeafSize() const
Get the leaf size (only relevant when the kd-tree is used).
RAType< tree::RPlusTree > * rPlusTreeRA
Non-NULL if the R+ tree is used.
TreeTypes
The list of tree types we can use with RASearch.
double Alpha() const
Get the desired success probability.
RAType< tree::HilbertRTree > * hilbertRTreeRA
Non-NULL if the Hilbert R tree is used.
RAType< tree::StandardCoverTree > * coverTreeRA
Non-NULL if the cover tree is used.
RAType< tree::KDTree > * kdTreeRA
Non-NULL if the kd-tree is used.
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
test cpp RESULT_VARIABLE MEX_RESULT_TRASH OUTPUT_VARIABLE MEX_OUTPUT ERROR_VARIABLE MEX_ERROR_TRASH string(REGEX MATCH"Warning: You are using"MEX_WARNING"${MEX_OUTPUT}") if(MEX_WARNING) string(REGEX REPLACE".*using [a-zA-Z]* version \"([0-9.]*)[^\"]*\".*""\\1"OTHER_COMPILER_VERSION"$
size_t leafSize
The leaf size of the tree being used (useful only for the kd-tree).
The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType param...
RAType< tree::XTree > * xTreeRA
Non-NULL if the X tree is used.