accuracytest

package
v0.0.0-...-9165f38 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Distributions is a useful set of distributions for accuracy testing.
	Distributions = []Option{
		Distribution("Uniform", rand.Float64),
		Distribution("Normal", rand.NormFloat64),
		Distribution("Exponential", rand.ExpFloat64),
	}
	// Orders is a set of data orders to insert into a sketch.
	Orders = []Option{
		Order("ascending", sort.Float64s),
		Order("descending", func(data []float64) {
			sort.Slice(data, func(i, j int) bool {
				return data[i] > data[j]
			})
		}),
		Order("shuffled", func(data []float64) {
			rand.Shuffle(len(data), func(i, j int) {
				data[i], data[j] = data[j], data[i]
			})
		}),
	}
)

Functions

func AddData

func AddData(data []float64, hists ...tdigest.Sketch)

func CombineOptions

func CombineOptions(options ...[]Option) [][]Option

CombineOptions makes a cartesian product of options

Types

type AccuracyTest

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

AccuracyTest tests the accuracy of a sketch given a distribution.

func MakeTests

func MakeTests(testOptions ...[]Option) []AccuracyTest

MakeTests makes a slice of tests where each test has been configured with the passed slice of options.

func (*AccuracyTest) Run

func (at *AccuracyTest) Run(t testing.TB)

func (*AccuracyTest) String

func (at *AccuracyTest) String() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func Constructor

func Constructor(f func() tdigest.Sketch) Option

func Constructors

func Constructors(
	name string, f func(o ...tdigest.Option) tdigest.Sketch, optionSets [][]tdigest.Option,
) []Option

func Distribution

func Distribution(name string, sample func() float64) Option

func N

func N(n int) Option

func Name

func Name(n string) Option

func Options

func Options(o ...Option) Option

func Order

func Order(name string, orderFunc func([]float64)) Option

Jump to

Keyboard shortcuts

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