mlpack
2.2.3

Neighborsearch routines. More...
Classes  
class  BiSearchVisitor 
BiSearchVisitor executes a bichromatic neighbor search on the given NSType. More...  
class  DeleteVisitor 
DeleteVisitor deletes the given NSType instance. More...  
class  DrusillaSelect 
class  EpsilonVisitor 
EpsilonVisitor exposes the Epsilon method of the given NSType. More...  
class  FurthestNeighborSort 
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSearch class. More...  
class  LSHSearch 
The LSHSearch class; this class builds a hash on the reference set and uses this hash to compute the distanceapproximate nearestneighbors of the given queries. More...  
class  MonoSearchVisitor 
MonoSearchVisitor executes a monochromatic neighbor search on the given NSType. More...  
class  NearestNeighborSort 
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSearch class. More...  
class  NeighborSearch 
The NeighborSearch class is a template class for performing distancebased neighbor searches. More...  
class  NeighborSearchRules 
The NeighborSearchRules class is a template helper class used by NeighborSearch class when performing distancebased neighbor searches. More...  
class  NeighborSearchStat 
Extra data for each node in the tree. More...  
class  NSModel 
The NSModel class provides an easy way to serialize a model, abstracts away the different types of trees, and also reflects the NeighborSearch API. More...  
struct  NSModelName 
struct  NSModelName< FurthestNeighborSort > 
struct  NSModelName< NearestNeighborSort > 
class  QDAFN 
class  RAModel 
The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType parameter and allowing it to be specified at runtime in this class. More...  
class  RAQueryStat 
Extra data for each node in the tree. More...  
class  RASearch 
The RASearch class: This class provides a generic manner to perform rankapproximate search via randomsampling. More...  
class  RASearchRules 
The RASearchRules class is a template helper class used by RASearch class when performing rankapproximate search via randomsampling. More...  
class  RAUtil 
class  ReferenceSetVisitor 
ReferenceSetVisitor exposes the referenceSet of the given NSType. More...  
class  SearchModeVisitor 
SearchModeVisitor exposes the SearchMode() method of the given NSType. More...  
class  SetSearchModeVisitor 
SetSearchModeVisitor modifies the SearchMode method of the given NSType. More...  
class  TrainVisitor 
TrainVisitor sets the reference set to a new reference set on the given NSType. More...  
Typedefs  
typedef NeighborSearch< FurthestNeighborSort, metric::EuclideanDistance >  AllkFN 
typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistance >  AllkNN 
typedef RASearch  AllkRAFN 
typedef RASearch  AllkRANN 
template < template < typename TreeMetricType , typename TreeStatType , typename TreeMatType > class TreeType = tree::SPTree >  
using  DefeatistKNN = NeighborSearch< NearestNeighborSort, metric::EuclideanDistance, arma::mat, TreeType, TreeType< metric::EuclideanDistance, NeighborSearchStat< NearestNeighborSort >, arma::mat >::template DefeatistDualTreeTraverser, TreeType< metric::EuclideanDistance, NeighborSearchStat< NearestNeighborSort >, arma::mat >::template DefeatistSingleTreeTraverser > 
The DefeatistKNN class is the knearestneighbors method considering defeatist search. More...  
typedef NeighborSearch< FurthestNeighborSort, metric::EuclideanDistance >  KFN 
The KFN class is the kfurthestneighbors method. More...  
typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistance >  KNN 
The KNN class is the knearestneighbors method. More...  
typedef RASearch< FurthestNeighborSort >  KRAFN 
The KRAFN class is the krankapproximatefarthestneighbors method. More...  
typedef RASearch  KRANN 
The KRANN class is the krankapproximatenearestneighbors method. More...  
template < typename SortPolicy , template < typename TreeMetricType , typename TreeStatType , typename TreeMatType > class TreeType >  
using  NSType = NeighborSearch< SortPolicy, metric::EuclideanDistance, arma::mat, TreeType, TreeType< metric::EuclideanDistance, NeighborSearchStat< SortPolicy >, arma::mat >::template DualTreeTraverser > 
Alias template for euclidean neighbor search. More...  
typedef DefeatistKNN< tree::SPTree >  SpillKNN 
The SpillKNN class is the knearestneighbors method considering defeatist search on SPTree. More...  
Enumerations  
enum  NeighborSearchMode { NAIVE_MODE , SINGLE_TREE_MODE , DUAL_TREE_MODE , GREEDY_SINGLE_TREE_MODE } 
NeighborSearchMode represents the different neighbor search modes available. More...  
Functions  
void  Unmap (const arma::Mat< size_t > &neighbors, const arma::mat &distances, const std::vector< size_t > &referenceMap, const std::vector< size_t > &queryMap, arma::Mat< size_t > &neighborsOut, arma::mat &distancesOut, const bool squareRoot=false) 
Assuming that the datasets have been mapped using the referenceMap and the queryMap (such as during kdtree construction), unmap the columns of the distances and neighbors matrices into neighborsOut and distancesOut, and also unmap the entries in each row of neighbors. More...  
void  Unmap (const arma::Mat< size_t > &neighbors, const arma::mat &distances, const std::vector< size_t > &referenceMap, arma::Mat< size_t > &neighborsOut, arma::mat &distancesOut, const bool squareRoot=false) 
Assuming that the datasets have been mapped using referenceMap (such as during kdtree construction), unmap the columns of the distances and neighbors matrices into neighborsOut and distancesOut, and also unmap the entries in each row of neighbors. More...  
Detailed Description
Neighborsearch routines.
These include allnearestneighbors and allfurthestneighbors searches.
Typedef Documentation
◆ AllkFN
It returns L2 distances (Euclidean distances) for each of the k furthest neighbors. This typedef will be removed in mlpack 3.0.0; use the KFN typedef instead.
Definition at line 83 of file typedef.hpp.
◆ AllkNN
It returns L2 distances (Euclidean distances) for each of the k nearest neighbors. This typedef will be removed in mlpack 3.0.0; use the KNN typedef instead.
Definition at line 75 of file typedef.hpp.
◆ AllkRAFN
typedef RASearch mlpack::neighbor::AllkRAFN 
It returns L2 distances for each of the k rankapproximate farthestneighbors.
The approximation is controlled with two parameters (see allkrann_main.cpp) which can be specified at search time. So the tree building is done only once while the search can be performed multiple times with different approximation levels.
This typedef will be removed in mlpack 3.0.0; use the KRANN typedef instead.
Definition at line 76 of file ra_typedef.hpp.
◆ AllkRANN
typedef RASearch mlpack::neighbor::AllkRANN 
It returns L2 distances for each of the k rankapproximate nearestneighbors.
The approximation is controlled with two parameters (see allkrann_main.cpp) which can be specified at search time. So the tree building is done only once while the search can be performed multiple times with different approximation levels.
This typedef will be removed in mlpack 3.0.0; use the KRANN typedef instead.
Definition at line 61 of file ra_typedef.hpp.
◆ DefeatistKNN
using mlpack::neighbor::DefeatistKNN = typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistance, arma::mat, TreeType, TreeType<metric::EuclideanDistance, NeighborSearchStat<NearestNeighborSort>, arma::mat>::template DefeatistDualTreeTraverser, TreeType<metric::EuclideanDistance, NeighborSearchStat<NearestNeighborSort>, arma::mat>::template DefeatistSingleTreeTraverser> 
The DefeatistKNN class is the knearestneighbors method considering defeatist search.
It returns L2 distances (Euclidean distances) for each of the k nearest neighbors found.
 Template Parameters

