{"_id":"tdigest","_rev":"3750558","name":"tdigest","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","dist-tags":{"latest":"0.1.2"},"maintainers":[{"name":"welch","email":""}],"time":{"modified":"2025-02-24T03:50:38.000Z","created":"2015-05-28T01:51:49.887Z","0.1.2":"2022-05-27T21:01:46.787Z","0.1.1":"2015-10-09T19:03:38.126Z","0.1.0":"2015-06-21T05:36:49.827Z","0.0.7":"2015-06-13T00:33:18.305Z","0.0.6":"2015-06-13T00:18:36.399Z","0.0.5":"2015-06-12T03:50:08.594Z","0.0.4":"2015-06-04T00:03:54.452Z","0.0.3":"2015-06-02T15:03:02.659Z","0.0.2":"2015-06-02T05:14:25.647Z","0.0.1":"2015-06-01T00:02:59.050Z","0.0.0":"2015-05-28T01:51:49.887Z"},"users":{},"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"versions":{"0.1.2":{"name":"tdigest","version":"0.1.2","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"1.0.2"},"devDependencies":{"better-assert":"^1.0.2","chai":"^3.0.0","grunt":"^0.4.5","grunt-pure-cjs":"^1.4.0","mocha":"^2.1.0"},"gitHead":"cf73bdd0544c4b0b5e9b34a423e888c3c5b26413","_id":"tdigest@0.1.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"shasum":"96c64bac4ff10746b910b0e23b515794e12faced","size":15940,"noattachment":false,"key":"/tdigest/-/tdigest-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.1.2.tgz"},"_npmUser":{"name":"welch","email":"npm@quietplease.com"},"directories":{},"maintainers":[{"name":"welch","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tdigest_0.1.2_1653685306599_0.4648601380152384"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-27T21:02:37.941Z","publish_time":1653685306787,"_cnpm_publish_time":1653685306787},"0.1.1":{"name":"tdigest","version":"0.1.1","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"1.0.1"},"devDependencies":{"better-assert":"^1.0.2","chai":"^3.0.0","grunt":"^0.4.5","grunt-pure-cjs":"^1.4.0","mocha":"^2.1.0"},"gitHead":"3dcd8776647dca489f013c56c36a10d261f5ce39","_id":"tdigest@0.1.1","_shasum":"2e3cb2c39ea449e55d1e6cd91117accca4588021","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"2e3cb2c39ea449e55d1e6cd91117accca4588021","size":18357,"noattachment":false,"key":"/tdigest/-/tdigest-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.1.1.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1444417418126,"_hasShrinkwrap":false,"_cnpm_publish_time":1444417418126,"_cnpmcore_publish_time":"2021-12-16T09:55:40.793Z"},"0.1.0":{"name":"tdigest","version":"0.1.0","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"^1.0.0"},"devDependencies":{"better-assert":"^1.0.2","chai":"^3.0.0","grunt":"^0.4.5","grunt-pure-cjs":"^1.4.0","mocha":"^2.1.0"},"gitHead":"921999a485c48b1b77cfdf65916ecab349c840b6","_id":"tdigest@0.1.0","_shasum":"83b8db13add17836a82ef85250a1c8e66c598b24","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"83b8db13add17836a82ef85250a1c8e66c598b24","size":18172,"noattachment":false,"key":"/tdigest/-/tdigest-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.1.0.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1434865009827,"_hasShrinkwrap":false,"_cnpm_publish_time":1434865009827,"_cnpmcore_publish_time":"2021-12-16T09:55:41.027Z"},"0.0.7":{"name":"tdigest","version":"0.0.7","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"^1.0.0"},"devDependencies":{"chai":"^3.0.0","grunt":"^0.4.5","grunt-pure-cjs":"^1.4.0","mocha":"^2.1.0"},"gitHead":"9443ac08b520b31db4185cafd4f0657e33c8b89f","_id":"tdigest@0.0.7","_shasum":"c30659395edcbedd105d5d420f87865c86d46fbc","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"c30659395edcbedd105d5d420f87865c86d46fbc","size":14494,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.7.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1434155598305,"_hasShrinkwrap":false,"_cnpm_publish_time":1434155598305,"_cnpmcore_publish_time":"2021-12-16T09:55:41.221Z"},"0.0.6":{"name":"tdigest","version":"0.0.6","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"^1.0.0"},"devDependencies":{"chai":"^3.0.0","grunt":"^0.4.5","grunt-pure-cjs":"^1.4.0","mocha":"^2.1.0"},"gitHead":"0e43cebcc630f1414b8cc13fb0e3fa9e263adc59","_id":"tdigest@0.0.6","_shasum":"9cb323a51f8bb46d6554a9e9527c5ad24016c0d7","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"9cb323a51f8bb46d6554a9e9527c5ad24016c0d7","size":8086,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.6.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1434154716399,"_hasShrinkwrap":false,"_cnpm_publish_time":1434154716399,"_cnpmcore_publish_time":"2021-12-16T09:55:41.454Z"},"0.0.5":{"name":"tdigest","version":"0.0.5","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha specs"},"repository":{"type":"git","url":"git+https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"^1.0.0"},"devDependencies":{"assert":"*","better-assert":"^1.0.2","grunt":"^0.4.5","grunt-dry":"^0.3.0","mocha":"^2.1.0"},"gitHead":"e8232029f022665b2921ebfb71558d17d6f267ba","_id":"tdigest@0.0.5","_shasum":"45bb8b20d3b9dbd4981d52a9594a42e3f78bbdd3","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"45bb8b20d3b9dbd4981d52a9594a42e3f78bbdd3","size":8416,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.5.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1434081008594,"_hasShrinkwrap":false,"_cnpm_publish_time":1434081008594,"_cnpmcore_publish_time":"2021-12-16T09:55:41.650Z"},"0.0.4":{"name":"tdigest","version":"0.0.4","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"^1.0.0"},"devDependencies":{"better-assert":"^1.0.2","mocha":"^2.2.5"},"gitHead":"6d44edf0852675a0ad99a3442dafaa30e1fd4c0c","_id":"tdigest@0.0.4","_shasum":"904351eed7a81703e7e613a5d0b9255aedfe35ae","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"904351eed7a81703e7e613a5d0b9255aedfe35ae","size":7206,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.4.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1433376234452,"_hasShrinkwrap":false,"_cnpm_publish_time":1433376234452,"_cnpmcore_publish_time":"2021-12-16T09:55:41.836Z"},"0.0.3":{"name":"tdigest","version":"0.0.3","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"https://github.com/welch/js_bintrees/tarball/master"},"devDependencies":{"better-assert":"^1.0.2","mocha":"^2.2.5"},"gitHead":"203b8642022fb2150d19f7b3286279911366f581","_id":"tdigest@0.0.3","_shasum":"c38fc8c7f4e8d73536f829fdc197732bf1f9983c","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"c38fc8c7f4e8d73536f829fdc197732bf1f9983c","size":7229,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.3.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1433257382659,"_hasShrinkwrap":false,"_cnpm_publish_time":1433257382659,"_cnpmcore_publish_time":"2021-12-16T09:55:42.134Z"},"0.0.2":{"name":"tdigest","version":"0.0.2","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"https://github.com/welch/js_bintrees/tarball/master"},"devDependencies":{"better-assert":"^1.0.2","mocha":"^2.2.5"},"gitHead":"3ad550ace4452d77a687a7cf247ab1cdd98e140f","_id":"tdigest@0.0.2","_shasum":"22fc70144705979f6c5446df22bee65c0c7dbad0","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"22fc70144705979f6c5446df22bee65c0c7dbad0","size":12126,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.2.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1433222065647,"_hasShrinkwrap":false,"_cnpm_publish_time":1433222065647,"_cnpmcore_publish_time":"2021-12-16T09:55:42.435Z"},"0.0.1":{"name":"tdigest","version":"0.0.1","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"https://github.com/welch/js_bintrees/tarball/master"},"devDependencies":{"better-assert":"^1.0.2","mocha":"^2.2.5"},"gitHead":"3ca80ccfa7b289b7746a0c4675d23144fc7e153d","_id":"tdigest@0.0.1","_shasum":"9e5cf48f5c8d262755c3ca16971a1334e4d2e3c2","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"9e5cf48f5c8d262755c3ca16971a1334e4d2e3c2","size":11823,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.1.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1433116979050,"_hasShrinkwrap":false,"_cnpm_publish_time":1433116979050,"_cnpmcore_publish_time":"2021-12-16T09:55:42.742Z"},"0.0.0":{"name":"tdigest","version":"0.0.0","description":"javascript implementation of Dunning's T-Digest for streaming quantile approximation","main":"tdigest.js","scripts":{"test":"mocha -b test.js"},"repository":{"type":"git","url":"https://github.com/welch/tdigest.git"},"keywords":["tdigest","percentile","quantile","histogram","approximation"],"author":{"name":"Will Welch","email":"welch@quietplease.com","url":"http://quietplease.com/"},"license":"MIT","bugs":{"url":"https://github.com/welch/tdigest/issues"},"homepage":"https://github.com/welch/tdigest","dependencies":{"bintrees":"https://github.com/welch/js_bintrees/tarball/master"},"devDependencies":{"better-assert":"^1.0.2"},"gitHead":"e00a1710e881e78571d5e50c6487b5f35a1beec5","_id":"tdigest@0.0.0","_shasum":"a6b37c0c02f0a92e11ea11349c7f7599ed0db78a","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"welch","email":"npm@quietplease.com"},"dist":{"shasum":"a6b37c0c02f0a92e11ea11349c7f7599ed0db78a","size":4940,"noattachment":false,"key":"/tdigest/-/tdigest-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tdigest/download/tdigest-0.0.0.tgz"},"maintainers":[{"name":"welch","email":""}],"directories":{},"publish_time":1432777909887,"_hasShrinkwrap":false,"_cnpm_publish_time":1432777909887,"_cnpmcore_publish_time":"2021-12-16T09:55:42.991Z"}},"readme":"tdigest\n============\n[![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] [![NPM download][download-image]][npm-url]\n\nJavascript implementation of Dunning's T-Digest for streaming quantile approximation\n\nThe T-Digest is a data structure and algorithm for constructing an\napproximate distribution for a collection of real numbers presented as a\nstream. The algorithm makes no guarantees, but behaves well enough in\npractice that implementations have been included in Apache Mahout and\nElasticSearch for computing summaries and approximate order\nstatistics over a stream.\n\nFor an overview of T-Digest's behavior, see Davidson-Pilon's\n[blog post](http://dataorigami.net/blogs/napkin-folding/19055451-percentile-and-quantile-estimation-of-big-data-the-t-digest) regarding a python implementation. For more details,\nthere are the [tdigest paper](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) and [reference implementation](https://github.com/tdunning/t-digest) (Java).\nThis javascript implementation is based on a reading of the paper,\nwith some boundary and performance tweaks.\n\n**changes in 0.1.2:**\n\nUpdated the bintree dependency to 1.0.2 to pick up its licencing declaration\n\n**changes in 0.1.1:**\n\n1. percentile on an empty digest returns *undefined* or array of *undefined*\n   instead of NaN\n\n2. upgraded bintrees to get bugfix.\n\n3. bugfix for discrete percentile and p_rank, make boundary conditions\n   conform to standard definition.\n\n**changes in 0.1.0:**\n\nDiscrete mode: when a TDigest is created with delta=false, the sample\ndistribution is treated as discrete. TDigest behavior is disabled,\ndiffering samples are never merged (they needn't even be numeric), and\npercentiles are reported as nearest exact data values rather than\ninterpolated.\n\nDigest: distribution digest structure. Starts in exact histogram\n(discrete) mode, remains in exact mode for reasonable numbers of\ndistinct values as sample size inreases, and automatically switches to\nTDigest mode for large samples that appear to be from a continuous\ndistribution.\n\nRenamed quantile() -> p_rank(), Percentile Rank.\n\npercentile() and p_rank() now accept arrays or singleton arguments.\n\n**changes in 0.0.7:**\n\nA `grunt dist` task has been added to create a UMD-wrapped version of tdigest\nand dependencies for importing as a standalone module in client-side javascript.\n\nbugfixes and speed improvements.\n\n**changes in 0.0.5:**\n\nAPI Overhaul:\n* asArray() -> toArray()\n* redigest() -> compress()\n* digest() -> push()\n* pushing an array no longer triggers compression\n\nbugfixes and speed improvements.\n\nquickstart\n------------\n\n#### node.js:\n\n```\nnpm install tdigest\n```\n\n```javascript\nvar TDigest = require('tdigest').TDigest;\nvar x=[], N = 100000;\nfor (var i = 0 ; i < N ; i += 1) {\n    x.push(Math.random() * 10 - 5);\n};\ntd = new TDigest();\ntd.push(x);\ntd.compress();\nconsole.log(td.summary());\nconsole.log(\"median ~ \"+td.percentile(0.5));\n```\n\nSee also [example.js](https://github.com/welch/tdigest/blob/master/example.js) in this package.\n\n#### In the browser:\n\nThe `grunt dist` task has been configured to generate\na self-contained [UMD-wrapped](https://github.com/umdjs/umd) version of tdigest in dist/tdigest.js.\n\nEmbed it in HTML like this:\n```\n<script src=\"dist/tdigest.js\"></script>\n<script>\n    var td = new this.tdigest.TDigest();\n    for (var i=0; i < 1000000; i++) {\n        td.push(Math.random());\n    }\n    td.compress();\n    document.write(td.summary())\n</script>\n```\n\nSee also [example.html](https://github.com/welch/tdigest/blob/master/example.html) in this package.\n\ndependencies\n-------------\n`bintrees`: [https://www.npmjs.com/package/bintrees](https://www.npmjs.com/package/bintrees)\n\n\n[travis-image]: https://travis-ci.org/welch/tdigest.svg?branch=master\n[travis-url]: https://travis-ci.org/welch/tdigest\n[npm-image]: http://img.shields.io/npm/v/tdigest.svg\n[download-image]: http://img.shields.io/npm/dm/tdigest.svg\n[npm-url]: https://www.npmjs.org/package/tdigest\n","_attachments":{},"homepage":"https://github.com/welch/tdigest","bugs":{"url":"https://github.com/welch/tdigest/issues"},"license":"MIT"}