mlpack  master
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
mlpack::neighbor::LSHSearch< SortPolicy > Class Template Reference

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

Classes

struct  CandidateCmp
 Compare two candidates based on the distance. More...
 

Public Member Functions

 LSHSearch (const arma::mat &referenceSet, const arma::cube &projections, const double hashWidth=0.0, const size_t secondHashSize=99901, const size_t bucketSize=500)
 This function initializes the LSH class. More...
 
 LSHSearch (const arma::mat &referenceSet, const size_t numProj, const size_t numTables, const double hashWidth=0.0, const size_t secondHashSize=99901, const size_t bucketSize=500)
 This function initializes the LSH class. More...
 
 LSHSearch ()
 Create an untrained LSH model. More...
 
 LSHSearch (const LSHSearch &other)
 Copy the given LSH model. More...
 
 LSHSearch (LSHSearch &&other)
 Take ownership of the given LSH model. More...
 
 ~LSHSearch ()
 Clean memory. More...
 
size_t BucketSize () const
 Get the bucket size of the second hash. More...
 
size_t DistanceEvaluations () const
 Return the number of distance evaluations performed. More...
 
size_t & DistanceEvaluations ()
 Modify the number of distance evaluations performed. More...
 
size_t NumProjections () const
 Get the number of projections. More...
 
const arma::mat & Offsets () const
 Get the offsets 'b' for each of the projections. (One 'b' per column.) More...
 
LSHSearchoperator= (const LSHSearch &other)
 Copy the given LSH model. More...
 
LSHSearchoperator= (LSHSearch &&other)
 Take ownership of the given LSH model. More...
 
const arma::cube & Projections ()
 Get the projection tables. More...
 
void Projections (const arma::cube &projTables)
 Change the projection tables (this retrains the LSH model). More...
 
const arma::mat & ReferenceSet () const
 Return the reference dataset. More...
 
void Search (const arma::mat &querySet, const size_t k, arma::Mat< size_t > &resultingNeighbors, arma::mat &distances, const size_t numTablesToSearch=0, const size_t T=0)
 Compute the nearest neighbors of the points in the given query set and store the output in the given matrices. More...
 
void Search (const size_t k, arma::Mat< size_t > &resultingNeighbors, arma::mat &distances, const size_t numTablesToSearch=0, size_t T=0)
 Compute the nearest neighbors and store the output in the given matrices. More...
 
const std::vector< arma::Col< size_t > > & SecondHashTable () const
 Get the second hash table. More...
 
const arma::vec & SecondHashWeights () const
 Get the weights of the second hash. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int version)
 Serialize the LSH model. More...
 
void Train (const arma::mat &referenceSet, const size_t numProj, const size_t numTables, const double hashWidth=0.0, const size_t secondHashSize=99901, const size_t bucketSize=500, const arma::cube &projection=arma::cube())
 Train the LSH model on the given dataset. More...
 

Static Public Member Functions

static double ComputeRecall (const arma::Mat< size_t > &foundNeighbors, const arma::Mat< size_t > &realNeighbors)
 Compute the recall (% of neighbors found) given the neighbors returned by LSHSearch::Search and a "ground truth" set of neighbors. More...
 

Private Types

typedef std::pair< double, size_t > Candidate
 Candidate represents a possible candidate neighbor (distance, index). More...
 
typedef std::priority_queue< Candidate, std::vector< Candidate >, CandidateCmpCandidateList
 Use a priority queue to represent the list of candidate neighbors. More...
 

Private Member Functions

void BaseCase (const size_t queryIndex, const arma::uvec &referenceIndices, const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances) const
 This is a helper function that computes the distance of the query to the neighbor candidates and appropriately stores the best 'k' candidates. More...
 
void BaseCase (const size_t queryIndex, const arma::uvec &referenceIndices, const size_t k, const arma::mat &querySet, arma::Mat< size_t > &neighbors, arma::mat &distances) const
 This is a helper function that computes the distance of the query to the neighbor candidates and appropriately stores the best 'k' candidates. More...
 
