percentile

package
v0.0.0-...-86e9f11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package percentile provides a pure go implementation of tDigest aggregation and the computation of percentiles

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CentroidsT

type CentroidsT []centroidT

CentroidsT is sorted by the mean of the centroidT, ascending.

func (CentroidsT) Len

func (c CentroidsT) Len() int

type TDigest

type TDigest struct {
	Data        CentroidsT
	TotalWeight weightT // total TotalWeight of all centroids
	Min, Max    weightT
}

func NewTDigest

func NewTDigest(data []meanT, compression int) *TDigest

func (*TDigest) Merge

func (t *TDigest) Merge(t2 *TDigest, compression int)

Merge of two TDigest structures is nothing more than add the centroids of one tDigest to the centroids of the other tDigest

func (*TDigest) Percentile

func (t *TDigest) Percentile(p float32) float32

Percentile returns the (approximate) Percentile of the distribution. Accepted values for q are between 0.0 and 1.0. Returns NaN if count is zero or bad inputs.

func (*TDigest) Percentiles

func (t *TDigest) Percentiles(p []float32) []float32

func (*TDigest) String

func (t *TDigest) String() string

Jump to

Keyboard shortcuts

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