Class ExponentialHistogramQuantile
java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramQuantile
Provides quantile estimation for
ExponentialHistogram instances.
All algorithms assume that the values of each histogram bucket have exactly the same value,
which is defined by ExponentialScaleUtils.getPointOfLeastRelativeError(long, int).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longestimateRank(ExponentialHistogram histo, double value, boolean inclusive) Estimates the rank of a given value in the distribution represented by the histogram.static doublegetQuantile(ExponentialHistogram histo, double quantile) Estimates a quantile for the distribution represented by the given histogram.
-
Constructor Details
-
ExponentialHistogramQuantile
public ExponentialHistogramQuantile()
-
-
Method Details
-
getQuantile
Estimates a quantile for the distribution represented by the given histogram. It returns the value of the element at rankmax(0, min(n - 1, (quantile * (n + 1)) - 1)), where n is the total number of values and rank starts at 0. If the rank is fractional, the result is linearly interpolated from the values of the two neighboring ranks. The result is clamped to the histogram's minimum and maximum values.- Parameters:
histo- the histogram representing the distributionquantile- the quantile to query, in the range [0, 1]- Returns:
- the estimated quantile value, or
Double.NaNif the histogram is empty
-
estimateRank
Estimates the rank of a given value in the distribution represented by the histogram. In other words, returns the number of values which are less than (or less-or-equal, ifinclusiveis true) the provided value.- Parameters:
histo- the histogram to queryvalue- the value to estimate the rank forinclusive- if true, counts values equal to the given value as well- Returns:
- the number of elements less than (or less-or-equal, if
inclusiveis true) the given value
-