estimator

package
v2.1.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package estimator implements future value estimation by EWMA algorithm. For a given key. Estimator gives Exponential Weighted Moving Average of its historical values. Estimator can be used in any places where we need to predict the next value associated with a key.

Index

Constants

View Source
const (
	// DefaultCapacity is the default maximum number of records that can
	// be present in Estimator
	DefaultCapacity = 10 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Estimator

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

Estimator calculates the EWMA of all historical values associated with a key

func NewEstimator

func NewEstimator(ca int64, wf float64) *Estimator

NewEstimator initializes an Estimator object with given capacity and EWMA weightingFactor

func (*Estimator) AddHistory

func (e *Estimator) AddHistory(key string, value float64)

AddHistory adds an additional historical value associated with a key

func (*Estimator) Estimate

func (e *Estimator) Estimate(key string) float64

Estimate returns the EWMA value associated with a given key

Jump to

Keyboard shortcuts

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