14 #ifndef MLPACK_METHODS_RANN_RA_MODEL_HPP 15 #define MLPACK_METHODS_RANN_RA_MODEL_HPP 21 #include <boost/variant.hpp> 30 template<
typename SortPolicy,
31 template<
typename TreeMetricType,
32 typename TreeStatType,
33 typename TreeMatType>
class TreeType>
34 using
RAType = RASearch<SortPolicy,
49 arma::Mat<size_t>& neighbors;
55 template<
typename RAType>
60 arma::Mat<size_t>& neighbors,
61 arma::mat& distances) :
74 template<
typename SortPolicy>
79 const arma::mat& querySet;
83 arma::Mat<size_t>& neighbors;
87 const size_t leafSize;
90 template<
typename RAType>
91 void SearchLeaf(RAType* ra)
const;
95 template<
template<
typename TreeMetricType,
96 typename TreeStatType,
97 typename TreeMatType>
class TreeType>
101 template<
template<
typename TreeMetricType,
102 typename TreeStatType,
103 typename TreeMatType>
class TreeType>
104 void operator()(RATypeT<TreeType>* ra)
const;
115 arma::Mat<size_t>& neighbors,
116 arma::mat& distances,
117 const size_t leafSize);
126 template<
typename SortPolicy>
131 arma::mat&& referenceSet;
136 template<
typename RAType>
137 void TrainLeaf(RAType* ra)
const;
141 template<
template<
typename TreeMetricType,
142 typename TreeStatType,
143 typename TreeMatType>
class TreeType>
147 template<
template<
typename TreeMetricType,
148 typename TreeStatType,
149 typename TreeMatType>
class TreeType>
150 void operator()(RATypeT<TreeType>* ra)
const;
161 const size_t leafSize);
170 template<
typename RAType>
180 template<
typename RAType>
191 template<
typename RAType>
202 template<
typename RAType>
213 template<
typename RAType>
224 template<
typename RAType>
235 template<
typename RAType>
236 const arma::mat&
operator()(RAType* ra)
const;
246 template<
typename RAType>
void operator()(RAType* ra)
const;
258 template<
typename RAType>
270 template<
typename SortPolicy>
304 boost::variant<RAType<SortPolicy, tree::KDTree>*,
354 template<
typename Archive>
355 void serialize(Archive& ar,
const unsigned int );
358 const arma::mat& Dataset()
const;
361 bool SingleMode()
const;
376 double Alpha()
const;
381 bool SampleAtLeaves()
const;
383 bool& SampleAtLeaves();
386 bool FirstLeafExact()
const;
388 bool& FirstLeafExact();
391 size_t SingleSampleLimit()
const;
393 size_t& SingleSampleLimit();
396 size_t LeafSize()
const;
412 void BuildModel(arma::mat&& referenceSet,
413 const size_t leafSize,
415 const bool singleMode);
419 void Search(arma::mat&& querySet,
421 arma::Mat<size_t>& neighbors,
422 arma::mat& distances);
428 void Search(
const size_t k,
429 arma::Mat<size_t>& neighbors,
430 arma::mat& distances);
433 std::string TreeName()
const;
439 #include "ra_model_impl.hpp" MonoSearchVisitor(const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances)
Construct the MonoSearchVisitor object with the given parameters.
NaiveVisitor exposes the Naive() method of the given RAType.
Exposes the FirstLeafExact() method of the given RAType.
ReferenceSetVisitor exposes the referenceSet of the given NSType.
void RandomBasis(arma::mat &basis, const size_t d)
Create a random d-dimensional orthogonal basis, storing it in the given matrix.
Exposes the SingleMode() method of the given RAType.
BiSearchVisitor executes a bichromatic neighbor search on the given NSType.
Exposes the Tau() method of the given RAType.
TrainVisitor sets the reference set to a new reference set on the given NSType.
RASearch< SortPolicy, metric::EuclideanDistance, arma::mat, TreeType > RAType
Alias template for RASearch.
void operator()(NSType *ns) const
Perform monochromatic nearest neighbor search.
MonoSearchVisitor executes a monochromatic neighbor search on the given NSType.
Exposes the Alpha() method of the given RAType.
The RASearch class: This class provides a generic manner to perform rank-approximate search via rando...
Exposes the SampleAtLeaves() method of the given RAType.
DeleteVisitor deletes the given NSType instance.
TreeTypes
The list of tree types we can use with RASearch.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType param...
Exposes the SingleSampleLimit() method of the given RAType.