Class HyperLogLogEstimator

java.lang.Object
com.yahoo.searchlib.aggregation.hll.HyperLogLogEstimator
All Implemented Interfaces:
UniqueCountEstimator<Sketch<?>>

public class HyperLogLogEstimator extends Object implements UniqueCountEstimator<Sketch<?>>
Implementation of the result computation phase of the HyperLogLog algorithm. Based on the pseudo code from: http://www.dmtcs.org/dmtcs-ojs/index.php/proceedings/article/viewArticle/914
Author:
bjorncs
  • Constructor Details

    • HyperLogLogEstimator

      public HyperLogLogEstimator(int precision)
      Creates the estimator for a given precision. The resulting memory consumption is the exponential to the precision.
      Parameters:
      precision - The precision parameter as defined in HLL algorithm.
    • HyperLogLogEstimator

      public HyperLogLogEstimator()
      Creates the estimator with the default precision (HyperLogLog.DEFAULT_PRECISION.
  • Method Details

    • estimateCount

      public long estimateCount(Sketch<?> sketch)
      Estimates the number of unique elements.
      Specified by:
      estimateCount in interface UniqueCountEstimator<Sketch<?>>
      Parameters:
      sketch - A sketch populated with values from the aggregation phase of HLL.
      Returns:
      The estimated number of unique elements.