Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EWMA ¶
type EWMA interface { // Add adds a new value to the EWMA Add(float64) // Get returns the current value of the EWMA Get() float64 // Reset resets the EWMA to the initial value Reset() // Set sets the EWMA to the given value Set(float64) }
EWMA is the interface for Exponentially Weighted Moving Average It is used to calculate the moving average with decay of a series of numbers
type SimpleEWMA ¶
type SimpleEWMA struct {
// contains filtered or unexported fields
}
SimpleEWMA is a simple implementation of EWMA
func NewSimpleEWMA ¶
func NewSimpleEWMA(alpha ...float64) *SimpleEWMA
NewSimpleEWMA returns a new SimpleEWMA If the alpha is not provided we use a default value of constDecayFactor If the alpha is provided we calulate the smoothing factor from it
func (*SimpleEWMA) Get ¶
func (s *SimpleEWMA) Get() float64
Get returns the current value of the EWMA
func (*SimpleEWMA) Set ¶
func (s *SimpleEWMA) Set(value float64)
Set sets the EWMA to the given value
Click to show internal directories.
Click to hide internal directories.