tdigest

package module
v0.0.0-...-724e0c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2015 License: MIT Imports: 2 Imported by: 1

README

T-Digest

This is a reimplementation of t-digest in Go that uses amortized merging instead of trees. It provides MergingDigest type that is similar to the original MergingDigest, however it does not have bounds on the summary size, and is more akin to tree digests in that regard.

WARNING: this is alpha and API is subject to change

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Centroid

type Centroid struct {
	Mean  float64
	Count int64
}

Centroid summarizes Count samples around Mean

func (*Centroid) Add

func (c *Centroid) Add(x float64, w int64)

Add adds a sample x with weight w to the centroid

func (*Centroid) Merge

func (c *Centroid) Merge(o Centroid)

Merge merges another centroid into this one

type MergingDigest

type MergingDigest struct {
	MaxUnmerged int
	// contains filtered or unexported fields
}

MergingDigest amortizes computation by merging in fixed sized batches

func New

func New(compression float64) *MergingDigest

New creates a new MergingDigest with the given compression

func (*MergingDigest) Add

func (digest *MergingDigest) Add(x float64, w int64)

Add adds a sample x with weight w

func (*MergingDigest) Compress

func (digest *MergingDigest) Compress()

Compress merges any unmerged data into the summary

func (*MergingDigest) Merge

func (digest *MergingDigest) Merge(c Centroid)

Merge merges a centroid into the digest

func (*MergingDigest) Quantile

func (digest *MergingDigest) Quantile(q float64) float64

Quantile returns an estimate of the value at quantile q

func (*MergingDigest) Summary

func (digest *MergingDigest) Summary() []Centroid

Summary returns compressed summary of the digest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL