Class HyperLogLogEstimator
java.lang.Object
com.yahoo.searchlib.aggregation.hll.HyperLogLogEstimator
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionCreates the estimator with the default precision (HyperLogLog.DEFAULT_PRECISION.HyperLogLogEstimator(int precision) Creates the estimator for a given precision. -
Method Summary
Modifier and TypeMethodDescriptionlongestimateCount(Sketch<?> sketch) Estimates the number of unique elements.
-
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
Estimates the number of unique elements.- Specified by:
estimateCountin interfaceUniqueCountEstimator<Sketch<?>>- Parameters:
sketch- A sketch populated with values from the aggregation phase of HLL.- Returns:
- The estimated number of unique elements.
-