15 #ifndef MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP 16 #define MLPACK_METHODS_RANGE_SEARCH_RS_MODEL_HPP 49 virtual const arma::mat&
Dataset()
const = 0;
57 virtual bool Naive()
const = 0;
59 virtual bool&
Naive() = 0;
63 arma::mat&& referenceSet,
64 const size_t leafSize) = 0;
71 std::vector<std::vector<size_t>>& neighbors,
72 std::vector<std::vector<double>>& distances,
73 const size_t leafSize) = 0;
79 std::vector<std::vector<size_t>>& neighbors,
80 std::vector<std::vector<double>>& distances) = 0;
86 template<
template<
typename TreeMetricType,
87 typename TreeStatType,
88 typename TreeMatType>
class TreeType>
93 RSWrapper(
const bool singleMode,
const bool naive) :
107 const arma::mat&
Dataset()
const {
return rs.ReferenceSet(); }
115 bool Naive()
const {
return rs.Naive(); }
117 bool&
Naive() {
return rs.Naive(); }
122 arma::mat&& referenceSet,
128 arma::mat&& querySet,
130 std::vector<std::vector<size_t>>& neighbors,
131 std::vector<std::vector<double>>& distances,
138 std::vector<std::vector<size_t>>& neighbors,
139 std::vector<std::vector<double>>& distances);
142 template<
typename Archive>
160 template<
template<
typename TreeMetricType,
161 typename TreeStatType,
162 typename TreeMatType>
class TreeType>
185 arma::mat&& referenceSet,
186 const size_t leafSize);
191 arma::mat&& querySet,
193 std::vector<std::vector<size_t>>& neighbors,
194 std::vector<std::vector<double>>& distances,
195 const size_t leafSize);
198 template<
typename Archive>
243 const bool randomBasis =
false);
279 template<
typename Archive>
280 void serialize(Archive& ar,
const uint32_t );
283 const arma::mat&
Dataset()
const {
return rSearch->Dataset(); }
291 bool Naive()
const {
return rSearch->Naive(); }
293 bool&
Naive() {
return rSearch->Naive(); }
314 void InitializeModel(
const bool naive,
const bool singleMode);
326 arma::mat&& referenceSet,
327 const size_t leafSize,
329 const bool singleMode);
342 arma::mat&& querySet,
344 std::vector<std::vector<size_t>>& neighbors,
345 std::vector<std::vector<double>>& distances);
358 std::vector<std::vector<size_t>>& neighbors,
359 std::vector<std::vector<double>>& distances);
383 std::string TreeName()
const;
395 #include "rs_model_impl.hpp"
RSWrapper is a wrapper class for most RangeSearch types.
bool & Naive()
Modify whether the model is in naive search mode.
TreeTypes TreeType() const
Get the type of tree.
virtual void Train(util::Timers &timers, arma::mat &&referenceSet, const size_t leafSize)=0
Train the model (build the reference tree if needed).
bool Naive() const
Get whether naive search is being used.
const arma::mat & Dataset() const
Get the dataset.
virtual ~LeafSizeRSWrapper()
Delete the LeafSizeRSWrapper.
Linear algebra utility functions, generally performed on matrices or vectors.
bool SingleMode() const
Get whether single-tree search is being used.
virtual RSWrapperBase * Clone() const =0
Create a new RSWrapperBase that is the same as this one.
void serialize(Archive &ar, const uint32_t)
Serialize the RangeSearch model.
virtual const arma::mat & Dataset() const =0
Get the dataset.
size_t LeafSize() const
Get the leaf size (applicable to everything but the cover tree).
bool & SingleMode()
Modify whether single-tree search is being used.
bool & Naive()
Modify whether naive search is being used.
RSWrapperBase()
Create the RSWrapperBase object.
RSWrapper(const bool singleMode, const bool naive)
Create the RSWrapper object.
bool SingleMode() const
Get whether the model is in single-tree search mode.
virtual bool SingleMode() const =0
Get whether single-tree search is being used.
The RSModel class provides an abstraction for the RangeSearch class, abstracting away the TreeType pa...
void serialize(Archive &ar, const uint32_t)
Serialize the RangeSearch model.
virtual LeafSizeRSWrapper * Clone() const
Return a copy of the LeafSizeRSWrapper.
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).
RSType rs
The instantiated RangeSearch object that we are wrapping.
virtual RSWrapper * Clone() const
Create a new RSWrapper that is the same as this one.
virtual void Search(util::Timers &timers, arma::mat &&querySet, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances, const size_t leafSize)=0
Perform bichromatic range search (i.e.
void CleanMemory(util::Params ¶ms)
Delete any unique pointers that are held by the IO object.
virtual bool Naive() const =0
Get whether naive search is being used.
LeafSizeRSWrapper(const bool singleMode, const bool naive)
Construct the LeafSizeRSWrapper by delegating to the RSWrapper constructor.
bool Naive() const
Get whether the model is in naive search mode.
virtual ~RSWrapper()
Destruct the RSWrapper (nothing to do).
bool & RandomBasis()
Modify whether a random basis is used (don't do this after the model has been built).
bool RandomBasis() const
Get whether a random basis is used.
RSWrapperBase is a base wrapper class for holding all RangeSearch types supported by RSModel...
bool & SingleMode()
Modify whether the model is in single-tree search mode.
virtual ~RSWrapperBase()
Destruct the RSWrapperBase (nothing to do).
const arma::mat & Dataset() const
Expose the dataset.
RangeSearch< metric::EuclideanDistance, arma::mat, TreeType > RSType