Expand description
T-Digest algorithm in rust
§Installation
Add this to your Cargo.toml:
[dependencies]
tdigest = "1.0"§Example
use tdigest::TDigest;
let t = TDigest::new_with_size(100);
let values: Vec<f64> = (1..=1_000_000).map(f64::from).collect();
let t = t.merge_sorted(values);
let ans = t.estimate_quantile(0.99).unwrap();
let expected: f64 = 990_000.0;
let percentage: f64 = (expected - ans).abs() / expected;
assert!(percentage < 0.01);§Handling of non-finite values
NaN and positive or negative infinity are contract violations. Public ingestion methods check this in debug builds, but estimates are unspecified if non-finite values are supplied to a release build.