Giter VIP home page Giter VIP logo

tdigest's People

Contributors

honzajavorek avatar wallin avatar welch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tdigest's Issues

when calculate centroid, fixed number

TDigest.prototype._addweight = function(nearest, x, n) {
// add weight at location x to nearest centroid. adding x to
// nearest will not shift its relative position in the tree and
// require reinsertion.
//
if (x !== nearest.mean) {
nearest.mean += n * (x - nearest.mean) / (nearest.n + n);
nearest.mean = nearest.mean.toFixed(number) // add this line?
}
nearest.cumn += n;
nearest.mean_cumn += n / 2;
nearest.n += n;
this.n += n;
};

Question: What is the best way to instantiate a new T Digest object from JSON?

First of all, thanks for writing this excellent library!

I'm currently using compress and then saving the result as JSON. I would like to be able to use said JSON to recreate the TDigest object at a later point in time so that I can compute percentiles.

I'm not terribly familiar with OOP in JavaScript, so I'm not sure I fully understand your source code. Any advice for how to best do this would be very much appreciated.

Thanks!

Feature: Add the ability to save internal state

The current implementation doesn't allow the internal state to be saved and later restored.

I'm proposing adding the following to TDigest:

  • load function ( takes object typically achieved via JSON.parse )
  • traverse function ( to traverse the centroid binary tree )
  • _insert_centroid ( to allow direct insertion )

"saving" will be accomplished via JSON.stringify ( tdObject )

I'll be forking this repo and doing the above shortly.

how merge centroid?

var a = [1,2,3,4,5]
var b = [7,8,9,10]

var t1 = new TDigest()
t1.push(a);
var c1 = t1.toArray();

var t2 = new TDigest();
t2.push(b)
var c2 = t2.toArray()

var t = new TDigest();
t.push(c1);
t.push(c2);

t.summary()

i want merge centroids. Am i right?

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.