void GetAdditionalProbingBins (const arma::vec &queryCode, const arma::vec &queryCodeNotFloored, const size_t T, arma::mat &additionalProbingBins) const
 This function implements the core idea behind Multiprobe LSH. More...
 
bool PerturbationExpand (std::vector< bool > &A) const
 Inline function used by GetAdditionalProbingBins. More...
 
double PerturbationScore (const std::vector< bool > &A, const arma::vec &scores) const
 Returns the score of a perturbation vector generated by perturbation set A. More...
 
bool PerturbationShift (std::vector< bool > &A) const
 Inline function used by GetAdditionalProbingBins. More...
 
bool PerturbationValid (const std::vector< bool > &A) const
 Return true if perturbation set A is valid. More...
 
template<typename VecType >
void ReturnIndicesFromTable (const VecType &queryPoint, arma::uvec &referenceIndices, size_t numTablesToSearch, const size_t T) const
 This function takes a query and hashes it into each of the hash tables to get keys for the query and then the key is hashed to a bucket of the second hash table and all the points (if any) in those buckets are collected as the potential neighbor candidates. More...
 

Private Attributes

arma::Col< size_t > bucketContentSize
 The number of elements present in each hash bucket; should be secondHashSize. More...
 
arma::Col< size_t > bucketRowInHashTable
 For a particular hash value, points to the row in secondHashTable corresponding to this value. More...
 
size_t bucketSize
 The bucket size of the second hash. More...
 
size_t distanceEvaluations
 The number of distance evaluations. More...
 
double hashWidth
 The hash width. More...
 
size_t numProj
 The number of projections. More...
 
size_t numTables
 The number of hash tables. More...
 
arma::mat offsets
 The list of the offsets 'b' for each of the projection for each table. More...
 
bool ownsSet
 If true, we own the reference set. More...
 
arma::cube projections
 The arma::cube containing the projection matrix of each table. More...
 
const arma::mat * referenceSet
 Reference dataset. More...
 
size_t secondHashSize
 The big prime representing the size of the second hash. More...
 
std::vector< arma::Col< size_t > > secondHashTable
 The final hash table; should be (< secondHashSize) vectors each with (<= bucketSize) elements. More...
 
arma::vec secondHashWeights
 The weights of the second hash. More...
 

Detailed Description

template<typename SortPolicy = NearestNeighborSort>
class mlpack::neighbor::LSHSearch< SortPolicy >

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.

Template Parameters
SortPolicyThe sort policy for distances; see NearestNeighborSort.

Definition at line 62 of file lsh_search.hpp.

Member Typedef Documentation

template<typename SortPolicy = NearestNeighborSort>
typedef std::pair<double, size_t> mlpack::neighbor::LSHSearch< SortPolicy >::Candidate
private

Candidate represents a possible candidate neighbor (distance, index).

Definition at line 460 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
typedef std::priority_queue<Candidate, std::vector<Candidate>, CandidateCmp> mlpack::neighbor::LSHSearch< SortPolicy >::CandidateList
private

Use a priority queue to represent the list of candidate neighbors.

Definition at line 472 of file lsh_search.hpp.

Constructor & Destructor Documentation

template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::LSHSearch ( const arma::mat &  referenceSet,
const arma::cube &  projections,
const double  hashWidth = 0.0,
const size_t  secondHashSize = 99901,
const size_t  bucketSize = 500 
)

This function initializes the LSH class.

It builds the hash on the reference set with 2-stable distributions. See the individual functions performing the hashing for details on how the hashing is done.

