quantile

package module
v0.0.0-...-4e47b9a Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 5 Imported by: 1

README

Documentation Go workflow CircleCI codecov Go Report Card GitHub tag (latest SemVer)

quantile

quantile is a few streaming quantile estimators. All are alloc-free and pretty efficient.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DDLog

type DDLog struct {
	// contains filtered or unexported fields
}

func NewDDLog

func NewDDLog(relAcc float64) *DDLog

func (*DDLog) Insert

func (s *DDLog) Insert(v float64)

func (*DDLog) InsertWeight

func (s *DDLog) InsertWeight(v float64, w float32)

func (*DDLog) Query

func (s *DDLog) Query(q float64) float64

type Exact

type Exact struct {
	// contains filtered or unexported fields
}

func NewExact

func NewExact() *Exact

func (*Exact) Insert

func (s *Exact) Insert(v float64)

func (*Exact) Query

func (s *Exact) Query(q float64) float64

type ExtremesBias

type ExtremesBias float32

func (ExtremesBias) Inv

func (eps ExtremesBias) Inv(q float32) float32

type HighBias

type HighBias float32

func (HighBias) Inv

func (eps HighBias) Inv(q float32) float32

type Invariant

type Invariant interface {
	Inv(q float32) float32
}

type InvariantFunc

type InvariantFunc func(q float32) float32

func (InvariantFunc) Inv

func (f InvariantFunc) Inv(q float32) float32

type KLL

type KLL struct {
	// contains filtered or unexported fields
}

KLL is kll-like streaming quantile algorithm.

func NewKLL

func NewKLL(width, depth int) *KLL

func (*KLL) Insert

func (s *KLL) Insert(v float64)

func (*KLL) Query

func (s *KLL) Query(q float64) float64

type LowBias

type LowBias float32

func (LowBias) Inv

func (eps LowBias) Inv(q float32) float32

type TDMulti

type TDMulti []*TDigest

func (TDMulti) Query

func (ss TDMulti) Query(q float64) float64

func (TDMulti) QueryMulti

func (ss TDMulti) QueryMulti(qs, res []float64)

type TDigest

type TDigest struct {
	Invariant Invariant
	Decay     float32

	ElementsReduced   float32
	Compressions      int
	BruteCompressions int
	// contains filtered or unexported fields
}

func NewTD

func NewTD(inv Invariant, size int) *TDigest

NewTDigest creates a new tdigest stream. 512 is a good size to start with.

func NewTDExtremesBiased

func NewTDExtremesBiased(eps float32, size int) *TDigest

func NewTDHighBiased

func NewTDHighBiased(eps float32, size int) *TDigest

func NewTDLowBiased

func NewTDLowBiased(eps float32, size int) *TDigest

func (*TDigest) AdjustWeights

func (s *TDigest) AdjustWeights(multiply float32)

func (*TDigest) Insert

func (s *TDigest) Insert(v float64)

func (*TDigest) InsertWeighted

func (s *TDigest) InsertWeighted(v float64, w float32)

func (*TDigest) Merge

func (s *TDigest) Merge(s1 *TDigest)

func (*TDigest) MergeWeighted

func (s *TDigest) MergeWeighted(s1 *TDigest, w0, w1 float32)

func (*TDigest) Query

func (s *TDigest) Query(q float64) float64

func (*TDigest) QueryMulti

func (s *TDigest) QueryMulti(qs, res []float64)

QueryMulti make multiple queries at once. qs is a list of queries (quantiles). res is a buffer for results, res[i] = Query(qs[i]).

func (*TDigest) Reset

func (s *TDigest) Reset()

Jump to

Keyboard shortcuts

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