java.lang.Object
org.elasticsearch.tdigest.TDigest
org.elasticsearch.tdigest.AbstractTDigest
org.elasticsearch.tdigest.AVLTreeDigest
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.lucene.util.Accountable
,Releasable
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double x, long w) Adds a sample to a histogram.int
byteSize()
Returns an upper bound on the number bytes that will be required to represent this histogram.double
cdf
(double x) Returns the fraction of all points added which are ≤ x.int
ACollection
that lets you go through the centroids in ascending order by mean.void
close()
void
compress()
Re-examines a t-digest to determine whether some centroids are redundant.double
Returns the current compression factor.double
quantile
(double q) Returns an estimate of a cutoff such that a specified fraction of the data added to this TDigest would be less than or equal to the cutoff.long
void
setRandomSeed
(long seed) Sets the seed for the RNG.long
size()
Returns the number of samples represented in this histogram.Methods inherited from class org.elasticsearch.tdigest.AbstractTDigest
add
Methods inherited from class org.elasticsearch.tdigest.TDigest
add, createAvlTreeDigest, createHybridDigest, createMergingDigest, createSortingDigest, getMax, getMin, reserve, setScaleFunction
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Method Details
-
ramBytesUsed
public long ramBytesUsed() -
setRandomSeed
public void setRandomSeed(long seed) Sets the seed for the RNG. In cases where a predictable tree should be created, this function may be used to make the randomness in this AVLTree become more deterministic.- Parameters:
seed
- The random seed to use for RNG purposes
-
centroidCount
public int centroidCount()- Specified by:
centroidCount
in classTDigest
-
add
public void add(double x, long w) Description copied from class:TDigest
Adds a sample to a histogram. -
compress
public void compress()Description copied from class:TDigest
Re-examines a t-digest to determine whether some centroids are redundant. If your data are perversely ordered, this may be a good idea. Even if not, this may save 20% or so in space. The cost is roughly the same as adding as many data points as there are centroids. This is typically < 10 * compression, but could be as high as 100 * compression. This is a destructive operation that is not thread-safe. -
size
public long size()Returns the number of samples represented in this histogram. If you want to know how many centroids are being used, try centroids().size(). -
cdf
public double cdf(double x) Description copied from class:TDigest
Returns the fraction of all points added which are ≤ x. Points that are exactly equal get half credit (i.e. we use the mid-point rule) -
quantile
public double quantile(double q) Description copied from class:TDigest
Returns an estimate of a cutoff such that a specified fraction of the data added to this TDigest would be less than or equal to the cutoff. -
centroids
Description copied from class:TDigest
ACollection
that lets you go through the centroids in ascending order by mean. Centroids returned will not be re-used, but may or may not share storage with this TDigest. -
compression
public double compression()Description copied from class:TDigest
Returns the current compression factor.- Specified by:
compression
in classTDigest
- Returns:
- The compression factor originally used to set up the TDigest.
-
byteSize
public int byteSize()Returns an upper bound on the number bytes that will be required to represent this histogram. -
close
public void close()
-