Parameters
referenceSetSet of reference points and the set of queries.
projectionsCube of projection tables. For a cube of size (a, b, c) we set numProj = a, numTables = c. b is the reference set dimensionality.
hashWidthThe width of hash for every table. If 0 (the default) is provided, then the hash width is automatically obtained by computing the average pairwise distance of 25 pairs. This should be a reasonable upper bound on the nearest-neighbor distance in general.
secondHashSizeThe size of the second hash table. This should be a large prime number.
bucketSizeThe size of the bucket in the second hash table. This is the maximum number of points that can be hashed into single bucket. A value of 0 indicates that there is no limit (so the second hash table can be arbitrarily large—be careful!).
template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::LSHSearch ( const arma::mat &  referenceSet,
const size_t  numProj,
const size_t  numTables,
const double  hashWidth = 0.0,
const size_t  secondHashSize = 99901,
const size_t  bucketSize = 500 
)

This function initializes the LSH class.

It builds the hash one the reference set using the provided projections. See the individual functions performing the hashing for details on how the hashing is done.

Parameters
referenceSetSet of reference points and the set of queries.
numProjNumber of projections in each hash table (anything between 10-50 might be a decent choice).
numTablesTotal number of hash tables (anything between 10-20 should suffice).
hashWidthThe width of hash for every table. If 0 (the default) is provided, then the hash width is automatically obtained by computing the average pairwise distance of 25 pairs. This should be a reasonable upper bound on the nearest-neighbor distance in general.
secondHashSizeThe size of the second hash table. This should be a large prime number.
bucketSizeThe size of the bucket in the second hash table. This is the maximum number of points that can be hashed into single bucket. A value of 0 indicates that there is no limit (so the second hash table can be arbitrarily large—be careful!).
template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::LSHSearch ( )

Create an untrained LSH model.

Be sure to call Train() before calling Search(); otherwise, an exception will be thrown when Search() is called.

template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::LSHSearch ( const LSHSearch< SortPolicy > &  other)

Copy the given LSH model.

Parameters
otherOther LSH model to copy.
template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::LSHSearch ( LSHSearch< SortPolicy > &&  other)

Take ownership of the given LSH model.

Parameters
otherOther LSH model to take ownership of.
template<typename SortPolicy = NearestNeighborSort>
mlpack::neighbor::LSHSearch< SortPolicy >::~LSHSearch ( )

Clean memory.

Member Function Documentation

template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::BaseCase ( const size_t  queryIndex,
const arma::uvec &  referenceIndices,
const size_t  k,
arma::Mat< size_t > &  neighbors,
arma::mat &  distances 
) const
private

This is a helper function that computes the distance of the query to the neighbor candidates and appropriately stores the best 'k' candidates.

This is specific to the monochromatic search case, where the query set is the reference set.

Parameters
queryIndexThe index of the query in question
referenceIndicesThe vector of indices of candidate neighbors for the query.
kNumber of neighbors to search for.
neighborsMatrix holding output neighbors.
distancesMatrix holding output distances.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::BaseCase ( const size_t  queryIndex,
const arma::uvec &  referenceIndices,
const size_t  k,
const arma::mat &  querySet,
arma::Mat< size_t > &  neighbors,
arma::mat &  distances 
) const
private

This is a helper function that computes the distance of the query to the neighbor candidates and appropriately stores the best 'k' candidates.

This is specific to bichromatic search, where the query set is not the same as the reference set.

Parameters
queryIndexThe index of the query in question
referenceIndicesThe vector of indices of candidate neighbors for the query.
kNumber of neighbors to search for.
querySetSet of query points.
neighborsMatrix holding output neighbors.
distancesMatrix holding output distances.
template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::BucketSize ( ) const
inline

Get the bucket size of the second hash.

Definition at line 280 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::bucketSize.

template<typename SortPolicy = NearestNeighborSort>
static double mlpack::neighbor::LSHSearch< SortPolicy >::ComputeRecall ( const arma::Mat< size_t > &  foundNeighbors,
const arma::Mat< size_t > &  realNeighbors 
)
static

Compute the recall (% of neighbors found) given the neighbors returned by LSHSearch::Search and a "ground truth" set of neighbors.

