15 #ifndef MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP
16 #define MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP
22 #include <boost/variant.hpp>
31 template<
template<
typename TreeMetricType,
32 typename TreeStatType,
33 typename TreeMatType>
class TreeType>
46 std::vector<std::vector<size_t>>& neighbors;
48 std::vector<std::vector<double>>& distances;
52 template<
typename RSType>
57 std::vector<std::vector<size_t>>& neighbors,
58 std::vector<std::vector<double>>& distances):
75 const arma::mat& querySet;
79 std::vector<std::vector<size_t>>& neighbors;
81 std::vector<std::vector<double>>& distances;
83 const size_t leafSize;
86 template<
typename RSType>
87 void SearchLeaf(
RSType* rs)
const;
91 template<
template<
typename TreeMetricType,
92 typename TreeStatType,
93 typename TreeMatType>
class TreeType>
97 template<
template<
typename TreeMetricType,
98 typename TreeStatType,
99 typename TreeMatType>
class TreeType>
100 void operator()(
RSTypeT<TreeType>* rs)
const;
114 std::vector<std::vector<size_t>>& neighbors,
115 std::vector<std::vector<double>>& distances,
116 const size_t leafSize);
129 arma::mat&& referenceSet;
133 template<
typename RSType>
134 void TrainLeaf(
RSType* rs)
const;
138 template<
template<
typename TreeMetricType,
139 typename TreeStatType,
140 typename TreeMatType>
class TreeType>
144 template<
template<
typename TreeMetricType,
145 typename TreeStatType,
146 typename TreeMatType>
class TreeType>
147 void operator()(
RSTypeT<TreeType>* rs)
const;
160 const size_t leafSize);
170 template<
typename RSType>
181 template<
typename RSType>
195 template<
typename RSType>
208 template<
typename RSType>
247 boost::variant<RSType<tree::KDTree>*,
271 const bool randomBasis =
false);
302 template<
typename Archive>
303 void serialize(Archive& ar,
const unsigned int );
306 const arma::mat&
Dataset()
const;
344 const size_t leafSize,
346 const bool singleMode);
358 void Search(arma::mat&& querySet,
360 std::vector<std::vector<size_t>>& neighbors,
361 std::vector<std::vector<double>>& distances);
373 std::vector<std::vector<size_t>>& neighbors,
374 std::vector<std::vector<double>>& distances);
393 #include "rs_model_impl.hpp"
The RangeSearch class is a template class for performing range searches.
bool SingleMode() const
Get whether the model is in single-tree search mode.
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.
bool RandomBasis() const
Get whether a random basis is used.
bool & operator()(RSType *rs) const
Get a reference to the naive parameter of the given RangeSearch object.
~RSModel()
Clean memory, if necessary.
ReferenceSetVisitor exposes the referenceSet of the given RSType.
RSModel & operator=(RSModel other)
Copy the given RSModel.
void serialize(Archive &ar, const unsigned int)
Serialize the range search model.
const arma::mat & operator()(RSType *rs) const
Return the reference set.
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.
void operator()(RSType *rs) const
Perform monochromatic search with the given RangeSearch object.
TrainVisitor(arma::mat &&referenceSet, const size_t leafSize)
Construct the TrainVisitor object with the given reference set, leafSize.
TreeTypes TreeType() const
Get the type of tree.
size_t LeafSize() const
Get the leaf size (applicable to everything but the cover tree).
MonoSearchVisitor(const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
Construct the MonoSearchVisitor with the given parameters.
void operator()(RSTypeT< TreeType > *rs) const
Default Bichromatic range search on the given RSType instance.
NaiveVisitor exposes the Naive() method of the given RSType.
bool Naive() const
Get whether the model is in naive search mode.
TrainVisitor sets the reference set to a new reference set on the given RSType.
TreeTypes & TreeType()
Modify the type of tree (don't do this after the model has been built).
size_t & LeafSize()
Modify the leaf size (applicable to everything but the cover tree).
const arma::mat & Dataset() const
Expose the dataset.
MonoSearchVisitor executes a monochromatic range search on the given RSType.
BiSearchVisitor(const arma::mat &querySet, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances, const size_t leafSize)
Construct the BiSearchVisitor.
void operator()(RSTypeT< TreeType > *rs) const
Default Train on the given RSType instance.
BiSearchVisitor executes a bichromatic range search on the given RSType.
void operator()(RSType *rs) const
Delete the RSType object.
bool & RandomBasis()
Modify whether a random basis is used (don't do this after the model has been built).
SingleModeVisitor exposes the SingleMode() method of the given RSType.
RSModel(const TreeTypes 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...
bool & operator()(RSType *rs) const
Get a reference to the singleMode parameter of the given RangeSeach object.
DeleteVisitor deletes the given RSType instance.
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$