Documentation
¶
Index ¶
- type MovingWindow
- func (mw *MovingWindow) Cap() int
- func (mw *MovingWindow) Drop(count int) (mean float64, stddev float64)
- func (mw *MovingWindow) Len() int
- func (mw *MovingWindow) Mean() float64
- func (mw *MovingWindow) Recalculate() (mean float64, stddev float64)
- func (mw *MovingWindow) Stats() (mean float64, stddev float64)
- func (mw *MovingWindow) StdDev() float64
- func (mw *MovingWindow) Update(value float64) (mean float64, stddev float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MovingWindow ¶
type MovingWindow struct {
// contains filtered or unexported fields
}
MovingWindow is a moving window
func NewMovingWindow ¶
func NewMovingWindow(size int) *MovingWindow
func (*MovingWindow) Drop ¶
func (mw *MovingWindow) Drop(count int) (mean float64, stddev float64)
Drop removes count values from the window.
func (*MovingWindow) Len ¶
func (mw *MovingWindow) Len() int
Len returns how many items in the window
func (*MovingWindow) Mean ¶
func (mw *MovingWindow) Mean() float64
Mean is the moving window average
func (*MovingWindow) Recalculate ¶ added in v1.8.5
func (mw *MovingWindow) Recalculate() (mean float64, stddev float64)
func (*MovingWindow) Stats ¶
func (mw *MovingWindow) Stats() (mean float64, stddev float64)
Stats returns the statistics of this window
func (*MovingWindow) StdDev ¶
func (mw *MovingWindow) StdDev() float64
StdDev is the moving average std
func (*MovingWindow) Update ¶
func (mw *MovingWindow) Update(value float64) (mean float64, stddev float64)
Update adds the new value to the moving window, returns average and stddev. If the window is full, the oldest value will be removed and the new value is added. Returns calculated Average and Standard Deviation.
Click to show internal directories.
Click to hide internal directories.