timeseries

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeSeries

type TimeSeries[T number] struct {
	// contains filtered or unexported fields
}

func NewTimeSeries

func NewTimeSeries[T number](params TimeSeriesParams) *TimeSeries[T]

func (*TimeSeries[T]) AddSample

func (t *TimeSeries[T]) AddSample(val T)

func (*TimeSeries[T]) AddSampleAt

func (t *TimeSeries[T]) AddSampleAt(val T, at time.Time)

func (*TimeSeries[T]) ClearSamples

func (t *TimeSeries[T]) ClearSamples()

func (*TimeSeries[T]) CommitActiveSample

func (t *TimeSeries[T]) CommitActiveSample()

func (*TimeSeries[T]) CommitActiveSampleAt

func (t *TimeSeries[T]) CommitActiveSampleAt(at time.Time)

func (*TimeSeries[T]) CurrentRun

func (t *TimeSeries[T]) CurrentRun(threshold T, op TimeSeriesCompareOp) time.Duration

func (*TimeSeries[T]) GetSamples

func (t *TimeSeries[T]) GetSamples() []TimeSeriesSample[T]

func (*TimeSeries[T]) GetSamplesAfter

func (t *TimeSeries[T]) GetSamplesAfter(at time.Time) []TimeSeriesSample[T]

func (*TimeSeries[T]) KendallsTau

func (t *TimeSeries[T]) KendallsTau(numSamplesToUse int) (float64, error)

func (*TimeSeries[T]) LinearExtrapolateTo

func (t *TimeSeries[T]) LinearExtrapolateTo(numSamplesToUse int, after time.Duration) (float64, error)

func (*TimeSeries[T]) Max

func (t *TimeSeries[T]) Max() T

func (*TimeSeries[T]) Min

func (t *TimeSeries[T]) Min() T

func (*TimeSeries[T]) OnlineAverage

func (t *TimeSeries[T]) OnlineAverage() float64

func (*TimeSeries[T]) OnlineStdDev

func (t *TimeSeries[T]) OnlineStdDev() float64

func (*TimeSeries[T]) OnlineVariance

func (t *TimeSeries[T]) OnlineVariance() float64

func (*TimeSeries[T]) Slope

func (t *TimeSeries[T]) Slope() float64

func (*TimeSeries[T]) Sum

func (t *TimeSeries[T]) Sum() float64

func (*TimeSeries[T]) UpdateSample

func (t *TimeSeries[T]) UpdateSample(val T)

func (*TimeSeries[T]) ZScore

func (t *TimeSeries[T]) ZScore(val T) float64

type TimeSeriesCompareOp

type TimeSeriesCompareOp int
const (
	TimeSeriesCompareOpEQ TimeSeriesCompareOp = iota
	TimeSeriesCompareOpNE
	TimeSeriesCompareOpGT
	TimeSeriesCompareOpGTE
	TimeSeriesCompareOpLT
	TimeSeriesCompareOpLTE
)

func (TimeSeriesCompareOp) String

func (t TimeSeriesCompareOp) String() string

type TimeSeriesParams

type TimeSeriesParams struct {
	UpdateOp         TimeSeriesUpdateOp
	Window           time.Duration
	CollapseDuration time.Duration
}

type TimeSeriesSample

type TimeSeriesSample[T number] struct {
	Value T
	At    time.Time
}

type TimeSeriesUpdateOp

type TimeSeriesUpdateOp int
const (
	TimeSeriesUpdateOpAdd TimeSeriesUpdateOp = iota
	TimeSeriesUpdateOpMax
	TimeSeriesUpdateOpLatest
)

func (TimeSeriesUpdateOp) String

func (t TimeSeriesUpdateOp) String() string

Jump to

Keyboard shortcuts

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