TreeType The tree type to use; must adhere to the TreeType API, and implement Defeatist Traversers.
Definition at line 60 of file typedef.hpp.
◆ KFN
The KFN class is the kfurthestneighbors method.
It returns L2 distances (Euclidean distances) for each of the k furthest neighbors.
Definition at line 38 of file typedef.hpp.
◆ KNN
The KNN class is the knearestneighbors method.
It returns L2 distances (Euclidean distances) for each of the k nearest neighbors.
Definition at line 32 of file typedef.hpp.
◆ KRAFN
The KRAFN class is the krankapproximatefarthestneighbors method.
It returns L2 distances for each of the k rankapproximate farthestneighbors.
The approximation is controlled with two parameters (see allkrann_main.cpp) which can be specified at search time. So the tree building is done only once while the search can be performed multiple times with different approximation levels.
Definition at line 47 of file ra_typedef.hpp.
◆ KRANN
typedef RASearch mlpack::neighbor::KRANN 
The KRANN class is the krankapproximatenearestneighbors method.
It returns L2 distances for each of the k rankapproximate nearestneighbors.
The approximation is controlled with two parameters (see allkrann_main.cpp) which can be specified at search time. So the tree building is done only once while the search can be performed multiple times with different approximation levels.
Definition at line 36 of file ra_typedef.hpp.
◆ NSType
using mlpack::neighbor::NSType = typedef NeighborSearch<SortPolicy, metric::EuclideanDistance, arma::mat, TreeType, TreeType<metric::EuclideanDistance, NeighborSearchStat<SortPolicy>, arma::mat>::template DualTreeTraverser> 
Alias template for euclidean neighbor search.
Definition at line 42 of file ns_model.hpp.
◆ SpillKNN
The SpillKNN class is the knearestneighbors method considering defeatist search on SPTree.
It returns L2 distances (Euclidean distances) for each of the k nearest neighbors found.
Definition at line 67 of file typedef.hpp.
Enumeration Type Documentation
◆ NeighborSearchMode
NeighborSearchMode represents the different neighbor search modes available.
Enumerator  

