mlpack::neighbor Namespace Reference

Classes

class  DrusillaSelect
 
class  FurthestNS
 This class implements the necessary methods for the SortPolicy template parameter of the NeighborSearch class. More...

 
class  LeafSizeNSWrapper
 LeafSizeNSWrapper wraps any NeighborSearch types that take a leaf size for tree construction. More...

 
class  LeafSizeRAWrapper
 LeafSizeRAWrapper wraps any RASearch type that needs to be able to take the leaf size into account when building trees. More...

 
class  LSHSearch
 The LSHSearch class; this class builds a hash on the reference set and uses this hash to compute the distance-approximate nearest-neighbors of the given queries. More...

 
class  NearestNS
 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 distance-based neighbor searches. More...

 
class  NeighborSearchRules
 The NeighborSearchRules class is a template helper class used by NeighborSearch class when performing distance-based 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...

 
class  NSWrapper
 NSWrapper is a wrapper class for most NeighborSearch types. More...

 
class  NSWrapperBase
 NSWrapperBase is a base wrapper class for holding all NeighborSearch types supported by NSModel. More...

 
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 rank-approximate search via random-sampling. More...

 
class  RASearchRules
 The RASearchRules class is a template helper class used by RASearch class when performing rank-approximate search via random-sampling. More...

 
class  RAUtil
 
class  RAWrapper
 RAWrapper is a wrapper class for most RASearch types. More...

 
class  RAWrapperBase
 RAWrapperBase is a base wrapper class for holding all RASearch types supported by RAModel. More...

 
class  SpillNSWrapper
 The SpillNSWrapper class wraps the NeighborSearch class when the spill tree is used. More...

 

Typedefs

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 k-nearest-neighbors method considering defeatist search. More...

 
using FurthestNeighborSort = FurthestNS
 
typedef NeighborSearch< FurthestNeighborSort, metric::EuclideanDistanceKFN
 The KFN class is the k-furthest-neighbors method. More...

 
typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistanceKNN
 The KNN class is the k-nearest-neighbors method. More...

 
typedef RASearch< FurthestNeighborSortKRAFN
 The KRAFN class is the k-rank-approximate-farthest-neighbors method. More...

 
typedef RASearch KRANN
 The KRANN class is the k-rank-approximate-nearest-neighbors method. More...

 
using NearestNeighborSort = NearestNS
 
typedef DefeatistKNN< tree::SPTreeSpillKNN
 The SpillKNN class is the k-nearest-neighbors 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 kd-tree 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 kd-tree 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...

 

Typedef Documentation

◆ DefeatistKNN

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 k-nearest-neighbors method considering defeatist search.

It returns L2 distances (Euclidean distances) for each of the k nearest neighbors found.

Template Parameters
TreeTypeThe tree type to use; must adhere to the TreeType API, and implement Defeatist Traversers.

Definition at line 60 of file typedef.hpp.

◆ FurthestNeighborSort

Definition at line 201 of file furthest_neighbor_sort.hpp.

◆ KFN

The KFN class is the k-furthest-neighbors 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 k-nearest-neighbors 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 k-rank-approximate-farthest-neighbors method.

It returns L2 distances for each of the k rank-approximate farthest-neighbors.

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 KRANN

The KRANN class is the k-rank-approximate-nearest-neighbors method.

It returns L2 distances for each of the k rank-approximate nearest-neighbors.

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.

◆ NearestNeighborSort

Definition at line 200 of file nearest_neighbor_sort.hpp.

◆ SpillKNN

The SpillKNN class is the k-nearest-neighbors 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 43 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 kd-tree 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 dual-tree case.

Parameters
neighborsMatrix of neighbors resulting from neighbor search.
distancesMatrix of distances resulting from neighbor search.
referenceMapMapping of reference set to old points.
queryMapMapping of query set to old points.
neighborsOutMatrix to store unmapped neighbors into.
distancesOutMatrix to store unmapped distances into.
squareRootIf 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 kd-tree 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 single-tree case.

Parameters
neighborsMatrix of neighbors resulting from neighbor search.
distancesMatrix of distances resulting from neighbor search.
referenceMapMapping of reference set to old points.
neighborsOutMatrix to store unmapped neighbors into.
distancesOutMatrix to store unmapped distances into.
squareRootIf true, take the square root of the distances.