- Locality sensitive hashing
Locality Sensitive Hashing (LSH) is a method of performing probabilistic
dimension reduction of high-dimensional data. The basic idea is to hash the input items so that similar items are mapped to the same buckets with high probability (the number of buckets being much smaller than the universe of possible input items).Definition
An "LSH family " is defined fora
metric space , a threshold and an approximation factor .An LSH familycite journal
author= Gionis, A.
coauthors = Indyk, P., Motwani, R.
year = 1999
title = Similarity Search in High Dimensions via Hashing
url= http://people.csail.mit.edu/indyk/vldb99.ps ,
journal = Proceedings of the 25th Very Large Database (VLDB) Conference] cite journal
author = Indyk, Piotr.
coauthors = Motwani, Rajeev.
year = 1998
title = Approximate Nearest Neighbors: Towards Removing the Curse of Dimensionality.
url= http://people.csail.mit.edu/indyk/nndraft.ps ,
journal = Proceedings of 30th Symposium on Theory of Computing] is afamily of functions satisfying the following conditions for any twopoints , and a function chosenuniformly at random from :
* if , then (i.e., and collide) with probability at least ,
* if , then with probability at most .A family is interesting when . Such a family is called "-sensitive".
An alternative definitioncite journal
author = Charikar, Moses S..
coauthors =
year = 2002
title = Similarity Estimation Techniques from Rounding Algorithms
journal = Proceedings of the 34th Annual ACM Symposium on Theory of Computing 2002
pages = (ACM 1–58113–495–9/02/0005)…
url = http://portal.acm.org/citation.cfm?id=509965
accessdate = 2007-12-21
doi = 10.1145/509907.509965] is defined with respect to a universe of items that have asimilarity function . An LSH scheme is a family of hash functions coupled with a probability distribution over the functions such that a function chosen according to satifies the property that for any .Applications
LSH has been applied to several problem domains including
*Near Duplicate Detection
*Image Similarity Identification
*Gene Expression Similarity Identification
*Audio Similarity Identification Methods
Bit Sampling For Hamming Distance
One of the easiest ways to construct an LSH family is by bit sampling ] .This approach works for the
Hamming distance over d-dimensional vectors . Here, the family of hash functions is simply the family of all the projections of points onone of the coordinates, i.e., , where is the coordinate of. A random function from simply selects a random bit from input point. This family has the following parameters:, .Min-Wise Independent Permutations
Suppose is composed of subsets of some ground set of enumerable items and the similarity function of interest is the Jaccard index . If is a permutation on the indices of , for let . Each possible choice of defines a single hash function mapping input sets to integers.
Define the function family to be the set of all such functions and let be the uniform distribution. Given two sets the event that corresponds exactly to the event that the minimizer of lies inside . As was chosen uniformly at random, and define an LSH scheme for the Jaccard index.
Because the symmetric group on n elements has size n!, choosing a truly random permutation from the full symmetric group is infeasible for even moderately sized n. Because of this fact, there has been significant work on finding a family of permutations that is "min-wise independent" - a permutation family for which each element of the domain has equal probability of being the minimum under a randomly chosen . It has been established that a min-wise independent family of permutations is at least of size cite journal
author = Broder, A.Z.
coauthors = Charikar, M.; Frieze, A.M.; Mitzenmacher, M.
year = 1998
title = Min-wise independent permutations
journal = Proceedings of the thirtieth annual ACM symposium on Theory of computing
pages = 327–336
url = http://www.cs.princeton.edu/~moses/papers/minwise.ps
accessdate = 2007-11-14
doi = 10.1145/276698.276781] and that this boundary is tight [cite journal
title=An optimal construction of exactly min-wise independent permutations
coauthors=Takei, Y. and Itoh, T. and Shinozaki, T.
journal=Technical Report COMP98-62, IEICE, 1998] .Because min-wise independent families are too big for practical applications, two variant notions of min-wise independence are introduced: restricted min-wise independent permutations families, and approximate min-wise independent families.Restricted min-wise independence is the min-wise independence property restricted to certain sets of cardinality at most k cite journal
author = Matousek, J.
coauthors = Stojakovic, M.
year = 2002
title = On Restricted Min-Wise Independence of Permutations
journal = Preprint
url = http://citeseer.ist.psu.edu/689217.html
accessdate = 2007-11-14] .Approximate min-wise independence differs from the property by at most a fixed cite journal
author = Saks, M.
coauthors = Srinivasan, A.; Zhou, S.; Zuckerman, D.
year = 2000
title = Low discrepancy sets yield approximate min-wise independent permutation families
journal = Information Processing Letters
volume = 73
issue = 1-2
pages = 29–32
url = http://citeseer.ist.psu.edu/saks99low.html
accessdate = 2007-11-14
doi = 10.1016/S0020-0190(99)00163-5] .Random Projection
The random projection method of LSH is designed to approximate the
cosine distance between vectors. The basic idea of this technique is to choose a randomhyperplane (defined by a normal unit vector ) at the outset and use the hyperplane to hash input vectors.Given an input vector and a hyperplane defined by , we let . That is, depending on which side of the hyperplane lies.
Each possible choice of defines a single function. Let be the set of all such functions and let be the uniform distribution once again. It is not difficult to prove that, for two vectors , , where is the angle between and . is closely related to .
In this instance hashing produces only a single bit. Two vectors' bits match with probability proportional to the cosine of the angle between them.
table Distributions
The hash functioncite journal
author = Datar, M.
coauthors = Immorlica, N., Indyk, P., Mirrokni, V.S.
year=2004
title = Locality-Sensitive Hashing Scheme Based on p-Stable Distributions
url = http://theory.csail.mit.edu/~mirrokni/pstable.ps
journal = Proceedings of the Symposium on Computational Geometry] maps a "d" dimensional vector onto a set of integers. Each hash functionin the family is indexed by a choice of random and where is a "d" dimensional vector withentries chosen independently from a stable distribution and isa real number chosen uniformly from the range [0,r] . For a fixed the hash function isgiven by .LSH Algorithm for the Nearest Neighbor Search
One of the main application of LSH is to provide efficient
nearest neighbor search algorithms.Consider any LSH family . Thealgorithm has two main parameters: the width parameter and thenumber of hash tables .In the first step, we define a new family of hashfunctions , where each function isobtained by concatenating functions from, i.e., .In other words, a random hash function is obtained byconcatenating randomly chosen hash functions from .The algorithm then constructs hash tables, each corresponding toa different randomly chosen hash function .
In the preprocessing step we hash all points from the data set into each ofthe hash tables.Given that the resulting hash tables have only non-zero entries,one can reduce the amount of memory used per each hash table to using standard
hash functions .Given a query point , the algorithm iterates over the hash functions .For each considered, it retrieves the data points that are hashedinto the same bucket as .The process is stopped as soon as a point within distance from is found.
Given the parameters and , the algorithm hasthe following performance guarantees:
* preprocessing time: , where is the time to evaluate a function on an input point ;
* space: , plus the space for storing data points;
* query time: ;
* the algorithm succeeds in finding a point within distance from (if it exists) with probability at least .For a fixed approximation ratio and probabilities and , one can set and , where.Then one obtains the following performance guarantees:
* preprocessing time: ;
* space: , plus the space for storing data points;
* query time: ;ee also
*
Nearest neighbor search Related Papers
* [http://web.mit.edu/andoni/www/LSH/index.html Alex Andoni's LSH homepage]
Wikimedia Foundation. 2010.