17 #ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_NS_MODEL_HPP
18 #define __MLPACK_METHODS_NEIGHBOR_SEARCH_NS_MODEL_HPP
29 template<
typename SortPolicy>
32 static const std::string
Name() {
return "neighbor_search_model"; }
38 static const std::string
Name() {
return "nearest_neighbor_search_model"; }
44 static const std::string
Name() {
return "furthest_neighbor_search_model"; }
47 template<
typename SortPolicy>
68 template<
template<
typename TreeMetricType,
69 typename TreeStatType,
70 typename TreeMatType>
class TreeType>
77 arma::mat>::template DualTreeTraverser>;
91 NSModel(
int treeType = TreeTypes::KD_TREE,
bool randomBasis =
false);
97 template<
typename Archive>
98 void Serialize(Archive& ar,
const unsigned int );
101 const arma::mat&
Dataset()
const;
121 const size_t leafSize,
123 const bool singleMode);
126 void Search(arma::mat&& querySet,
128 arma::Mat<size_t>& neighbors,
129 arma::mat& distances);
132 void Search(
const size_t k,
133 arma::Mat<size_t>& neighbors,
134 arma::mat& distances);
143 #include "ns_model_impl.hpp"
const arma::mat & Dataset() const
Expose the dataset.
static const std::string Name()
Linear algebra utility functions, generally performed on matrices or vectors.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
std::string TreeName() const
Extra data for each node in the tree.
The NeighborSearch class is a template class for performing distance-based neighbor searches...
bool SingleMode() const
Expose singleMode.
NSType< tree::RStarTree > * rStarTreeNS
void Serialize(Archive &ar, const unsigned int)
Serialize the neighbor search model.
NSModel(int treeType=TreeTypes::KD_TREE, bool randomBasis=false)
Initialize the NSModel with the given type and whether or not a random basis should be used...
static const std::string Name()
void BuildModel(arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
Build the reference tree.
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSear...
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSear...
NSType< tree::KDTree > * kdTreeNS
NSType< tree::StandardCoverTree > * coverTreeNS
static const std::string Name()
NSType< tree::RTree > * rTreeNS
void Search(arma::mat &&querySet, const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances)
Perform neighbor search. The query set will be reordered.
~NSModel()
Clean memory, if necessary.
NSType< tree::BallTree > * ballTreeNS