Git Product home page Git Product logo

kapacitor-udfs's Introduction

kapacitor-UDFs

Go

1. Exponential Moving average (expMovAvg.go) STREAM-STREAM

4 inputs to function.

  • field - str
  • size - int
  • as - str
  • alpha - float

Calculates the EMA[t] of a series x[t] where n is the length of the window and α is a smoothing factor where 0 < α < 1: EMA[t+1] = x[t+1]α + (EMA[t] - x[t-n](1-α)n-1)(1-α)

or:

EMA[t+1] = α(x[t] + (1-α)x[t-1] + (1-α)2x[t-2] + (1-α)3x[t-3] ... (1-α)nx[t-n])

Python

1. Exponential Moving average (EMA.py) STREAM-STREAM

Operates identically to the Go version

4 inputs to function.

  • field - str
  • size - int
  • as - str
  • alpha - float

Calculates the EMA[t] of a series x[t] where n is the length of the window and α is a smoothing factor where 0 < α < 1: EMA[t+1] = x[t+1]α + (EMA[t] - x[t-n](1-α)n-1)(1-α)

or:

EMA[t+1] = α(x[t] + (1-α)x[t-1] + (1-α)2x[t-2] + (1-α)3x[t-3] ... (1-α)nx[t-n])

2. Echo batch (echoBatch.py) STREAM-BATCH

4 inputs to function

  • field - str
  • size - int
  • as - str - not used yet
  • period - duration

Echoes the data coming in on a stream as a batch. Period determines how long before the batch is dumped to the output and size determines the maximum size of the batch. If both are used the size will dump only the group that exceeded the size limit and the time will dump all of the groups independently of each other. This could create strange behavior in downstream nodes.

3. Windowed uncorrected sample standard deviation (Sigma.py) STREAM-STREAM

1 mandatory input

  • field - str 3 optional
  • window - int - default 100
  • as - str - default sigma_
  • fillWindow - bool - default false

Calculates how many uncorrected sample standard deviations the newest point in the field is off of the mean. σ = (E[X2] - E[X]2)0.5 Unlike kapacitor's sigma function this only calculates σ over the last N points, as well as returning the direction of the deviation. e.g. a value two σ below the mean will will return -2. note that the error of this function compared to the sample standard deviation is 1/N so small windows are not recommended.

kapacitor-udfs's People

Contributors

pjmore avatar pmore-teck avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

voiprodrigo

kapacitor-udfs's Issues

BATCH-Stream Example

Hi @pjmore I was able to create a simple example (nothing with statistical important) for a BATCH to STREAM UDF in Python. Would this be a good idea to add it here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.