lshkit::HyperPlaneLsh Class Reference

Random hyperplane based LSH for cosine similarity. More...

#include <lsh.h>

List of all members.

Public Types

typedef const float * Domain

Public Member Functions

template<typename RNG>
void reset (const Parameter &param, RNG &rng)
template<typename RNG>
 HyperPlaneLsh (const Parameter &param, RNG &rng)
unsigned getRange () const
unsigned operator() (Domain obj) const
unsigned operator() (Domain obj, float *delta) const
template<class Archive>
void serialize (Archive &ar, const unsigned int version)


struct  Parameter

Detailed Description

Random hyperplane based LSH for cosine similarity.

Random hyperplane based LSH can be used to approximate cosine similarity. This LSH is defined on the D-dimensional vector space. For a vector X, the hash value is defined as

\[ h(X) = [a_1*X_1 + a_2*X_2 + ... + a_D*X_D] > 0 ? 1 : 0 \]

where <a1,...,aD> is a random vector sampled from the unit hypersphere.

The domain of the LSH is (const float *), and the parameter is defined as

      struct Parameter {
          unsigned dim;
The range of this LSH is 0.

For more information on stable distribution based LSH, see the following reference.

Charikar, M. S. 2002. Similarity estimation techniques from rounding algorithms. In Proceedings of the Thiry-Fourth Annual ACM Symposium on theory of Computing (Montreal, Quebec, Canada, May 19 - 21, 2002). STOC '02. ACM, New York, NY, 380-388. DOI=

The documentation for this class was generated from the following file:
Get LSHKIT at Fast, secure and Free Open Source software downloads doxygen