Coder Social home page Coder Social logo

downsampling-algorithm's Introduction

Downsampling Algorthim

The Golang implemtation for downsampling time series data algorthim

Background

While monitoring the online system, there could be so many metrics' time series data will be stored into the Elasticsearch or NoSQL databaser for analysis. When the time passed, storing every piece of the histrical data is not very effective way, and ithose huge data could impact the analysis performance and the cost of storage.

One of solution just simply delete the aged histrical data(e.g. only keep the latest 6 months data), but there is a solution we can compressing those data to small size with good resolution.

Here is a demo shows how to downsamping the time series data from 7500 points to 500 points.

Acknowledgement

Usage

Sveinn Steinarsson's paper mentioned 3 types of algorithm:

  • Largest triangle three buckets (LTTB)
  • Largest triangle one bucket (LTOB)
  • Largest triangle dynamic (LTD)

You can file all of the implmentation under src/downsampling directory.

Following the below instuction to compile and run this repo.

make vget 
make 
./build/bin/main

If everything goes fine, you will see the following message

2019/09/07 18:34:42 Reading the testing data...
2019/09/07 18:34:42 Downsampling the data from 7501 to 500...
2019/09/07 18:34:42 Downsampling data - LTOB algorithm done!
2019/09/07 18:34:42 Downsampling data - LTTB algorithm done!
2019/09/07 18:34:42 Downsampling data - LTD algorithm done!
2019/09/07 18:34:42 Creating the diagram file...
2019/09/07 18:34:43 Successfully created the diagram - ..../build/data/downsampling.chart.png

You can go to the ./build/data/ directory to check the diagram and the cvs files.

The diagram picture as below

  • The first black chart at the top is the raw data with 7500 points
  • The second, third, and fourth respectively are LTOB, LTTB and LTD downsampling data with 500 points
  • The last one at the bottom just put all together.

Further Reading

Enjoy it!

downsampling-algorithm's People

Contributors

haoel avatar

Watchers

 avatar  avatar

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.