MLPACK  1.0.11
Classes | Typedefs | Functions
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  NeighborSearchTraversalInfo
 Traversal information for NeighborSearch. More...
 
class  RASearchRules
 

Typedefs

typedef NeighborSearch< FurthestNeighborSort, metric::EuclideanDistanceAllkFN
 The AllkFN class is the all-k-furthest-neighbors method. More...
 
typedef NeighborSearch< NearestNeighborSort, metric::EuclideanDistanceAllkNN
 The AllkNN class is the all-k-nearest-neighbors method. More...
 
typedef RASearch< FurthestNeighborSortAllkRAFN
 The AllkRAFN class is the all-k-rank-approximate-farthest-neighbors method. More...
 
typedef RASearch AllkRANN
 The AllkRANN class is the all-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

The AllkFN class is the all-k-furthest-neighbors method.

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

Definition at line 48 of file typedef.hpp.

The AllkNN class is the all-k-nearest-neighbors method.

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

Definition at line 42 of file typedef.hpp.

The AllkRAFN class is the all-k-rank-approximate-farthest-neighbors method.

It returns squared L2 distances (squared Euclidean distances) for each of the k rank-approximate farthest-neighbors. Squared distances are used because they are slightly faster than non-squared distances (they have one fewer call to sqrt()).

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 63 of file ra_typedef.hpp.

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

It returns squared L2 distances (squared Euclidean distances) for each of the k rank-approximate nearest-neighbors. Squared distances are used because they are slightly faster than non-squared distances (they have one fewer call to sqrt()).

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.

Function Documentation

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