The recall returned will be in the range [0, 1].

Parameters
foundNeighborsSet of neighbors to compute recall of.
realNeighborsSet of "ground truth" neighbors to compute recall against.
template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::DistanceEvaluations ( ) const
inline

Return the number of distance evaluations performed.

Definition at line 263 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::distanceEvaluations.

template<typename SortPolicy = NearestNeighborSort>
size_t& mlpack::neighbor::LSHSearch< SortPolicy >::DistanceEvaluations ( )
inline

Modify the number of distance evaluations performed.

Definition at line 265 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::distanceEvaluations.

template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::GetAdditionalProbingBins ( const arma::vec &  queryCode,
const arma::vec &  queryCodeNotFloored,
const size_t  T,
arma::mat &  additionalProbingBins 
) const
private

This function implements the core idea behind Multiprobe LSH.

It is called by ReturnIndicesFromTables when T > 0. Given a query's code and its projection location, GetAdditionalProbingBins will calculate the T most likely alternative bin codes (other than queryCode) where a query's neighbors might be found in.

Parameters
queryCodevector containing the numProj-dimensional query code.
queryCodeNotFlooredvector containing the projection location of the query.
Tnumber of additional probing bins.
additionalProbingBinsmatrix. Each column will hold one additional bin.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::NumProjections ( ) const
inline

Get the number of projections.

Definition at line 271 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
const arma::mat& mlpack::neighbor::LSHSearch< SortPolicy >::Offsets ( ) const
inline

Get the offsets 'b' for each of the projections. (One 'b' per column.)

Definition at line 274 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::offsets.

template<typename SortPolicy = NearestNeighborSort>
LSHSearch& mlpack::neighbor::LSHSearch< SortPolicy >::operator= ( const LSHSearch< SortPolicy > &  other)

Copy the given LSH model.

Parameters
otherOther LSH model to copy.
template<typename SortPolicy = NearestNeighborSort>
LSHSearch& mlpack::neighbor::LSHSearch< SortPolicy >::operator= ( LSHSearch< SortPolicy > &&  other)

Take ownership of the given LSH model.

Parameters
otherOther LSH model to take ownership of.
template<typename SortPolicy = NearestNeighborSort>
bool mlpack::neighbor::LSHSearch< SortPolicy >::PerturbationExpand ( std::vector< bool > &  A) const
private

Inline function used by GetAdditionalProbingBins.

The vector expansion operation adds the element [1 + (largest_element)] to a vector A, where largest_element is the largest element of A. Returns true if resulting vector is valid, otherwise false.

Parameters
Aperturbation set to expand.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
double mlpack::neighbor::LSHSearch< SortPolicy >::PerturbationScore ( const std::vector< bool > &  A,
const arma::vec &  scores 
) const
private

Returns the score of a perturbation vector generated by perturbation set A.

The score of a pertubation set (vector) is the sum of scores of the participating actions.

Parameters
Aperturbation set to compute the score of.
scoresvector containing score of each perturbation.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
bool mlpack::neighbor::LSHSearch< SortPolicy >::PerturbationShift ( std::vector< bool > &  A) const
private

Inline function used by GetAdditionalProbingBins.

The vector shift operation replaces the largest element of a vector A with (largest element)

  • 1. Returns true if resulting vector is valid, otherwise false.
Parameters
Aperturbation set to shift.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
bool mlpack::neighbor::LSHSearch< SortPolicy >::PerturbationValid ( const std::vector< bool > &  A) const
private

Return true if perturbation set A is valid.

A perturbation set is invalid if it contains two (or more) actions for the same dimension or dimensions that are larger than the queryCode's dimensions.

Parameters
Aperturbation set to validate.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
const arma::cube& mlpack::neighbor::LSHSearch< SortPolicy >::Projections ( )
inline

Get the projection tables.

Definition at line 287 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::projections.

