public class ArrayDigest extends AbstractTDigest
Modifier and Type | Field and Description |
---|---|
static int |
SMALL_ARRAY_DIGEST |
static int |
SMALL_ENCODING |
static int |
VERBOSE_ARRAY_DIGEST |
static int |
VERBOSE_ENCODING |
gen, recordAllData
Constructor and Description |
---|
ArrayDigest(int pageSize,
double compression) |
Modifier and Type | Method and Description |
---|---|
void |
add(double x,
int w)
Adds a sample to a histogram.
|
Iterator<com.tdunning.math.stats.ArrayDigest.Index> |
allAfter(double x) |
Iterator<com.tdunning.math.stats.ArrayDigest.Index> |
allBefore(double x)
Returns an iterator which will give each element <= to x in non-increasing order.
|
void |
asBytes(ByteBuffer buf)
Outputs a histogram as bytes using a particularly cheesy encoding.
|
void |
asSmallBytes(ByteBuffer buf)
Serialize this TDigest into a byte buffer.
|
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.
|
com.tdunning.math.stats.ArrayDigest.Index |
ceiling(double x) |
int |
centroidCount()
The number of centroids currently in the TDigest.
|
Iterable<? extends Centroid> |
centroids()
An iterable that lets you go through the centroids in ascending order by mean.
|
void |
compress()
Re-examines a t-digest to determine whether some centroids are redundant.
|
void |
compress(GroupTree other) |
double |
compression()
Returns the current compression factor.
|
int |
count(com.tdunning.math.stats.ArrayDigest.Index index) |
com.tdunning.math.stats.ArrayDigest.Index |
floor(double x)
Returns a cursor pointing to the first element <= x.
|
static ArrayDigest |
fromBytes(ByteBuffer buf)
Reads a histogram from a byte buffer
|
long |
headSum(com.tdunning.math.stats.ArrayDigest.Index limit) |
com.tdunning.math.stats.ArrayDigest.Index |
increment(com.tdunning.math.stats.ArrayDigest.Index x,
int delta) |
double |
mean(com.tdunning.math.stats.ArrayDigest.Index index) |
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.
|
long |
size()
Returns the number of points that have been added to this TDigest.
|
int |
smallByteSize()
Returns an upper bound on the number of bytes that will be required to represent this histogram in
the tighter representation.
|
add, add, createCentroid, decode, encode, interpolate, isRecording, merge, recordAllData
checkValue, createArrayDigest, createArrayDigest, createTreeDigest
public static final int VERBOSE_ENCODING
public static final int SMALL_ENCODING
public static final int VERBOSE_ARRAY_DIGEST
public static final int SMALL_ARRAY_DIGEST
public void add(double x, int w)
TDigest
public long headSum(com.tdunning.math.stats.ArrayDigest.Index limit)
public double mean(com.tdunning.math.stats.ArrayDigest.Index index)
public int count(com.tdunning.math.stats.ArrayDigest.Index index)
public void compress()
TDigest
public void compress(GroupTree other)
compress
in class AbstractTDigest
public long size()
TDigest
public double cdf(double x)
TDigest
public double quantile(double q)
TDigest
public int centroidCount()
TDigest
centroidCount
in class TDigest
public Iterable<? extends Centroid> centroids()
TDigest
public Iterator<com.tdunning.math.stats.ArrayDigest.Index> allAfter(double x)
public com.tdunning.math.stats.ArrayDigest.Index floor(double x)
x
- The value used to find the cursor.public com.tdunning.math.stats.ArrayDigest.Index ceiling(double x)
public Iterator<com.tdunning.math.stats.ArrayDigest.Index> allBefore(double x)
x
- The upper bound of all returned elementspublic com.tdunning.math.stats.ArrayDigest.Index increment(com.tdunning.math.stats.ArrayDigest.Index x, int delta)
public double compression()
TDigest
compression
in class TDigest
public int byteSize()
public int smallByteSize()
smallByteSize
in class TDigest
public void asBytes(ByteBuffer buf)
public void asSmallBytes(ByteBuffer buf)
TDigest
asSmallBytes
in class TDigest
buf
- The byte buffer into which the TDigest should be serialized.public static ArrayDigest fromBytes(ByteBuffer buf)
Copyright © 2015. All rights reserved.