smoothie

package module
v0.0.0-...-e8f7e2e Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: MIT Imports: 8 Imported by: 2

README

smoothie

Data smoothing toolkit

Moving Average

Weighted Moving Average

Single Exponential Smoothing (Brown's simple smoothing)

Double Exponential Smoothing (Holt-Winters)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinearWeighting

func LinearWeighting(index, length int) float64

Values have a higher weight as time goes on in a liniar fashion

func ReverseLinearWeighting

func ReverseLinearWeighting(index, length int) float64

Types

type DataFrame

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

A ring buffer implementation optomized for use with moving window statistic operations

func EmptyDataFrame

func EmptyDataFrame(size int) *DataFrame

Create a new dataframe filled with NaN values

func NewDataFrame

func NewDataFrame(length int) *DataFrame

Create a new 0'd out dataframe

func NewDataFrameFromSlice

func NewDataFrameFromSlice(f []float64) *DataFrame

Create a new dataframe from an existing slice

func NewSignal

func NewSignal(length int, freq float64) *DataFrame

create a new data frame filled with a signal given a frequencey and a phase

func Noise

func Noise(length int) *DataFrame

func (*DataFrame) Add

func (d *DataFrame) Add(df *DataFrame) *DataFrame

Add two dataframes together

func (*DataFrame) AddConst

func (d *DataFrame) AddConst(f float64) *DataFrame

Add a single value to every value of the dataframe

func (*DataFrame) Avg

func (d *DataFrame) Avg() float64

Return the mean of the dataframe

func (*DataFrame) Cat

func (d *DataFrame) Cat(c *DataFrame) *DataFrame

Concatinate two dataframes

func (*DataFrame) Copy

func (d *DataFrame) Copy() *DataFrame

Copy return a copy of the dataframe

func (*DataFrame) Data

func (d *DataFrame) Data() []float64

Return the contents of a dataframe flattened into a []float64

func (*DataFrame) Derivative

func (d *DataFrame) Derivative() *DataFrame

return a dataframe filled with the derivative values of this dataframe

func (*DataFrame) Div

func (d *DataFrame) Div(df *DataFrame) *DataFrame

Divide a dataframe by another dataframe

func (*DataFrame) DivConst

func (d *DataFrame) DivConst(f float64) *DataFrame

Devide every value of the dataframe by a single value

func (*DataFrame) DoubleExponentialSmooth

func (d *DataFrame) DoubleExponentialSmooth(sf, tf float64) *DataFrame

DoubleExponentialSmooth given a smoothing factor, apply the hold-winters double exponential smoothing algorhythm

func (*DataFrame) DoubleSmoothPredictN

func (d *DataFrame) DoubleSmoothPredictN(n int, sf, tf float64) *DataFrame

DoubleSmoothPredictN return a new DataFrame filled with n predictions

func (*DataFrame) FFT

func (d *DataFrame) FFT() []complex128

Return the real and imaginary parts of the fft

func (*DataFrame) FFTTopFreqs

func (d *DataFrame) FFTTopFreqs() *DataFrame

Return the top frequencies found in the dataframe

func (*DataFrame) ForEach

func (d *DataFrame) ForEach(f func(data float64, index int))

func (*DataFrame) Grow

func (d *DataFrame) Grow(amount int) *DataFrame

Grow the dataframe by a given amount

func (*DataFrame) Index

func (d *DataFrame) Index(i int) float64

Get the value of the dataframe at a given index

func (*DataFrame) Insert

func (d *DataFrame) Insert(i int, val float64) float64

Insert an element to a spesific index of the dataframe

func (*DataFrame) KernalConvolve

func (d *DataFrame) KernalConvolve(kernal *DataFrame) *DataFrame

func (*DataFrame) Len

func (d *DataFrame) Len() int

Return the length of the dataframe

func (*DataFrame) Max

func (d *DataFrame) Max() float64

Return the maximum value of the dataframe

func (*DataFrame) Median

func (d *DataFrame) Median() float64

Return the median value of the dataframe

func (*DataFrame) Min

func (d *DataFrame) Min() float64

Return the minimum value of the dataframe

func (*DataFrame) MovingAverage

func (d *DataFrame) MovingAverage(windowSize int) *DataFrame

calculate the moving average of the dataframe

func (*DataFrame) MultiConst

func (d *DataFrame) MultiConst(f float64) *DataFrame

Multiply every value of the dataframe by a single value

func (*DataFrame) Mutli

func (d *DataFrame) Mutli(df *DataFrame) *DataFrame

Multiply two dataframes together

func (*DataFrame) PlotPoints

func (d *DataFrame) PlotPoints() plotter.XYs

Return a numgo.Plot format for the dataframe

func (*DataFrame) Push

func (d *DataFrame) Push(e float64) float64

Add a new element to the beginning of the dataframe, this will remove the last value of the dataframe

func (*DataFrame) Reduce

func (d *DataFrame) Reduce(newSize int) *DataFrame

Reduce the dataframe to a given size. TODO : (eliothedeman) optomize this

func (*DataFrame) Reverse

func (d *DataFrame) Reverse() *DataFrame

Return a reversed version of the dataframe

func (*DataFrame) Shift

func (d *DataFrame) Shift(offset int) *DataFrame

Shift the pivito of the dataframe.

func (*DataFrame) Shrink

func (d *DataFrame) Shrink(amount int) *DataFrame

Shrink a dataframe by a given amount

func (*DataFrame) SingleExponentialSmooth

func (d *DataFrame) SingleExponentialSmooth(sf float64) *DataFrame

SingleExponentialSmooth applies basic exponential smoothing to the contents of the DataFrame.

func (*DataFrame) Slice

func (d *DataFrame) Slice(b, e int) *DataFrame

return the sub slice of the data as a data frame

func (*DataFrame) Sort

func (d *DataFrame) Sort() *DataFrame

Return a sorted version of the dataframe

func (*DataFrame) StdDev

func (d *DataFrame) StdDev() float64

standard deviation of the data frame

func (*DataFrame) Sub

func (d *DataFrame) Sub(df *DataFrame) *DataFrame

Subtract a dataframe by another dataframe

func (*DataFrame) SubConst

func (d *DataFrame) SubConst(f float64) *DataFrame

Subtract a single value from every value in the dataframe

func (*DataFrame) Sum

func (d *DataFrame) Sum() float64

Sum the values of the dataframe

func (*DataFrame) TripleSmooth

func (d *DataFrame) TripleSmooth(smooth, trend, season float64, period int) *DataFrame

TripleSmooth applies holt-winters triple-exponential smoothing to the given dataframe

func (*DataFrame) Weight

func (d *DataFrame) Weight(wf WeightingFunc) *DataFrame

Apply a weighting function to a dataframe

func (*DataFrame) WeightedMovingAverage

func (d *DataFrame) WeightedMovingAverage(windowSize int, wf WeightingFunc) *DataFrame

Returns a new dataframe with a weighted moving average applied to it

type WeightingFunc

type WeightingFunc func(index, length int) float64

Given an index and the length of a dataframe, returns the weight for the given value

Jump to

Keyboard shortcuts

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