public interface QuantilesDoublesAPI extends QuantilesAPI
QuantilesAPI| Modifier and Type | Interface and Description |
|---|---|
static class |
QuantilesDoublesAPI.DoublesPartitionBoundaries
This encapsulates the essential information needed to construct actual partitions and is returned from the
getPartitionBoundaries(int, QuantileSearchCritera) method.
|
| Modifier and Type | Method and Description |
|---|---|
default double[] |
getCDF(double[] splitPoints)
This is equivalent to
getCDF(splitPoints, INCLUSIVE) |
double[] |
getCDF(double[] splitPoints,
QuantileSearchCriteria searchCrit)
Returns an approximation to the Cumulative Distribution Function (CDF) of the input stream
as a monotonically increasing array of double ranks (or cumulative probabilities) on the interval [0.0, 1.0],
given a set of splitPoints.
|
double |
getMaxItem()
Returns the maximum item of the stream.
|
double |
getMinItem()
Returns the minimum item of the stream.
|
default QuantilesDoublesAPI.DoublesPartitionBoundaries |
getPartitionBoundaries(int numEquallyWeighted)
This method returns an instance of
DoublesPartitionBoundaries which provides
sufficient information for the user to create the given number of equally weighted partitions. |
QuantilesDoublesAPI.DoublesPartitionBoundaries |
getPartitionBoundaries(int numEquallyWeighted,
QuantileSearchCriteria searchCrit)
This method returns an instance of
DoublesPartitionBoundaries which provides
sufficient information for the user to create the given number of equally weighted partitions. |
default double[] |
getPMF(double[] splitPoints)
This is equivalent to
getPMF(splitPoints, INCLUSIVE) |
double[] |
getPMF(double[] splitPoints,
QuantileSearchCriteria searchCrit)
Returns an approximation to the Probability Mass Function (PMF) of the input stream
as an array of probability masses as doubles on the interval [0.0, 1.0],
given a set of splitPoints.
|
default double |
getQuantile(double rank)
This is equivalent to
getQuantile(rank, INCLUSIVE) |
double |
getQuantile(double rank,
QuantileSearchCriteria searchCrit)
Gets the approximate quantile of the given normalized rank and the given search criterion.
|
double |
getQuantileLowerBound(double rank)
Gets the lower bound of the quantile confidence interval in which the quantile of the
given rank exists.
|
default double[] |
getQuantiles(double[] ranks)
This is equivalent to
getQuantiles(ranks, INCLUSIVE) |
double[] |
getQuantiles(double[] ranks,
QuantileSearchCriteria searchCrit)
Gets an array of quantiles from the given array of normalized ranks.
|
double |
getQuantileUpperBound(double rank)
Gets the upper bound of the quantile confidence interval in which the true quantile of the
given rank exists.
|
default double |
getRank(double quantile)
This is equivalent to
getRank(quantile, INCLUSIVE) |
double |
getRank(double quantile,
QuantileSearchCriteria searchCrit)
Gets the normalized rank corresponding to the given a quantile.
|
default double[] |
getRanks(double[] quantiles)
This is equivalent to
getRanks(quantiles, INCLUSIVE) |
double[] |
getRanks(double[] quantiles,
QuantileSearchCriteria searchCrit)
Gets an array of normalized ranks corresponding to the given array of quantiles and the given
search criterion.
|
int |
getSerializedSizeBytes()
Returns the current number of bytes this Sketch would require if serialized.
|
DoublesSortedView |
getSortedView()
Gets the sorted view of this sketch
|
QuantilesDoublesSketchIterator |
iterator()
Gets the iterator for this sketch, which is not sorted.
|
byte[] |
toByteArray()
Returns a byte array representation of this sketch.
|
void |
update(double item)
Updates this sketch with the given item.
|
getK, getN, getNumRetained, getRankLowerBound, getRankUpperBound, hasMemory, isDirect, isEmpty, isEstimationMode, isReadOnly, reset, toStringdefault double[] getCDF(double[] splitPoints)
getCDF(splitPoints, INCLUSIVE)splitPoints - an array of m unique, monotonically increasing items.IllegalArgumentException - if sketch is empty.double[] getCDF(double[] splitPoints,
QuantileSearchCriteria searchCrit)
The resulting approximations have a probabilistic guarantee that can be obtained from the getNormalizedRankError(false) function.
splitPoints - an array of m unique, monotonically increasing items
(of the same type as the input items)
that divide the item input domain into m+1 overlapping intervals.
The start of each interval is below the lowest item retained by the sketch corresponding to a zero rank or zero probability, and the end of the interval is the rank or cumulative probability corresponding to the split point.
The (m+1)th interval represents 100% of the distribution represented by the sketch and consistent with the definition of a cumulative probability distribution, thus the (m+1)th rank or probability in the returned array is always 1.0.
If a split point exactly equals a retained item of the sketch and the search criterion is:
It is not recommended to include either the minimum or maximum items of the input stream.
searchCrit - the desired search criteria.IllegalArgumentException - if sketch is empty.double getMaxItem()
IllegalArgumentException - if sketch is empty.double getMinItem()
IllegalArgumentException - if sketch is empty.default QuantilesDoublesAPI.DoublesPartitionBoundaries getPartitionBoundaries(int numEquallyWeighted)
DoublesPartitionBoundaries which provides
sufficient information for the user to create the given number of equally weighted partitions.
This method is equivalent to
getPartitionBoundaries(numEquallyWeighted, INCLUSIVE).
numEquallyWeighted - an integer that specifies the number of equally weighted partitions between
getMinItem() and getMaxItem().
This must be a positive integer greater than zero.
DoublesPartitionBoundaries.IllegalArgumentException - if sketch is empty.IllegalArgumentException - if numEquallyWeighted is less than 1.QuantilesDoublesAPI.DoublesPartitionBoundaries getPartitionBoundaries(int numEquallyWeighted, QuantileSearchCriteria searchCrit)
DoublesPartitionBoundaries which provides
sufficient information for the user to create the given number of equally weighted partitions.numEquallyWeighted - an integer that specifies the number of equally weighted partitions between
getMinItem() and getMaxItem().
This must be a positive integer greater than zero.
searchCrit - If INCLUSIVE, all the returned quantiles are the upper boundaries of the equally weighted partitions
with the exception of the lowest returned quantile, which is the lowest boundary of the lowest ranked partition.
If EXCLUSIVE, all the returned quantiles are the lower boundaries of the equally weighted partitions
with the exception of the highest returned quantile, which is the upper boundary of the highest ranked partition.DoublesPartitionBoundaries.IllegalArgumentException - if sketch is empty.IllegalArgumentException - if numEquallyWeighted is less than 1.default double[] getPMF(double[] splitPoints)
getPMF(splitPoints, INCLUSIVE)splitPoints - an array of m unique, monotonically increasing items.IllegalArgumentException - if sketch is empty.double[] getPMF(double[] splitPoints,
QuantileSearchCriteria searchCrit)
The resulting approximations have a probabilistic guarantee that can be obtained from the getNormalizedRankError(true) function.
splitPoints - an array of m unique, monotonically increasing items
(of the same type as the input items)
that divide the item input domain into m+1 consecutive, non-overlapping intervals.
Each interval except for the end intervals starts with a split point and ends with the next split point in sequence.
The first interval starts below the lowest item retained by the sketch corresponding to a zero rank or zero probability, and ends with the first split point
The last (m+1)th interval starts with the last split point and ends after the last item retained by the sketch corresponding to a rank or probability of 1.0.
The sum of the probability masses of all (m+1) intervals is 1.0.
If the search criterion is:
It is not recommended to include either the minimum or maximum items of the input stream.
searchCrit - the desired search criteria.IllegalArgumentException - if sketch is empty.default double getQuantile(double rank)
getQuantile(rank, INCLUSIVE)rank - the given normalized rank, a double in the range [0.0, 1.0].IllegalArgumentException - if sketch is empty.double getQuantile(double rank,
QuantileSearchCriteria searchCrit)
rank - the given normalized rank, a double in the range [0.0, 1.0].searchCrit - If INCLUSIVE, the given rank includes all quantiles ≤
the quantile directly corresponding to the given rank.
If EXCLUSIVE, he given rank includes all quantiles <
the quantile directly corresponding to the given rank.IllegalArgumentException - if sketch is empty.QuantileSearchCriteriadouble getQuantileLowerBound(double rank)
Although it is possible to estimate the probability that the true quantile exists within the quantile confidence interval specified by the upper and lower quantile bounds, it is not possible to guarantee the width of the quantile confidence interval as an additive or multiplicative percent of the true quantile.
rank - the given normalized rankIllegalArgumentException - if sketch is empty.double getQuantileUpperBound(double rank)
Although it is possible to estimate the probability that the true quantile exists within the quantile confidence interval specified by the upper and lower quantile bounds, it is not possible to guarantee the width of the quantile interval as an additive or multiplicative percent of the true quantile.
rank - the given normalized rankIllegalArgumentException - if sketch is empty.default double[] getQuantiles(double[] ranks)
getQuantiles(ranks, INCLUSIVE)ranks - the given array of normalized ranks, each of which must be
in the interval [0.0,1.0].IllegalArgumentException - if sketch is empty.double[] getQuantiles(double[] ranks,
QuantileSearchCriteria searchCrit)
ranks - the given array of normalized ranks, each of which must be
in the interval [0.0,1.0].searchCrit - if INCLUSIVE, the given ranks include all quantiles ≤
the quantile directly corresponding to each rank.IllegalArgumentException - if sketch is empty.QuantileSearchCriteriadefault double getRank(double quantile)
getRank(quantile, INCLUSIVE)quantile - the given quantileIllegalArgumentException - if sketch is empty.double getRank(double quantile,
QuantileSearchCriteria searchCrit)
quantile - the given quantilesearchCrit - if INCLUSIVE the given quantile is included into the rank.IllegalArgumentException - if sketch is empty.QuantileSearchCriteriadefault double[] getRanks(double[] quantiles)
getRanks(quantiles, INCLUSIVE)quantiles - the given array of quantilesIllegalArgumentException - if sketch is empty.double[] getRanks(double[] quantiles,
QuantileSearchCriteria searchCrit)
quantiles - the given array of quantilessearchCrit - if INCLUSIVE, the given quantiles include the rank directly corresponding to each quantile.IllegalArgumentException - if sketch is empty.QuantileSearchCriteriaint getSerializedSizeBytes()
DoublesSortedView getSortedView()
QuantilesDoublesSketchIterator iterator()
byte[] toByteArray()
void update(double item)
item - from a stream of quantiles. NaNs are ignored.Copyright © 2015–2022 The Apache Software Foundation. All rights reserved.