welford

package
v0.0.0-...-dcb2eba Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Simple package used to calculate a average and standard deviation of a series of values online, using the welford method

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Welford

type Welford struct {
	N   float64
	Avg float64

	StdDev float64
	Var    float64
	// contains filtered or unexported fields
}

Struct used to calculate welford's method

func (*Welford) AddValue

func (wf *Welford) AddValue(val float64)

CheckAndAddValue adds a value to the welford online computation

func (*Welford) CheckAndAddValue

func (wf *Welford) CheckAndAddValue(val, maxStdDev, maxVal float64) bool

CheckAndAddValue adds a value to the welford online computation only if val is less than maxStdDev times the standard deviation and less than maxIat. Returns True if the value is added. False otherwise

func (*Welford) Reset

func (wf *Welford) Reset()

Reset resets the welford computation to the initial state (i.e. all zeros)

Jump to

Keyboard shortcuts

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