Class Bucket

java.lang.Object
smile.neighbor.lsh.Bucket
All Implemented Interfaces:
Serializable

public class Bucket extends Object implements Serializable
A bucket is a container for points that all have the same value for hash function g (function g is a vector of k LSH functions). A bucket is specified by an integer vector of length k.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The bucket id is given by the universal bucket hashing.
    The indices of points that all have the same value for hash function g.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Bucket(int bucket)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int point)
    Adds a point to bucket.
    Returns the points in the bucket.
    boolean
    remove(int point)
    Removes a point from bucket.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bucket

      public final int bucket
      The bucket id is given by the universal bucket hashing. The id is used instead of the full k-vector (value of the hash function g) describing the bucket. With a high probability all buckets will have different pairs of id's.
    • entry

      public final IntArrayList entry
      The indices of points that all have the same value for hash function g.
  • Constructor Details

    • Bucket

      public Bucket(int bucket)
      Constructor.
      Parameters:
      bucket - the bucket number given by universal hashing.
  • Method Details

    • points

      public IntArrayList points()
      Returns the points in the bucket.
      Returns:
      the points in the bucket.
    • add

      public void add(int point)
      Adds a point to bucket.
      Parameters:
      point - the index of point.
    • remove

      public boolean remove(int point)
      Removes a point from bucket.
      Parameters:
      point - the index of point.
      Returns:
      true if the point was in the bucket.