template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::Projections ( const arma::cube &  projTables)
inline
template<typename SortPolicy = NearestNeighborSort>
const arma::mat& mlpack::neighbor::LSHSearch< SortPolicy >::ReferenceSet ( ) const
inline

Return the reference dataset.

Definition at line 268 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::referenceSet.

template<typename SortPolicy = NearestNeighborSort>
template<typename VecType >
void mlpack::neighbor::LSHSearch< SortPolicy >::ReturnIndicesFromTable ( const VecType &  queryPoint,
arma::uvec &  referenceIndices,
size_t  numTablesToSearch,
const size_t  T 
) const
private

This function takes a query and hashes it into each of the hash tables to get keys for the query and then the key is hashed to a bucket of the second hash table and all the points (if any) in those buckets are collected as the potential neighbor candidates.

Parameters
queryPointThe query point currently being processed.
referenceIndicesThe list of neighbor candidates obtained from hashing the query into all the hash tables and eventually into multiple buckets of the second hash table.
numTablesToSearchThe number of tables to perform the search in. If 0, all tables are searched.
TThe number of additional probing bins for multiprobe LSH. If 0, single-probe is used.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::Search ( const arma::mat &  querySet,
const size_t  k,
arma::Mat< size_t > &  resultingNeighbors,
arma::mat &  distances,
const size_t  numTablesToSearch = 0,
const size_t  T = 0 
)

Compute the nearest neighbors of the points in the given query set and store the output in the given matrices.

The matrices will be set to the size of n columns by k rows, where n is the number of points in the query dataset and k is the number of neighbors being searched for.

Parameters
querySetSet of query points.
kNumber of neighbors to search for.
resultingNeighborsMatrix storing lists of neighbors for each query point.
distancesMatrix storing distances of neighbors for each query point.
numTablesToSearchThis parameter allows the user to have control over the number of hash tables to be searched. This allows the user to pick the number of tables it can afford for the time available without having to build hashing for every table size. By default, this is set to zero in which case all tables are considered.
TThe number of additional probing bins to examine with multiprobe LSH. If T = 0, classic single-probe LSH is run (default).
template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::Search ( const size_t  k,
arma::Mat< size_t > &  resultingNeighbors,
arma::mat &  distances,
const size_t  numTablesToSearch = 0,
size_t  T = 0 
)

Compute the nearest neighbors and store the output in the given matrices.

The matrices will be set to the size of n columns by k rows, where n is the number of points in the query dataset and k is the number of neighbors being searched for.

Parameters
kNumber of neighbors to search for.
resultingNeighborsMatrix storing lists of neighbors for each query point.
distancesMatrix storing distances of neighbors for each query point.
numTablesToSearchThis parameter allows the user to have control over the number of hash tables to be searched. This allows the user to pick the number of tables it can afford for the time available without having to build hashing for every table size. By default, this is set to zero in which case all tables are considered.
template<typename SortPolicy = NearestNeighborSort>
const std::vector<arma::Col<size_t> >& mlpack::neighbor::LSHSearch< SortPolicy >::SecondHashTable ( ) const
inline

Get the second hash table.

Definition at line 283 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::secondHashTable.

template<typename SortPolicy = NearestNeighborSort>
const arma::vec& mlpack::neighbor::LSHSearch< SortPolicy >::SecondHashWeights ( ) const
inline

Get the weights of the second hash.

Definition at line 277 of file lsh_search.hpp.

References mlpack::neighbor::LSHSearch< SortPolicy >::secondHashWeights.

template<typename SortPolicy = NearestNeighborSort>
template<typename Archive >
void mlpack::neighbor::LSHSearch< SortPolicy >::Serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the LSH model.

Parameters
arArchive to serialize to.
template<typename SortPolicy = NearestNeighborSort>
void mlpack::neighbor::LSHSearch< SortPolicy >::Train ( const arma::mat &  referenceSet,
const size_t  numProj,
const size_t  numTables,
const double  hashWidth = 0.0,
const size_t  secondHashSize = 99901,
const size_t  bucketSize = 500,
const arma::cube &  projection = arma::cube() 
)

