Documentation ¶
Overview ¶
Package tdigest implements the t-digest algorithm for accurate on-line accumulation of rank-based statistics such as quantiles from "Computing Extremely Accurate Quantiles Using t-Digests" and is based on Ted Dunning's implementation in Java: https://github.com/tdunning/t-digest/blob/master/src/main/java/com/tdunning/math/stats/
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CentroidsPool ¶
type CentroidsPool interface { // Init initializes the pool. Init() // Get provides a centroid slice from the pool. Get(capacity int) []Centroid // Put returns a centroid slice to the pool. Put(value []Centroid) }
CentroidsPool provides a pool for variable-sized centroid slices.
func NewCentroidsPool ¶
func NewCentroidsPool(sizes []pool.Bucket, opts pool.ObjectPoolOptions) CentroidsPool
NewCentroidsPool creates a new centroids pool.
type Options ¶
type Options interface { // SetCompression sets the compression. SetCompression(value float64) Options // Compression returns the compression. Compression() float64 // SetPrecision sets the quantile precision. SetPrecision(value int) Options // Precision returns the quantile precision. Precision() int // SetCentroidsPool sets the centroids pool. SetCentroidsPool(value CentroidsPool) Options // CentroidsPool returns the centroids pool. CentroidsPool() CentroidsPool // Validate validates the options. Validate() error }
Options provides a set of t-digest options.
type TDigest ¶
type TDigest interface { // Merged returns the merged centroids. Merged() []Centroid // Unmerged returns the unmerged centroids. Unmerged() []Centroid // Add adds a value. Add(value float64) // Min returns the minimum value. Min() float64 // Max returns the maximum value. Max() float64 // Quantile returns the quantile value. Quantile(q float64) float64 // Merge merges another t-digest. Merge(tdigest TDigest) // Close clsoes the t-digest. Close() // Reset resets the t-digest. Reset() }
TDigest is the t-digest interface.
func NewTDigest ¶
NewTDigest creates a new t-digest. TODO(xichen): add pooling for t-digests TODO(xichen): add metrics
Click to show internal directories.
Click to hide internal directories.