ewma

package
v2.1.0-alpha.2+incompa... Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package ewma implements exponentially weighted moving averages(EWMA). See https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average for formal definitions.

Index

Constants

View Source
const (
	// DefaultWeightingFactor is the default smoothing factor α
	// The value 0.875 is used in TCP RTT estimation
	DefaultWeightingFactor = 0.875
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EWMA

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

EWMA is the class to calculate exponentially weighted moving average of a series of data

func NewEWMA

func NewEWMA(wf float64) *EWMA

NewEWMA returns a EWMA object which can calculate EWMA of a series of data gradually added to it

func (*EWMA) AddValue

func (e *EWMA) AddValue(value float64)

AddValue adds a new data point into the EWMA calculation, by which the EWMA is automatically updated

func (*EWMA) GetEWMA

func (e *EWMA) GetEWMA() float64

GetEWMA returns the EWMA calculated from historical data

func (*EWMA) Size

func (e *EWMA) Size() int

Size makes EWMA to satisfy cache.Value interface

Jump to

Keyboard shortcuts

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