Train the LSH model on the given dataset.

If a correctly-sized projection cube is not provided, this means building new hash tables. Otherwise, we use the projections provided by the user.

Parameters
referenceSetSet of reference points and the set of queries.
numProjNumber of projections in each hash table (anything between 10-50 might be a decent choice).
numTablesTotal number of hash tables (anything between 10-20 should suffice).
hashWidthThe width of hash for every table. If 0 (the default) is provided, then the hash width is automatically obtained by computing the average pairwise distance of 25 pairs. This should be a reasonable upper bound on the nearest-neighbor distance in general.
secondHashSizeThe size of the second hash table. This should be a large prime number.
bucketSizeThe size of the bucket in the second hash table. This is the maximum number of points that can be hashed into single bucket. A value of 0 indicates that there is no limit (so the second hash table can be arbitrarily large—be careful!).
projectionsCube of projection tables. For a cube of size (a, b, c) we set numProj = a, numTables = c. b is the reference set dimensionality.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

Member Data Documentation

template<typename SortPolicy = NearestNeighborSort>
arma::Col<size_t> mlpack::neighbor::LSHSearch< SortPolicy >::bucketContentSize
private

The number of elements present in each hash bucket; should be secondHashSize.

Definition at line 450 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
arma::Col<size_t> mlpack::neighbor::LSHSearch< SortPolicy >::bucketRowInHashTable
private

For a particular hash value, points to the row in secondHashTable corresponding to this value.

Length secondHashSize.

Definition at line 454 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::bucketSize
private

The bucket size of the second hash.

Definition at line 442 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::BucketSize(), and mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::distanceEvaluations
private

The number of distance evaluations.

Definition at line 457 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::DistanceEvaluations().

template<typename SortPolicy = NearestNeighborSort>
double mlpack::neighbor::LSHSearch< SortPolicy >::hashWidth
private

The hash width.

Definition at line 433 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::numProj
private

The number of projections.

Definition at line 422 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::numTables
private

The number of hash tables.

Definition at line 424 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
arma::mat mlpack::neighbor::LSHSearch< SortPolicy >::offsets
private

The list of the offsets 'b' for each of the projection for each table.

Definition at line 430 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Offsets().

template<typename SortPolicy = NearestNeighborSort>
bool mlpack::neighbor::LSHSearch< SortPolicy >::ownsSet
private

If true, we own the reference set.

Definition at line 419 of file lsh_search.hpp.

template<typename SortPolicy = NearestNeighborSort>
arma::cube mlpack::neighbor::LSHSearch< SortPolicy >::projections
private

The arma::cube containing the projection matrix of each table.

Definition at line 427 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
const arma::mat* mlpack::neighbor::LSHSearch< SortPolicy >::referenceSet
private

Reference dataset.

Definition at line 417 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::ReferenceSet().

template<typename SortPolicy = NearestNeighborSort>
size_t mlpack::neighbor::LSHSearch< SortPolicy >::secondHashSize
private

The big prime representing the size of the second hash.

Definition at line 436 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::Projections().

template<typename SortPolicy = NearestNeighborSort>
std::vector<arma::Col<size_t> > mlpack::neighbor::LSHSearch< SortPolicy >::secondHashTable
private

The final hash table; should be (< secondHashSize) vectors each with (<= bucketSize) elements.

Definition at line 446 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::SecondHashTable().

template<typename SortPolicy = NearestNeighborSort>
arma::vec mlpack::neighbor::LSHSearch< SortPolicy >::secondHashWeights
private

The weights of the second hash.

Definition at line 439 of file lsh_search.hpp.

Referenced by mlpack::neighbor::LSHSearch< SortPolicy >::SecondHashWeights().


The documentation for this class was generated from the following file: