Closed oekekezie closed 9 years ago
Glad to hear this is useful to you. I like your use case and will add something for it next time I'm at the code.
Meanwhile, you should be able to save a digest using the output of toArray() (this returns a list of centroid centers and weights). You can later feed such an array to a fresh TDigest like this: var digest = new TDigest(); digest.push_centroid(my_json_array); digest.compress();
This pattern also works for combining multiple TDigests, with multiple calls to push_centroid.
It works! Thanks!
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!