Gathering detailed insights and metrics for tdigest
Gathering detailed insights and metrics for tdigest
Gathering detailed insights and metrics for tdigest
Gathering detailed insights and metrics for tdigest
tdigest: javascript implementation of Dunning's T-Digest for streaming quantile approximation
npm install tdigest
Typescript
Module System
Node Version
NPM Version
JavaScript (98.76%)
HTML (1.24%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
71 Stars
57 Commits
11 Forks
3 Watchers
1 Branches
3 Contributors
Updated on Mar 06, 2025
Latest Version
0.1.2
Package Id
tdigest@0.1.2
Unpacked Size
81.64 kB
Size
15.57 kB
File Count
13
NPM Version
8.5.5
Node Version
16.15.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
5
Javascript implementation of Dunning's T-Digest for streaming quantile approximation
The T-Digest is a data structure and algorithm for constructing an approximate distribution for a collection of real numbers presented as a stream. The algorithm makes no guarantees, but behaves well enough in practice that implementations have been included in Apache Mahout and ElasticSearch for computing summaries and approximate order statistics over a stream.
For an overview of T-Digest's behavior, see Davidson-Pilon's blog post regarding a python implementation. For more details, there are the tdigest paper and reference implementation (Java). This javascript implementation is based on a reading of the paper, with some boundary and performance tweaks.
changes in 0.1.2:
Updated the bintree dependency to 1.0.2 to pick up its licencing declaration
changes in 0.1.1:
percentile on an empty digest returns undefined or array of undefined instead of NaN
upgraded bintrees to get bugfix.
bugfix for discrete percentile and p_rank, make boundary conditions conform to standard definition.
changes in 0.1.0:
Discrete mode: when a TDigest is created with delta=false, the sample distribution is treated as discrete. TDigest behavior is disabled, differing samples are never merged (they needn't even be numeric), and percentiles are reported as nearest exact data values rather than interpolated.
Digest: distribution digest structure. Starts in exact histogram (discrete) mode, remains in exact mode for reasonable numbers of distinct values as sample size inreases, and automatically switches to TDigest mode for large samples that appear to be from a continuous distribution.
Renamed quantile() -> p_rank(), Percentile Rank.
percentile() and p_rank() now accept arrays or singleton arguments.
changes in 0.0.7:
A grunt dist
task has been added to create a UMD-wrapped version of tdigest
and dependencies for importing as a standalone module in client-side javascript.
bugfixes and speed improvements.
changes in 0.0.5:
API Overhaul:
bugfixes and speed improvements.
npm install tdigest
1var TDigest = require('tdigest').TDigest; 2var x=[], N = 100000; 3for (var i = 0 ; i < N ; i += 1) { 4 x.push(Math.random() * 10 - 5); 5}; 6td = new TDigest(); 7td.push(x); 8td.compress(); 9console.log(td.summary()); 10console.log("median ~ "+td.percentile(0.5));
See also example.js in this package.
The grunt dist
task has been configured to generate
a self-contained UMD-wrapped version of tdigest in dist/tdigest.js.
Embed it in HTML like this:
<script src="dist/tdigest.js"></script>
<script>
var td = new this.tdigest.TDigest();
for (var i=0; i < 1000000; i++) {
td.push(Math.random());
}
td.compress();
document.write(td.summary())
</script>
See also example.html in this package.
bintrees
: https://www.npmjs.com/package/bintrees
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More