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>
171 const arma::mat&
operator()(RSType* rs)
const;
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;
309 bool SingleMode()
const;
343 void BuildModel(arma::mat&& referenceSet,
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);
381 std::string TreeName()
const;
393 #include "rs_model_impl.hpp" The RangeSearch class is a template class for performing range searches.
TreeTypes TreeType() const
Get the type of tree.
void operator()(RSType *rs) const
Perform monochromatic search with the given RangeSearch object.
ReferenceSetVisitor exposes the referenceSet of the given RSType.
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.
NaiveVisitor exposes the Naive() method of the given RSType.
void CleanMemory()
Delete any unique pointers that are held by the CLI object.
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).
MonoSearchVisitor executes a monochromatic range search on the given RSType.
BiSearchVisitor executes a bichromatic range search on the given RSType.
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.
bool RandomBasis() const
Get whether a random basis is used.
DeleteVisitor deletes the given RSType instance.