Class AbstractQuantileEstimation<SAMPLE extends AbstractQuantileEstimation.AbstractSample<SAMPLE>>
- java.lang.Object
-
- com.linkedin.alpini.base.statistics.AbstractQuantileEstimation<SAMPLE>
-
- Direct Known Subclasses:
DoubleQuantileEstimation
,GenericQuantileEstimation
,LongQuantileEstimation
public abstract class AbstractQuantileEstimation<SAMPLE extends AbstractQuantileEstimation.AbstractSample<SAMPLE>> extends java.lang.Object
A memory efficient abstract implementation for calculating quantile summaries.- See Also:
- "Greenwald and Khanna, 'Space-efficient online computation of quantile summaries' SIGMOD 2001"
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractQuantileEstimation.AbstractSample<SAMPLE extends AbstractQuantileEstimation.AbstractSample<SAMPLE>>
protected class
AbstractQuantileEstimation.Data
static class
AbstractQuantileEstimation.Quantile
static class
AbstractQuantileEstimation.Quantiles
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
_log
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractQuantileEstimation(double epsilon, int compactSize)
protected
AbstractQuantileEstimation(double epsilon, int compactSize, ConcurrentAccumulator.Mode accumulatorMode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
accept(SAMPLE v)
protected java.util.SortedSet<SAMPLE>
cloneSortedSet(java.util.SortedSet<SAMPLE> samples)
protected java.util.stream.Collector<SAMPLE,AbstractQuantileEstimation.Data,AbstractQuantileEstimation.Data>
collector()
protected abstract int
compare(SAMPLE o1, SAMPLE o2)
protected AbstractQuantileEstimation.Quantile
computeQuantile(SAMPLE v)
Computes the quantile which the given sample v is a member.protected AbstractQuantileEstimation.Data
data()
protected SAMPLE
floor(java.util.SortedSet<SAMPLE> samples, SAMPLE v)
protected int
getCompactSize()
int
getNumberOfSamples()
protected AbstractQuantileEstimation.Data
newData()
protected java.util.SortedSet<SAMPLE>
newSortedSet(java.util.Comparator<SAMPLE> comparator)
protected java.util.List<SAMPLE>
queryAndReset(AbstractQuantileEstimation.Quantiles quantiles)
protected java.util.List<SAMPLE>
queryAndReset(AbstractQuantileEstimation.Quantiles quantiles, java.util.function.Consumer<AbstractQuantileEstimation.Data> consumer)
protected java.util.List<SAMPLE>
querySample(AbstractQuantileEstimation.Quantiles quantiles)
void
reset()
-
-
-
Constructor Detail
-
AbstractQuantileEstimation
protected AbstractQuantileEstimation(double epsilon, int compactSize)
-
AbstractQuantileEstimation
protected AbstractQuantileEstimation(double epsilon, int compactSize, ConcurrentAccumulator.Mode accumulatorMode)
-
-
Method Detail
-
getCompactSize
protected int getCompactSize()
-
collector
protected java.util.stream.Collector<SAMPLE,AbstractQuantileEstimation.Data,AbstractQuantileEstimation.Data> collector()
-
newData
@Nonnull protected AbstractQuantileEstimation.Data newData()
-
newSortedSet
protected java.util.SortedSet<SAMPLE> newSortedSet(java.util.Comparator<SAMPLE> comparator)
-
cloneSortedSet
protected java.util.SortedSet<SAMPLE> cloneSortedSet(java.util.SortedSet<SAMPLE> samples)
-
querySample
protected final java.util.List<SAMPLE> querySample(@Nonnull AbstractQuantileEstimation.Quantiles quantiles)
-
reset
public void reset()
-
data
@Nonnull protected final AbstractQuantileEstimation.Data data()
-
queryAndReset
@Nonnull protected java.util.List<SAMPLE> queryAndReset(@Nonnull AbstractQuantileEstimation.Quantiles quantiles, java.util.function.Consumer<AbstractQuantileEstimation.Data> consumer)
-
queryAndReset
@Nonnull protected java.util.List<SAMPLE> queryAndReset(@Nonnull AbstractQuantileEstimation.Quantiles quantiles)
-
computeQuantile
protected final AbstractQuantileEstimation.Quantile computeQuantile(@Nonnull SAMPLE v)
Computes the quantile which the given sample v is a member.- Parameters:
v
- sample- Returns:
- quantile
-
getNumberOfSamples
public int getNumberOfSamples()
-
accept
protected final void accept(SAMPLE v)
-
-