17 #ifndef __MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP 18 #define __MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP 51 template<
template<
typename TreeMetricType,
52 typename TreeStatType,
53 typename TreeMatType>
class TreeType>
76 RSModel(
const int treeType = TreeTypes::KD_TREE,
77 const bool randomBasis =
false);
85 template<
typename Archive>
86 void Serialize(Archive& ar,
const unsigned int );
89 const arma::mat&
Dataset()
const;
127 const size_t leafSize,
129 const bool singleMode);
141 void Search(arma::mat&& querySet,
143 std::vector<std::vector<size_t>>& neighbors,
144 std::vector<std::vector<double>>& distances);
156 std::vector<std::vector<size_t>>& neighbors,
157 std::vector<std::vector<double>>& distances);
176 #include "rs_model_impl.hpp" The RangeSearch class is a template class for performing range searches.
void BuildModel(arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
Build the reference tree on the given dataset with the given parameters.
bool SingleMode() const
Get whether the model is in single-tree search mode.
void Serialize(Archive &ar, const unsigned int)
Serialize the range search model.
int TreeType() const
Get the type of tree.
RSType< tree::RStarTree > * rStarTreeRS
R* tree based range search object (NULL if not in use).
RSType< tree::RTree > * rTreeRS
R tree based range search object (NULL if not in use).
Linear algebra utility functions, generally performed on matrices or vectors.
bool Naive() const
Get whether the model is in naive search mode.
int & TreeType()
Modify the type of tree (don't do this after the model has been built).
arma::mat q
Random projection matrix.
bool & RandomBasis()
Modify whether a random basis is used (don't do this after the model has been built).
void CleanMemory()
Clean up memory.
RSType< tree::StandardCoverTree > * coverTreeRS
Cover tree based range search object (NULL if not in use).
size_t LeafSize() const
Get the leaf size (applicable to everything but the cover tree).
bool randomBasis
If true, we randomly project the data into a new basis before search.
Simple real-valued range.
bool RandomBasis() const
Get whether a random basis is used.
RSModel(const int treeType=TreeTypes::KD_TREE, const bool randomBasis=false)
Initialize the RSModel with the given type and whether or not a random basis should be used...
~RSModel()
Clean memory, if necessary.
size_t & LeafSize()
Modify the leaf size (applicable to everything but the cover tree).
const arma::mat & Dataset() const
Expose the dataset.
void Search(arma::mat &&querySet, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
Perform range search.
RSType< tree::KDTree > * kdTreeRS
kd-tree based range search object (NULL if not in use).
std::string TreeName() const
Return a string representing the name of the tree.
RSType< tree::BallTree > * ballTreeRS
Ball tree based range search object (NULL if not in use).