Package elki.index.lsh.hashfunctions
Class CosineLocalitySensitiveHashFunction
- java.lang.Object
-
- elki.index.lsh.hashfunctions.CosineLocalitySensitiveHashFunction
-
- All Implemented Interfaces:
LocalitySensitiveHashFunction<NumberVector>
@Reference(authors="M. S. Charikar", title="Similarity estimation techniques from rounding algorithms", booktitle="Proc. 34th ACM Symposium on Theory of Computing, STOC\'02", url="https://doi.org/10.1145/509907.509965", bibkey="DBLP:conf/stoc/Charikar02") public class CosineLocalitySensitiveHashFunction extends java.lang.Object implements LocalitySensitiveHashFunction<NumberVector>
Random projection family to use with sparse vectors.Reference:
M. S. Charikar
Similarity estimation techniques from rounding algorithms
Proc. 34th ACM Symposium on Theory of Computing, STOC'02- Since:
- 0.7.0
- Author:
- Evgeniy Faerman
-
-
Field Summary
Fields Modifier and Type Field Description private RandomProjectionFamily.ProjectionprojectionProjection function.
-
Constructor Summary
Constructors Constructor Description CosineLocalitySensitiveHashFunction(RandomProjectionFamily.Projection projection)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumberOfProjections()Get the number of projections performed.inthashObject(NumberVector obj)Compute the hash value of an object.inthashObject(NumberVector obj, double[] buf)Compute the hash value of an object (faster version).
-
-
-
Field Detail
-
projection
private RandomProjectionFamily.Projection projection
Projection function.
-
-
Constructor Detail
-
CosineLocalitySensitiveHashFunction
public CosineLocalitySensitiveHashFunction(RandomProjectionFamily.Projection projection)
Constructor.- Parameters:
projection- Projection
-
-
Method Detail
-
hashObject
public int hashObject(NumberVector obj)
Description copied from interface:LocalitySensitiveHashFunctionCompute the hash value of an object.- Specified by:
hashObjectin interfaceLocalitySensitiveHashFunction<NumberVector>- Parameters:
obj- Object to hash- Returns:
- Hash value
-
hashObject
public int hashObject(NumberVector obj, double[] buf)
Description copied from interface:LocalitySensitiveHashFunctionCompute the hash value of an object (faster version).- Specified by:
hashObjectin interfaceLocalitySensitiveHashFunction<NumberVector>- Parameters:
obj- Object to hashbuf- Buffer, sized according to the number of projections.- Returns:
- Hash value
-
getNumberOfProjections
public int getNumberOfProjections()
Description copied from interface:LocalitySensitiveHashFunctionGet the number of projections performed.- Specified by:
getNumberOfProjectionsin interfaceLocalitySensitiveHashFunction<NumberVector>- Returns:
- Number of projections.
-
-