Class Hash
java.lang.Object
smile.neighbor.lsh.Hash
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MultiProbeHash
The hash function for Euclidean spaces.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Hash
public Hash(int d, int k, double w, int H) Constructor.- Parameters:
d- the dimensionality of data.k- the number of random projection hash functions, which is usually set to log(N) where N is the dataset size.w- the width of random projections. It should be sufficiently away from 0. But we should not choose a w value that is too large, which will increase the query time.H- the size of universal hash tables.
-
-
Method Details
-
hash
public int hash(double[] x) Apply hash functions on given vector x.- Parameters:
x- the vector to be hashed.- Returns:
- the bucket of hash table for given vector x.
-
add
public void add(int index, double[] x) Insert an item into the hash table.- Parameters:
index- the index of point in the data set.x- the data point.
-
get
Returns the bucket entry for the given hash value.- Parameters:
i- the hash code.- Returns:
- the bucket.
-
get
Returns the bucket entry for the given point.- Parameters:
x- the data point.- Returns:
- the bucket.
-