Crate tdigest_ch

source ·
Expand description

A Rust library for estimating quantiles in a stream, using ClickHouse t-digest data structure.

The t-digest data structure is designed around computing accurate quantile estimates from streaming data. Two t-digests can be merged, making the data structure well suited for map-reduce settings.

Repository

§Examples

use tdigest_ch::TDigest;

let mut digest = TDigest::new();

// Add some elements.
digest.insert(1.0);
digest.insert(2.0);
digest.insert(3.0);

// Get the median of the distribution.
let quantile = digest.quantile(0.5);
assert_eq!(quantile, 2.0);

Structs§

  • Estimates quantiles of a t-digest.
  • T-digest data structure for approximating the quantiles of a distribution.
  • A TDigestBuilder can be used to create a TDigest with custom configuration.