public abstract class TDigest extends Object
Constructor and Description |
---|
TDigest() |
Modifier and Type | Method and Description |
---|---|
abstract void |
add(double x)
Add a sample to this TDigest.
|
abstract void |
add(double x,
int w)
Adds a sample to a histogram.
|
abstract void |
add(TDigest other)
Add all of the centroids of another TDigest to this one.
|
abstract void |
asBytes(ByteBuffer buf)
Serialize this TDigest into a byte buffer.
|
abstract void |
asSmallBytes(ByteBuffer buf)
Serialize this TDigest into a byte buffer.
|
abstract int |
byteSize()
Returns the number of bytes required to encode this TDigest using #asBytes().
|
abstract double |
cdf(double x)
Returns the fraction of all points added which are <= x.
|
abstract int |
centroidCount()
The number of centroids currently in the TDigest.
|
abstract Iterable<? extends Centroid> |
centroids()
An iterable that lets you go through the centroids in ascending order by mean.
|
protected void |
checkValue(double x) |
abstract void |
compress()
Re-examines a t-digest to determine whether some centroids are redundant.
|
abstract double |
compression()
Returns the current compression factor.
|
static ArrayDigest |
createArrayDigest(double compression)
Creates an ArrayDigest with default page size.
|
static ArrayDigest |
createArrayDigest(int pageSize,
double compression)
Creates an ArrayDigest with specified page size.
|
static TDigest |
createTreeDigest(double compression)
Creates a TreeDigest.
|
abstract boolean |
isRecording() |
abstract double |
quantile(double q)
Returns an estimate of the cutoff such that a specified fraction of the data
added to this TDigest would be less than or equal to the cutoff.
|
abstract TDigest |
recordAllData()
Tell this TDigest to record the original data as much as possible for test
purposes.
|
abstract long |
size()
Returns the number of points that have been added to this TDigest.
|
abstract int |
smallByteSize()
Returns the number of bytes required to encode this TDigest using #asSmallBytes().
|
public static ArrayDigest createArrayDigest(double compression)
compression
- The compression parameter. 100 is a common value for normal uses. 1000 is extremely large.
The number of centroids retained will be a smallish (usually less than 10) multiple of this number.public static ArrayDigest createArrayDigest(int pageSize, double compression)
pageSize
- The internal page size to use. This should be about sqrt(10*compression)compression
- The compression parameter. 100 is a common value for normal uses. 1000 is extremely large.
The number of centroids retained will be a smallish (usually less than 10) multiple of this number.public static TDigest createTreeDigest(double compression)
compression
- The compression parameter. 100 is a common value for normal uses. 1000 is extremely large.
The number of centroids retained will be a smallish (usually less than 10) multiple of this number.public abstract void add(double x, int w)
x
- The value to add.w
- The weight of this point.protected final void checkValue(double x)
public abstract void compress()
public abstract long size()
public abstract double cdf(double x)
public abstract double quantile(double q)
q
- The desired fractionpublic abstract int centroidCount()
public abstract Iterable<? extends Centroid> centroids()
public abstract double compression()
public abstract int byteSize()
public abstract int smallByteSize()
public abstract void asBytes(ByteBuffer buf)
buf
- The byte buffer into which the TDigest should be serialized.public abstract void asSmallBytes(ByteBuffer buf)
buf
- The byte buffer into which the TDigest should be serialized.public abstract TDigest recordAllData()
public abstract boolean isRecording()
public abstract void add(double x)
x
- The data value to addpublic abstract void add(TDigest other)
other
- The other TDigestCopyright © 2015. All rights reserved.