Interface ConcurrentQuantileEstimator
-
- All Known Implementing Classes:
MultiQuantileDigest,QuantileDigest,SlidingWindowQuantileDigest
public interface ConcurrentQuantileEstimatorThread-safe quantile and cdf estimation- Author:
- Mojtaba Kohram
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidadd(double x)Add an unweighted sample to this estimator.voidadd(double x, int w)Add a weighted sample.doublecdf(double x)Get an estimate for the cdf of the distribution atx.List<Double>cdf(List<Double> coordinates)Get an estimate for the cdf of the distribution at every coordinate of input list.doublequantile(double q)Get an estimate of the quantile atq.List<Double>quantile(List<Double> quantileList)Get an estimated quantile for every value in the input list.longsize()Returns the number of samples added to the current Estimator.default booleantryAdd(double x)Attempts to add an unweighted sample to this estimator.booleantryAdd(double x, int w)Attempts to add a weighted sample to this estimator.
-
-
-
Method Detail
-
size
long size()
Returns the number of samples added to the current Estimator.- Returns:
- the number of samples currently added
-
cdf
double cdf(double x)
Get an estimate for the cdf of the distribution atx. This function could be expensive depending on implementation. Consider usingcdf(List)when querying more than one cdf value.- Parameters:
x- the value to get cdf at- Returns:
- the estimated cumulative distribution function value at
x, always between 0 and 1
-
cdf
List<Double> cdf(List<Double> coordinates)
Get an estimate for the cdf of the distribution at every coordinate of input list.- Parameters:
coordinates- the list of coordinates to compute the cdf at- Returns:
- the estimated cumulative distribution function value for every element in
coordinates, in order, results are always between 0 and 1
-
quantile
double quantile(double q)
Get an estimate of the quantile atq. This function could be expensive depending on implementation. Consider usingquantile(List)when querying more than one quantile value.- Parameters:
q- quantile to query, must be between 0 and 1- Returns:
- the estimated quantile value at
q
-
quantile
List<Double> quantile(List<Double> quantileList)
Get an estimated quantile for every value in the input list.- Parameters:
quantileList- list of quantiles to query, must all be between 0 and 1- Returns:
- the estimated quantile value for every element in
quantileList, in order
-
tryAdd
boolean tryAdd(double x, int w)Attempts to add a weighted sample to this estimator. Returns false if a lock is held by another thread.- Parameters:
x- data to addw- weight- Returns:
- false if this object's lock is held by another thread, true otherwise
-
tryAdd
default boolean tryAdd(double x)
Attempts to add an unweighted sample to this estimator. Returns false if a lock is held by another thread.- Parameters:
x- data to add- Returns:
- false if this objects lock is held by another thread, true otherwise
-
add
void add(double x, int w)Add a weighted sample. This function could block to ensure the data is added to the estimator, for non-blocking adds seetryAdd(double, int).- Parameters:
x- data to addw- weight
-
add
default void add(double x)
Add an unweighted sample to this estimator. This function could block to ensure the data is added to the estimator, for non-blocking adds seetryAdd(double).- Parameters:
x- data to add
-
-