Class 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 Detail

      • 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.
    • Method Detail

      • 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.