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>
57 template<
typename RSType>
58 void operator()(RSType* rs)
const;
62 std::vector<std::vector<size_t>>& neighbors,
63 std::vector<std::vector<double>>& distances):
91 template<
typename RSType>
92 void SearchLeaf(RSType* rs)
const;
96 template<
template<
typename TreeMetricType,
97 typename TreeStatType,
98 typename TreeMatType>
class TreeType>
102 template<
template<
typename TreeMetricType,
103 typename TreeStatType,
104 typename TreeMatType>
class TreeType>
105 void operator()(RSTypeT<TreeType>* rs)
const;
119 std::vector<std::vector<size_t>>& neighbors,
120 std::vector<std::vector<double>>& distances,
121 const size_t leafSize);
138 template<
typename RSType>
139 void TrainLeaf(RSType* rs)
const;
143 template<
template<
typename TreeMetricType,
144 typename TreeStatType,
145 typename TreeMatType>
class TreeType>
149 template<
template<
typename TreeMetricType,
150 typename TreeStatType,
151 typename TreeMatType>
class TreeType>
152 void operator()(RSTypeT<TreeType>* rs)
const;
165 const size_t leafSize);
175 template<
typename RSType>
176 const arma::mat& operator()(RSType* rs)
const;
186 template<
typename RSType>
187 void operator()(RSType* rs)
const;
193 template<
typename Archive>
204 template<
typename RSType>
205 void operator()(RSType* rs)
const;
221 template<
typename RSType>
222 bool& operator()(RSType* rs)
const;
234 template<
typename RSType>
235 bool& operator()(RSType* rs)
const;
273 boost::variant<RSType<tree::KDTree>*,
297 const bool randomBasis =
false);
333 template<
typename Archive>
334 void Serialize(Archive& ar,
const unsigned int );
337 const arma::mat& Dataset()
const;
340 bool SingleMode()
const;
374 void BuildModel(arma::mat&& referenceSet,
375 const size_t leafSize,
377 const bool singleMode);
389 void Search(arma::mat&& querySet,
391 std::vector<std::vector<size_t>>& neighbors,
392 std::vector<std::vector<double>>& distances);
404 std::vector<std::vector<size_t>>& neighbors,
405 std::vector<std::vector<double>>& distances);
424 #include "rs_model_impl.hpp" The RangeSearch class is a template class for performing range searches.
std::vector< std::vector< size_t > > & neighbors
The result vector for neighbors.
const math::Range & range
Range to search neighbours for.
Exposes the seralize method of the given RSType.
Linear algebra utility functions, generally performed on matrices or vectors.
arma::mat q
Random projection matrix.
size_t leafSize
The leaf size, used only by BinarySpaceTree.
ReferenceSetVisitor exposes the referenceSet of the given RSType.
std::vector< std::vector< double > > & distances
Output distances.
std::vector< std::vector< size_t > > & neighbors
Output neighbors.
const math::Range & range
The range to search for.
bool & RandomBasis()
Modify whether a random basis is used (don't do this after the model has been built).
TreeTypes TreeType() const
Get the type of tree.
boost::variant< RSType< tree::KDTree > *, RSType< tree::StandardCoverTree > *, RSType< tree::RTree > *, RSType< tree::RStarTree > *, RSType< tree::BallTree > *, RSType< tree::XTree > *, RSType< tree::HilbertRTree > *, RSType< tree::RPlusTree > *, RSType< tree::RPlusPlusTree > *, RSType< tree::VPTree > *, RSType< tree::RPTree > *, RSType< tree::MaxRPTree > *, RSType< tree::UBTree > *, RSType< tree::Octree > * > rSearch
rSearch holds an instance of the RangeSearch class for the current treeType.
const size_t leafSize
The number of points in a leaf (for BinarySpaceTrees).
static const std::string Name()
const std::string & name
Name of the model to serialize.
size_t LeafSize() const
Get the leaf size (applicable to everything but the cover tree).
TreeTypes & TreeType()
Modify the type of tree (don't do this after the model has been built).
Archive & ar
Archive to serialize to.
bool randomBasis
If true, we randomly project the data into a new basis before search.
NaiveVisitor exposes the Naive() method of the given RSType.
TrainVisitor sets the reference set to a new reference set on the given RSType.
bool RandomBasis() const
Get whether a random basis is used.
size_t & LeafSize()
Modify the leaf size (applicable to everything but the cover tree).
MonoSearchVisitor executes a monochromatic range search on the given RSType.
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.
arma::mat && referenceSet
The reference set to use for training.
const arma::mat & querySet
The query set for the bichromatic search.
BiSearchVisitor executes a bichromatic range search on the given RSType.
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"$
SingleModeVisitor exposes the SingleMode() method of the given RSType.
std::vector< std::vector< double > > & distances
The result vector for distances.
DeleteVisitor deletes the given RSType instance.