welch / tdigest Goto Github PK
View Code? Open in Web Editor NEWtdigest: javascript implementation of Dunning's T-Digest for streaming quantile approximation
License: MIT License
tdigest: javascript implementation of Dunning's T-Digest for streaming quantile approximation
License: MIT License
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;
};
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!
The current implementation doesn't allow the internal state to be saved and later restored.
I'm proposing adding the following to TDigest:
"saving" will be accomplished via JSON.stringify ( tdObject )
I'll be forking this repo and doing the above shortly.
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?
Hey! I'm the developer of Js-sdsl. Official website: https://js-sdsl.github.io/
Now, we published the version 4.1.4.
I see you are using bintrees.
In benchmark, we have confirmed that Js-sdsl is several times faster than bintrees.
I've submitted a PR to eslint and has been accepted.
See eslint/eslint#16255 and eslint/eslint#16267.
I am willing to submit a pull request for this change.
Looking forward to your reply! :D
Does this apply to big data? 500 million?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.