NAIVE_MODE  
SINGLE_TREE_MODE  
DUAL_TREE_MODE  
GREEDY_SINGLE_TREE_MODE 
Definition at line 38 of file neighbor_search.hpp.
Function Documentation
◆ Unmap() [1/2]
void mlpack::neighbor::Unmap  (  const arma::Mat< size_t > &  neighbors, 
const arma::mat &  distances,  
const std::vector< size_t > &  referenceMap,  
const std::vector< size_t > &  queryMap,  
arma::Mat< size_t > &  neighborsOut,  
arma::mat &  distancesOut,  
const bool  squareRoot = false 

) 
Assuming that the datasets have been mapped using the referenceMap and the queryMap (such as during kdtree construction), unmap the columns of the distances and neighbors matrices into neighborsOut and distancesOut, and also unmap the entries in each row of neighbors.
This is useful for the dualtree case.
 Parameters

neighbors Matrix of neighbors resulting from neighbor search. distances Matrix of distances resulting from neighbor search. referenceMap Mapping of reference set to old points. queryMap Mapping of query set to old points. neighborsOut Matrix to store unmapped neighbors into. distancesOut Matrix to store unmapped distances into. squareRoot If true, take the square root of the distances.
◆ Unmap() [2/2]
void mlpack::neighbor::Unmap  (  const arma::Mat< size_t > &  neighbors, 
const arma::mat &  distances,  
const std::vector< size_t > &  referenceMap,  
arma::Mat< size_t > &  neighborsOut,  
arma::mat &  distancesOut,  
const bool  squareRoot = false 

) 
Assuming that the datasets have been mapped using referenceMap (such as during kdtree construction), unmap the columns of the distances and neighbors matrices into neighborsOut and distancesOut, and also unmap the entries in each row of neighbors.
This is useful for the singletree case.
 Parameters

neighbors Matrix of neighbors resulting from neighbor search. distances Matrix of distances resulting from neighbor search. referenceMap Mapping of reference set to old points. neighborsOut Matrix to store unmapped neighbors into. distancesOut Matrix to store unmapped distances into. squareRoot If true, take the square root of the distances.
Generated by 1.8.13