mlpack: a scalable c++ machine learning library
mlpack  2.0.2
mlpack::neighbor Namespace Reference

Neighbor-search routines. More...

Classes

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 distance-approximate nearest-neighbors of the given queries. 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 distance-based neighbor searches. More...

 
class  NeighborSearchRules
 
class  NeighborSearchStat
 Extra data for each node in the tree. More...

 
class  NSModel
 
struct  NSModelName
 
struct  NSModelName< FurthestNeighborSort >
 
struct  NSModelName< NearestNeighborSort >
 
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
 
class  RAUtil
 

Typedefs

typedef NeighborSearch< FurthestNeighborSort, metric::EuclideanDistanceAllkFN
 
typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistanceAllkNN
 
typedef RASearch AllkRAFN
 
typedef RASearch AllkRANN
 
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...

 

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...

 

Detailed Description

Neighbor-search routines.

These include all-nearest-neighbors and all-furthest-neighbors 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 56 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 48 of file typedef.hpp.

◆ AllkRAFN

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.

This typedef will be removed in mlpack 3.0.0; use the KRANN typedef instead.

Definition at line 78 of file ra_typedef.hpp.

◆ AllkRANN

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.

This typedef will be removed in mlpack 3.0.0; use the KRANN typedef instead.

Definition at line 63 of file ra_typedef.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 40 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 34 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 49 of file ra_typedef.hpp.

◆ 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 38 of file ra_typedef.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.