T - The sketch data typepublic class ItemsSketchSortedView<T> extends Object implements GenericSortedView<T>, PartitioningFeature<T>
| Modifier and Type | Method and Description |
|---|---|
double[] |
getCDF(T[] 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.
|
long[] |
getCumulativeWeights()
Returns the array of cumulative weights from the sketch.
|
T |
getMaxItem()
Returns the maximum item of the stream.
|
T |
getMinItem()
Returns the minimum item of the stream.
|
long |
getN()
Returns the total number of items presented to the sourcing sketch.
|
GenericPartitionBoundaries<T> |
getPartitionBoundaries(int numEquallySized,
QuantileSearchCriteria searchCrit)
This method returns an instance of
GenericPartitionBoundaries which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition. |
double[] |
getPMF(T[] 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.
|
T |
getQuantile(double rank,
QuantileSearchCriteria searchCrit)
Gets the approximate quantile of the given normalized rank and the given search criterion.
|
T[] |
getQuantiles()
Returns the full array of quantiles.
|
T[] |
getQuantiles(double[] ranks,
QuantileSearchCriteria searchCrit) |
double |
getRank(T quantile,
QuantileSearchCriteria searchCrit)
Gets the normalized rank corresponding to the given a quantile.
|
boolean |
isEmpty()
Returns true if this sorted view is empty.
|
GenericSortedViewIterator<T> |
iterator()
Returns an iterator for this Sorted View.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateItemsgetPartitionBoundariespublic double[] getCDF(T[] splitPoints, QuantileSearchCriteria searchCrit)
GenericSortedViewIf the sketch is empty this returns null.
The resulting approximations have a probabilistic guarantee that can be obtained from the getNormalizedRankError(false) function.
getCDF in interface GenericSortedView<T>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.public long[] getCumulativeWeights()
SortedViewgetCumulativeWeights in interface SortedViewpublic T getMaxItem()
GenericSortedViewgetMaxItem in interface GenericSortedView<T>public T getMinItem()
GenericSortedViewgetMinItem in interface GenericSortedView<T>public long getN()
SortedViewgetN in interface SortedViewpublic GenericPartitionBoundaries<T> getPartitionBoundaries(int numEquallySized, QuantileSearchCriteria searchCrit)
PartitioningFeatureGenericPartitionBoundaries which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition.getPartitionBoundaries in interface PartitioningFeature<T>numEquallySized - an integer that specifies the number of equally sized 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 sized 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 sized partitions
with the exception of the highest returned quantile, which is the upper boundary of the highest ranked partition.GenericPartitionBoundaries.public double[] getPMF(T[] splitPoints, QuantileSearchCriteria searchCrit)
GenericSortedViewThe resulting approximations have a probabilistic guarantee that can be obtained from the getNormalizedRankError(true) function.
getPMF in interface GenericSortedView<T>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.public T getQuantile(double rank, QuantileSearchCriteria searchCrit)
GenericSortedViewgetQuantile in interface GenericSortedView<T>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.QuantileSearchCriteriapublic T[] getQuantiles(double[] ranks, QuantileSearchCriteria searchCrit)
public T[] getQuantiles()
GenericSortedViewgetQuantiles in interface GenericSortedView<T>public double getRank(T quantile, QuantileSearchCriteria searchCrit)
GenericSortedViewgetRank in interface GenericSortedView<T>quantile - the given quantilesearchCrit - if INCLUSIVE the given quantile is included into the rank.QuantileSearchCriteriapublic boolean isEmpty()
SortedViewisEmpty in interface SortedViewpublic GenericSortedViewIterator<T> iterator()
SortedViewiterator in interface GenericSortedView<T>iterator in interface SortedViewCopyright © 2015–2022 The Apache Software Foundation. All rights reserved.