Class HyperLogLogEstimator
- java.lang.Object
-
- com.yahoo.searchlib.aggregation.hll.HyperLogLogEstimator
-
- All Implemented Interfaces:
UniqueCountEstimator<Sketch<?>>
public class HyperLogLogEstimator extends java.lang.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 Summary
Constructors Constructor Description HyperLogLogEstimator()
Creates the estimator with the default precision (HyperLogLog.DEFAULT_PRECISION
.HyperLogLogEstimator(int precision)
Creates the estimator for a given precision.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
estimateCount(Sketch<?> sketch)
Estimates the number of unique elements.
-
-
-
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.
-
HyperLogLogEstimator
public HyperLogLogEstimator()
Creates the estimator with the default precision (HyperLogLog.DEFAULT_PRECISION
.
-
-
Method Detail
-
estimateCount
public long estimateCount(Sketch<?> sketch)
Estimates the number of unique elements.- Specified by:
estimateCount
in interfaceUniqueCountEstimator<Sketch<?>>
- Parameters:
sketch
- A sketch populated with values from the aggregation phase of HLL.- Returns:
- The estimated number of unique elements.
-
-