Class CountMinSketch<T>


  • public class CountMinSketch<T>
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CountMinSketch​(int tableWidth, int tableHeight, com.google.common.hash.Funnel<T> funnel)
      Creates a new CountMinSketch.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(T obj)
      Adds this object to the min sketch.
      int approximateCount​(T obj)
      Gives an approximate count of how often this element was seen through add(Object).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CountMinSketch

        public CountMinSketch​(int tableWidth,
                              int tableHeight,
                              com.google.common.hash.Funnel<T> funnel)
        Creates a new CountMinSketch. This will allocate a 2D array of (tableHeight * tableWidth) integers, which is the whole memory constraint of the counting sketch. The height of the table tells how many hash functions to use.
        Parameters:
        tableWidth - the width of the counter table.
        tableHeight - the height of the counter table (as in how many hashing functions to use).
        funnel - the funnel to hash an object.
    • Method Detail

      • add

        public void add​(T obj)
        Adds this object to the min sketch.
      • approximateCount

        public int approximateCount​(T obj)
        Gives an approximate count of how often this element was seen through add(Object).
        Returns:
        0 if it was never seen, an approximate count otherwise.